1 |
1009
|
Ruebenwurz
|
<?php
|
2 |
1377
|
FrankH
|
/**
|
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$
|
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 |
1009
|
Ruebenwurz
|
*/
|
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 |
|
|
if(!$script)
|
29 |
|
|
$script = $PHP_SELF;
|
30 |
|
|
|
31 |
|
|
if(strstr($script, $admin_folder."/pages/index.php"))
|
32 |
|
|
$page_type = 'pages';
|
33 |
|
|
elseif(strstr($script, $admin_folder."/pages/sections.php"))
|
34 |
|
|
$page_type = 'sections';
|
35 |
|
|
elseif(strstr($script, $admin_folder."/settings/tool.php")
|
36 |
|
|
&& isset($_REQUEST["tool"]) && $_REQUEST["tool"] == 'jsadmin')
|
37 |
|
|
$page_type = 'config';
|
38 |
|
|
else
|
39 |
|
|
$page_type = '';
|
40 |
|
|
if($page_type) {
|
41 |
|
|
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
|
42 |
|
|
|
43 |
|
|
// Default scripts
|
44 |
|
|
$js_buttonCell = 3;
|
45 |
|
|
$js_scripts = Array();
|
46 |
|
|
$js_scripts[] = 'jsadmin.js';
|
47 |
|
|
|
48 |
|
|
if($page_type == 'pages') {
|
49 |
|
|
if(!get_setting('mod_jsadmin_persist_order', '1')) { //Maybe Bug settings to negativ for persist , by Swen Uth
|
50 |
|
|
$js_scripts[] = 'restore_pages.js';
|
51 |
|
|
}
|
52 |
|
|
if(get_setting('mod_jsadmin_ajax_order_pages', '1')) {
|
53 |
|
|
$js_scripts[] = 'dragdrop.js';
|
54 |
1048
|
Ruebenwurz
|
$js_buttonCell= 7; // This ist the Cell where the Button "Up" is , by Swen Uth
|
55 |
1009
|
Ruebenwurz
|
}
|
56 |
|
|
} elseif($page_type == 'sections') {
|
57 |
|
|
if(get_setting('mod_jsadmin_ajax_order_sections', '1')) {
|
58 |
|
|
$js_scripts[] = 'dragdrop.js';
|
59 |
|
|
if(SECTION_BLOCKS) {
|
60 |
|
|
$js_buttonCell= 5;}
|
61 |
|
|
else{ $js_buttonCell= 5;} // This ist the Cell where the Button "Up" is , by Swen Uth
|
62 |
|
|
}
|
63 |
|
|
} elseif($page_type == 'config') {
|
64 |
|
|
$js_scripts[] = 'tool.js';
|
65 |
|
|
}
|
66 |
|
|
?>
|
67 |
|
|
|
68 |
|
|
<script type="text/javascript" language="JavaScript">
|
69 |
|
|
<!--
|
70 |
|
|
var JsAdmin = { WB_URL : '<?php echo WB_URL ?>', ADMIN_URL : '<?php echo ADMIN_URL ?>' };
|
71 |
|
|
var JsAdminTheme = { THEME_URL : '<?php echo THEME_URL ?>' };
|
72 |
|
|
//-->
|
73 |
|
|
</script>
|
74 |
|
|
<?php
|
75 |
|
|
// For variable cell structure in the tables of admin content
|
76 |
|
|
echo "<script type='text/javascript'>buttonCell=".$js_buttonCell.";</script>\n"; // , by Swen Uth
|
77 |
|
|
|
78 |
|
|
// Check and Load the needed YUI functions //, all by Swen Uth
|
79 |
|
|
$YUI_ERROR=false; // ist there an Error
|
80 |
|
|
$YUI_PUT =''; // String with javascipt includes
|
81 |
|
|
$YUI_PUT_MISSING_Files=''; // Strin with missing files
|
82 |
|
|
reset($js_yui_scripts);
|
83 |
|
|
foreach($js_yui_scripts as $script) {
|
84 |
|
|
if(file_exists($WB_MAIN_RELATIVE_PATH.$script)){
|
85 |
|
|
$YUI_PUT=$YUI_PUT."<script type='text/javascript' src='".$WB_MAIN_RELATIVE_PATH.$script."'></script>\n"; // go and include
|
86 |
|
|
} else {
|
87 |
|
|
$YUI_ERROR=true;
|
88 |
|
|
$YUI_PUT_MISSING_Files=$YUI_PUT_MISSING_Files."- ".WB_URL.$script."\\n"; // catch all missing files
|
89 |
|
|
}
|
90 |
|
|
}
|
91 |
|
|
if(!$YUI_ERROR)
|
92 |
|
|
{
|
93 |
|
|
echo $YUI_PUT; // no Error so go and include
|
94 |
|
|
// Load the needed functions
|
95 |
|
|
foreach($js_scripts as $script) {
|
96 |
|
|
echo "<script type='text/javascript' src='".$JSADMIN_PATH."/js/".$script."'></script>\n";
|
97 |
|
|
}
|
98 |
|
|
} else {
|
99 |
|
|
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
|
100 |
|
|
}
|
101 |
|
|
|
102 |
|
|
}
|
103 |
|
|
?>
|