Project

General

Profile

1 1420 Luisehahne
<?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$
14 1477 Luisehahne
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16 1420 Luisehahne
 *
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 1441 Luisehahne
elseif(strstr($script, $admin_folder."/pages/modify.php"))
38
	$page_type = 'modules';
39 1420 Luisehahne
else
40
	$page_type = '';
41 1441 Luisehahne
42 1420 Luisehahne
if($page_type) {
43 1441 Luisehahne
44 1420 Luisehahne
	require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
45
46
	// Default scripts
47 1441 Luisehahne
	$js_buttonCell = 5;
48 1420 Luisehahne
	$js_scripts = Array();
49
	$js_scripts[] = 'jsadmin.js';
50
51 1441 Luisehahne
	if($page_type == 'modules') {
52 1420 Luisehahne
		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 1441 Luisehahne
	} 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 1420 Luisehahne
	} elseif($page_type == 'sections') {
68
		if(get_setting('mod_jsadmin_ajax_order_sections', '1')) {
69
			$js_scripts[] = 'dragdrop.js';
70
			if(SECTION_BLOCKS) {
71 1441 Luisehahne
			$js_buttonCell= 5; }
72
      else{ $js_buttonCell= 5; } // This ist the Cell where the Button "Up" is , by Swen Uth
73 1420 Luisehahne
		}
74
	} elseif($page_type == 'config') {
75
		$js_scripts[] = 'tool.js';
76 1441 Luisehahne
	} else {
77
		$admin->print_error('PageTtype '.$TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
78 1420 Luisehahne
	}
79
?>
80 1441 Luisehahne
<script  type="text/javascript">
81 1420 Luisehahne
<!--
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 1441 Luisehahne
	// 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 1420 Luisehahne
	}
102 1441 Luisehahne
/*  */
103 1420 Luisehahne
	if(!$YUI_ERROR)
104
	{
105 1441 Luisehahne
		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 1420 Luisehahne
114 1441 Luisehahne
} 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 1009 Ruebenwurz
?>