Project

General

Profile

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 1420 2011-01-26 17:43:56Z Luisehahne $
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

    
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
else
38
	$page_type = '';
39
if($page_type) {
40
	require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
41

    
42
	// Default scripts
43
	$js_buttonCell = 3;
44
	$js_scripts = Array();
45
	$js_scripts[] = 'jsadmin.js';
46

    
47
	if($page_type == 'pages') {
48
		if(!get_setting('mod_jsadmin_persist_order', '1')) {   //Maybe Bug settings to negativ for persist , by Swen Uth
49
			$js_scripts[] = 'restore_pages.js';
50
  		}
51
		if(get_setting('mod_jsadmin_ajax_order_pages', '1')) {
52
			$js_scripts[] = 'dragdrop.js';
53
			$js_buttonCell= 7; // This ist the Cell where the Button "Up" is , by Swen Uth
54
		}
55
	} elseif($page_type == 'sections') {
56
		if(get_setting('mod_jsadmin_ajax_order_sections', '1')) {
57
			$js_scripts[] = 'dragdrop.js';
58
			if(SECTION_BLOCKS) {
59
			$js_buttonCell= 5;}
60
      else{ $js_buttonCell= 5;} // This ist the Cell where the Button "Up" is , by Swen Uth
61
		}
62
	} elseif($page_type == 'config') {
63
		$js_scripts[] = 'tool.js';
64
	}
65
?>
66

    
67
<script  type="text/javascript" language="JavaScript">
68
<!--
69
var JsAdmin = { WB_URL : '<?php echo WB_URL ?>', ADMIN_URL : '<?php echo ADMIN_URL ?>' };
70
var JsAdminTheme = { THEME_URL : '<?php echo THEME_URL ?>' };
71
//-->
72
</script>
73
<?php
74
 // For variable cell structure in the tables of admin content
75
  echo "<script type='text/javascript'>buttonCell=".$js_buttonCell.";</script>\n";   // , by Swen  Uth
76

    
77
 // Check and Load the needed YUI functions  //, all by Swen Uth
78
  $YUI_ERROR=false; // ist there an Error
79
  $YUI_PUT ='';   // String with javascipt includes
80
  $YUI_PUT_MISSING_Files=''; // Strin with missing files
81
  reset($js_yui_scripts);
82
  foreach($js_yui_scripts as $script) {
83
    if(file_exists($WB_MAIN_RELATIVE_PATH.$script)){
84
        $YUI_PUT=$YUI_PUT."<script type='text/javascript' src='".$WB_MAIN_RELATIVE_PATH.$script."'></script>\n"; // go and include
85
    } else {
86
        $YUI_ERROR=true;
87
        $YUI_PUT_MISSING_Files=$YUI_PUT_MISSING_Files."- ".WB_URL.$script."\\n";   // catch all missing files
88
    }
89
	}
90
	if(!$YUI_ERROR)
91
	{
92
    echo $YUI_PUT;  // no Error so go and include
93
    // Load the needed functions
94
	  foreach($js_scripts as $script) {
95
		  echo "<script type='text/javascript' src='".$JSADMIN_PATH."/js/".$script."'></script>\n";
96
	  }
97
  } else  {
98
      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
99
  }
100

    
101
 }
102
?>
(7-7/10)