Project

General

Profile

« Previous | Next » 

Revision 1707

Added by Dietmar about 12 years ago

! update folder admin/pages, admin/skel/htt
! change multi-dimensional arrays (variables) to similar arrays
! change default templates, change code to new templates

View differences:

settings.php
3 3
 *
4 4
 * @category        admin
5 5
 * @package         pages
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
9 8
 * @link			http://www.websitebaker2.org/
10 9
 * @license         http://www.gnu.org/licenses/gpl.html
11 10
 * @platform        WebsiteBaker 2.8.x
......
118 117
// Convert the unix ts for modified_when to human a readable form
119 118
	if($aCurrentPage['modified_when'] != 0) {
120 119
		$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $aCurrentPage['modified_when']+TIMEZONE);
121
	}else {
120
	} else {
122 121
		$modified_ts = 'Unknown';
123 122
	}
124 123
// Setup template object, parse vars to it, then parse it
125 124
// Create new template object
126
	$oTpl = new Template(dirname($admin->correct_theme_source('pages_settings.htt')), 'keep');
125
	$oTpl = new Template(dirname($admin->correct_theme_source('pages_settings.htt')),'keep' );
127 126
	$oTpl->set_file('page', 'pages_settings.htt');
128 127
	$oTpl->set_block('page', 'main_block', 'main');
129 128
	$oTpl->set_var('FTAN', $admin->getFTAN());
......
141 140
			'WB_URL'               => WB_URL,
142 141
			'THEME_URL'            => THEME_URL
143 142
			));
143

  
144
	if( $admin->get_permission('pages_modify') )
145
	{
146
		$oTpl->set_var(array(
147
				'MODIFY_LINK_BEFORE' => '<a href="'.ADMIN_URL.'/pages/modify.php?page_id='.$aCurrentPage['page_id'].'">',
148
				'MODIFY_LINK_AFTER' => '</a>',
149
				'DISPLAY_MANAGE_MODIFY' => 'link',
150
				));
151
	} else {
152
		$oTpl->set_var(array(
153
				'MODIFY_LINK_BEFORE' => '<span class="bold grey">',
154
				'MODIFY_LINK_AFTER' => '</span>',
155
				'DISPLAY_MANAGE_MODIFY' => 'link',
156
				));
157
	}
158

  
159

  
144 160
/*-- workout if we should show the "manage sections" link ------------------------------*/
145 161
	$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'sections` '
146 162
	     . 'WHERE `page_id`='.$page_id.' AND `module`=\'menu_link\'';
147 163
	$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);
164
//	$oTpl->set_block('main_block', 'show_manage_sections_block', 'show_manage_sections');
165
//	if(!$bIsMenuLink && (MANAGE_SECTIONS == true) && $admin->get_permission('pages_add') )
166
	if((MANAGE_SECTIONS == true) && $admin->get_permission('pages_add') )
167
	{
168
//		$oTpl->parse('show_manage_sections', 'show_manage_sections_block', true);
169
		$oTpl->set_var(array(
170
				'SECTIONS_LINK_BEFORE' => '<a href="'.ADMIN_URL.'/pages/sections.php?page_id='.$aCurrentPage['page_id'].'">',
171
				'SECTIONS_LINK_AFTER' => '</a>',
172
				'DISPLAY_MANAGE_SECTIONS' => 'link',
173
				));
151 174
	}else {
152
		$oTpl->set_block('show_manage_sections', '');
175
//		$oTpl->set_block('show_manage_sections', '');
176
		$oTpl->set_var(array(
177
				'SECTIONS_LINK_BEFORE' => '<span class="bold grey">',
178
				'SECTIONS_LINK_AFTER' => '</span>',
179
				'DISPLAY_MANAGE_SECTIONS' => 'link',
180
				));
153 181
	}
154 182

  
155 183
/*-- collect page-icons for select boxes -----------------------------------------------*/
......
159 187
	$sTemplate = ($aCurrentPage['template'] == '' ? DEFAULT_TEMPLATE : $aCurrentPage['template']);
160 188
	$sIconDir = str_replace('\\', '/', ((defined('PAGE_ICON_DIR') && PAGE_ICON_DIR != '') ? PAGE_ICON_DIR : MEDIA_DIRECTORY));
161 189
	$sIconDir = str_replace('/*', '/'.$sTemplate, $sIconDir);
162
	$oTpl->set_var('ICON_DIR', WB_REL.$sIconDir);
