Revision 1009
Added by Matthias almost 15 years ago
jsadmin_backend_include.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
// JsAdmin module for Website Baker |
|
6 |
// Copyright (C) 2006, Stepan Riha |
|
7 |
// www.nonplus.net |
|
8 |
|
|
9 |
// modified by Swen Uth for Website Baker 2.7 |
|
10 |
|
|
11 |
/* |
|
12 |
|
|
13 |
Website Baker Project <http://www.websitebaker.org/> |
|
14 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
15 |
|
|
16 |
Website Baker is free software; you can redistribute it and/or modify |
|
17 |
it under the terms of the GNU General Public License as published by |
|
18 |
the Free Software Foundation; either version 2 of the License, or |
|
19 |
(at your option) any later version. |
|
20 |
|
|
21 |
Website Baker is distributed in the hope that it will be useful, |
|
22 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
24 |
GNU General Public License for more details. |
|
25 |
|
|
26 |
You should have received a copy of the GNU General Public License |
|
27 |
along with Website Baker; if not, write to the Free Software |
|
28 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
29 |
|
|
30 |
*/ |
|
31 |
|
|
32 |
// Direct access prevention |
|
33 |
defined('WB_PATH') OR die(header('Location: ../index.php')); |
|
34 |
|
|
35 |
// obtain the admin folder (e.g. /admin) |
|
36 |
$admin_folder = str_replace(WB_PATH, '', ADMIN_PATH); |
|
37 |
|
|
38 |
$JSADMIN_PATH = WB_URL.'/modules/jsadmin'; |
|
39 |
$YUI_PATH = WB_URL.'/include/yui'; |
|
40 |
$script = $_SERVER['SCRIPT_NAME']; |
|
41 |
if(!$script) |
|
42 |
$script = $PHP_SELF; |
|
43 |
|
|
44 |
if(strstr($script, $admin_folder."/pages/index.php")) |
|
45 |
$page_type = 'pages'; |
|
46 |
elseif(strstr($script, $admin_folder."/pages/sections.php")) |
|
47 |
$page_type = 'sections'; |
|
48 |
elseif(strstr($script, $admin_folder."/settings/tool.php") |
|
49 |
&& isset($_REQUEST["tool"]) && $_REQUEST["tool"] == 'jsadmin') |
|
50 |
$page_type = 'config'; |
|
51 |
else |
|
52 |
$page_type = ''; |
|
53 |
if($page_type) { |
|
54 |
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php'); |
|
55 |
|
|
56 |
// Default scripts |
|
57 |
$js_buttonCell = 3; |
|
58 |
$js_scripts = Array(); |
|
59 |
$js_scripts[] = 'jsadmin.js'; |
|
60 |
|
|
61 |
if($page_type == 'pages') { |
|
62 |
if(!get_setting('mod_jsadmin_persist_order', '1')) { //Maybe Bug settings to negativ for persist , by Swen Uth |
|
63 |
$js_scripts[] = 'restore_pages.js'; |
|
64 |
} |
|
65 |
if(get_setting('mod_jsadmin_ajax_order_pages', '1')) { |
|
66 |
$js_scripts[] = 'dragdrop.js'; |
|
67 |
$js_buttonCell= 6; // This ist the Cell where the Button "Up" is , by Swen Uth |
|
68 |
} |
|
69 |
} elseif($page_type == 'sections') { |
|
70 |
if(get_setting('mod_jsadmin_ajax_order_sections', '1')) { |
|
71 |
$js_scripts[] = 'dragdrop.js'; |
|
72 |
if(SECTION_BLOCKS) { |
|
73 |
$js_buttonCell= 4;} |
|
74 |
else{ $js_buttonCell= 3;} // This ist the Cell where the Button "Up" is , by Swen Uth |
|
75 |
} |
|
76 |
} elseif($page_type == 'config') { |
|
77 |
$js_scripts[] = 'tool.js'; |
|
78 |
} |
|
79 |
?> |
|
80 |
<style type="text/css"> |
|
81 |
/* Fix for funky spacing on page listing */ |
|
82 |
.pages_list li { |
|
83 |
margin-bottom: -2px; |
|
84 |
} |
|
85 |
|
|
86 |
body.jsadmin_busy td.content { |
|
87 |
background: white url(<?php echo WB_URL ?>/modules/jsadmin/images/busy.gif) 4px 4px no-repeat; |
|
88 |
} |
|
89 |
|
|
90 |
body.jsadmin_success td.content { |
|
91 |
background: white url(<?php echo WB_URL ?>/modules/jsadmin/images/success.gif) 4px 4px no-repeat; |
|
92 |
} |
|
93 |
|
|
94 |
body.jsadmin_failure td.content { |
|
95 |
background: white url(<?php echo WB_URL ?>/modules/jsadmin/images/failure.gif) 4px 4px no-repeat; |
|
96 |
} |
|
97 |
|
|
98 |
.jsadmin_drag { |
|
99 |
cursor: move; |
|
100 |
} |
|
101 |
|
|
102 |
.jsadmin_drag a, .jsadmin_drag input, .jsadmin_drag select { |
|
103 |
cursor: pointer; |
|
104 |
cursor: hand; |
|
105 |
} |
|
106 |
|
|
107 |
ul.jsadmin_drag_area { |
|
108 |
border: solid 1px #99f; |
|
109 |
} |
|
110 |
|
|
111 |
</style> |
|
112 |
|
|
113 |
<script language="JavaScript"> |
|
114 |
<!-- |
|
115 |
var JsAdmin = { WB_URL : '<?php echo WB_URL ?>', ADMIN_URL : '<?php echo ADMIN_URL ?>' }; |
|
116 |
var JsAdminTheme = { THEME_URL : '<?php echo THEME_URL ?>' }; |
|
117 |
//--> |
|
118 |
</script> |
|
119 |
<?php |
|
120 |
// For variable cell structure in the tables of admin content |
|
121 |
echo "<script type='text/javascript'>buttonCell=".$js_buttonCell.";</script>\n"; // , by Swen Uth |
|
122 |
|
|
123 |
// Check and Load the needed YUI functions //, all by Swen Uth |
|
124 |
$YUI_ERROR=false; // ist there an Error |
|
125 |
$YUI_PUT =''; // String with javascipt includes |
|
126 |
$YUI_PUT_MISSING_Files=''; // Strin with missing files |
|
127 |
reset($js_yui_scripts); |
|
128 |
foreach($js_yui_scripts as $script) { |
|
129 |
if(file_exists($WB_MAIN_RELATIVE_PATH.$script)){ |
|
130 |
$YUI_PUT=$YUI_PUT."<script type='text/javascript' src='".$WB_MAIN_RELATIVE_PATH.$script."'></script>\n"; // go and include |
|
131 |
} else { |
|
132 |
$YUI_ERROR=true; |
|
133 |
$YUI_PUT_MISSING_Files=$YUI_PUT_MISSING_Files."- ".WB_URL.$script."\\n"; // catch all missing files |
|
134 |
} |
|
135 |
} |
|
136 |
if(!$YUI_ERROR) |
|
137 |
{ |
|
138 |
echo $YUI_PUT; // no Error so go and include |
|
139 |
// Load the needed functions |
|
140 |
foreach($js_scripts as $script) { |
|
141 |
echo "<script type='text/javascript' src='".$JSADMIN_PATH."/js/".$script."'></script>\n"; |
|
142 |
} |
|
143 |
} else { |
|
144 |
echo "<script type='text/javascript'>alert('YUI ERROR!! File not Found!! > \\n".$YUI_PUT_MISSING_Files." so look in the include folder or switch Javascript Admin off!');</script>\n"; //, by Swen Uth |
|
145 |
} |
|
146 |
|
|
147 |
} |
|
148 |
?> |
|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
// JsAdmin module for Website Baker |
|
6 |
// Copyright (C) 2006, Stepan Riha |
|
7 |
// www.nonplus.net |
|
8 |
|
|
9 |
// modified by Swen Uth for Website Baker 2.7 |
|
10 |
|
|
11 |
/* |
|
12 |
|
|
13 |
Website Baker Project <http://www.websitebaker.org/> |
|
14 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
15 |
|
|
16 |
Website Baker is free software; you can redistribute it and/or modify |
|
17 |
it under the terms of the GNU General Public License as published by |
|
18 |
the Free Software Foundation; either version 2 of the License, or |
|
19 |
(at your option) any later version. |
|
20 |
|
|
21 |
Website Baker is distributed in the hope that it will be useful, |
|
22 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
24 |
GNU General Public License for more details. |
|
25 |
|
|
26 |
You should have received a copy of the GNU General Public License |
|
27 |
along with Website Baker; if not, write to the Free Software |
|
28 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
29 |
|
|
30 |
*/ |
|
31 |
|
|
32 |
// Direct access prevention |
|
33 |
defined('WB_PATH') OR die(header('Location: ../index.php')); |
|
34 |
|
|
35 |
// obtain the admin folder (e.g. /admin) |
|
36 |
$admin_folder = str_replace(WB_PATH, '', ADMIN_PATH); |
|
37 |
|
|
38 |
$JSADMIN_PATH = WB_URL.'/modules/jsadmin'; |
|
39 |
$YUI_PATH = WB_URL.'/include/yui'; |
|
40 |
$script = $_SERVER['SCRIPT_NAME']; |
|
41 |
if(!$script) |
|
42 |
$script = $PHP_SELF; |
|
43 |
|
|
44 |
if(strstr($script, $admin_folder."/pages/index.php")) |
|
45 |
$page_type = 'pages'; |
|
46 |
elseif(strstr($script, $admin_folder."/pages/sections.php")) |
|
47 |
$page_type = 'sections'; |
|
48 |
elseif(strstr($script, $admin_folder."/settings/tool.php") |
|
49 |
&& isset($_REQUEST["tool"]) && $_REQUEST["tool"] == 'jsadmin') |
|
50 |
$page_type = 'config'; |
|
51 |
else |
|
52 |
$page_type = ''; |
|
53 |
if($page_type) { |
|
54 |
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php'); |
|
55 |
|
|
56 |
// Default scripts |
|
57 |
$js_buttonCell = 3; |
|
58 |
$js_scripts = Array(); |
|
59 |
$js_scripts[] = 'jsadmin.js'; |
|
60 |
|
|
61 |
if($page_type == 'pages') { |
|
62 |
if(!get_setting('mod_jsadmin_persist_order', '1')) { //Maybe Bug settings to negativ for persist , by Swen Uth |
|
63 |
$js_scripts[] = 'restore_pages.js'; |
|
64 |
} |
|
65 |
if(get_setting('mod_jsadmin_ajax_order_pages', '1')) { |
|
66 |
$js_scripts[] = 'dragdrop.js'; |
|
67 |
$js_buttonCell= 6; // This ist the Cell where the Button "Up" is , by Swen Uth |
|
68 |
} |
|
69 |
} elseif($page_type == 'sections') { |
|
70 |
if(get_setting('mod_jsadmin_ajax_order_sections', '1')) { |
|
71 |
$js_scripts[] = 'dragdrop.js'; |
|
72 |
if(SECTION_BLOCKS) { |
|
73 |
$js_buttonCell= 5;} |
|
74 |
else{ $js_buttonCell= 5;} // This ist the Cell where the Button "Up" is , by Swen Uth |
|
75 |
} |
|
76 |
} elseif($page_type == 'config') { |
|
77 |
$js_scripts[] = 'tool.js'; |
|
78 |
} |
|
79 |
?> |
|
80 |
|
|
81 |
<script type="text/javascript" language="JavaScript"> |
|
82 |
<!-- |
|
83 |
var JsAdmin = { WB_URL : '<?php echo WB_URL ?>', ADMIN_URL : '<?php echo ADMIN_URL ?>' }; |
|
84 |
var JsAdminTheme = { THEME_URL : '<?php echo THEME_URL ?>' }; |
|
85 |
//--> |
|
86 |
</script> |
|
87 |
<?php |
|
88 |
// For variable cell structure in the tables of admin content |
|
89 |
echo "<script type='text/javascript'>buttonCell=".$js_buttonCell.";</script>\n"; // , by Swen Uth |
|
90 |
|
|
91 |
// Check and Load the needed YUI functions //, all by Swen Uth |
|
92 |
$YUI_ERROR=false; // ist there an Error |
|
93 |
$YUI_PUT =''; // String with javascipt includes |
|
94 |
$YUI_PUT_MISSING_Files=''; // Strin with missing files |
|
95 |
reset($js_yui_scripts); |
|
96 |
foreach($js_yui_scripts as $script) { |
|
97 |
if(file_exists($WB_MAIN_RELATIVE_PATH.$script)){ |
|
98 |
$YUI_PUT=$YUI_PUT."<script type='text/javascript' src='".$WB_MAIN_RELATIVE_PATH.$script."'></script>\n"; // go and include |
|
99 |
} else { |
|
100 |
$YUI_ERROR=true; |
|
101 |
$YUI_PUT_MISSING_Files=$YUI_PUT_MISSING_Files."- ".WB_URL.$script."\\n"; // catch all missing files |
|
102 |
} |
|
103 |
} |
|
104 |
if(!$YUI_ERROR) |
|
105 |
{ |
|
106 |
echo $YUI_PUT; // no Error so go and include |
|
107 |
// Load the needed functions |
|
108 |
foreach($js_scripts as $script) { |
|
109 |
echo "<script type='text/javascript' src='".$JSADMIN_PATH."/js/".$script."'></script>\n"; |
|
110 |
} |
|
111 |
} else { |
|
112 |
echo "<script type='text/javascript'>alert('YUI ERROR!! File not Found!! > \\n".$YUI_PUT_MISSING_Files." so look in the include folder or switch Javascript Admin off!');</script>\n"; //, by Swen Uth |
|
113 |
} |
|
114 |
|
|
115 |
} |
|
116 |
?> |
Also available in: Unified diff
-Moved styles from admin/pages/sections.php to sections.htt in backend themes (Thanks to Luisehahne)
- Moved javascript files from admin/pages/index.php to external js files (Thanks to Luisehahne)
- Major improovements and changes to all backend files to get more valide Code output (Thanks to Luisehahne)