Project

General

Profile

1 601 doc
<?php
2 1377 FrankH
/**
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
 * @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 601 doc
*/
18
19 1420 Luisehahne
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
21 601 doc
22
// check if module language file exists for the language set by the user (e.g. DE, EN)
23
if(!file_exists(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php')) {
24
	// no module language file exists for the language set by the user, include default module language file EN.php
25
	require_once(WB_PATH .'/modules/jsadmin/languages/EN.php');
26
} else {
27
	// a module language file exists for the language defined by the user, load it
28
	require_once(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php');
29
}
30 1457 Luisehahne
/*
31 601 doc
// check if backend.css file needs to be included into the <body></body>
32
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH .'/modules/jsadmin/backend.css')) {
33
	echo '<style type="text/css">';
34
	include(WB_PATH .'/modules/jsadmin/backend.css');
35
	echo "\n</style>\n";
36
}
37 1457 Luisehahne
*/
38 601 doc
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
39
40
// Check if user selected what add-ons to reload
41 1457 Luisehahne
if(isset($_POST['save_settings']))  {
42 1460 Luisehahne
43 1377 FrankH
	if (!$admin->checkFTAN())
44
	{
45 1460 Luisehahne
		if(!$admin_header) { $admin->print_header(); }
46 1425 Luisehahne
		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI']);
47 1377 FrankH
	}
48
49 601 doc
	// Include functions file
50
	require_once(WB_PATH.'/framework/functions.php');
51
	save_setting('mod_jsadmin_persist_order', isset($_POST['persist_order']));
52
	save_setting('mod_jsadmin_ajax_order_pages', isset($_POST['ajax_order_pages']));
53
	save_setting('mod_jsadmin_ajax_order_sections', isset($_POST['ajax_order_sections']));
54 1457 Luisehahne
   // 	echo '<div style="border: solid 2px #9c9; background: #ffd; padding: 0.5em; margin-top: 1em">'.$MESSAGE['SETTINGS']['SAVED'].'</div>';
55
	// check if there is a database error, otherwise say successful
56 1460 Luisehahne
	if(!$admin_header) { $admin->print_header(); }
57 1457 Luisehahne
	if($database->is_error()) {
58
		$admin->print_error($database->get_error(), $js_back);
59
	} else {
60
61
		$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/admintools/tool.php?tool=jsadmin');
62
	}
63
64
} else {
65
	// $admin->print_header();
66 601 doc
}
67
68
// Display form
69 1457 Luisehahne
	$persist_order = get_setting('mod_jsadmin_persist_order', true) ? 'checked="checked"' : '';
70
	$ajax_order_pages = get_setting('mod_jsadmin_ajax_order_pages', true) ? 'checked="checked"' : '';
71
	$ajax_order_sections = get_setting('mod_jsadmin_ajax_order_sections', true) ? 'checked="checked"' : '';
72 601 doc
73
// THIS ROUTINE CHECKS THE EXISTING OFF ALL NEEDED YUI FILES
74
  $YUI_ERROR=false; // ist there an Error
75
  $YUI_PUT ='';   // String with javascipt includes
76
  $YUI_PUT_MISSING_Files=''; // String with missing files
77
  reset($js_yui_scripts);
78
  foreach($js_yui_scripts as $script) {
79 626 doc
     if(!file_exists($WB_MAIN_RELATIVE_PATH.$script)){
80 601 doc
        $YUI_ERROR=true;
81 626 doc
        $YUI_PUT_MISSING_Files =$YUI_PUT_MISSING_Files."- ".WB_URL.$script."<br />";   // catch all missing files
82 601 doc
    }
83
	}
84
	if($YUI_ERROR)
85
	{
86 1457 Luisehahne
?>
87
	<div id="jsadmin_install" style="border: solid 2px #c99; background: #ffd; padding: 0.5em; margin-top: 1em">
88 601 doc
89
     <?php echo $MOD_JSADMIN['TXT_ERROR_INSTALLINFO_B'].$YUI_PUT_MISSING_Files; ?>
90
      </div>
91 1457 Luisehahne
<?php
92 601 doc
  }
93
  else
94
  {
95
  ?>
96 1457 Luisehahne
   <form id="jsadmin_form" name="store_settings" style="margin-top: 1em; display: true;" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
97 1377 FrankH
	<?php echo $admin->getFTAN(); ?>
98 601 doc
   <table cellpadding="4" cellspacing="0" border="0">
99
   <tr>
100
	     <td colspan="2"><?php echo $MOD_JSADMIN['TXT_HEADING_B']; ?>:</td>
101
   </tr>
102
   <tr>
103
	     <td width="20"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
104
	     <td><label for="persist_order"><?php echo $MOD_JSADMIN['TXT_PERSIST_ORDER_B']; ?></label></td>
105
   </tr>
106
   <tr>
107
	     <td width="20"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
108
	     <td><label for="ajax_order_pages"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_PAGES_B']; ?></label></td>
109
   </tr>
110
   <tr>
111
	     <td width="20"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
112
	     <td><label for="ajax_order_sections"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_SECTIONS_B']; ?></label></td>
113
   </tr>
114
   <tr>
115
	     <td>&nbsp;</td>
116
	     <td>
117 1457 Luisehahne
		   <input type="submit" name="save_settings" value="<?php echo $TEXT['SAVE']; ?>" />
118 601 doc
	    </td>
119
   </tr>
120
   </table>
121
   </form>
122
 <?php
123
 }