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 1377 FrankH
	if (!$admin->checkFTAN())
43
	{
44 1457 Luisehahne
		$admin->print_header();
45 1425 Luisehahne
		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI']);
46 1377 FrankH
	}
47 1457 Luisehahne
	$admin->print_header();
48 1377 FrankH
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
	if($database->is_error()) {
57
		$admin->print_error($database->get_error(), $js_back);
58
	} else {
59
60
		$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/admintools/tool.php?tool=jsadmin');
61
	}
62
63
} else {
64
	// $admin->print_header();
65 601 doc
}
66
67
// Display form
68 1457 Luisehahne
	$persist_order = get_setting('mod_jsadmin_persist_order', true) ? 'checked="checked"' : '';
69
	$ajax_order_pages = get_setting('mod_jsadmin_ajax_order_pages', true) ? 'checked="checked"' : '';
70
	$ajax_order_sections = get_setting('mod_jsadmin_ajax_order_sections', true) ? 'checked="checked"' : '';
71 601 doc
72
// THIS ROUTINE CHECKS THE EXISTING OFF ALL NEEDED YUI FILES
73
  $YUI_ERROR=false; // ist there an Error
74
  $YUI_PUT ='';   // String with javascipt includes
75
  $YUI_PUT_MISSING_Files=''; // String with missing files
76
  reset($js_yui_scripts);
77
  foreach($js_yui_scripts as $script) {
78 626 doc
     if(!file_exists($WB_MAIN_RELATIVE_PATH.$script)){
79 601 doc
        $YUI_ERROR=true;
80 626 doc
        $YUI_PUT_MISSING_Files =$YUI_PUT_MISSING_Files."- ".WB_URL.$script."<br />";   // catch all missing files
81 601 doc
    }
82
	}
83
	if($YUI_ERROR)
84
	{
85 1457 Luisehahne
?>
86
	<div id="jsadmin_install" style="border: solid 2px #c99; background: #ffd; padding: 0.5em; margin-top: 1em">
87 601 doc
88
     <?php echo $MOD_JSADMIN['TXT_ERROR_INSTALLINFO_B'].$YUI_PUT_MISSING_Files; ?>
89
      </div>
90 1457 Luisehahne
<?php
91 601 doc
  }
92
  else
93
  {
94
  ?>
95 1457 Luisehahne
   <form id="jsadmin_form" name="store_settings" style="margin-top: 1em; display: true;" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
96 1377 FrankH
	<?php echo $admin->getFTAN(); ?>
97 601 doc
   <table cellpadding="4" cellspacing="0" border="0">
98
   <tr>
99
	     <td colspan="2"><?php echo $MOD_JSADMIN['TXT_HEADING_B']; ?>:</td>
100
   </tr>
101
   <tr>
102
	     <td width="20"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
103
	     <td><label for="persist_order"><?php echo $MOD_JSADMIN['TXT_PERSIST_ORDER_B']; ?></label></td>
104
   </tr>
105
   <tr>
106
	     <td width="20"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
107
	     <td><label for="ajax_order_pages"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_PAGES_B']; ?></label></td>
108
   </tr>
109
   <tr>
110
	     <td width="20"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
111
	     <td><label for="ajax_order_sections"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_SECTIONS_B']; ?></label></td>
112
   </tr>
113
   <tr>
114
	     <td>&nbsp;</td>
115
	     <td>
116 1457 Luisehahne
		   <input type="submit" name="save_settings" value="<?php echo $TEXT['SAVE']; ?>" />
117 601 doc
	    </td>
118
   </tr>
119
   </table>
120
   </form>
121
 <?php
122
 }