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