From d46162271a5ca3c3af690173d0abfcd1ab9f69a1 Mon Sep 17 00:00:00 2001 From: brettp Date: Fri, 16 Oct 2009 21:05:54 +0000 Subject: Standardized views/failsafe/* git-svn-id: http://code.elgg.org/elgg/trunk@3558 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/failsafe/canvas/default.php | 32 +++--- views/failsafe/input/access.php | 90 ++++++++-------- views/failsafe/input/button.php | 82 ++++++++------- views/failsafe/input/checkboxes.php | 89 ++++++++-------- views/failsafe/input/form.php | 62 ++++++----- views/failsafe/input/hidden.php | 32 +++--- views/failsafe/input/longtext.php | 39 ++++--- views/failsafe/input/pulldown.php | 83 +++++++-------- views/failsafe/input/reset.php | 47 ++++----- views/failsafe/input/submit.php | 47 ++++----- views/failsafe/input/text.php | 41 ++++---- views/failsafe/messages/errors/error.php | 31 +++--- views/failsafe/messages/errors/list.php | 51 ++++------ views/failsafe/messages/exceptions/exception.php | 65 ++++++------ views/failsafe/messages/list.php | 39 +++---- views/failsafe/messages/messages/list.php | 60 +++++------ views/failsafe/messages/messages/message.php | 31 +++--- views/failsafe/messages/sanitisation/htaccess.php | 25 ++--- views/failsafe/messages/sanitisation/settings.php | 36 +++---- views/failsafe/pageshells/pageshell.php | 74 +++++++------- views/failsafe/settings/install.php | 31 +++--- views/failsafe/settings/system.php | 119 +++++++++++----------- 22 files changed, 589 insertions(+), 617 deletions(-) diff --git a/views/failsafe/canvas/default.php b/views/failsafe/canvas/default.php index a5c30fe52..0cfa8b49a 100644 --- a/views/failsafe/canvas/default.php +++ b/views/failsafe/canvas/default.php @@ -1,21 +1,15 @@ \ No newline at end of file +} \ No newline at end of file diff --git a/views/failsafe/input/access.php b/views/failsafe/input/access.php index 74fc56ddf..c0dabccaf 100644 --- a/views/failsafe/input/access.php +++ b/views/failsafe/input/access.php @@ -1,51 +1,49 @@ 0) { + + ?> + + class=""> - $option) { - if ($key != $vars['value']) { - echo ""; - } else { - echo ""; - } - } - -?> - - - + - } + \ No newline at end of file +} \ No newline at end of file diff --git a/views/failsafe/input/button.php b/views/failsafe/input/button.php index 0f6fdf6a5..2c36841df 100644 --- a/views/failsafe/input/button.php +++ b/views/failsafe/input/button.php @@ -1,39 +1,53 @@ wwwroot)===false) $src = ""; // blank src if trying to access an offsite image. +$class = $vars['class']; +if (!$class) { + $class = "submit_button"; +} + +if (isset($vars['type'])) { + $type = strtolower($vars['type']); +} else { + $type = 'submit'; +} + +switch ($type) { + case 'button' : + $type='button'; + break; + case 'reset' : + $type='reset'; + break; + case 'submit': + default: + $type = 'submit'; +} + +$value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); +$name = $vars['internalname']; +$src = $vars['src']; +// blank src if trying to access an offsite image. +if (strpos($src,$CONFIG->wwwroot)===false) { + $src = ""; +} ?> value="" src="" class="" /> \ No newline at end of file diff --git a/views/failsafe/input/checkboxes.php b/views/failsafe/input/checkboxes.php index 0e394af55..0cc32958f 100644 --- a/views/failsafe/input/checkboxes.php +++ b/views/failsafe/input/checkboxes.php @@ -1,49 +1,48 @@ $option) { + //if (!in_array($option,$vars['value'])) { + if (is_array($vars['value'])) { + if (!in_array($option,$vars['value'])) { + $selected = ""; + } else { + $selected = "checked = \"checked\""; + } + } else { + if ($option != $vars['value']) { + $selected = ""; + } else { + $selected = "checked = \"checked\""; + } + } + $labelint = (int) $label; + if ("{$label}" == "{$labelint}") { + $label = $option; + } - * @link http://elgg.org/ - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['options'] An array of strings representing the options for the checkbox field - * - */ - - $class = $vars['class']; - if (!$class) $class = "input-checkboxes"; - - foreach($vars['options'] as $label => $option) { - //if (!in_array($option,$vars['value'])) { - if (is_array($vars['value'])) { - if (!in_array($option,$vars['value'])) { - $selected = ""; - } else { - $selected = "checked = \"checked\""; - } - } else { - if ($option != $vars['value']) { - $selected = ""; - } else { - $selected = "checked = \"checked\""; - } - } - $labelint = (int) $label; - if ("{$label}" == "{$labelint}") { - $label = $option; - } - - $disabled = ""; - if ($vars['disabled']) $disabled = ' disabled="yes" '; - echo "
"; - } - -?> \ No newline at end of file + $disabled = ""; + if ($vars['disabled']) { + $disabled = ' disabled="yes" '; + } + echo "
"; +} \ No newline at end of file diff --git a/views/failsafe/input/form.php b/views/failsafe/input/form.php index 99b6f9965..10fe89dcf 100644 --- a/views/failsafe/input/form.php +++ b/views/failsafe/input/form.php @@ -1,27 +1,43 @@
id="" name="" action="" method="" > diff --git a/views/failsafe/input/hidden.php b/views/failsafe/input/hidden.php index 58b86c25e..dd5c8bb98 100644 --- a/views/failsafe/input/hidden.php +++ b/views/failsafe/input/hidden.php @@ -1,18 +1,18 @@ - name="" value="" /> \ No newline at end of file + name="" value="" /> \ No newline at end of file diff --git a/views/failsafe/input/longtext.php b/views/failsafe/input/longtext.php index c1f38fe69..9c89583de 100644 --- a/views/failsafe/input/longtext.php +++ b/views/failsafe/input/longtext.php @@ -1,25 +1,24 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/views/failsafe/input/pulldown.php b/views/failsafe/input/pulldown.php index 1adbad099..6ad12eec4 100644 --- a/views/failsafe/input/pulldown.php +++ b/views/failsafe/input/pulldown.php @@ -1,52 +1,45 @@ "option" where "value" is an internal name and "option" is - * the value displayed on the button. Replaces $vars['options'] when defined. - */ - - - $class = $vars['class']; - if (!$class) $class = "input-pulldown"; - +/** + * Elgg pulldown input + * Displays a pulldown input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['options'] An array of strings representing the options for the pulldown field + * @uses $vars['options_values'] An associative array of "value" => "option" where "value" is an internal name and "option" is + * the value displayed on the button. Replaces $vars['options'] when defined. + */ + + +$class = $vars['class']; +if (!$class) { + $class = "input-pulldown"; +} ?> - - \ No newline at end of file diff --git a/views/failsafe/input/reset.php b/views/failsafe/input/reset.php index 96fc57a4f..bb8d278c3 100644 --- a/views/failsafe/input/reset.php +++ b/views/failsafe/input/reset.php @@ -1,25 +1,26 @@ \ No newline at end of file +$vars['type'] = 'reset'; +$class = $vars['class']; +if (!$class) { + $class = "submit_button"; +} +$vars['class'] = $class; + +echo elgg_view('input/button', $vars); \ No newline at end of file diff --git a/views/failsafe/input/submit.php b/views/failsafe/input/submit.php index 79d6522b9..cfa7989d0 100644 --- a/views/failsafe/input/submit.php +++ b/views/failsafe/input/submit.php @@ -1,25 +1,26 @@ \ No newline at end of file +$vars['type'] = 'submit'; +$class = $vars['class']; +if (!$class) { + $class = "submit_button"; +} +$vars['class'] = $class; + +echo elgg_view('input/button', $vars); \ No newline at end of file diff --git a/views/failsafe/input/text.php b/views/failsafe/input/text.php index 4c37e5219..f94ee0135 100644 --- a/views/failsafe/input/text.php +++ b/views/failsafe/input/text.php @@ -1,27 +1,26 @@ - - name="" value="" class=""/> \ No newline at end of file + name="" value="" class=""/> \ No newline at end of file diff --git a/views/failsafe/messages/errors/error.php b/views/failsafe/messages/errors/error.php index e3eb065e7..2ec365890 100644 --- a/views/failsafe/messages/errors/error.php +++ b/views/failsafe/messages/errors/error.php @@ -1,20 +1,17 @@ -

- -

\ No newline at end of file +

+ +

\ No newline at end of file diff --git a/views/failsafe/messages/errors/list.php b/views/failsafe/messages/errors/list.php index 8a4b26056..c270d6c0a 100644 --- a/views/failsafe/messages/errors/list.php +++ b/views/failsafe/messages/errors/list.php @@ -1,32 +1,29 @@
@@ -41,8 +38,4 @@
\ No newline at end of file +} \ No newline at end of file diff --git a/views/failsafe/messages/exceptions/exception.php b/views/failsafe/messages/exceptions/exception.php index 12e49c50f..f6fb4d144 100644 --- a/views/failsafe/messages/exceptions/exception.php +++ b/views/failsafe/messages/exceptions/exception.php @@ -1,37 +1,36 @@ -

