1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category modules
|
5
|
* @package JsAdmin
|
6
|
* @package JsAdmin
|
7
|
* @author Ryan Djurovich (2004-2009), WebsiteBaker Project
|
8
|
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
9
|
* @link http://www.websitebaker2.org/
|
10
|
* @license http://www.gnu.org/licenses/gpl.html
|
11
|
* @platform WebsiteBaker 2.8.x
|
12
|
* @requirements PHP 5.2.2 and higher
|
13
|
* @version $Id: jsadmin_backend_include.php 2070 2014-01-03 01:21:42Z darkviper $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/jsadmin/jsadmin_backend_include.php $
|
15
|
* @lastmodified $Date: 2014-01-03 02:21:42 +0100 (Fri, 03 Jan 2014) $
|
16
|
*
|
17
|
*/
|
18
|
|
19
|
/* -------------------------------------------------------- */
|
20
|
// Must include code to stop this file being accessed directly
|
21
|
if(!defined('WB_URL')) {
|
22
|
require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
|
23
|
throw new IllegalFileException();
|
24
|
}
|
25
|
/* -------------------------------------------------------- */
|
26
|
|
27
|
// obtain the admin folder (e.g. /admin)
|
28
|
$admin_folder = str_replace(WB_PATH, '', ADMIN_PATH);
|
29
|
|
30
|
$JSADMIN_PATH = WB_URL.'/modules/jsadmin';
|
31
|
$YUI_PATH = WB_URL.'/include/yui';
|
32
|
$script = $_SERVER['SCRIPT_NAME'];
|
33
|
|
34
|
if(strstr($script, $admin_folder."/pages/index.php"))
|
35
|
$page_type = 'pages';
|
36
|
elseif(strstr($script, $admin_folder."/pages/sections.php"))
|
37
|
$page_type = 'sections';
|
38
|
elseif(strstr($script, $admin_folder."/settings/tool.php")
|
39
|
&& isset($_REQUEST["tool"]) && $_REQUEST["tool"] == 'jsadmin')
|
40
|
$page_type = 'config';
|
41
|
elseif(strstr($script, $admin_folder."/pages/modify.php"))
|
42
|
$page_type = 'modules';
|
43
|
else
|
44
|
$page_type = '';
|
45
|
|
46
|
if($page_type) {
|
47
|
|
48
|
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
|
49
|
|
50
|
// Default scripts
|
51
|
$js_buttonCell = 5;
|
52
|
$js_pagesCell = 7;
|
53
|
$js_scripts = Array();
|
54
|
$js_scripts[] = 'jsadmin.js';
|
55
|
|
56
|
if($page_type == 'modules') {
|
57
|
if(!get_setting('mod_jsadmin_persist_order', '1')) { //Maybe Bug settings to negativ for persist , by Swen Uth
|
58
|
$js_scripts[] = 'restore_pages.js';
|
59
|
}
|
60
|
if(get_setting('mod_jsadmin_ajax_order_pages', '1')) {
|
61
|
$js_scripts[] = 'dragdrop.js';
|
62
|
$js_buttonCell= $js_pagesCell; // This ist the Cell where the Button "Up" is , by Swen Uth
|
63
|
}
|
64
|
} elseif($page_type == 'pages') {
|
65
|
if(!get_setting('mod_jsadmin_persist_order', '1')) { //Maybe Bug settings to negativ for persist , by Swen Uth
|
66
|
$js_scripts[] = 'restore_pages.js';
|
67
|
}
|
68
|
if(get_setting('mod_jsadmin_ajax_order_pages', '1')) {
|
69
|
$js_scripts[] = 'dragdrop.js';
|
70
|
$js_buttonCell= $js_pagesCell; // This ist the Cell where the Button "Up" is , by Swen Uth
|
71
|
}
|
72
|
} elseif($page_type == 'sections') {
|
73
|
if(get_setting('mod_jsadmin_ajax_order_sections', '1')) {
|
74
|
$js_scripts[] = 'dragdrop.js';
|
75
|
if(SECTION_BLOCKS) {
|
76
|
$js_buttonCell= 5;
|
77
|
} else {
|
78
|
$js_buttonCell= 5;
|
79
|
} // This ist the Cell where the Button "Up" is , by Swen Uth
|
80
|
}
|
81
|
} elseif($page_type == 'config') {
|
82
|
$js_scripts[] = 'tool.js';
|
83
|
} else {
|
84
|
$admin->print_error('PageTtype '.$TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
|
85
|
}
|
86
|
|
87
|
?>
|
88
|
<script type="text/javascript">
|
89
|
<!--
|
90
|
var JsAdmin = { WB_URL : '<?php echo WB_URL ?>', ADMIN_URL : '<?php echo ADMIN_URL ?>' };
|
91
|
var JsAdminTheme = { THEME_URL : '<?php echo THEME_URL ?>' };
|
92
|
//-->
|
93
|
</script>
|
94
|
<?php
|
95
|
// For variable cell structure in the tables of admin content
|
96
|
echo "<script type='text/javascript'>buttonCell=".$js_buttonCell.";</script>\n"; // , by Swen Uth
|
97
|
// Check and Load the needed YUI functions //, all by Swen Uth
|
98
|
$YUI_ERROR=false; // ist there an Error
|
99
|
$YUI_PUT =''; // String with javascipt includes
|
100
|
$YUI_PUT_MISSING_Files=''; // String with missing files
|
101
|
reset($js_yui_scripts);
|
102
|
foreach($js_yui_scripts as $script) {
|
103
|
if(file_exists($WB_MAIN_RELATIVE_PATH.$script)){
|
104
|
$YUI_PUT=$YUI_PUT."<script src='".$WB_MAIN_RELATIVE_PATH.$script."' type='text/javascript'></script>\n"; // go and include
|
105
|
} else {
|
106
|
$YUI_ERROR=true;
|
107
|
$YUI_PUT_MISSING_Files=$YUI_PUT_MISSING_Files."- ".WB_URL.$script."\\n"; // catch all missing files
|
108
|
}
|
109
|
}
|
110
|
/* */
|
111
|
if(!$YUI_ERROR)
|
112
|
{
|
113
|
echo $YUI_PUT; // no Error so go and include
|
114
|
// Load the needed functions
|
115
|
foreach($js_scripts as $script) {
|
116
|
echo "<script src='".$JSADMIN_PATH."/js/".$script."' type='text/javascript'></script>\n";
|
117
|
}
|
118
|
} else {
|
119
|
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
|
120
|
}
|
121
|
|
122
|
}
|