diff options
Diffstat (limited to 'views/default/input')
-rw-r--r-- | views/default/input/autocomplete.php | 20 | ||||
-rw-r--r-- | views/default/input/button.php | 2 | ||||
-rw-r--r-- | views/default/input/checkboxes.php | 1 | ||||
-rw-r--r-- | views/default/input/date.php | 2 | ||||
-rw-r--r-- | views/default/input/dropdown.php | 2 | ||||
-rw-r--r-- | views/default/input/friendspicker.php | 2 | ||||
-rw-r--r-- | views/default/input/radio.php | 1 | ||||
-rw-r--r-- | views/default/input/reset.php | 3 | ||||
-rw-r--r-- | views/default/input/submit.php | 2 | ||||
-rw-r--r-- | views/default/input/userpicker.php | 38 |
10 files changed, 41 insertions, 32 deletions
diff --git a/views/default/input/autocomplete.php b/views/default/input/autocomplete.php index 421541e24..e58eb1ae8 100644 --- a/views/default/input/autocomplete.php +++ b/views/default/input/autocomplete.php @@ -8,7 +8,7 @@ * @todo This currently only works for ONE AUTOCOMPLETE TEXT FIELD on a page. * * @uses $vars['value'] Current value for the text input - * @uses $vars['match_on'] Array | str What to match on. all|array(groups|users|friends|subtype) + * @uses $vars['match_on'] Array | str What to match on. all|array(groups|users|friends) * @uses $vars['match_owner'] Bool. Match only entities that are owned by logged in user. * @uses $vars['class'] Additional CSS class */ @@ -26,15 +26,19 @@ $defaults = array( $vars = array_merge($defaults, $vars); -$ac_url_params = http_build_query(array( - 'match_on' => $vars['match_on'], - 'match_owner' => $vars['match_owner'], -)); - -unset($vars['match_on']); -unset($vars['match_owner']); +$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 index c21989919..9957fdc54 100644 --- a/views/default/input/button.php +++ b/views/default/input/button.php @@ -33,7 +33,7 @@ switch ($vars['type']) { } // blank src if trying to access an offsite image. @todo why? -if (strpos($vars['src'], elgg_get_site_url()) === false) { +if (isset($vars['src']) && strpos($vars['src'], elgg_get_site_url()) === false) { $vars['src'] = ""; } ?> diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php index 985858b85..db4b06949 100644 --- a/views/default/input/checkboxes.php +++ b/views/default/input/checkboxes.php @@ -49,7 +49,6 @@ $id = ''; if (isset($vars['id'])) { $id = "id=\"{$vars['id']}\""; unset($vars['id']); - unset($vars['internalid']); } if (is_array($vars['value'])) { diff --git a/views/default/input/date.php b/views/default/input/date.php index ceeb2105c..828ce5520 100644 --- a/views/default/input/date.php +++ b/views/default/input/date.php @@ -49,7 +49,7 @@ if ($timestamp) { // convert timestamps to text for display if (is_numeric($vars['value'])) { - $vars['value'] = gmdate('Y/m/d', $vars['value']); + $vars['value'] = gmdate('Y-m-d', $vars['value']); } $attributes = elgg_format_attributes($vars); diff --git a/views/default/input/dropdown.php b/views/default/input/dropdown.php index 4673a9301..9f07874f1 100644 --- a/views/default/input/dropdown.php +++ b/views/default/input/dropdown.php @@ -11,7 +11,7 @@ * @uses $vars['value'] The current value, if any * @uses $vars['options'] An array of strings representing the options for the dropdown field * @uses $vars['options_values'] An associative array of "value" => "option" - * where "value" is an internal name and "option" is + * 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 diff --git a/views/default/input/friendspicker.php b/views/default/input/friendspicker.php index 1a60e0d88..b41449fbf 100644 --- a/views/default/input/friendspicker.php +++ b/views/default/input/friendspicker.php @@ -187,7 +187,7 @@ if (!isset($vars['replacement'])) { } //echo "<p>" . $user->name . "</p>"; - $label = elgg_view_entity_icon($friend, 'tiny', array('override' => true)); + $label = elgg_view_entity_icon($friend, 'tiny', array('use_hover' => false)); $options[$label] = $friend->getGUID(); if ($vars['highlight'] == 'all' diff --git a/views/default/input/radio.php b/views/default/input/radio.php index a8b278efd..ef860a773 100644 --- a/views/default/input/radio.php +++ b/views/default/input/radio.php @@ -32,7 +32,6 @@ $id = ''; if (isset($vars['id'])) { $id = "id=\"{$vars['id']}\""; unset($vars['id']); - unset($vars['internalid']); } $class = "elgg-input-radios elgg-{$vars['align']}"; diff --git a/views/default/input/reset.php b/views/default/input/reset.php index 12866421e..082da8669 100644 --- a/views/default/input/reset.php +++ b/views/default/input/reset.php @@ -4,8 +4,11 @@ * * @package Elgg * @subpackage Core + * + * @uses $vars['class'] CSS class that replaces elgg-button-cancel */ $vars['type'] = 'reset'; +$vars['class'] = elgg_extract('class', $vars, 'elgg-button-cancel'); echo elgg_view('input/button', $vars);
\ No newline at end of file diff --git a/views/default/input/submit.php b/views/default/input/submit.php index 64b135afa..df369b3b4 100644 --- a/views/default/input/submit.php +++ b/views/default/input/submit.php @@ -4,6 +4,8 @@ * * @package Elgg * @subpackage Core + * + * @uses $vars['class'] CSS class that replaces elgg-button-submit */ $vars['type'] = 'submit'; diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php index dcd65072a..246c462da 100644 --- a/views/default/input/userpicker.php +++ b/views/default/input/userpicker.php @@ -6,17 +6,17 @@ * @subpackage Core * * @uses $vars['value'] Array of user guids for already selected users or null - * @uses $vars['name'] The name of the input field * + * The name of the hidden fields is members[] * - * Defaults to lazy load user lists in paginated alphabetical order. User needs - * two type two characters before seeing the user popup list. + * @warning Only a single input/userpicker is supported per web page. * - * As users are checked they move down to a "users" box. - * When this happens, a hidden input is created also. - * {$internalnal}[] with the value the GUID. + * Defaults to lazy load user lists in alphabetical order. User needs + * to type two characters before seeing the user popup list. * - * @warning: this is not stable + * As users are selected they move down to a "users" box. + * When this happens, a hidden input is created with the + * name of members[] and a value of the GUID. */ elgg_load_js('elgg.userpicker'); @@ -24,18 +24,18 @@ elgg_load_js('elgg.userpicker'); function user_picker_add_user($user_id) { $user = get_entity($user_id); if (!$user || !($user instanceof ElggUser)) { - return FALSE; + return false; } - $icon = $user->getIconURL('tiny'); - - $code = '<li class="elgg-image-block">'; - $code .= "<div class='elgg-image'><img class=\"livesearch_icon\" src=\"$icon\" /></div>"; - $code .= "<div class='elgg-image-alt'><a onclick='elgg.userpicker.removeUser(this, $user_id)'><strong>X</strong></a></div>"; - $code .= "<div class='elgg-body'>"; - $code .= "$user->name - $user->username"; - $code .= "<input type=\"hidden\" name=\"members[]\" value=\"$user_id\">"; + $icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => false)); + + // this html must be synced with the userpicker.js library + $code = '<li><div class="elgg-image-block">'; + $code .= "<div class='elgg-image'>$icon</div>"; + $code .= "<div class='elgg-image-alt'><a href='#' class='elgg-userpicker-remove'>X</a></div>"; + $code .= "<div class='elgg-body'>" . $user->name . "</div>"; $code .= "</div>"; + $code .= "<input type=\"hidden\" name=\"members[]\" value=\"$user_id\">"; $code .= '</li>'; return $code; @@ -62,9 +62,11 @@ foreach ($vars['value'] as $user_id) { ?> <div class="elgg-user-picker"> <input type="text" class="elgg-input-user-picker" size="30"/> - <label><input type="checkbox" name="match_on" value="true" /><?php echo elgg_echo('userpicker:only_friends'); ?></label> - <ul class="elgg-user-picker-entries"><?php echo $user_list; ?></ul> + <input type="checkbox" name="match_on" value="true" /> + <label><?php echo elgg_echo('userpicker:only_friends'); ?></label> + <ul class="elgg-user-picker-list"><?php echo $user_list; ?></ul> </div> <script type="text/javascript"> + // @todo grab the values in the init function rather than using inline JS elgg.userpicker.userList = <?php echo $json_values ?>; </script>
\ No newline at end of file |