Project

General

Profile

1 601 doc
<?php
2
3
// $Id$
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
// check if module language file exists for the language set by the user (e.g. DE, EN)
36
if(!file_exists(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php')) {
37
	// no module language file exists for the language set by the user, include default module language file EN.php
38
	require_once(WB_PATH .'/modules/jsadmin/languages/EN.php');
39
} else {
40
	// a module language file exists for the language defined by the user, load it
41
	require_once(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php');
42
}
43
44
// check if backend.css file needs to be included into the <body></body>
45
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH .'/modules/jsadmin/backend.css')) {
46
	echo '<style type="text/css">';
47
	include(WB_PATH .'/modules/jsadmin/backend.css');
48
	echo "\n</style>\n";
49
}
50
51
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
52
53
// Check if user selected what add-ons to reload
54
if(isset($_POST['submit']) AND $_POST['submit'] != '') {
55
	// Include functions file
56
	require_once(WB_PATH.'/framework/functions.php');
57
	save_setting('mod_jsadmin_persist_order', isset($_POST['persist_order']));
58
	save_setting('mod_jsadmin_ajax_order_pages', isset($_POST['ajax_order_pages']));
59
	save_setting('mod_jsadmin_ajax_order_sections', isset($_POST['ajax_order_sections']));
60
	echo '<div style="border: solid 2px #9c9; background: #ffd; padding: 0.5em; margin-top: 1em">'.$MESSAGE['SETTINGS']['SAVED'].'</div>';
61
}
62
63
// Display form
64
$persist_order = get_setting('mod_jsadmin_persist_order', true) ? 'checked="1"' : '';
65
$ajax_order_pages = get_setting('mod_jsadmin_ajax_order_pages', true) ? 'checked="1"' : '';
66
$ajax_order_sections = get_setting('mod_jsadmin_ajax_order_sections', true) ? 'checked="1"' : '';
67
?>
68
<?php
69
70
// THIS ROUTINE CHECKS THE EXISTING OFF ALL NEEDED YUI FILES
71
  $YUI_ERROR=false; // ist there an Error
72
  $YUI_PUT ='';   // String with javascipt includes
73
  $YUI_PUT_MISSING_Files=''; // String with missing files
74
  reset($js_yui_scripts);
75
  foreach($js_yui_scripts as $script) {
76
    $fcheck =fopen($script,"r");  // Check if File Exist , This is better the file_exists
77
    if(!$fcheck){
78
        $YUI_ERROR=true;
79
        $YUI_PUT_MISSING_Files =$YUI_PUT_MISSING_Files."- ".$script."<br />";   // catch all missing files
80
    }
81
    fclose($fcheck);
82
	}
83
	if($YUI_ERROR)
84
	{
85
    ?><div id="jsadmin_install" style="border: solid 2px #c99; background: #ffd; padding: 0.5em; margin-top: 1em">
86
87
     <?php echo $MOD_JSADMIN['TXT_ERROR_INSTALLINFO_B'].$YUI_PUT_MISSING_Files; ?>
88
      </div>
89
      <?php
90
  }
91
  else
92
  {
93
  ?>
94
   <form id="jsadmin_form" style="margin-top: 1em; display: true;" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
95
   <table cellpadding="4" cellspacing="0" border="0">
96
   <tr>
97
	     <td colspan="2"><?php echo $MOD_JSADMIN['TXT_HEADING_B']; ?>:</td>
98
   </tr>
99
   <tr>
100
	     <td width="20"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
101
	     <td><label for="persist_order"><?php echo $MOD_JSADMIN['TXT_PERSIST_ORDER_B']; ?></label></td>
102
   </tr>
103
   <tr>
104
	     <td width="20"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
105
	     <td><label for="ajax_order_pages"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_PAGES_B']; ?></label></td>
106
   </tr>
107
   <tr>
108
	     <td width="20"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
109
	     <td><label for="ajax_order_sections"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_SECTIONS_B']; ?></label></td>
110
   </tr>
111
   <tr>
112
	     <td>&nbsp;</td>
113
	     <td>
114
		   <input type="submit" name="submit" value="<?php echo $TEXT['SAVE']; ?>" onClick="javascript: if(!confirm('<?php echo $TEXT['ARE_YOU_SURE']; ?>')) { return false; }" />
115
	    </td>
116
   </tr>
117
   </table>
118
   </form>
119
 <?php
120
 }
121
?>