1
|
|
|
/* |
2
|
|
|
* CMS Pico - Integration of Pico within your files to create websites. |
3
|
|
|
* |
4
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
5
|
|
|
* later. See the COPYING file. |
6
|
|
|
* |
7
|
|
|
* @author Maxence Lange <[email protected]> |
8
|
|
|
* @copyright 2017 |
9
|
|
|
* @license GNU AGPL version 3 or any later version |
10
|
|
|
* |
11
|
|
|
* This program is free software: you can redistribute it and/or modify |
12
|
|
|
* it under the terms of the GNU Affero General Public License as |
13
|
|
|
* published by the Free Software Foundation, either version 3 of the |
14
|
|
|
* License, or (at your option) any later version. |
15
|
|
|
* |
16
|
|
|
* This program is distributed in the hope that it will be useful, |
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19
|
|
|
* GNU Affero General Public License for more details. |
20
|
|
|
* |
21
|
|
|
* You should have received a copy of the GNU Affero General Public License |
22
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
23
|
|
|
* |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
/** global: OC */ |
27
|
|
|
/** global: pico_nav */ |
28
|
|
|
/** global: pico_result */ |
29
|
|
|
|
30
|
|
|
var pico_elements = { |
31
|
|
|
|
32
|
|
|
cms_pico_list_websites: null, |
33
|
|
|
cms_pico_new_name: null, |
34
|
|
|
cms_pico_new_url: null, |
35
|
|
|
cms_pico_new_website: null, |
36
|
|
|
cms_pico_new_template: null, |
37
|
|
|
cms_pico_new_folder: null, |
38
|
|
|
cms_pico_new_folder_result: '', |
39
|
|
|
cms_pico_new_submit: null, |
40
|
|
|
|
41
|
|
|
|
42
|
|
|
init: function () { |
43
|
|
|
pico_elements.initElements(); |
44
|
|
|
pico_elements.initUI(); |
45
|
|
|
pico_elements.initTweaks(); |
46
|
|
|
}, |
47
|
|
|
|
48
|
|
|
initElements: function () { |
49
|
|
|
|
50
|
|
|
pico_elements.cms_pico_list_websites = $('#cms_pico_list_websites'); |
51
|
|
|
pico_elements.cms_pico_new_name = $('#cms_pico_new_name'); |
52
|
|
|
pico_elements.cms_pico_new_website = $('#cms_pico_new_website'); |
53
|
|
|
pico_elements.cms_pico_new_url = $('#cms_pico_new_url'); |
54
|
|
|
pico_elements.cms_pico_new_template = $('#cms_pico_new_template'); |
55
|
|
|
pico_elements.cms_pico_new_folder = $('#cms_pico_new_folder'); |
56
|
|
|
pico_elements.cms_pico_new_submit = $('#cms_pico_new_submit'); |
57
|
|
|
}, |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
initUI: function () { |
61
|
|
|
pico_elements.cms_pico_new_website.on('input propertychange paste focus', function () { |
62
|
|
|
pico_nav.updateNewWebsite($(this).val()); |
63
|
|
|
}); |
64
|
|
|
|
65
|
|
|
pico_elements.cms_pico_new_folder.on('click', function () { |
66
|
|
|
OC.dialogs.filepicker(t('cms_pico', 'test'), pico_nav.pickFolderResult, false, |
67
|
|
|
"httpd/unix-directory", true); |
68
|
|
|
}); |
69
|
|
|
|
70
|
|
|
pico_elements.cms_pico_new_submit.on('click', function () { |
71
|
|
|
pico_nav.createNewWebsite(); |
72
|
|
|
}); |
73
|
|
|
}, |
74
|
|
|
|
75
|
|
|
|
76
|
|
|
initTweaks: function () { |
77
|
|
|
$.fn.emptyTable = function () { |
78
|
|
|
this.children('tr').each(function () { |
79
|
|
|
if ($(this).attr('class') !== 'header') { |
80
|
|
|
$(this).remove(); |
81
|
|
|
} |
82
|
|
|
}); |
83
|
|
|
}; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
|
87
|
|
|
}; |