- - getMessage()); - - ?> - -

- - debug) { ?> - -

- -

- \ No newline at end of file +

+ + getMessage()); + + ?> + +

+ +debug) { ?> + +

+ +

+ \ No newline at end of file diff --git a/views/failsafe/messages/list.php b/views/failsafe/messages/list.php index dd02fdac5..2410103da 100644 --- a/views/failsafe/messages/list.php +++ b/views/failsafe/messages/list.php @@ -1,25 +1,18 @@ 0) { - - foreach($vars['object'] as $register => $list ) { - echo elgg_view("messages/{$register}/list", array('object' => $list)); - } - - } - -?> \ No newline at end of file +if (!empty($vars['object']) && is_array($vars['object']) && sizeof($vars['object']) > 0) { + foreach($vars['object'] as $register => $list ) { + echo elgg_view("messages/{$register}/list", array('object' => $list)); + } +} \ No newline at end of file diff --git a/views/failsafe/messages/messages/list.php b/views/failsafe/messages/messages/list.php index 2cb94b4e1..ed169c692 100644 --- a/views/failsafe/messages/messages/list.php +++ b/views/failsafe/messages/messages/list.php @@ -1,51 +1,43 @@
$message)); - } - + foreach($vars['object'] as $message) { + echo elgg_view('messages/messages/message',array('object' => $message)); + } ?>
- - \ No newline at end of file +} \ No newline at end of file diff --git a/views/failsafe/messages/messages/message.php b/views/failsafe/messages/messages/message.php index c63c27498..6bc24d730 100644 --- a/views/failsafe/messages/messages/message.php +++ b/views/failsafe/messages/messages/message.php @@ -1,20 +1,17 @@ -

