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