Project

General

Profile

1
<?php
2

    
3
// $Id: jsadmin_backend_include.php 915 2009-01-21 19:27:01Z Ruebenwurzel $
4

    
5
// JsAdmin module for Website Baker
6
// Copyright (C) 2006, Stepan Riha
7
// www.nonplus.net
8

    
9
// modified by Swen Uth for Website Baker 2.7
10

    
11
/*
12

    
13
 Website Baker Project <http://www.websitebaker.org/>
14
 Copyright (C) 2004-2009, Ryan Djurovich
15

    
16
 Website Baker is free software; you can redistribute it and/or modify
17
 it under the terms of the GNU General Public License as published by
18
 the Free Software Foundation; either version 2 of the License, or
19
 (at your option) any later version.
20

    
21
 Website Baker is distributed in the hope that it will be useful,
22
 but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 GNU General Public License for more details.
25

    
26
 You should have received a copy of the GNU General Public License
27
 along with Website Baker; if not, write to the Free Software
28
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29

    
30
*/
31

    
32
// Direct access prevention
33
defined('WB_PATH') OR die(header('Location: ../index.php'));
34

    
35
// obtain the admin folder (e.g. /admin)
36
$admin_folder = str_replace(WB_PATH, '', ADMIN_PATH);
37

    
38
$JSADMIN_PATH = WB_URL.'/modules/jsadmin';
39
$YUI_PATH = WB_URL.'/include/yui';
40
$script = $_SERVER['SCRIPT_NAME'];
41
if(!$script)
42
	$script = $PHP_SELF;
43

    
44
if(strstr($script, $admin_folder."/pages/index.php"))
45
	$page_type = 'pages';
46
elseif(strstr($script, $admin_folder."/pages/sections.php"))
47
	$page_type = 'sections';
48
elseif(strstr($script, $admin_folder."/settings/tool.php")
49
	&& isset($_REQUEST["tool"]) && $_REQUEST["tool"] == 'jsadmin')
50
	$page_type = 'config';
51
else
52
	$page_type = '';
53
if($page_type) {
54
	require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
55

    
56
	// Default scripts
57
	$js_buttonCell = 3;
58
	$js_scripts = Array();
59
	$js_scripts[] = 'jsadmin.js';
60

    
61
	if($page_type == 'pages') {
62
		if(!get_setting('mod_jsadmin_persist_order', '1')) {   //Maybe Bug settings to negativ for persist , by Swen Uth
63
			$js_scripts[] = 'restore_pages.js';
64
  		}
65
		if(get_setting('mod_jsadmin_ajax_order_pages', '1')) {
66
			$js_scripts[] = 'dragdrop.js';
67
			$js_buttonCell= 6; // This ist the Cell where the Button "Up" is , by Swen Uth
68
		}
69
	} elseif($page_type == 'sections') {
70
		if(get_setting('mod_jsadmin_ajax_order_sections', '1')) {
71
			$js_scripts[] = 'dragdrop.js';
72
			if(SECTION_BLOCKS) {
73
			$js_buttonCell= 4;}
74
      else{ $js_buttonCell= 3;} // This ist the Cell where the Button "Up" is , by Swen Uth
75
		}
76
	} elseif($page_type == 'config') {
77
		$js_scripts[] = 'tool.js';
78
	}
79
?>
80
<style type="text/css">
81
/* Fix for funky spacing on page listing */
82
.pages_list li {
83
	margin-bottom: -2px;
84
}
85

    
86
body.jsadmin_busy td.content {
87
	background: white url(<?php echo WB_URL ?>/modules/jsadmin/images/busy.gif) 4px 4px no-repeat;
88
}
89

    
90
body.jsadmin_success td.content {
91
	background: white url(<?php echo WB_URL ?>/modules/jsadmin/images/success.gif) 4px 4px no-repeat;
92
}
93

    
94
body.jsadmin_failure td.content {
95
	background: white url(<?php echo WB_URL ?>/modules/jsadmin/images/failure.gif) 4px 4px no-repeat;
96
}
97

    
98
.jsadmin_drag {
99
	cursor: move;
100
}
101

    
102
.jsadmin_drag a, .jsadmin_drag input, .jsadmin_drag select {
103
	cursor: pointer;
104
	cursor: hand;
105
}
106

    
107
ul.jsadmin_drag_area {
108
	border: solid 1px #99f;
109
}
110

    
111
</style>
112

    
113
<script language="JavaScript">
114
<!--
115
var JsAdmin = { WB_URL : '<?php echo WB_URL ?>' };
116
//-->
117
</script>
118
<?php
119
 // For variable cell structure in the tables of admin content
120
  echo "<script type='text/javascript'>buttonCell=".$js_buttonCell.";</script>\n";   // , by Swen  Uth
121

    
122
 // Check and Load the needed YUI functions  //, all by Swen Uth
123
  $YUI_ERROR=false; // ist there an Error
124
  $YUI_PUT ='';   // String with javascipt includes
125
  $YUI_PUT_MISSING_Files=''; // Strin with missing files
126
  reset($js_yui_scripts);
127
  foreach($js_yui_scripts as $script) {
128
    if(file_exists($WB_MAIN_RELATIVE_PATH.$script)){
129
        $YUI_PUT=$YUI_PUT."<script type='text/javascript' src='".$WB_MAIN_RELATIVE_PATH.$script."'></script>\n"; // go and include
130
    } else {
131
        $YUI_ERROR=true;
132
        $YUI_PUT_MISSING_Files=$YUI_PUT_MISSING_Files."- ".WB_URL.$script."\\n";   // catch all missing files
133
    }
134
	}
135
	if(!$YUI_ERROR)
136
	{
137
    echo $YUI_PUT;  // no Error so go and include
138
    // Load the needed functions
139
	  foreach($js_scripts as $script) {
140
		  echo "<script type='text/javascript' src='".$JSADMIN_PATH."/js/".$script."'></script>\n";
141
	  }
142
  } else  {
143
      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
144
  }
145

    
146
 }
147
?>
(6-6/9)