Project

General

Profile

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 1441 Luisehahne
			$js_buttonCell= 5; }
77
      else{ $js_buttonCell= 5; } // This ist the Cell where the Button "Up" is , by Swen Uth
78 1420 Luisehahne
		}
79
	} elseif($page_type == 'config') {
80
		$js_scripts[] = 'tool.js';
81 1441 Luisehahne
	} else {
82
		$admin->print_error('PageTtype '.$TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
83 1420 Luisehahne
	}
84 1831 Luisehahne
85 1420 Luisehahne
?>
86 1441 Luisehahne
<script  type="text/javascript">
87 1420 Luisehahne
<!--
88
var JsAdmin = { WB_URL : '<?php echo WB_URL ?>', ADMIN_URL : '<?php echo ADMIN_URL ?>' };
89
var JsAdminTheme = { THEME_URL : '<?php echo THEME_URL ?>' };
90
//-->
91
</script>
92
<?php
93 1441 Luisehahne
	// For variable cell structure in the tables of admin content
94
	echo "<script type='text/javascript'>buttonCell=".$js_buttonCell.";</script>\n";   // , by Swen  Uth
95
	// Check and Load the needed YUI functions  //, all by Swen Uth
96
	$YUI_ERROR=false; // ist there an Error
97
	$YUI_PUT ='';   // String with javascipt includes
98
	$YUI_PUT_MISSING_Files=''; // String with missing files
99
	reset($js_yui_scripts);
100
	foreach($js_yui_scripts as $script) {
101
		if(file_exists($WB_MAIN_RELATIVE_PATH.$script)){
102
			$YUI_PUT=$YUI_PUT."<script src='".$WB_MAIN_RELATIVE_PATH.$script."' type='text/javascript'></script>\n"; // go and include
103
		} else {
104
			$YUI_ERROR=true;
105
			$YUI_PUT_MISSING_Files=$YUI_PUT_MISSING_Files."- ".WB_URL.$script."\\n";   // catch all missing files
106
		}
107 1420 Luisehahne
	}
108 1441 Luisehahne
/*  */
109 1420 Luisehahne
	if(!$YUI_ERROR)
110
	{
111 1441 Luisehahne
		echo $YUI_PUT;  // no Error so go and include
112
		// Load the needed functions
113
		foreach($js_scripts as $script) {
114
			echo "<script src='".$JSADMIN_PATH."/js/".$script."' type='text/javascript'></script>\n";
115
		}
116
	} else {
117
	    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
118
	}
119 1420 Luisehahne
120 1831 Luisehahne
}