Project

General

Profile

« Previous | Next » 

Revision 1681

Added by darkviper over 12 years ago

reorganisation of default theme of page-settings
added menu_icon_0 and menu_icon_1
update show_menu2 to handle the new icon fields (see README.de|en.txt)
add new droplet 'iParentIcon' for use with the new icons
added new module-depending language files (not complete yet) in admin/pages

View differences:

settings.php
15 15
 * @lastmodified    $Date$
16 16
 *
17 17
 */
18

  
19
/*
20
*/
21 18
// Create new admin object
22 19
require('../../config.php');
23 20
require_once(WB_PATH.'/framework/class.admin.php');
24 21
$admin = new admin('Pages', 'pages_settings');
25
// Include the WB functions file
26
//require_once(WB_PATH.'/framework/functions-utf8.php');
27 22

  
28 23
/*-- Parent page list ------------------------------------------------------------------*/
29 24
	function parent_list($parent)
......
84 79
		}
85 80
	} // end of function parent_list
86 81
/* -------------------------------------------------------------------------------------*/
82
	$mLang = ModLanguage::getInstance();
83
	$mLang->setLanguage(dirname(__FILE__).'/languages/', LANGUAGE, DEFAULT_LANGUAGE);
87 84
	$sDisabled = ' disabled="disabled"';
88 85
	$sSelected  = ' selected="selected"';
89 86
	$sChecked   = ' checked="checked"';
......
94 91
		header("Location: index.php");
95 92
		exit(0);
96 93
	}
97
/*
98
if( (!($page_id = $admin->checkIDKEY('page_id', 0, $_SERVER['REQUEST_METHOD']))) )
99
{
100
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
101
	exit();
102
}
103
*/
104 94
/*-- get all details of current page ---------------------------------------------------*/
105 95
	$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$page_id;
