[CS-Project-svn_notify] SF.net SVN: cs-project: [800] trunk/1.2/includes
Brought to you by:
crazedsanity
From: <cra...@us...> - 2008-02-07 07:10:07
|
Revision: 800 http://cs-project.svn.sourceforge.net/cs-project/?rev=800&view=rev Author: crazedsanity Date: 2008-02-06 23:10:01 -0800 (Wed, 06 Feb 2008) Log Message: ----------- Add special link for admin, clean code for doing admin/non-admin settings. Modified Paths: -------------- trunk/1.2/includes/content/settings.inc trunk/1.2/includes/content.inc Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-07 07:00:16 UTC (rev 799) +++ trunk/1.2/includes/content/settings.inc 2008-02-07 07:10:01 UTC (rev 800) @@ -128,49 +128,7 @@ $x = $page->set_all_block_rows("content"); - //show 'em their preferences. - $allPrefs = $prefObj->list_all_prefs(); - $userPrefs = $prefObj->get_user_prefs(); - if(is_array($allPrefs)) { - $rowColor = "#D3D3D3"; - foreach($allPrefs as $index=>$data) { - $myOptions = $data['optionList']; - - //TODO: fix this... it's sloppy. - $myOptionList = array(); - $optionListRepArr = array(); - foreach($data['optionList'] as $x=>$y) { - $tKey = $y['pref_option_id']; - $tVal = $y['name']; - $myOptionList[$tKey] = $tVal; - - $optionListRepArr[$tKey] = $y; - } - - unset($data['optionList'], $data['optionList']); - - $checkThis = NULL; - if(strlen($userPrefs[$data['pref_type_id']])) { - $checkThis = $userPrefs[$data['pref_type_id']]; - $data['currentSetting'] = $myOptionList[$checkThis]; - } - else { - $data['currentSetting'] = '<font color="red"><b>Select something!</b></font>'; - } - - $data['row_optionList'] = array_as_option_list( - $myOptionList, $checkThis, 'select', $page->templateRows['pref_optionList'], $optionListRepArr - ); - - $rowColor = swapValue($rowColor, '#D3D3D3', '#C3C3C3'); - $data['rowColor'] = $rowColor; - - $prefRow .= mini_parser($page->templateRows['pref_row'], $data, '%%', '%%'); - } - $page->add_template_var('pref_row', $prefRow); - } - if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { if($user->is_admin() == 1) { //add the template to show various admin stuff. @@ -206,6 +164,50 @@ $page->set_message_wrapper($msg); } } + else { + //show 'em their preferences. + $allPrefs = $prefObj->list_all_prefs(); + $userPrefs = $prefObj->get_user_prefs(); + + if(is_array($allPrefs)) { + $rowColor = "#D3D3D3"; + foreach($allPrefs as $index=>$data) { + $myOptions = $data['optionList']; + + //TODO: fix this... it's sloppy. + $myOptionList = array(); + $optionListRepArr = array(); + foreach($data['optionList'] as $x=>$y) { + $tKey = $y['pref_option_id']; + $tVal = $y['name']; + $myOptionList[$tKey] = $tVal; + + $optionListRepArr[$tKey] = $y; + } + + unset($data['optionList'], $data['optionList']); + + $checkThis = NULL; + if(strlen($userPrefs[$data['pref_type_id']])) { + $checkThis = $userPrefs[$data['pref_type_id']]; + $data['currentSetting'] = $myOptionList[$checkThis]; + } + else { + $data['currentSetting'] = '<font color="red"><b>Select something!</b></font>'; + } + + $data['row_optionList'] = array_as_option_list( + $myOptionList, $checkThis, 'select', $page->templateRows['pref_optionList'], $optionListRepArr + ); + + $rowColor = swapValue($rowColor, '#D3D3D3', '#C3C3C3'); + $data['rowColor'] = $rowColor; + + $prefRow .= mini_parser($page->templateRows['pref_row'], $data, '%%', '%%'); + } + $page->add_template_var('pref_row', $prefRow); + } + } } Modified: trunk/1.2/includes/content.inc =================================================================== --- trunk/1.2/includes/content.inc 2008-02-07 07:00:16 UTC (rev 799) +++ trunk/1.2/includes/content.inc 2008-02-07 07:10:01 UTC (rev 800) @@ -133,7 +133,7 @@ ); if($user->is_admin()) { - $tabNames['settings'] = "Settings<BR>\n<b>[Admin]</b>"; + $tabNames['settings'] = "Settings</a><BR>\n<a href=\"/content/settings/admin\"><b>[Admin]</b>"; } #$page->add_template_var('tabs', $page->file_to_string('tabs.shared.tmpl')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |