From 6b41096def0670e8dfe132075bf290fccd2511c0 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 15 Sep 2011 18:49:14 +0200 Subject: [PATCH] Changing layout of the settings page --- main/admin/settings.php | 28 +++++++++++-------- main/css/base.css | 12 ++++++++ .../lib/formvalidator/FormValidator.class.php | 15 +++++++--- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/main/admin/settings.php b/main/admin/settings.php index 3455503bfd..a71a556cd7 100755 --- a/main/admin/settings.php +++ b/main/admin/settings.php @@ -67,8 +67,12 @@ if (isset($_GET['delete_watermark'])) { if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search'))) { $form = new FormValidator('settings', 'post', 'settings.php?category='.$_GET['category']); $renderer = & $form->defaultRenderer(); - $renderer->setHeaderTemplate('
{header}
'."\n"); - $renderer->setElementTemplate('
{label}
'."\n".'
{element}
'."\n"); + /*$renderer->setHeaderTemplate('
{header}
'); + $renderer->setElementTemplate('
{element}
{label}
'."\n");*/ + + //$renderer->setHeaderTemplate('
{header}
'); + $renderer->setElementTemplate('
{label}
{element}{label_2}
'); + $my_category = Database::escape_string($_GET['category']); $sqlcountsettings = "SELECT COUNT(*) FROM $table_settings_current WHERE category='".$my_category."' AND type<>'checkbox'"; @@ -121,7 +125,7 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' $i++; - $form->addElement('header', null, get_lang($row['title'])); + //$form->addElement('header', null, get_lang($row['title'])); if ($row['access_url_changeable'] == '1' && $_configuration['multiple_access_urls']) { $form->addElement('html', '
'.Display::return_icon('shared_setting.png', get_lang('SharedSettingIconComment')).'
'); @@ -155,7 +159,7 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' switch ($row['type']) { case 'textfield': if ($row['variable'] == 'account_valid_duration') { - $form->addElement('text', $row['variable'], get_lang($row['comment']), array('maxlength' => '5')); + $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('maxlength' => '5')); $form->applyFilter($row['variable'], 'html_filter'); $default_values[$row['variable']] = $row['selected_value']; @@ -184,10 +188,10 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' unset($valid_encodings[$key]); } } - $form->addElement('select', $row['variable'], get_lang($row['comment']), $valid_encodings); + $form->addElement('select', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), $valid_encodings); $default_values[$row['variable']] = $current_system_encoding; } else { - $form->addElement('text', $row['variable'], get_lang($row['comment']), $hideme); + $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), $hideme); $form->applyFilter($row['variable'],'html_filter'); $default_values[$row['variable']] = $row['selected_value']; } @@ -199,10 +203,10 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' if (file_exists($file)) { $value = file_get_contents($file); } - $form->addElement('textarea', $row['variable'], get_lang($row['comment']) , array('rows'=>'10','cols'=>'50'), $hideme); + $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10','cols'=>'50'), $hideme); $default_values[$row['variable']] = $value; } else { - $form->addElement('textarea', $row['variable'], get_lang($row['comment']) , array('rows'=>'10','cols'=>'50'), $hideme); + $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10','cols'=>'50'), $hideme); $default_values[$row['variable']] = $row['selected_value']; } break; @@ -218,7 +222,7 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' $group[] = $element; } } - $form->addGroup($group, $row['variable'], get_lang($row['comment']), '
', false); + $form->addGroup($group, $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), '
', false); //julio $default_values[$row['variable']] = $row['selected_value']; break; case 'checkbox'; @@ -259,17 +263,17 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' } $group[] = $element; } - $form->addGroup($group, $row['variable'], get_lang($row['comment']), '
'."\n"); + $form->addGroup($group, $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])),'
'); break; case 'link': - $form->addElement('static', null, get_lang($row['comment']), get_lang('CurrentValue').' : '.$row['selected_value'], $hideme); + $form->addElement('static', null, array(get_lang($row['title']), get_lang($row['comment'])), get_lang('CurrentValue').' : '.$row['selected_value'], $hideme); break; /* * To populate its list of options, the select type dynamically calls a function that must be called select_ + the name of the variable being displayed. * The functions being called must be added to the file settings.lib.php. */ case 'select': - $form->addElement('select', $row['variable'], get_lang($row['comment']), call_user_func('select_'.$row['variable']), $hideme); + $form->addElement('select', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), call_user_func('select_'.$row['variable']), $hideme); $default_values[$row['variable']] = $row['selected_value']; break; /* diff --git a/main/css/base.css b/main/css/base.css index 241a87d49b..d03ef154a7 100644 --- a/main/css/base.css +++ b/main/css/base.css @@ -3555,6 +3555,18 @@ fieldset legend { color: red; } +.help-block{ + display:block; + max-width:640px; + margin:5px 0 0!important; + line-height:18px; +} +.help-inline, .help-block { + color: #777777; + font-size: 12px; +} + + form div.error > .label, form div.error > label, form div.error span.help-inline, diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index 2dd6aa4bc5..583fd7522e 100755 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -71,20 +71,27 @@ EOT;
- * {label} + * + {label}
- {element}{error} + {element} + + {label_2} + + + + {error} +
- EOT; $renderer->setElementTemplate($element_template); $header_template = <<{header} EOT; $renderer->setHeaderTemplate($header_template); - HTML_QuickForm :: setRequiredNote('* '.get_lang('ThisFieldIsRequired').''); + HTML_QuickForm::setRequiredNote('* '.get_lang('ThisFieldIsRequired').''); $required_note_template = <<