Project

General

Profile

1
<?php
2

    
3
// $Id: jsadmin_backend_include.php 603 2008-01-26 16:02:19Z 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-2008, 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
$JSADMIN_PATH = WB_URL.'/modules/jsadmin';
36
$YUI_PATH = WB_URL.'/include/yui';
37
$script = $_SERVER['SCRIPT_NAME'];
38
if(!$script)
39
	$script = $PHP_SELF;
40

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

    
53
	// Default scripts
54
	$js_buttonCell = 3;
55
	$js_scripts = Array();
56
	$js_scripts[] = 'jsadmin.js';
57

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

    
81
body.jsadmin_busy td.content {
82
	background: white url(<?php echo WB_URL ?>/modules/jsadmin/images/busy.gif) 4px 4px no-repeat;
83
}
84

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

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

    
93
.jsadmin_drag {
94
	cursor: move;
95
}
96

    
97
.jsadmin_drag a, .jsadmin_drag input, .jsadmin_drag select {
98
	cursor: pointer;
99
	cursor: hand;
100
}
101

    
102
ul.jsadmin_drag_area {
103
	border: solid 1px #99f;
104
}
105

    
106
</style>
107

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

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

    
143
 }
144
?>
(6-6/9)