- -

\ No newline at end of file +

+ +

\ No newline at end of file diff --git a/views/failsafe/messages/sanitisation/htaccess.php b/views/failsafe/messages/sanitisation/htaccess.php index b8800c9be..e0eddacef 100644 --- a/views/failsafe/messages/sanitisation/htaccess.php +++ b/views/failsafe/messages/sanitisation/htaccess.php @@ -1,17 +1,14 @@ \ No newline at end of file diff --git a/views/failsafe/messages/sanitisation/settings.php b/views/failsafe/messages/sanitisation/settings.php index ac17d16cd..cf3ee719d 100644 --- a/views/failsafe/messages/sanitisation/settings.php +++ b/views/failsafe/messages/sanitisation/settings.php @@ -1,28 +1,23 @@

@@ -34,8 +29,9 @@ - +
- \ No newline at end of file + <?php echo $vars['title']; ?> - + - - - + + +

- + $vars['sysmessages'])); ?> - +

diff --git a/views/failsafe/settings/install.php b/views/failsafe/settings/install.php index 2bf632c6a..6fccfb06f 100644 --- a/views/failsafe/settings/install.php +++ b/views/failsafe/settings/install.php @@ -1,19 +1,14 @@ " . autop(elgg_echo("installation:settings:description")) . "

"; - - echo elgg_view("settings/system",array("action" => "action/systemsettings/install")); - -?> \ No newline at end of file +/** + * Elgg system settings on initial installation + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + */ + +echo "

" . autop(elgg_echo("installation:settings:description")) . "

"; + +echo elgg_view("settings/system",array("action" => "action/systemsettings/install")); \ No newline at end of file diff --git a/views/failsafe/settings/system.php b/views/failsafe/settings/system.php index 2f7a85031..aa06dd44c 100644 --- a/views/failsafe/settings/system.php +++ b/views/failsafe/settings/system.php @@ -1,66 +1,67 @@ "; + $form_body .= elgg_echo('installation:' . $field) . "
"; + $warning = elgg_echo('installation:warning:' . $field); + if ($warning != 'installation:warning:' . $field) { + echo "" . $warning . "
"; + } + $value = $vars['config']->$field; + if ($field == 'view') { + $value = 'default'; + } + $form_body .= elgg_view("input/text",array('internalname' => $field, 'value' => $value)); + $form_body .= "

"; +} - * @link http://elgg.org/ - * - * @uses $vars['action'] If set, the place to forward the form to (usually action/systemsettings/save) - */ +$languages = get_installed_translations(); +$form_body .= "

" . elgg_echo('installation:language') . elgg_view("input/pulldown", array('internalname' => 'language', 'value' => $vars['config']->language, 'options_values' => $languages)) . "

