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 1383 2011-01-15 14:09:11Z FrankH $
|
14
|
* @filesource $HeadURL: http://svn.websitebaker2.org/branches/2.8.x/wb/modules/menu_link/save.php $
|
15
|
* @lastmodified $Date: 2011-01-10 13:21:47 +0100 (Mo, 10 Jan 2011) $
|
16
|
*
|
17
|
*/
|
18
|
|
19
|
// Direct access prevention
|
20
|
defined('WB_PATH') OR die(header('Location: ../index.php'));
|
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
|
else
|
37
|
$page_type = '';
|
38
|
if($page_type) {
|
39
|
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
|
40
|
|
41
|
// Default scripts
|
42
|
$js_buttonCell = 3;
|
43
|
$js_scripts = Array();
|
44
|
$js_scripts[] = 'jsadmin.js';
|
45
|
|
46
|
if($page_type == 'pages') {
|
47
|
if(!get_setting('mod_jsadmin_persist_order', '1')) { //Maybe Bug settings to negativ for persist , by Swen Uth
|
48
|
$js_scripts[] = 'restore_pages.js';
|
49
|
}
|
50
|
if(get_setting('mod_jsadmin_ajax_order_pages', '1')) {
|
51
|
$js_scripts[] = 'dragdrop.js';
|
52
|
$js_buttonCell= 7; // This ist the Cell where the Button "Up" is , by Swen Uth
|
53
|
}
|
54
|
} elseif($page_type == 'sections') {
|
55
|
if(get_setting('mod_jsadmin_ajax_order_sections', '1')) {
|
56
|
$js_scripts[] = 'dragdrop.js';
|
57
|
if(SECTION_BLOCKS) {
|
58
|
$js_buttonCell= 5;}
|
59
|
else{ $js_buttonCell= 5;} // This ist the Cell where the Button "Up" is , by Swen Uth
|
60
|
}
|
61
|
} elseif($page_type == 'config') {
|
62
|
$js_scripts[] = 'tool.js';
|
63
|
}
|
64
|
?>
|
65
|
|
66
|
<script type="text/javascript" language="JavaScript">
|
67
|
<!--
|
68
|
var JsAdmin = { WB_URL : '<?php echo WB_URL ?>', ADMIN_URL : '<?php echo ADMIN_URL ?>' };
|
69
|
var JsAdminTheme = { THEME_URL : '<?php echo THEME_URL ?>' };
|
70
|
//-->
|
71
|
</script>
|
72
|
<?php
|
73
|
// For variable cell structure in the tables of admin content
|
74
|
echo "<script type='text/javascript'>buttonCell=".$js_buttonCell.";</script>\n"; // , by Swen Uth
|
75
|
|
76
|
// Check and Load the needed YUI functions //, all by Swen Uth
|
77
|
$YUI_ERROR=false; // ist there an Error
|
78
|
$YUI_PUT =''; // String with javascipt includes
|
79
|
$YUI_PUT_MISSING_Files=''; // Strin with missing files
|
80
|
reset($js_yui_scripts);
|
81
|
foreach($js_yui_scripts as $script) {
|
82
|
if(file_exists($WB_MAIN_RELATIVE_PATH.$script)){
|
83
|
$YUI_PUT=$YUI_PUT."<script type='text/javascript' src='".$WB_MAIN_RELATIVE_PATH.$script."'></script>\n"; // go and include
|
84
|
} else {
|
85
|
$YUI_ERROR=true;
|
86
|
$YUI_PUT_MISSING_Files=$YUI_PUT_MISSING_Files."- ".WB_URL.$script."\\n"; // catch all missing files
|
87
|
}
|
88
|
}
|
89
|
if(!$YUI_ERROR)
|
90
|
{
|
91
|
echo $YUI_PUT; // no Error so go and include
|
92
|
// Load the needed functions
|
93
|
foreach($js_scripts as $script) {
|
94
|
echo "<script type='text/javascript' src='".$JSADMIN_PATH."/js/".$script."'></script>\n";
|
95
|
}
|
96
|
} else {
|
97
|
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
|
98
|
}
|
99
|
|
100
|
}
|
101
|
?>
|