From 5041c6c48153453ed597206d08eeff37cf20e676 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 15 Mar 2014 14:46:48 -0300 Subject: Squashed 'mod/cool_theme/' content from commit a26f7df git-subtree-dir: mod/cool_theme git-subtree-split: a26f7df43a266f7d1ff04847da330d15f6041e9b --- views/default/input/access.php | 38 ++++ views/default/input/autocomplete.php | 49 ++++++ views/default/input/button.php | 40 +++++ views/default/input/calendar.php | 6 + views/default/input/captcha.php | 8 + views/default/input/checkbox.php | 39 +++++ views/default/input/checkboxes.php | 90 ++++++++++ views/default/input/date.php | 56 ++++++ views/default/input/datepicker.php | 6 + views/default/input/dropdown.php | 71 ++++++++ views/default/input/email.php | 26 +++ views/default/input/file.php | 31 ++++ views/default/input/form.php | 44 +++++ views/default/input/friendspicker.php | 319 ++++++++++++++++++++++++++++++++++ views/default/input/hidden.php | 12 ++ views/default/input/location.php | 27 +++ views/default/input/longtext.php | 40 +++++ views/default/input/password.php | 28 +++ views/default/input/plaintext.php | 35 ++++ views/default/input/pulldown.php | 9 + views/default/input/radio.php | 76 ++++++++ views/default/input/reset.php | 14 ++ views/default/input/securitytoken.php | 15 ++ views/default/input/submit.php | 14 ++ views/default/input/tag.php | 25 +++ views/default/input/tags.php | 45 +++++ views/default/input/text.php | 27 +++ views/default/input/url.php | 27 +++ views/default/input/urlshortener.php | 8 + views/default/input/userpicker.php | 73 ++++++++ 30 files changed, 1298 insertions(+) create mode 100644 views/default/input/access.php create mode 100644 views/default/input/autocomplete.php create mode 100644 views/default/input/button.php create mode 100644 views/default/input/calendar.php create mode 100644 views/default/input/captcha.php create mode 100644 views/default/input/checkbox.php create mode 100644 views/default/input/checkboxes.php create mode 100644 views/default/input/date.php create mode 100644 views/default/input/datepicker.php create mode 100644 views/default/input/dropdown.php create mode 100644 views/default/input/email.php create mode 100644 views/default/input/file.php create mode 100644 views/default/input/form.php create mode 100644 views/default/input/friendspicker.php create mode 100644 views/default/input/hidden.php create mode 100644 views/default/input/location.php create mode 100644 views/default/input/longtext.php create mode 100644 views/default/input/password.php create mode 100644 views/default/input/plaintext.php create mode 100644 views/default/input/pulldown.php create mode 100644 views/default/input/radio.php create mode 100644 views/default/input/reset.php create mode 100644 views/default/input/securitytoken.php create mode 100644 views/default/input/submit.php create mode 100644 views/default/input/tag.php create mode 100644 views/default/input/tags.php create mode 100644 views/default/input/text.php create mode 100644 views/default/input/url.php create mode 100644 views/default/input/urlshortener.php create mode 100644 views/default/input/userpicker.php (limited to 'views/default/input') diff --git a/views/default/input/access.php b/views/default/input/access.php new file mode 100644 index 000000000..137eea288 --- /dev/null +++ b/views/default/input/access.php @@ -0,0 +1,38 @@ + label pairs (overrides default) + * @uses $vars['name'] The name of the input field + * @uses $vars['entity'] Optional. The entity for this access control (uses access_id) + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-access {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-access"; +} + +$defaults = array( + 'disabled' => false, + 'value' => get_default_access(), + 'options_values' => get_write_access_array(), +); + +if (isset($vars['entity'])) { + $defaults['value'] = $vars['entity']->access_id; + unset($vars['entity']); +} + +$vars = array_merge($defaults, $vars); + +if ($vars['value'] == ACCESS_DEFAULT) { + $vars['value'] = get_default_access(); +} + +if (is_array($vars['options_values']) && sizeof($vars['options_values']) > 0) { + echo elgg_view('input/dropdown', $vars); +} diff --git a/views/default/input/autocomplete.php b/views/default/input/autocomplete.php new file mode 100644 index 000000000..e58eb1ae8 --- /dev/null +++ b/views/default/input/autocomplete.php @@ -0,0 +1,49 @@ + '', + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +$params = array(); +if (isset($vars['match_on'])) { + $params['match_on'] = $vars['match_on']; + unset($vars['match_on']); +} +if (isset($vars['match_owner'])) { + $params['match_owner'] = $vars['match_owner']; + unset($vars['match_owner']); +} +$ac_url_params = http_build_query($params); + +elgg_load_js('elgg.autocomplete'); +elgg_load_js('jquery.ui.autocomplete.html'); + +?> + + + /> diff --git a/views/default/input/button.php b/views/default/input/button.php new file mode 100644 index 000000000..9957fdc54 --- /dev/null +++ b/views/default/input/button.php @@ -0,0 +1,40 @@ + 'button', +); + +$vars = array_merge($defaults, $vars); + +switch ($vars['type']) { + case 'button': + case 'reset': + case 'submit': + case 'image': + break; + default: + $vars['type'] = 'button'; + break; +} + +// blank src if trying to access an offsite image. @todo why? +if (isset($vars['src']) && strpos($vars['src'], elgg_get_site_url()) === false) { + $vars['src'] = ""; +} +?> + /> diff --git a/views/default/input/calendar.php b/views/default/input/calendar.php new file mode 100644 index 000000000..52c84ff82 --- /dev/null +++ b/views/default/input/calendar.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/views/default/input/checkbox.php b/views/default/input/checkbox.php new file mode 100644 index 000000000..3dc75c6c3 --- /dev/null +++ b/views/default/input/checkbox.php @@ -0,0 +1,39 @@ + 0, + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +$default = $vars['default']; +unset($vars['default']); + +if (isset($vars['name']) && $default !== false) { + echo ""; +} + +?> + /> diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php new file mode 100644 index 000000000..db4b06949 --- /dev/null +++ b/views/default/input/checkboxes.php @@ -0,0 +1,90 @@ + option for the each checkbox field + * @uses string $vars['default'] The default value to send if nothing is checked. + * Optional, defaults to 0. Set to FALSE for no default. + * @uses bool $vars['disabled'] Make all input elements disabled. Optional. + * @uses string $vars['value'] The current value. Single value or array. Optional. + * @uses string $vars['class'] Additional class of the list. Optional. + * @uses string $vars['align'] 'horizontal' or 'vertical' Default: 'vertical' + * + */ + +$defaults = array( + 'align' => 'vertical', + 'value' => array(), + 'default' => 0, + 'disabled' => false, + 'options' => array(), + 'name' => '', +); + +$vars = array_merge($defaults, $vars); + +$class = "elgg-input-checkboxes elgg-{$vars['align']}"; +if (isset($vars['class'])) { + $class .= " {$vars['class']}"; + unset($vars['class']); +} + +$id = ''; +if (isset($vars['id'])) { + $id = "id=\"{$vars['id']}\""; + unset($vars['id']); +} + +if (is_array($vars['value'])) { + $values = array_map('elgg_strtolower', $vars['value']); +} else { + $values = array(elgg_strtolower($vars['value'])); +} + +$input_vars = $vars; +$input_vars['default'] = false; +if ($vars['name']) { + $input_vars['name'] = "{$vars['name']}[]"; +} +unset($input_vars['align']); +unset($input_vars['options']); + +if (count($vars['options']) > 0) { + // include a default value so if nothing is checked 0 will be passed. + if ($vars['name'] && $vars['default'] !== false) { + echo ""; + } + + echo "'; +} diff --git a/views/default/input/date.php b/views/default/input/date.php new file mode 100644 index 000000000..828ce5520 --- /dev/null +++ b/views/default/input/date.php @@ -0,0 +1,56 @@ + '', + 'disabled' => false, + 'timestamp' => false, +); + +$vars = array_merge($defaults, $vars); + +$timestamp = $vars['timestamp']; +unset($vars['timestamp']); + +if ($timestamp) { + echo elgg_view('input/hidden', array( + 'name' => $vars['name'], + 'value' => $vars['value'], + )); + + $vars['class'] = "{$vars['class']} elgg-input-timestamp"; + $vars['id'] = $vars['name']; + unset($vars['name']); + unset($vars['internalname']); +} + +// convert timestamps to text for display +if (is_numeric($vars['value'])) { + $vars['value'] = gmdate('Y-m-d', $vars['value']); +} + +$attributes = elgg_format_attributes($vars); +echo ""; diff --git a/views/default/input/datepicker.php b/views/default/input/datepicker.php new file mode 100644 index 000000000..8955e6e53 --- /dev/null +++ b/views/default/input/datepicker.php @@ -0,0 +1,6 @@ + "option" + * where "value" is the name and "option" is + * the value displayed on the button. Replaces + * $vars['options'] when defined. + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-dropdown {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-dropdown"; +} + +$defaults = array( + 'disabled' => false, + 'value' => '', + 'options_values' => array(), + 'options' => array(), +); + +$vars = array_merge($defaults, $vars); + +$options_values = $vars['options_values']; +unset($vars['options_values']); + +$options = $vars['options']; +unset($vars['options']); + +$value = $vars['value']; +unset($vars['value']); + +?> + diff --git a/views/default/input/email.php b/views/default/input/email.php new file mode 100644 index 000000000..190fb88c6 --- /dev/null +++ b/views/default/input/email.php @@ -0,0 +1,26 @@ + false, +); + +$vars = array_merge($defaults, $vars); + +?> + + /> \ No newline at end of file diff --git a/views/default/input/file.php b/views/default/input/file.php new file mode 100644 index 000000000..452fe72b9 --- /dev/null +++ b/views/default/input/file.php @@ -0,0 +1,31 @@ +"; +} + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-file {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-file"; +} + +$defaults = array( + 'disabled' => false, + 'size' => 30, +); + +$attrs = array_merge($defaults, $vars); + +?> + /> diff --git a/views/default/input/form.php b/views/default/input/form.php new file mode 100644 index 000000000..df30133b3 --- /dev/null +++ b/views/default/input/form.php @@ -0,0 +1,44 @@ + "post", + 'disable_security' => FALSE, +); + +$vars = array_merge($defaults, $vars); + +if (isset($vars['class'])) { + $vars['class'] = "elgg-form {$vars['class']}"; +} else { + $vars['class'] = 'elgg-form'; +} + +$vars['action'] = elgg_normalize_url($vars['action']); +$vars['method'] = strtolower($vars['method']); + +$body = $vars['body']; +unset($vars['body']); + +// Generate a security header +if (!$vars['disable_security']) { + $body = elgg_view('input/securitytoken') . $body; +} +unset($vars['disable_security']); + +$attributes = elgg_format_attributes($vars); + +echo "
$body
"; diff --git a/views/default/input/friendspicker.php b/views/default/input/friendspicker.php new file mode 100644 index 000000000..40708c890 --- /dev/null +++ b/views/default/input/friendspicker.php @@ -0,0 +1,319 @@ +name, 0, 1)); + + if (!elgg_substr_count($chararray, $letter)) { + $letter = "*"; + } + if (!isset($users[$letter])) { + $users[$letter] = array(); + } + $users[$letter][$user->guid] = $user; + } +} + +// sort users in letters alphabetically +foreach ($users as $letter => $letter_users) { + usort($letter_users, create_function('$a, $b', ' + return strcasecmp($a->name, $b->name); + ')); + $users[$letter] = $letter_users; +} + +if (!$callback) { + ?> + +
+ + + +
+ + + + + + +
+ + 'collection_id', + 'value' => $vars['collection_id'], + )); + } +?> + +
+
+
+ +
+
+

