aboutsummaryrefslogtreecommitdiff
path: root/views/default/input
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/input')
-rw-r--r--views/default/input/access.php11
-rw-r--r--views/default/input/dropdown.php14
-rw-r--r--views/default/input/location.php21
-rw-r--r--views/default/input/tag.php17
-rw-r--r--views/default/input/tags.php11
-rw-r--r--views/default/input/userpicker.php12
6 files changed, 68 insertions, 18 deletions
diff --git a/views/default/input/access.php b/views/default/input/access.php
index 7fa2323bf..40a93aaa4 100644
--- a/views/default/input/access.php
+++ b/views/default/input/access.php
@@ -3,12 +3,10 @@
* Elgg access level input
* Displays a dropdown input field
*
- * @package Elgg
- * @subpackage Core
- *
* @uses $vars['value'] The current value, if any
* @uses $vars['options_values']
* @uses $vars['name'] The name of the input field
+ * @uses $vars['entity'] Optional. The entity for this access control (uses access_id)
*/
$defaults = array(
@@ -18,6 +16,11 @@ $defaults = array(
'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) {
@@ -26,4 +29,4 @@ if ($vars['value'] == ACCESS_DEFAULT) {
if (is_array($vars['options_values']) && sizeof($vars['options_values']) > 0) {
echo elgg_view('input/dropdown', $vars);
-} \ No newline at end of file
+}
diff --git a/views/default/input/dropdown.php b/views/default/input/dropdown.php
index 6fd97d3b5..fccccb888 100644
--- a/views/default/input/dropdown.php
+++ b/views/default/input/dropdown.php
@@ -3,7 +3,7 @@
* Elgg dropdown input
* Displays a dropdown (select) input field
*
- * NB: Default values of FALSE or NULL will match '' (empty string) and not 0.
+ * @warning Default values of FALSE or NULL will match '' (empty string) and not 0.
*
* @package Elgg
* @subpackage Core
@@ -47,13 +47,15 @@ if ($options_values) {
echo "<option $option_attrs>$option</option>";
}
} else {
- foreach ($options as $option) {
+ if (is_array($options)) {
+ foreach ($options as $option) {
- $option_attrs = elgg_format_attributes(array(
- 'selected' => (string)$option == (string)$value
- ));
+ $option_attrs = elgg_format_attributes(array(
+ 'selected' => (string)$option == (string)$value
+ ));
- echo "<option $option_attrs>$option</option>";
+ echo "<option $option_attrs>$option</option>";
+ }
}
}
?>
diff --git a/views/default/input/location.php b/views/default/input/location.php
new file mode 100644
index 000000000..d7ae2bbbd
--- /dev/null
+++ b/views/default/input/location.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Location input field
+ *
+ * @uses $vars['entity'] The ElggEntity that has a location
+ * @uses $vars['value'] The default value for the location
+ */
+
+$defaults = array(
+ 'class' => 'elgg-input-location',
+ 'disabled' => 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/tag.php b/views/default/input/tag.php
new file mode 100644
index 000000000..a78ec3163
--- /dev/null
+++ b/views/default/input/tag.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Elgg tag input
+ *
+ * Accepts a single tag value
+ *
+ * @uses $vars['value'] The default value for the tag
+ */
+
+$defaults = array(
+ 'class' => 'elgg-input-tag',
+ 'disabled' => FALSE,
+);
+
+$vars = array_merge($defaults, $vars);
+
+echo elgg_view('input/text', $vars); \ No newline at end of file
diff --git a/views/default/input/tags.php b/views/default/input/tags.php
index 539bbd4db..7cda958aa 100644
--- a/views/default/input/tags.php
+++ b/views/default/input/tags.php
@@ -3,8 +3,10 @@
* Elgg tag input
* Displays a tag input field
*
- * @package Elgg
- * @subpackage Core
+ * @uses $vars['disabled']
+ * @uses $vars['class']
+ * @uses $vars['value'] Array of tags or a string
+ * @uses $vars['entity'] Optional. Entity whose tags are being displayed (metadata ->tags)
*/
$defaults = array(
@@ -12,6 +14,11 @@ $defaults = array(
'disabled' => FALSE,
);
+if (isset($vars['entity'])) {
+ $defaults['value'] = $vars['entity']->tags;
+ unset($vars['entity']);
+}
+
$vars = array_merge($defaults, $vars);
if (is_array($vars['value'])) {
diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php
index 656effc98..dcd65072a 100644
--- a/views/default/input/userpicker.php
+++ b/views/default/input/userpicker.php
@@ -5,17 +5,18 @@
* @package Elgg
* @subpackage Core
*
- * @uses $vars['value'] The current value, if any
- * @uses $vars['name'] The name of the input field
+ * @uses $vars['value'] Array of user guids for already selected users or null
+ * @uses $vars['name'] The name of the input field
*
*
- * pops up defaulted to lazy load friends lists in paginated alphabetical order.
- * upon
+ * Defaults to lazy load user lists in paginated alphabetical order. User needs
+ * two type two characters before seeing the user popup list.
*
* As users are checked they move down to a "users" box.
* When this happens, a hidden input is created also.
- * {$internalnal}[] with the value th GUID.
+ * {$internalnal}[] with the value the GUID.
*
+ * @warning: this is not stable
*/
elgg_load_js('elgg.userpicker');
@@ -65,6 +66,5 @@ foreach ($vars['value'] as $user_id) {
<ul class="elgg-user-picker-entries"><?php echo $user_list; ?></ul>
</div>
<script type="text/javascript">
- elgg.provide('elgg.userpicker');
elgg.userpicker.userList = <?php echo $json_values ?>;
</script> \ No newline at end of file