From 9ff9d71952db26c06fe2eb1bf98b53340242e524 Mon Sep 17 00:00:00 2001 From: Evan Winslow Date: Thu, 21 Oct 2010 17:46:39 +0000 Subject: Removed html/tag view -- all we really needed was a function to form an attribute string from an array. This is now being used in each input view and there is not so much view nesting going on... --- views/default/html/form.php | 11 ------ views/default/html/img.php | 8 ++--- views/default/html/input.php | 12 ------- views/default/html/option.php | 1 - views/default/html/tag.php | 64 ---------------------------------- views/default/html/textarea.php | 16 --------- views/default/input/button.php | 10 +----- views/default/input/checkbox.php | 10 +----- views/default/input/checkboxes.php | 35 ++++++++----------- views/default/input/color.php | 12 +------ views/default/input/date.php | 12 ++----- views/default/input/datetime-local.php | 12 ++----- views/default/input/datetime.php | 12 ++----- views/default/input/default.php | 19 ---------- views/default/input/email.php | 13 +------ views/default/input/file.php | 12 +------ views/default/input/form.php | 19 ++++++---- views/default/input/hidden.php | 12 +------ views/default/input/image.php | 12 +------ views/default/input/longtext.php | 7 +++- views/default/input/month.php | 11 ++---- views/default/input/number.php | 12 +------ views/default/input/option.php | 22 ++++-------- views/default/input/password.php | 12 +------ views/default/input/plaintext.php | 20 +++++++++-- views/default/input/pulldown.php | 53 +++++++++++++--------------- views/default/input/range.php | 7 ++-- views/default/input/reset.php | 7 ++-- views/default/input/search.php | 7 ++-- views/default/input/submit.php | 9 ++--- views/default/input/tags.php | 6 ---- views/default/input/tel.php | 8 ++--- views/default/input/text.php | 7 ++-- views/default/input/time.php | 7 ++-- views/default/input/url.php | 9 ++--- views/default/input/week.php | 7 ++-- 36 files changed, 131 insertions(+), 382 deletions(-) delete mode 100644 views/default/html/form.php delete mode 100644 views/default/html/input.php delete mode 100644 views/default/html/option.php delete mode 100644 views/default/html/tag.php delete mode 100644 views/default/html/textarea.php delete mode 100644 views/default/input/default.php (limited to 'views') diff --git a/views/default/html/form.php b/views/default/html/form.php deleted file mode 100644 index b93c62051..000000000 --- a/views/default/html/form.php +++ /dev/null @@ -1,11 +0,0 @@ - 'POST', - 'body' => '', -); - -$overrides = array( - 'tag' => 'form', -); - -echo elgg_view('html/tag', array_merge($defaults, $vars, $overrides)); \ No newline at end of file diff --git a/views/default/html/img.php b/views/default/html/img.php index 3560e066e..734e59a55 100644 --- a/views/default/html/img.php +++ b/views/default/html/img.php @@ -3,11 +3,9 @@ $defaults = array( 'alt' => '', 'title' => '', + 'border' => 0, ); -$overrides = array( - 'tag' => 'img', - 'body' => NULL, -); +$attributes = html5_get_html_attributes(array_merge($defaults, $vars)); -echo elgg_view('html/tag', array_merge($defaults, $vars, $overrides)); \ No newline at end of file +echo ""; \ No newline at end of file diff --git a/views/default/html/input.php b/views/default/html/input.php deleted file mode 100644 index 7350ae308..000000000 --- a/views/default/html/input.php +++ /dev/null @@ -1,12 +0,0 @@ - 'text', -); - -$overrides = array( - 'tag' => 'input', -); - -$args = array_merge($defaults, $vars, $overrides); - -echo elgg_view('html/tag', $args); \ No newline at end of file diff --git a/views/default/html/option.php b/views/default/html/option.php deleted file mode 100644 index b3d9bbc7f..000000000 --- a/views/default/html/option.php +++ /dev/null @@ -1 +0,0 @@ -$value) { - unset($vars[$key]); -} - -// backwards compatibility code -if (isset($vars['internalname'])) { - //@todo put deprecated notice - $vars['name'] = $vars['internalname']; - unset($vars['internalname']); -} - -if (isset($vars['internalid'])) { - //@todo put deprecated notice - $vars['id'] = $vars['internalid']; - unset($vars['internalid']); -} - -$js = ''; -if (isset($vars['js'])) { - //@todo put deprecated notice - $js = $vars['js']; - unset($vars['js']); -} - -$tag = $vars['tag']; -unset($vars['tag']); - -$body = $vars['body']; -unset($vars['body']); - -//Build the input -$element = array(); - -$element[] = "<$tag"; -foreach ($vars as $attr => $val) { - if ($val === TRUE) { - $element[] = $attr; - } elseif (!empty($val)) { - $val = htmlspecialchars($val); - $element[] = "$attr=\"$val\""; - } -} - -if (!empty($js)) { - $element[] = $js; -} - -if (!isset($body)) { - $element[] = '/'; -} - -echo implode(" ", $element).">"; - -if (isset($body)) { - echo "$body"; -} \ No newline at end of file diff --git a/views/default/html/textarea.php b/views/default/html/textarea.php deleted file mode 100644 index 0c3813246..000000000 --- a/views/default/html/textarea.php +++ /dev/null @@ -1,16 +0,0 @@ - '', - 'class' => 'input-textarea', -); - -$overrides = array( - 'tag' => 'textarea', -); - -if (isset($vars['value'])) { - $vars['body'] = $vars['value']; - unset($vars['value']); -} - -echo elgg_view('html/tag', array_merge($defaults, $vars, $overrides)); \ No newline at end of file diff --git a/views/default/input/button.php b/views/default/input/button.php index bda1d7bb3..ddf432562 100644 --- a/views/default/input/button.php +++ b/views/default/input/button.php @@ -1,9 +1 @@ - 'button', -); - -$args = array_merge($vars, $overrides); - -echo elgg_view('html/input', $args); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/checkbox.php b/views/default/input/checkbox.php index c9a2c6498..5ba04a8cd 100644 --- a/views/default/input/checkbox.php +++ b/views/default/input/checkbox.php @@ -1,9 +1 @@ - 'checkbox', -); - -$args = array_merge($vars, $overrides); - -echo elgg_view('html/input', $args); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php index 816d65680..1e13b0687 100644 --- a/views/default/input/checkboxes.php +++ b/views/default/input/checkboxes.php @@ -25,32 +25,27 @@ $defaults = array( 'class' => 'input-checkboxes', - 'default' => 0, 'disabled' => FALSE, ); -$args = array_merge($defaults, $vars); +$vars = array_merge($defaults, $vars); -$value_array = (is_array($args['value'])) ? array_map('strtolower', $args['value']) : array(strtolower($args['value'])); +$value = $vars['value']; +unset($vars['value']); -$options = $args['options']; +$value_array = (is_array($value)) ? array_map('strtolower', $value) : array(strtolower($value)); + +$options = $vars['options']; +unset($vars['options']); if ($options) { - // include a default value so if nothing is checked 0 will be passed. - if ($args['internalname']) { - echo elgg_view('input/hidden', array('internalname' => $args['internalname'], 'value' => $args['default'])); - } - - foreach($options as $option => $label) { - $opts = array( - 'value' => $option, - 'checked' => in_array(strtolower($option), $value_array), - 'class' => $args['class'], - 'disabled' => $args['disabled'], - 'js' => $args['js'], - 'internalname' => $args['internalname'].'[]', - ); - - echo "
"; + foreach($options as $value => $label) { + echo "
"; } } \ No newline at end of file diff --git a/views/default/input/color.php b/views/default/input/color.php index 07a364b50..76dd50603 100644 --- a/views/default/input/color.php +++ b/views/default/input/color.php @@ -1,11 +1 @@ - elgg_echo('placeholder:color'), -); - -$overrides = array( - 'type' => 'color', -); - -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/date.php b/views/default/input/date.php index 62014cb92..c408ea3a7 100644 --- a/views/default/input/date.php +++ b/views/default/input/date.php @@ -1,14 +1,6 @@ elgg_echo('placeholder:date'), //'yyyy-mm-dd', -); - -$overrides = array( - 'type' => 'date', -); - if (isset($vars['value']) && is_int($vars['value'])) { $vars['value'] = date("Y-m-d", $vars['value']); } - -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file +?> + /> diff --git a/views/default/input/datetime-local.php b/views/default/input/datetime-local.php index c9f0b32f9..e0ab4b171 100644 --- a/views/default/input/datetime-local.php +++ b/views/default/input/datetime-local.php @@ -1,14 +1,6 @@ elgg_echo('placeholder:datetime-local'), //'yyyy-mm-ddThh:mm:ss', -); - -$overrides = array( - 'type' => 'datetime-local', -); - if (isset($vars['value']) && is_int($vars['value'])) { $vars['value'] = date("Y-m-d\TH:i:s", $vars['value']); } - -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file +?> + /> \ No newline at end of file diff --git a/views/default/input/datetime.php b/views/default/input/datetime.php index 7eecb62e8..eaa32634e 100644 --- a/views/default/input/datetime.php +++ b/views/default/input/datetime.php @@ -1,14 +1,6 @@ elgg_echo('placeholder:datetime'), //'yyyy-mm-ddThh:mm:ss+hh:mm', -); - -$overrides = array( - 'type' => 'datetime', -); - if (isset($vars['value']) && is_int($vars['value'])) { $vars['value'] = date("c", $vars['value']); } - -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file +?> + /> diff --git a/views/default/input/default.php b/views/default/input/default.php deleted file mode 100644 index cf9f64097..000000000 --- a/views/default/input/default.php +++ /dev/null @@ -1,19 +0,0 @@ - elgg_echo('placeholder:email'), -); - -$overrides = array( - 'type' => 'email', -); - -$args = array_merge($defaults, $vars, $overrides); - -echo elgg_view('html/input', $args); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/file.php b/views/default/input/file.php index ef7223a80..9df286890 100644 --- a/views/default/input/file.php +++ b/views/default/input/file.php @@ -1,11 +1 @@ - 'file', -); - -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/form.php b/views/default/input/form.php index c30dd5c9a..565db3afe 100644 --- a/views/default/input/form.php +++ b/views/default/input/form.php @@ -10,17 +10,24 @@ * @link http://elgg.org/ * * @uses $vars['body'] The body of the form (made up of other input/xxx views and html - * @uses $vars['method'] Method (default POST) - * @uses $vars['enctype'] How the form is encoded, default blank - * @uses $vars['action'] URL of the action being called * @uses $vars['disable_security'] Force the securitytokens not to be added to this form (@todo what's the point??) * */ +$defaults = array( + 'body' => '', + 'method' => 'POST', +); + +$vars = array_merge($defaults, $vars); if ($vars['disable_security'] != TRUE) { - $vars['body'] .= elgg_view('input/securitytoken'); + $body .= elgg_view('input/securitytoken'); } - unset($vars['disable_security']); -echo elgg_view('html/form', $vars); +$body = $vars['body']; +unset($vars['body']); + +$attributes = html5_get_html_attributes($vars); + +echo "
$body
"; diff --git a/views/default/input/hidden.php b/views/default/input/hidden.php index da1e9bd00..944382616 100644 --- a/views/default/input/hidden.php +++ b/views/default/input/hidden.php @@ -1,11 +1 @@ - 'hidden', -); - -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/image.php b/views/default/input/image.php index f1b07cb8e..ae65d86ca 100644 --- a/views/default/input/image.php +++ b/views/default/input/image.php @@ -1,11 +1 @@ - 'image', -); - -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/longtext.php b/views/default/input/longtext.php index 6366f8a3d..1020ef640 100644 --- a/views/default/input/longtext.php +++ b/views/default/input/longtext.php @@ -18,4 +18,9 @@ $defaults = array( 'class' => 'input-richtext', ); -echo elgg_view('html/textarea', array_merge($defaults, $vars)); \ No newline at end of file +$value = $vars['value']; +unset($vars['value']); + +$attributes = html5_get_html_attributes(array_merge($defaults, $vars)); + +echo ""; \ No newline at end of file diff --git a/views/default/input/month.php b/views/default/input/month.php index 071d40262..4bd320046 100644 --- a/views/default/input/month.php +++ b/views/default/input/month.php @@ -1,14 +1,7 @@ elgg_echo('placeholder:month'), -); - -$overrides = array( - 'type' => 'month', -); - if (isset($vars['value']) && is_int($vars['value'])) { $vars['value'] = date("Y-m", $vars['value']); } +?> -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/number.php b/views/default/input/number.php index fbd1bec72..ccfb72641 100644 --- a/views/default/input/number.php +++ b/views/default/input/number.php @@ -1,11 +1 @@ - 'number', -); - -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/option.php b/views/default/input/option.php index 2955f1cb9..f420c9be4 100644 --- a/views/default/input/option.php +++ b/views/default/input/option.php @@ -1,21 +1,13 @@ 'option', -); - -$args = array_merge($defaults, $vars, $overrides); - -if (!isset($args['body'])) { - $args['body'] = $args['value']; +if (!isset($text)) { + $text = $vars['value']; + unset($vars['value']); } -if (isset($args['body'])) { - $args['body'] = htmlentities($args['body'], ENT_QUOTES, 'UTF-8'); -} +$text = htmlentities($text, ENT_QUOTES, 'UTF-8'); +$attributes = html5_get_html_attributes($vars); -echo elgg_view('html/tag', $args); \ No newline at end of file +echo ""; \ No newline at end of file diff --git a/views/default/input/password.php b/views/default/input/password.php index 609b39faa..8c97cf020 100644 --- a/views/default/input/password.php +++ b/views/default/input/password.php @@ -1,11 +1 @@ - elgg_echo('placeholder:password'), -); - -$overrides = array( - 'type' => 'password', -); - -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/plaintext.php b/views/default/input/plaintext.php index 1d907dcfc..cd0a7d6b5 100644 --- a/views/default/input/plaintext.php +++ b/views/default/input/plaintext.php @@ -1,6 +1,22 @@ 'input-plaintext', +); + +$value = $vars['value']; +unset($vars['value']); + +$attributes = html5_get_html_attributes(array_merge($defaults, $vars)); + +echo ""; \ No newline at end of file diff --git a/views/default/input/pulldown.php b/views/default/input/pulldown.php index 49c126c77..8a30838d4 100644 --- a/views/default/input/pulldown.php +++ b/views/default/input/pulldown.php @@ -9,9 +9,6 @@ * @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. @@ -21,35 +18,35 @@ $defaults = array( 'class' => 'input-pulldown', ); -$overrides = array( - 'tag' => 'select', -); +$vars = array_merge($defaults, $vars); + +$options_values = $vars['options_values']; +unset($vars['options_values']); -$args = array_merge($defaults, $vars, $overrides); +$options = $vars['options']; +unset($options); -$body = ''; +$value = $vars['value']; +unset($vars['value']); +?> -if ($vars['options_values']) { - foreach($vars['options_values'] as $value => $option) { - $option_args = array( - 'value' => $value, - 'body' => $option, - 'selected' => ($value == $args['value']), - ); - - $body .= elgg_view('input/option', $option_args); + \ No newline at end of file diff --git a/views/default/input/range.php b/views/default/input/range.php index 8fedf067a..588b835d1 100644 --- a/views/default/input/range.php +++ b/views/default/input/range.php @@ -4,8 +4,7 @@ $defaults = array( ); -$overrides = array( - 'type' => 'range', -); +$vars = array_merge($defaults, $vars); +?> -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/reset.php b/views/default/input/reset.php index 911c6671b..b1c7c06ed 100644 --- a/views/default/input/reset.php +++ b/views/default/input/reset.php @@ -4,8 +4,7 @@ $defaults = array( 'value' => elgg_echo('reset'), ); -$overrides = array( - 'type' => 'reset', -); +$vars = array_merge($defaults, $vars); +?> -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/search.php b/views/default/input/search.php index 457c45999..47988be51 100644 --- a/views/default/input/search.php +++ b/views/default/input/search.php @@ -4,8 +4,7 @@ $defaults = array( 'placeholder' => elgg_echo('placeholder:search'), ); -$overrides = array( - 'type' => 'search', -); +$vars = array_merge($defaults, $vars); +?> -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/submit.php b/views/default/input/submit.php index a0cd1cfac..4c86f6c66 100644 --- a/views/default/input/submit.php +++ b/views/default/input/submit.php @@ -4,10 +4,7 @@ $defaults = array( 'value' => elgg_echo('submit'), ); -$overrides = array( - 'type' => 'submit', -); - -$args = array_merge($vars, $overrides); +$vars = array_merge($defaults, $vars); +?> -echo elgg_view('html/input', $args); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/tags.php b/views/default/input/tags.php index 952134db0..3f5e2481a 100644 --- a/views/default/input/tags.php +++ b/views/default/input/tags.php @@ -9,14 +9,8 @@ * @link http://elgg.org/ * * @uses $vars['value'] The current value, if any - string or array - tags will be encoded - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['internalid'] The id of the input field - * @uses $vars['class'] CSS class override - * @uses $vars['disabled'] Is the input field disabled? */ - $defaults = array( 'class' => 'input-tags', 'placeholder' => elgg_echo('placeholder:tags'), diff --git a/views/default/input/tel.php b/views/default/input/tel.php index 1bb146ce5..441e85bf0 100644 --- a/views/default/input/tel.php +++ b/views/default/input/tel.php @@ -1,11 +1,9 @@ elgg_echo('placeholder:tel'), ); -$overrides = array( - 'type' => 'tel', -); +$vars = array_merge($defaults, $vars); +?> -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/text.php b/views/default/input/text.php index 0993d1f2b..b84d3d16f 100644 --- a/views/default/input/text.php +++ b/views/default/input/text.php @@ -4,8 +4,7 @@ $defaults = array( 'placeholder' => elgg_echo('placeholder:text'), ); -$overrides = array( - 'type' => 'text', -); +$vars = array_merge($defaults, $vars); +?> -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/time.php b/views/default/input/time.php index 3d714ccc1..641dd5244 100644 --- a/views/default/input/time.php +++ b/views/default/input/time.php @@ -4,8 +4,7 @@ $defaults = array( 'placeholder' => elgg_echo('placeholder:time'), ); -$overrides = array( - 'type' => 'time', -); +$vars = array_merge($defaults, $vars); +?> -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/url.php b/views/default/input/url.php index 60d8820e7..a0851f4d9 100644 --- a/views/default/input/url.php +++ b/views/default/input/url.php @@ -4,10 +4,7 @@ $defaults = array( 'placeholder' => elgg_echo('placeholder:url'), ); -$overrides = array( - 'type' => 'url', -); - -$args = array_merge($vars, $overrides); +$vars = array_merge($defaults, $vars); +?> -echo elgg_view('html/input', $args); \ No newline at end of file + /> \ No newline at end of file diff --git a/views/default/input/week.php b/views/default/input/week.php index 294811aee..d921755a9 100644 --- a/views/default/input/week.php +++ b/views/default/input/week.php @@ -4,8 +4,7 @@ $defauts = array( 'placeholder' => elgg_echo('placeholder:week'), ); -$overrides = array( - 'type' => 'week', -); +$vars = array_merge($defaults, $vars); +?> -echo elgg_view('html/input', array_merge($defaults, $vars, $overrides)); \ No newline at end of file + /> \ No newline at end of file -- cgit v1.2.3