190
//	$oTpl->set_var('ICON_DIR', WB_REL.$sIconDir);
191
	$sHelp = replaceVars($mLang->HELP_PAGE_IMAGE_DIR, array('icon_dir'=>WB_REL.$sIconDir ) );
192

  
193
	$oTpl->set_var('p_page_icon_dir',  p($sHelp,$mLang->TEXT_PAGE_ICON_DIR));
194
	$oTpl->set_var('p_menu_icon0_dir', p($sHelp,$mLang->TEXT_MENU_ICON_0_DIR));
195
	$oTpl->set_var('p_menu_icon1_dir', p($sHelp,$mLang->TEXT_MENU_ICON_1_DIR));
196
	$oTpl->set_var('p_menu_page_code', p($mLang->HELP_PAGE_CODE,$mLang->TEXT_PAGE_CODE));
197

  
163 198
	if(is_readable(WB_PATH.$sIconDir)) {
164 199
		$oIterator = new DirectoryIterator(WB_PATH.$sIconDir);
165 200
		foreach ($oIterator as $fileinfo) {
......
173 208
	}
174 209
/*-- show page-icon select box ---------------------------------------------------------*/
175 210
	$oTpl->set_block('main_block', 'page_icon_list_block', 'page_icon_list');
176
	foreach($aPageIcons as $value) {
177
		$aIcon = $value;
178
		$aIcon['SELECTED'] = ($aCurrentPage['page_icon'] == $aIcon['VALUE'] ? $sSelected : '');
179
		$oTpl->set_var($aIcon);
180
		$oTpl->parse('page_icon_list', 'page_icon_list_block', true);
211
	if(sizeof($aPageIcons)>0){
212
		foreach($aPageIcons as $value) {
213
			$aIcon = $value;
214
			$aIcon['SELECTED'] = ($aCurrentPage['page_icon'] == $aIcon['VALUE'] ? $sSelected : '');
215
			$oTpl->set_var($aIcon);
216
			$oTpl->parse('page_icon_list', 'page_icon_list_block', true);
217
		}
218
	} else {
219
	$oTpl->parse('page_icon_list', '');
181 220
	}
182 221
/*-- show menu-icon-0 select box -------------------------------------------------------*/
183 222
	$oTpl->set_block('main_block', 'menu_icon0_list_block', 'menu_icon0_list');
184
	foreach($aPageIcons as $value) {
185
		$aIcon = $value;
186
		$aIcon['SELECTED'] = ($aCurrentPage['menu_icon_0'] == $aIcon['VALUE'] ? $sSelected : '');
187
		$oTpl->set_var($aIcon);
188
		$oTpl->parse('menu_icon0_list', 'menu_icon0_list_block', true);
223
	if(sizeof($aPageIcons)>0){
224
		foreach($aPageIcons as $value) {
225
			$aIcon = $value;
226
			$aIcon['SELECTED'] = ($aCurrentPage['menu_icon_0'] == $aIcon['VALUE'] ? $sSelected : '');
227
			$oTpl->set_var($aIcon);
228
			$oTpl->parse('menu_icon0_list', 'menu_icon0_list_block', true);
229
		}
230
	} else {
231
	$oTpl->parse('menu_icon0_list', '');
189 232
	}
190 233
/*-- show menu-icon-1 select box -------------------------------------------------------*/
191 234
	$oTpl->set_block('main_block', 'menu_icon1_list_block', 'menu_icon1_list');
192
	foreach($aPageIcons as $value) {
193
		$aIcon = $value;
194
		$aIcon['SELECTED'] = ($aCurrentPage['menu_icon_1'] == $aIcon['VALUE'] ? $sSelected : '');
195
		$oTpl->set_var($aIcon);
196
		$oTpl->parse('menu_icon1_list', 'menu_icon1_list_block', true);
235
	if(sizeof($aPageIcons)>0){
236
		foreach($aPageIcons as $value) {
237
			$aIcon = $value;
238
			$aIcon['SELECTED'] = ($aCurrentPage['menu_icon_1'] == $aIcon['VALUE'] ? $sSelected : '');
239
			$oTpl->set_var($aIcon);
240
			$oTpl->parse('menu_icon1_list', 'menu_icon1_list_block', true);
241
		}
242
	} else {
243
	$oTpl->parse('menu_icon1_list', '');
197 244
	}
198

  
199 245
/*-- show visibility select box --------------------------------------------------------*/
200 246
	$aVisibility = array();
201 247
	$aVisibility['PUBLIC_SELECTED']     = ($aCurrentPage['visibility'] == 'public' ? $sSelected : '');
......
263 309
	}
264 310

  
265 311
/*-- admin user list block -------------------------------------------------------------*/
312
// admin_group_show_list_block
313
	$oTpl->set_block('main_block', 'admin_group_show_list_block', 'admin_group_show_list');
314

  
266 315
	$aAdminUsers = ($aCurrentPage['admin_users'] == ''
267 316
	                ? array()
268 317
	                : explode(',', $aCurrentPage['admin_users']));
269 318
	$aAdminUsers = explode(',', $aCurrentPage['admin_users']);
270
	$oTpl->set_block('main_block', 'admin_user_list_block', 'admin_user_list');
319
	$oTpl->set_block('admin_group_show_list_block', 'admin_user_list_block', 'admin_user_list');
271 320
	$sAllowedAdminUsers = trim(implode(',',$aAdminUsers));
272 321
	$sAllowedAdminUsers = $sAllowedAdminUsers ? $sAllowedAdminUsers : '-1';
273 322
	$sql = 'SELECT `user_id`, `display_name` '
......
285 334
			$oTpl->parse('admin_user_list', 'admin_user_list_block', true);
286 335
		}
287 336
	}
337
	if($admin->ami_group_member('1')) {
338
		$oTpl->parse('admin_group_show_list', 'admin_group_show_list_block', true);
288 339

  
340
	} else {
341
		$oTpl->parse('admin_group_show_list', '', true);
342
	}
343

  
289 344
/*-- viewer users list block -----------------------------------------------------------*/
290 345
	$aViewingUsers = ($aCurrentPage['viewing_users'] == ''
291 346
	                  ? array()
......
339 394
	{
340 395
		// workout field is set but module missing
341 396
		$oTpl->set_var('TEXT_PAGE_CODE',
342
						   '<a href="'.WB_URL.'/modules/mod_multilingual/update_keys.php?page_id='.
343
						   $page_id.'">'.$mLang->TEXT_PAGE_CODE.'</a>'
397
						   '<a href="'.WB_URL.'/modules/mod_multilingual/update_keys.php?page_id='.$page_id.'">'.$mLang->TEXT_PAGE_CODE.'</a>'
344 398
		);
345 399
	/*-- begin recursive function page_code list ---------------------------------------*/
346 400
		function page_code_list($parent)
......
531 585
	$oTpl->pparse('output', 'page');
532 586
// Print admin footer
533 587
	$admin->print_footer();
588

  
589
function p($text,$lang)
590
{
591
	global $admin;
592
	$retVal  = 'onmouseover="return overlib(';
593
	$retVal .= '\''.$text.'\',';
594
	$retVal .= 'CAPTION,\''.$lang.'\',';
595
	$retVal .= 'FGCOLOR,\'#ffffff\',';
596
	$retVal .= 'BGCOLOR,\'#557c9e\',';
597
	$retVal .= 'BORDER,1,';
598
	$retVal .= 'WIDTH,';
599
	$retVal .= 'HEIGHT,';
600
	$retVal .= 'STICKY,';
601
	$retVal .= 'CAPTIONSIZE,\'13px\',';
602
	$retVal .= 'CLOSETEXT,\'X\',';
603
	$retVal .= 'CLOSESIZE,\'14px\',';
604
	$retVal .= 'CLOSECOLOR,\'#ffffff\',';
605
	$retVal .= 'TEXTSIZE,\'12px\',';
606
	$retVal .= 'VAUTO,';
607
	$retVal .= 'HAUTO,';
608
	$retVal .= 'MOUSEOFF,';
609
	$retVal .= 'WRAP,';
610
	$retVal .= 'CELLPAD,5';
611
	$retVal .= ')" onmouseout="return nd()"';
612
//	$retVal .= '';
613

  
614
	return $retVal;
615
}
616

  
617
/**
618
* replace varnames with values in a string
619
*
620
* @param string $subject: stringvariable with vars placeholder
621
* @param array $replace: values to replace vars placeholder
622
* @return string
623
*/
624
function replaceVars($subject = '', $replace = null )
625
{
626
	if(is_array($replace)==true)
627
	{
628
		foreach ($replace  as $key => $value) {
629
			$subject = str_replace("{{".$key."}}", $value, $subject);
630
		}
631
	}
632
	return $subject;
633
}

Also available in: Unified diff