106 96
	if( ($oPages = $database->query($sql)) ) {
......
154 144
/*-- workout if we should show the "manage sections" link ------------------------------*/
155 145
	$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'sections` '
156 146
	     . 'WHERE `page_id`='.$page_id.' AND `module`=\'menu_link\'';
157
	$sections_available = (intval($database->get_one($sql)) != 0);
158
	if ($sections_available) {
159
		$oTpl->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
160
	} elseif(MANAGE_SECTIONS == 'enabled') {
161
		$oTpl->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
162
	} else {
163
		$oTpl->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
147
	$bIsMenuLink = (intval($database->get_one($sql)) != 0);
148
	$oTpl->set_block('main_block', 'show_manage_sections_block', 'show_manage_sections');
149
	if(!$bIsMenuLink && (MANAGE_SECTIONS == true)) {
150
		$oTpl->parse('show_manage_sections', 'show_manage_sections_block', true);
151
	}else {
152
		$oTpl->set_block('show_manage_sections', '');
164 153
	}
165 154

  
155
/*-- collect page-icons for select boxes -----------------------------------------------*/
156
    $sAllowedImageTypes = '\.jpg|\.jpeg|\.png|\.gif';
157
	$aPageIcons = array();
158
	$aIcon = array();
159
	$sTemplate = ($aCurrentPage['template'] == '' ? DEFAULT_TEMPLATE : $aCurrentPage['template']);
160
	$sIconDir = str_replace('\\', '/', ((defined('PAGE_ICON_DIR') && PAGE_ICON_DIR != '') ? PAGE_ICON_DIR : MEDIA_DIRECTORY));
161
	$sIconDir = str_replace('/*', '/'.$sTemplate, $sIconDir);
162
	$oTpl->set_var('ICON_DIR', WB_REL.$sIconDir);
163
	if(is_readable(WB_PATH.$sIconDir)) {
164
		$oIterator = new DirectoryIterator(WB_PATH.$sIconDir);
165
		foreach ($oIterator as $fileinfo) {
166
			if(preg_match('/'.$sAllowedImageTypes.'$/i', $fileinfo->getFilename())) {
167
				$sItem = str_replace(WB_PATH, '', str_replace('\\', '/', $fileinfo->getPathname()));
168
//				$sItem = WB_REL.$sItem;
169
				$aPageIcons[] = array('VALUE'=>$sItem, 'NAME'=>$fileinfo->getFilename());
170
			}
171
		}
172
	}
173
/*-- show page-icon select box ---------------------------------------------------------*/
174
	$oTpl->set_block('main_block', 'page_icon_list_block', 'page_icon_list');
175
	foreach($aPageIcons as $value) {
176
		$aIcon = $value;
177
		$aIcon['SELECTED'] = ($aCurrentPage['page_icon'] == $aIcon['VALUE'] ? $sSelected : '');
178
		$oTpl->set_var($aIcon);
179
		$oTpl->parse('page_icon_list', 'page_icon_list_block', true);
180
	}
181
/*-- show menu-icon-0 select box -------------------------------------------------------*/
182
	$oTpl->set_block('main_block', 'menu_icon0_list_block', 'menu_icon0_list');
183
	foreach($aPageIcons as $value) {
184
		$aIcon = $value;
185
		$aIcon['SELECTED'] = ($aCurrentPage['menu_icon_0'] == $aIcon['VALUE'] ? $sSelected : '');
186
		$oTpl->set_var($aIcon);
187
		$oTpl->parse('menu_icon0_list', 'menu_icon0_list_block', true);
188
	}
189
/*-- show menu-icon-1 select box -------------------------------------------------------*/
190
	$oTpl->set_block('main_block', 'menu_icon1_list_block', 'menu_icon1_list');
191
	foreach($aPageIcons as $value) {
192
		$aIcon = $value;
193
		$aIcon['SELECTED'] = ($aCurrentPage['menu_icon_1'] == $aIcon['VALUE'] ? $sSelected : '');
194
		$oTpl->set_var($aIcon);
195
		$oTpl->parse('menu_icon1_list', 'menu_icon1_list_block', true);
196
	}
197

  
166 198
/*-- show visibility select box --------------------------------------------------------*/
167 199
	$aVisibility = array();
168 200
	$aVisibility['PUBLIC_SELECTED']     = ($aCurrentPage['visibility'] == 'public' ? $sSelected : '');
......
305 337
		 file_exists(WB_PATH.'/modules/mod_multilingual/update_keys.php') )
306 338
	{
307 339
		// workout field is set but module missing
308
		$TEXT['PAGE_CODE'] = empty($TEXT['PAGE_CODE']) ? 'Pagecode' : $TEXT['PAGE_CODE'];
309 340
		$oTpl->set_var('TEXT_PAGE_CODE',
310 341
						   '<a href="'.WB_URL.'/modules/mod_multilingual/update_keys.php?page_id='.
311
						   $page_id.'">'.$TEXT['PAGE_CODE'].'</a>'
342
						   $page_id.'">'.$mLang->TEXT_PAGE_CODE.'</a>'
312 343
		);
313 344
	/*-- begin recursive function page_code list ---------------------------------------*/
314 345
		function page_code_list($parent)
......
373 404
			$selected = ($aCurrentPage['parent'] == 0 ? $sSelected : '');
374 405
			$oTpl->set_var(array(
375 406
					'VALUE' => 0,
376
					'PAGE_CODE' => $TEXT['NONE'],
407
					'PAGE_CODE' => $mLang->TEXT_NONE,
377 408
					'PAGE_VALUE' => '',
378 409
					'SELECTED' => $selected
379 410
				)
......
393 424
	if($admin->get_permission('pages_add_l0') == true OR $aCurrentPage['level'] == 0) {
394 425
		$oTpl->set_var(array(
395 426
					'ID' => '0',
396
					'TITLE' => $TEXT['NONE'],
427
					'TITLE' => $mLang->TEXT_NONE,
397 428
					'SELECTED' => ($aCurrentPage['parent'] == 0 ? $sSelected : ''),
398 429
					) );
399 430
		$oTpl->parse('parent_page_list', 'parent_page_list_block', true);
......
493 524
	$oTpl->set_var('BLANK_SELECTED', ($aCurrentPage['target'] == '_blank' ? $sSelected : ''));
494 525

  
495 526
/*-- insert all needed vars from language files ----------------------------------------*/
496
	$oTpl->set_var(array(
497
		'HEADING_MODIFY_PAGE_SETTINGS' => $HEADING['MODIFY_PAGE_SETTINGS'],
498
		'TEXT_CURRENT_PAGE'            => $TEXT['CURRENT_PAGE'],
499
		'TEXT_MODIFY'                  => $TEXT['MODIFY'],
500
		'TEXT_MODIFY_PAGE'             => $HEADING['MODIFY_PAGE'],
501
		'LAST_MODIFIED'                => $MESSAGE['PAGES_LAST_MODIFIED'],
502
		'TEXT_PAGE_TITLE'              => $TEXT['PAGE_TITLE'],
503
		'TEXT_MENU_TITLE'              => $TEXT['MENU_TITLE'],
504
		'TEXT_TYPE'                    => $TEXT['TYPE'],
505
		'TEXT_MENU'                    => $TEXT['MENU'],
506
		'TEXT_PARENT'                  => $TEXT['PARENT'],
507
		'TEXT_VISIBILITY'              => $TEXT['VISIBILITY'],
508
		'TEXT_PUBLIC'                  => $TEXT['PUBLIC'],
509
		'TEXT_PRIVATE'                 => $TEXT['PRIVATE'],
510
		'TEXT_REGISTERED'              => $TEXT['REGISTERED'],
511
		'TEXT_NONE'                    => $TEXT['NONE'],
512
		'TEXT_HIDDEN'                  => $TEXT['HIDDEN'],
513
		'TEXT_TEMPLATE'                => $TEXT['TEMPLATE'],
514
		'TEXT_TARGET'                  => $TEXT['TARGET'],
515
		'TEXT_SYSTEM_DEFAULT'          => $TEXT['SYSTEM_DEFAULT'],
516
		'TEXT_PLEASE_SELECT'           => $TEXT['PLEASE_SELECT'],
517
		'TEXT_NEW_WINDOW'              => $TEXT['NEW_WINDOW'],
518
		'TEXT_SAME_WINDOW'             => $TEXT['SAME_WINDOW'],
519
		'TEXT_TOP_FRAME'               => $TEXT['TOP_FRAME'],
520
		'TEXT_ADMINISTRATORS'          => $TEXT['ADMINISTRATORS'],
521
		'TEXT_ALLOWED_VIEWERS'         => $TEXT['ALLOWED_VIEWERS'],
522
		'TEXT_USER'                    => $TEXT['USER'],
523
		'TEXT_GROUP'                   => $TEXT['GROUP'],
524
		'TEXT_DESCRIPTION'             => $TEXT['DESCRIPTION'],
525
		'TEXT_KEYWORDS'                => $TEXT['KEYWORDS'],
526
		'TEXT_SEARCHING'               => $TEXT['SEARCHING'],
527
		'TEXT_LANGUAGE'                => $TEXT['LANGUAGE'],
528
		'TEXT_ENABLED'                 => $TEXT['ENABLED'],
529
		'TEXT_DISABLED'                => $TEXT['DISABLED'],
530
		'TEXT_SAVE'                    => $TEXT['SAVE'],
531
		'TEXT_RESET'                   => $TEXT['RESET'],
532
		'LAST_MODIFIED'                => $MESSAGE['PAGES_LAST_MODIFIED'],
533
		'HEADING_MODIFY_PAGE'          => $HEADING['MODIFY_PAGE'],
534
		'TEXT_NO_SELECTION'            => $TEXT['NO_SELECTION'],
535
	) );
536

  
527
	$oTpl->set_var($mLang->getLangArray());
528
/*-- finalize the page -----------------------------------------------------------------*/
537 529
	$oTpl->parse('main', 'main_block', false);
538 530
	$oTpl->pparse('output', 'page');
539

  
540 531
// Print admin footer
541 532
	$admin->print_footer();
542

  
543
?>

Also available in: Unified diff