From 6153cf580078c1c0d7d77404a0dd8a3cbaacb69c Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 25 Sep 2006 07:35:43 +0000 Subject: [PATCH] Moving all the admin settings to a tableless design MDL-6678 Thanks Urs for the CSS help! --- lib/adminlib.php | 135 +++++++++++++++---------------- theme/standard/styles_layout.css | 49 +++++++++++ 2 files changed, 114 insertions(+), 70 deletions(-) diff --git a/lib/adminlib.php b/lib/adminlib.php index c24384fbbf..3db57e297a 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -1233,11 +1233,12 @@ class admin_settingpage extends part_of_admin_tree { // outputs this page as html in a table (suitable for inclusion in an admin pagetype) // returns a string of the html function output_html() { - $return = '' . "\n"; + $return = '
' . "\n"; + $return .= '
' . "\n"; foreach($this->settings as $setting) { $return .= $setting->output_html(); } - $return .= '
'; + $return .= ''; return $return; } @@ -1338,9 +1339,9 @@ class admin_setting_configtext extends admin_setting { } else { $current = $this->get_setting(); } - return '' . $this->visiblename . '' . - '' . - ' ' . $this->description . ''; + return format_admin_setting('text', $this->name, $this->visiblename, + '', + $this->description); } } @@ -1370,9 +1371,9 @@ class admin_setting_configcheckbox extends admin_setting { } else { $current = $this->get_setting(); } - return '' . $this->visiblename . '' . - '' . - ' ' . $this->description . ''; + return format_admin_setting('checkbox', $this->name, $this->visiblename, + '', + $this->description); } } @@ -1407,12 +1408,13 @@ class admin_setting_configselect extends admin_setting { } else { $current = $this->get_setting(); } - $return = '' . $this->visiblename . ''; foreach ($this->choices as $key => $value) { - $return .= ''; + $return .= ''; } - $return .= ' ' . $this->description . ''; - return $return; + $return .= ''; + + return format_admin_setting('select', $this->name, $this->visiblename, $return, $this->description); } } @@ -1458,16 +1460,16 @@ class admin_setting_configtime extends admin_setting { } else { $currentsetting = $this->get_setting(); } - $return = '' . $this->visiblename . ''; foreach ($this->choices as $key => $value) { $return .= ''; } - $return .= '       ' . $this->description . ''; - return $return; + $return .= ''; + return format_admin_setting('configtime', $this->name, $this->visiblename, $return, $this->description); } } @@ -1499,12 +1501,12 @@ class admin_setting_configmultiselect extends admin_setting_configselect { } else { $currentsetting = $this->get_setting(); } - $return = '' . $this->visiblename . ''; foreach ($this->choices as $key => $value) { $return .= ''; } - $return .= ' ' . $this->description . ''; - return $return; + $return .= ''; + return format_admin_setting('configmultiselect', $this->name, $this->visiblename, $return, $this->description); } } @@ -1606,9 +1608,9 @@ class admin_setting_courselist_frontpage extends admin_setting_configselect { $currentsetting[$i] = 0; } } - $return = '' . $this->visiblename . ''; + $return = ''; for ($i = 0; $i < count($this->choices) - 1; $i++) { - $return .=''; foreach ($this->choices as $key => $value) { $return .= ''; } @@ -1617,8 +1619,7 @@ class admin_setting_courselist_frontpage extends admin_setting_configselect { $return .= '
'; } } - $return .= ' ' . $this->description . ''; - return $return; + return format_admin_setting('frontpage', $this->name, $this->visiblename, $return, $this->description); } } @@ -1709,20 +1710,16 @@ class admin_setting_special_frontpagedesc extends admin_setting { $usehtmleditor = can_use_html_editor(); - $return = '' . $this->visiblename . '' . - ''; - ob_start(); // double-check the number of columns below... might overrun some screen resolutions print_textarea($usehtmleditor, 15, 60, 0, 0, 's_' . $this->name, $currentsetting); if ($usehtmleditor) { use_html_editor(); } - $return .= ob_get_contents(); + $return = ob_get_contents(); ob_end_clean(); - $return .= ' ' . $this->description . ''; - return $return; + return format_admin_setting('frontpagedesc', $this->name, $this->visiblename, $return, $this->description); } function get_setting() { @@ -1834,7 +1831,7 @@ class admin_setting_special_editorfontlist extends admin_setting { $currentsetting = $this->get_setting(); } - $return = '' . $this->visiblename . ''; + $return = ''; for ($i = 0; $i < count($currentsetting) / 2; $i++) { $return .= ''; $return .= '  '; @@ -1846,8 +1843,8 @@ class admin_setting_special_editorfontlist extends admin_setting { $return .= ''; $return .= '  '; $return .= ''; - $return .= ' ' . $this->description . ''; - return $return; + + return format_admin_setting('editorfontlist', $this->name, $this->visiblename, $return, $this->description); } } @@ -2011,9 +2008,7 @@ class admin_setting_special_editorhidebuttons extends admin_setting { $currentsetting = $this->get_setting(); } - $return = '' . $this->visiblename . ''; - - $return .= ''; - return $return; + return format_admin_setting('editorhidebuttons', $this->name, $this->visiblename, $return, $this->description); } } @@ -2172,20 +2166,20 @@ class admin_setting_special_backupdays extends admin_setting { $currentsetting = $currentsetting['u'] . $currentsetting['m'] . $currentsetting['t'] . $currentsetting['w'] . $currentsetting['r'] . $currentsetting['f'] . $currentsetting['s']; - return '' . - '' . - ''; + $return = ''; + return format_admin_setting('checkbox', $this->name, $this->visiblename, $return, $this->description); } } @@ -2480,12 +2473,14 @@ function apply_default_exception_settings($defaults) { } -function format_admin_setting($name, $title='', $form='', $description='') { - $output = '
'; - $output .= 'etc'; - $output .= '
'; - - return $output; +function format_admin_setting($class, $name, $title='', $form='', $description='') { + return "\n". + '
'."\n". + ''."\n". + $form."\n". + '
'.$description.'
'."\n\n"; } -?> \ No newline at end of file +?> diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 56d2ebc335..da126ea46e 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -451,6 +451,55 @@ body#admin-roles-manage table.generalbox { text-align:center; } +fieldset.adminsettings { + margin-top: 1em; + padding: 1em 0.5em; + background-color: #EEE; + border-color: #BBB; + color: #000; +} +fieldset.adminsettings legend { + display: none; +} +fieldset.adminsettings .form-item { + margin: 0; +} +fieldset.adminsettings label { + display: block; + float: left; + width: 150px; + text-align: right; +} +fieldset.adminsettings .form-shortname { + display: block; + font-size: 75%; + color: #888; +} +fieldset.adminsettings select, +fieldset.adminsettings input { + float: left; + margin: 0 0 0 10px; +} +fieldset.adminsettings .description { + clear: both; + margin: 0 1em 0 160px; + padding: 0.3em 0 1.5em 0; +} +.form-buttons { + margin: 10px 0 0 160px; +} + +.form-text { + width: 20em; +} +.form-textarea { } +.form-select { } +.form-checkbox { } +.form-radio { } +.form-submit { } +.form-reset { } + + /*** *** Blocks ***/ -- 2.39.5
'; + $return = ''; $return .= '
'; $count = 0; @@ -2023,7 +2018,7 @@ class admin_setting_special_editorhidebuttons extends admin_setting { } $return .= ($value == '' ? get_string($key,'editor') : '' . get_string($key,'editor') . '') . ' '; - $return .= '       '; + $return .= '       '; $count++; if ($count % 15 != 0) { $return .= '

'; @@ -2032,9 +2027,8 @@ class admin_setting_special_editorhidebuttons extends admin_setting { $return .= '
'; - $return .= '
 ' . $this->description . '
' . $this->visiblename . '' . - ''; + '' . + '' . + '' . + '' . + '' . + '' . + '' . + '
  ' . get_string('sunday', 'calendar') . '  
  ' . + $return = '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '
  ' . get_string('sunday', 'calendar') . '  
  ' . get_string('monday', 'calendar') . '  
  ' . get_string('tuesday', 'calendar') . '  
  ' . get_string('wednesday', 'calendar') . '  
  ' . get_string('thursday', 'calendar') . '  
  ' . get_string('friday', 'calendar') . '  
  ' . get_string('saturday', 'calendar') . '  
' . - '
 ' . $this->description . '
'; + + return format_admin_setting('backupdays', $this->name, $this->visiblename, $return, $this->description); } @@ -2275,20 +2269,20 @@ class admin_setting_special_calendar_weekend extends admin_setting { $currentsetting = $this->get_setting(); } - return '
' . $this->visiblename . '' . - ''; + '' . + '' . + '' . + '' . + '' . + '' . + '' . + '
  ' . get_string('sunday', 'calendar') . '  
  ' . + $return = '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '
  ' . get_string('sunday', 'calendar') . '  
  ' . get_string('monday', 'calendar') . '  
  ' . get_string('tuesday', 'calendar') . '  
  ' . get_string('wednesday', 'calendar') . '  
  ' . get_string('thursday', 'calendar') . '  
  ' . get_string('friday', 'calendar') . '  
  ' . get_string('saturday', 'calendar') . '  
' . - '
 ' . $this->description . '
'; + + return format_admin_setting('calendarweekend', $this->name, $this->visiblename, $return, $this->description); } @@ -2319,9 +2313,8 @@ class admin_setting_special_perfdebug extends admin_setting_configcheckbox { $currentsetting = $this->get_setting(); } - return '
' . $this->visiblename . '
 ' . $this->description . '