Project

General

Profile

1 601 doc
<?php
2 1377 FrankH
/**
3
 *
4
 * @category        modules
5
 * @package         JsAdmin
6 1831 Luisehahne
 * @author          Ryan Djurovich (2004-2009), WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 1377 FrankH
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id$
13 1477 Luisehahne
 * @filesource		$HeadURL$
14
 * @lastmodified    $Date$
15 1377 FrankH
 *
16 601 doc
*/
17
18 1537 Luisehahne
/* -------------------------------------------------------- */
19 1831 Luisehahne
// Must include code to stop this file being accessed directly
20
if(!defined('WB_URL')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
23 1537 Luisehahne
}
24
/* -------------------------------------------------------- */
25 601 doc
26
// check if module language file exists for the language set by the user (e.g. DE, EN)
27
if(!file_exists(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php')) {
28
	// no module language file exists for the language set by the user, include default module language file EN.php
29
	require_once(WB_PATH .'/modules/jsadmin/languages/EN.php');
30
} else {
31
	// a module language file exists for the language defined by the user, load it
32
	require_once(WB_PATH .'/modules/jsadmin/languages/'.LANGUAGE .'.php');
33
}
34 1457 Luisehahne
/*
35 601 doc
// check if backend.css file needs to be included into the <body></body>
36
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH .'/modules/jsadmin/backend.css')) {
37
	echo '<style type="text/css">';
38
	include(WB_PATH .'/modules/jsadmin/backend.css');
39
	echo "\n</style>\n";
40
}
41 1457 Luisehahne
*/
42 601 doc
require_once(WB_PATH.'/modules/jsadmin/jsadmin.php');
43
44
// Check if user selected what add-ons to reload
45 1457 Luisehahne
if(isset($_POST['save_settings']))  {
46 1460 Luisehahne
47 1377 FrankH
	if (!$admin->checkFTAN())
48
	{
49 1460 Luisehahne
		if(!$admin_header) { $admin->print_header(); }
50 1425 Luisehahne
		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI']);
51 1377 FrankH
	}
52
53 601 doc
	// Include functions file
54
	require_once(WB_PATH.'/framework/functions.php');
55
	save_setting('mod_jsadmin_persist_order', isset($_POST['persist_order']));
56
	save_setting('mod_jsadmin_ajax_order_pages', isset($_POST['ajax_order_pages']));
57
	save_setting('mod_jsadmin_ajax_order_sections', isset($_POST['ajax_order_sections']));
58 1457 Luisehahne
   // 	echo '<div style="border: solid 2px #9c9; background: #ffd; padding: 0.5em; margin-top: 1em">'.$MESSAGE['SETTINGS']['SAVED'].'</div>';
59
	// check if there is a database error, otherwise say successful
60 1460 Luisehahne
	if(!$admin_header) { $admin->print_header(); }
61 1457 Luisehahne
	if($database->is_error()) {
62
		$admin->print_error($database->get_error(), $js_back);
63
	} else {
64
65 1831 Luisehahne
		$admin->print_success($MESSAGE['PAGES_SAVED'], ADMIN_URL.'/admintools/tool.php?tool=jsadmin');
66 1457 Luisehahne
	}
67
68
} else {
69
	// $admin->print_header();
70 601 doc
}
71
72
// Display form
73 1457 Luisehahne
	$persist_order = get_setting('mod_jsadmin_persist_order', true) ? 'checked="checked"' : '';
74
	$ajax_order_pages = get_setting('mod_jsadmin_ajax_order_pages', true) ? 'checked="checked"' : '';
75
	$ajax_order_sections = get_setting('mod_jsadmin_ajax_order_sections', true) ? 'checked="checked"' : '';
76 601 doc
77
// THIS ROUTINE CHECKS THE EXISTING OFF ALL NEEDED YUI FILES
78
  $YUI_ERROR=false; // ist there an Error
79
  $YUI_PUT ='';   // String with javascipt includes
80
  $YUI_PUT_MISSING_Files=''; // String with missing files
81
  reset($js_yui_scripts);
82
  foreach($js_yui_scripts as $script) {
83 626 doc
     if(!file_exists($WB_MAIN_RELATIVE_PATH.$script)){
84 601 doc
        $YUI_ERROR=true;
85 626 doc
        $YUI_PUT_MISSING_Files =$YUI_PUT_MISSING_Files."- ".WB_URL.$script."<br />";   // catch all missing files
86 601 doc
    }
87
	}
88
	if($YUI_ERROR)
89
	{
90 1457 Luisehahne
?>
91
	<div id="jsadmin_install" style="border: solid 2px #c99; background: #ffd; padding: 0.5em; margin-top: 1em">
92 601 doc
93
     <?php echo $MOD_JSADMIN['TXT_ERROR_INSTALLINFO_B'].$YUI_PUT_MISSING_Files; ?>
94
      </div>
95 1457 Luisehahne
<?php
96 601 doc
  }
97
  else
98
  {
99
  ?>
100 1657 Luisehahne
<div  id="jsadmin_form"></div>
101
   <form name="store_settings" style="margin-top: 1em; display: true;" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
102 1377 FrankH
	<?php echo $admin->getFTAN(); ?>
103 1831 Luisehahne
   <table class="jsadmin_drag_area">
104
<tbody>
105 601 doc
   <tr>
106
	     <td colspan="2"><?php echo $MOD_JSADMIN['TXT_HEADING_B']; ?>:</td>
107
   </tr>
108
   <tr>
109 1831 Luisehahne
	     <td style="width: 20px;"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
110 601 doc
	     <td><label for="persist_order"><?php echo $MOD_JSADMIN['TXT_PERSIST_ORDER_B']; ?></label></td>
111
   </tr>
112
   <tr>
113 1831 Luisehahne
	     <td  style="width: 20px;"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
114 601 doc
	     <td><label for="ajax_order_pages"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_PAGES_B']; ?></label></td>
115
   </tr>
116
   <tr>
117 1831 Luisehahne
	     <td style="width: 20px;"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
118 601 doc
	     <td><label for="ajax_order_sections"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_SECTIONS_B']; ?></label></td>
119
   </tr>
120
   <tr>
121 1831 Luisehahne
	     <td style="width: 20px;">&nbsp;</td>
122 601 doc
	     <td>
123 1457 Luisehahne
		   <input type="submit" name="save_settings" value="<?php echo $TEXT['SAVE']; ?>" />
124 601 doc
	    </td>
125
   </tr>
126 1831 Luisehahne
</tbody>
127 601 doc
   </table>
128
   </form>
129
 <?php
130
 }