| 1 |
1420
|
Luisehahne
|
<?php
|
| 2 |
|
|
/**
|
| 3 |
|
|
*
|
| 4 |
|
|
* @category modules
|
| 5 |
|
|
* @package JsAdmin
|
| 6 |
1831
|
Luisehahne
|
* @package JsAdmin
|
| 7 |
|
|
* @author Ryan Djurovich (2004-2009), WebsiteBaker Project
|
| 8 |
|
|
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
| 9 |
1420
|
Luisehahne
|
* @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 |
1477
|
Luisehahne
|
* @filesource $HeadURL$
|
| 15 |
|
|
* @lastmodified $Date$
|
| 16 |
1420
|
Luisehahne
|
*
|
| 17 |
|
|
*/
|
| 18 |
|
|
|
| 19 |
1831
|
Luisehahne
|
/* -------------------------------------------------------- */
|
| 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 |
1420
|
Luisehahne
|
|
| 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 |
1831
|
Luisehahne
|
if(strstr($script, $admin_folder."/pages/index.php"))
|
| 35 |
1420
|
Luisehahne
|
$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 |
1441
|
Luisehahne
|
elseif(strstr($script, $admin_folder."/pages/modify.php"))
|
| 42 |
|
|
$page_type = 'modules';
|
| 43 |
1420
|
Luisehahne
|
else
|
| 44 |
|
|
$page_type = '';
|
| 45 |
1441
|
Luisehahne
|
|
| 46 |
1420
|
Luisehahne
|
if($page_type) {
|
| 47 |
1441
|
Luisehahne
|
|
| 48 |
1420
|
Luisehahne
|
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
|
| 49 |
|
|
|
| 50 |
|
|
// Default scripts
|
| 51 |
1441
|
Luisehahne
|
$js_buttonCell = 5;
|
| 52 |
1831
|
Luisehahne
|
$js_pagesCell = 7;
|
| 53 |
1420
|
Luisehahne
|
$js_scripts = Array();
|
| 54 |
|
|
$js_scripts[] = 'jsadmin.js';
|
| 55 |
|
|
|
| 56 |
1441
|
Luisehahne
|
if($page_type == 'modules') {
|
| 57 |
1420
|
Luisehahne
|
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 |
1831
|
Luisehahne
|
$js_buttonCell= $js_pagesCell; // This ist the Cell where the Button "Up" is , by Swen Uth
|
| 63 |
1420
|
Luisehahne
|
}
|
| 64 |
1441
|
Luisehahne
|
} 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 |
1831
|
Luisehahne
|
$js_buttonCell= $js_pagesCell; // This ist the Cell where the Button "Up" is , by Swen Uth
|
| 71 |
1441
|
Luisehahne
|
}
|
| 72 |
1420
|
Luisehahne
|
} elseif($page_type == 'sections') {
|
| 73 |
|
|
if(get_setting('mod_jsadmin_ajax_order_sections', '1')) {
|
| 74 |
|
|
$js_scripts[] = 'dragdrop.js';
|
| 75 |
|
|
if(SECTION_BLOCKS) {
|
| 76 |
1835
|
Luisehahne
|
$js_buttonCell= 5;
|
| 77 |
|
|
} else {
|
| 78 |
|
|
$js_buttonCell= 5;
|
| 79 |
|
|
} // This ist the Cell where the Button "Up" is , by Swen Uth
|
| 80 |
1420
|
Luisehahne
|
}
|
| 81 |
|
|
} elseif($page_type == 'config') {
|
| 82 |
|
|
$js_scripts[] = 'tool.js';
|
| 83 |
1441
|
Luisehahne
|
} else {
|
| 84 |
|
|
$admin->print_error('PageTtype '.$TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
|
| 85 |
1420
|
Luisehahne
|
}
|
| 86 |
1831
|
Luisehahne
|
|
| 87 |
1420
|
Luisehahne
|
?>
|
| 88 |
1441
|
Luisehahne
|
<script type="text/javascript">
|
| 89 |
1420
|
Luisehahne
|
<!--
|
| 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 |
1441
|
Luisehahne
|
// 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 |
1420
|
Luisehahne
|
}
|
| 110 |
1441
|
Luisehahne
|
/* */
|
| 111 |
1420
|
Luisehahne
|
if(!$YUI_ERROR)
|
| 112 |
|
|
{
|
| 113 |
1441
|
Luisehahne
|
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 |
1420
|
Luisehahne
|
|
| 122 |
1831
|
Luisehahne
|
}
|