"; - // Set action appropriately - if (!isset($vars['action'])) { - $action = $vars['url'] . "action/systemsettings/save"; - } else { - $action = $vars['action']; - } - - $form_body = ""; - foreach(array('sitename','sitedescription', 'siteemail', 'wwwroot','path','dataroot', 'view') as $field) { - $form_body .= "

"; - $form_body .= elgg_echo('installation:' . $field) . "
"; - $warning = elgg_echo('installation:warning:' . $field); - if ($warning != 'installation:warning:' . $field) echo "" . $warning . "
"; - $value = $vars['config']->$field; - if ($field == 'view') $value = 'default'; - $form_body .= elgg_view("input/text",array('internalname' => $field, 'value' => $value)); - $form_body .= "

"; - } - - $languages = get_installed_translations(); - $form_body .= "

" . elgg_echo('installation:language') . elgg_view("input/pulldown", array('internalname' => 'language', 'value' => $vars['config']->language, 'options_values' => $languages)) . "

"; - - $form_body .= "

" . elgg_echo('installation:sitepermissions') . elgg_view('input/access', array('internalname' => 'default_access','value' => ACCESS_LOGGED_IN)) . "

"; +$form_body .= "

" . elgg_echo('installation:sitepermissions') . elgg_view('input/access', array('internalname' => 'default_access','value' => ACCESS_LOGGED_IN)) . "

"; - $form_body .= "

" . elgg_echo('installation:debug') . "
" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:debug:label')), 'internalname' => 'debug', 'value' => ($vars['config']->debug ? elgg_echo('installation:debug:label') : "") )) . "

"; - - $form_body .= "

" . elgg_echo('installation:httpslogin') . "
" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:httpslogin:label')), 'internalname' => 'https_login', 'value' => ($vars['config']->https_login ? elgg_echo('installation:httpslogin:label') : "") )) . "

"; - - $form_body .= "

" . elgg_echo('installation:disableapi') . "
"; - $on = elgg_echo('installation:disableapi:label'); - if ((isset($CONFIG->disable_api)) && ($CONFIG->disable_api == true)) - $on = ($vars['config']->disable_api ? "" : elgg_echo('installation:disableapi:label')); - $form_body .= elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:disableapi:label')), 'internalname' => 'api', 'value' => $on )); - $form_body .= "

"; - - $form_body .= "

" . elgg_echo('installation:usage') . "
"; - $on = elgg_echo('installation:usage:label'); +$form_body .= "

" . elgg_echo('installation:debug') . "
" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:debug:label')), 'internalname' => 'debug', 'value' => ($vars['config']->debug ? elgg_echo('installation:debug:label') : "") )) . "

"; - if (isset($CONFIG->ping_home)) - $on = ($vars['config']->ping_home!='disabled' ? elgg_echo('installation:usage:label') : ""); - $form_body .= elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:usage:label')), 'internalname' => 'usage', 'value' => $on )); - $form_body .= "

"; - - $form_body .= elgg_view('input/hidden', array('internalname' => 'settings', 'value' => 'go')); - - $form_body .= elgg_view('input/submit', array('value' => elgg_echo("save"))); - - echo elgg_view('input/form', array('action' => $action, 'body' => $form_body)); - -?> \ No newline at end of file +$form_body .= "

" . elgg_echo('installation:httpslogin') . "
" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:httpslogin:label')), 'internalname' => 'https_login', 'value' => ($vars['config']->https_login ? elgg_echo('installation:httpslogin:label') : "") )) . "

"; + +$form_body .= "

" . elgg_echo('installation:disableapi') . "
"; +$on = elgg_echo('installation:disableapi:label'); +if ((isset($CONFIG->disable_api)) && ($CONFIG->disable_api == true)) { + $on = ($vars['config']->disable_api ? "" : elgg_echo('installation:disableapi:label')); +} +$form_body .= elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:disableapi:label')), 'internalname' => 'api', 'value' => $on )); +$form_body .= "

"; + +$form_body .= "

" . elgg_echo('installation:usage') . "
"; +$on = elgg_echo('installation:usage:label'); + +if (isset($CONFIG->ping_home)) { + $on = ($vars['config']->ping_home!='disabled' ? elgg_echo('installation:usage:label') : ""); +} +$form_body .= elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:usage:label')), 'internalname' => 'usage', 'value' => $on )); +$form_body .= "

"; + +$form_body .= elgg_view('input/hidden', array('internalname' => 'settings', 'value' => 'go')); + +$form_body .= elgg_view('input/submit', array('value' => elgg_echo("save"))); + +echo elgg_view('input/form', array('action' => $action, 'body' => $form_body)); \ No newline at end of file -- cgit v1.2.3