+ "; + $col = 0; + + foreach($users[$letter] as $friend) { + if ($col == 0) { + echo ""; + } + + //echo "

" . $user->name . "

"; + $label = elgg_view_entity_icon($friend, 'tiny', array('use_hover' => false)); + $options[$label] = $friend->getGUID(); + + if ($vars['highlight'] == 'all' && !in_array($letter,$activeletters)) { + $activeletters[] = $letter; + } + + + if (in_array($friend->getGUID(),$vars['value'])) { + $checked = "checked = \"checked\""; + if (!in_array($letter,$activeletters) && $vars['highlight'] == 'default') { + $activeletters[] = $letter; + } + } else { + $checked = ""; + } + ?> + + + + name="[]" value="" /> + + + + + +
+ +
+ + + name; ?> + + "; + $col = 0; + } + } + if ($col < 3) { + echo ""; + } + + echo ""; + } + +?> + +
+
+ +
+ + +
+
+ + +
+ + + + +
+
+ + + +
+
+ + + + + + + + + /> \ No newline at end of file diff --git a/views/default/input/location.php b/views/default/input/location.php new file mode 100644 index 000000000..4cf05c72a --- /dev/null +++ b/views/default/input/location.php @@ -0,0 +1,27 @@ + false, +); + +if (isset($vars['entity'])) { + $defaults['value'] = $vars['entity']->location; + unset($vars['entity']); +} + +$vars = array_merge($defaults, $vars); + +echo elgg_view('input/tag', $vars); diff --git a/views/default/input/longtext.php b/views/default/input/longtext.php new file mode 100644 index 000000000..2b1462635 --- /dev/null +++ b/views/default/input/longtext.php @@ -0,0 +1,40 @@ + '', + 'id' => 'elgg-input-' . rand(), //@todo make this more robust +); + +$vars = array_merge($defaults, $vars); + +$value = $vars['value']; +unset($vars['value']); + +echo elgg_view_menu('longtext', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + 'id' => $vars['id'], +)); + +?> + + diff --git a/views/default/input/password.php b/views/default/input/password.php new file mode 100644 index 000000000..45f2b20a6 --- /dev/null +++ b/views/default/input/password.php @@ -0,0 +1,28 @@ + false, + 'value' => '', +); + +$attrs = array_merge($defaults, $vars); +?> + + /> diff --git a/views/default/input/plaintext.php b/views/default/input/plaintext.php new file mode 100644 index 000000000..cd0aaafcf --- /dev/null +++ b/views/default/input/plaintext.php @@ -0,0 +1,35 @@ + '', + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +$value = $vars['value']; +unset($vars['value']); + +?> + + diff --git a/views/default/input/pulldown.php b/views/default/input/pulldown.php new file mode 100644 index 000000000..705329691 --- /dev/null +++ b/views/default/input/pulldown.php @@ -0,0 +1,9 @@ + option + * @uses $vars['class'] Additional class of the list. Optional. + * @uses $vars['align'] 'horizontal' or 'vertical' Default: 'vertical' + */ + +$defaults = array( + 'align' => 'vertical', + 'value' => array(), + 'disabled' => false, + 'options' => array(), + 'name' => '', +); + +$vars = array_merge($defaults, $vars); + +$id = ''; +if (isset($vars['id'])) { + $id = "id=\"{$vars['id']}\""; + unset($vars['id']); +} + +$class = "elgg-input-radios elgg-{$vars['align']}"; +if (isset($vars['class'])) { + $class .= " {$vars['class']}"; + unset($vars['class']); +} +unset($vars['align']); +$vars['class'] = 'elgg-input-radio'; + +if (is_array($vars['value'])) { + $vars['value'] = array_map('elgg_strtolower', $vars['value']); +} else { + $vars['value'] = array(elgg_strtolower($vars['value'])); +} + +$options = $vars['options']; +unset($vars['options']); + +$value = $vars['value']; +unset($vars['value']); + +if ($options && count($options) > 0) { + echo "'; +} diff --git a/views/default/input/reset.php b/views/default/input/reset.php new file mode 100644 index 000000000..082da8669 --- /dev/null +++ b/views/default/input/reset.php @@ -0,0 +1,14 @@ + '__elgg_token', 'value' => $token)); +echo elgg_view('input/hidden', array('name' => '__elgg_ts', 'value' => $ts)); diff --git a/views/default/input/submit.php b/views/default/input/submit.php new file mode 100644 index 000000000..df369b3b4 --- /dev/null +++ b/views/default/input/submit.php @@ -0,0 +1,14 @@ + '', + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); +?> + + /> \ No newline at end of file diff --git a/views/default/input/tags.php b/views/default/input/tags.php new file mode 100644 index 000000000..261cf9f97 --- /dev/null +++ b/views/default/input/tags.php @@ -0,0 +1,45 @@ +tags) + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-tags {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-tags"; +} + +$defaults = array( + 'value' => '', + 'disabled' => false, +); + +if (isset($vars['entity'])) { + $defaults['value'] = $vars['entity']->tags; + unset($vars['entity']); +} + +$vars = array_merge($defaults, $vars); + +if (is_array($vars['value'])) { + $tags = array(); + + foreach ($vars['value'] as $tag) { + if (is_string($tag)) { + $tags[] = $tag; + } else { + $tags[] = $tag->value; + } + } + + $vars['value'] = implode(", ", $tags); +} + +?> + /> \ No newline at end of file diff --git a/views/default/input/text.php b/views/default/input/text.php new file mode 100644 index 000000000..707a50179 --- /dev/null +++ b/views/default/input/text.php @@ -0,0 +1,27 @@ + '', + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +?> + + /> \ No newline at end of file diff --git a/views/default/input/url.php b/views/default/input/url.php new file mode 100644 index 000000000..e97a316d8 --- /dev/null +++ b/views/default/input/url.php @@ -0,0 +1,27 @@ + '', + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +?> + + /> diff --git a/views/default/input/urlshortener.php b/views/default/input/urlshortener.php new file mode 100644 index 000000000..ecfb02efa --- /dev/null +++ b/views/default/input/urlshortener.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php new file mode 100644 index 000000000..91a397e37 --- /dev/null +++ b/views/default/input/userpicker.php @@ -0,0 +1,73 @@ + false)); + + // this html must be synced with the userpicker.js library + $code = '
  • '; + $code .= "
    $icon
    "; + $code .= ""; + $code .= "
    " . $user->name . "
    "; + $code .= "
    "; + $code .= ""; + $code .= '
  • '; + + return $code; +} + +// loop over all values and prepare them so that "in" will work in javascript +$values = array(); +if (!is_array($vars['value'])) { + $vars['value'] = array($vars['value']); +} +foreach ($vars['value'] as $value) { + $values[$value] = TRUE; +} + +// convert the values to a json-encoded list +$json_values = json_encode($values); + +// create an HTML list of users +$user_list = ''; +foreach ($vars['value'] as $user_id) { + $user_list .= user_picker_add_user($user_id); +} + +?> +
    + + + + +
    + \ No newline at end of file -- cgit v1.2.3