diff options
Diffstat (limited to 'views/default/forms')
30 files changed, 442 insertions, 399 deletions
diff --git a/views/default/forms/account/settings.php b/views/default/forms/account/settings.php index 824b2280b..3967207ce 100644 --- a/views/default/forms/account/settings.php +++ b/views/default/forms/account/settings.php @@ -5,4 +5,6 @@ * This form is extended by Elgg with the views in core/settings/account. * Plugins can additionally extend it and then register for the * 'usersettings:save', 'user' plugin hook. + * + * This view is included by "forms/usersettings/save" */ diff --git a/views/default/forms/admin/menu/save.php b/views/default/forms/admin/menu/save.php index c55ff3367..1a67ffcc4 100644 --- a/views/default/forms/admin/menu/save.php +++ b/views/default/forms/admin/menu/save.php @@ -3,6 +3,9 @@ * Form body for setting up site menu */ +// @todo Could probably make this number configurable +$num_featured_items = 6; + // get site menu items $menu = elgg_get_config('menus'); $menu = $menu['site']; @@ -14,9 +17,9 @@ $featured_menu_names = elgg_get_config('site_featured_menu_names'); $dropdown_values = array(); foreach ($menu_items as $item) { - $dropdown_values[$item->getName()] = $item->getTitle(); + $dropdown_values[$item->getName()] = $item->getText(); } -$dropdown_values[''] = elgg_echo('none'); +$dropdown_values[' '] = elgg_echo('none'); ?> <div class="elgg-module elgg-module-inline"> @@ -29,12 +32,11 @@ echo elgg_view('output/longtext', array( 'value' => elgg_echo("admin:menu_items:description") )); -// @todo Could probably make this number configurable -for ($i=0; $i<6; $i++) { - if (array_key_exists($i, $featured_menu_names)) { +for ($i=0; $i<$num_featured_items; $i++) { + if ($featured_menu_names && array_key_exists($i, $featured_menu_names)) { $current_value = $featured_menu_names[$i]; } else { - $current_value = ''; + $current_value = ' '; } echo elgg_view('input/dropdown', array( @@ -62,7 +64,7 @@ $custom_items = elgg_get_config('site_custom_menu_items'); $name_str = elgg_echo('name'); $url_str = elgg_echo('admin:plugins:label:website'); -echo '<ul class="elgg-simple-list">'; +echo '<ul class="elgg-list elgg-list-simple">'; if (is_array($custom_items)) { foreach ($custom_items as $title => $url) { diff --git a/views/default/forms/admin/plugins/change_state.php b/views/default/forms/admin/plugins/change_state.php new file mode 100644 index 000000000..730c8ff32 --- /dev/null +++ b/views/default/forms/admin/plugins/change_state.php @@ -0,0 +1,22 @@ +<?php +/** + * Activate/deactive all plugins specified by guids array + * + * @uses $vars['guids'] Array of GUIDs + * @uses $vars['action'] 'activate' or 'deactivate' + */ + +$guids = elgg_extract('guids', $vars, array()); +$guids = implode(',', $guids); + +echo '<div>'; +echo elgg_view('input/hidden', array( + 'name' => 'guids', + 'value' => $guids, +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo("admin:plugins:{$vars['action']}_all"), + 'class' => 'elgg-button elgg-button-action mrm' +)); +echo '</div>'; diff --git a/views/default/forms/admin/plugins/filter.php b/views/default/forms/admin/plugins/filter.php new file mode 100644 index 000000000..fd1b618bc --- /dev/null +++ b/views/default/forms/admin/plugins/filter.php @@ -0,0 +1,26 @@ +<?php +/** + * Category filter for plugins + * + * @uses $vars['category'] + * @uses $vars['category_options'] + * @uses $vvars['sort'] + */ + +echo '<div>'; +echo elgg_view('input/dropdown', array( + 'name' => 'category', + 'options_values' => $vars['category_options'], + 'value' => $vars['category'], +)); + +echo elgg_view('input/hidden', array( + 'name' => 'sort', + 'value' => $vars['sort'], +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo('filter'), + 'class' => 'elgg-button elgg-button-action', +)); +echo '</div>'; diff --git a/views/default/forms/admin/plugins/simple_update_states.php b/views/default/forms/admin/plugins/simple_update_states.php deleted file mode 100644 index bf9f4e4c1..000000000 --- a/views/default/forms/admin/plugins/simple_update_states.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -/** - * Elgg administration simple plugin screen - * - * Shows an alphabetical list of "simple" plugins. - * - * @package Elgg - * @subpackage Core - */ - -elgg_generate_plugin_entities(); -$installed_plugins = elgg_get_plugins('any'); -$plugin_list = array(); - -foreach ($installed_plugins as $plugin) { - if (!$plugin->isValid()) { - continue; - } - $interface = $plugin->manifest->getAdminInterface(); - if ($interface == 'simple') { - $plugin_list[$plugin->manifest->getName()] = $plugin; - } -} - -ksort($plugin_list); - -echo <<<___END - <ul> -___END; - -$actions_base = '/action/admin/plugins/'; -$ts = time(); -$token = generate_action_token($ts); - -foreach ($plugin_list as $name => $plugin) { - $plugin_guid = $plugin->guid; - $plugin_id = $plugin->getID(); - $active = $plugin->isActive(); - $can_activate = $plugin->canActivate(); - $author = $plugin->manifest->getAuthor(); - $version = $plugin->manifest->getVersion(); - $website = $plugin->manifest->getWebsite(); - $description = $plugin->manifest->getDescription(); - - if ($active) { - $active_class = 'elgg-state-active'; - $checked = 'checked="checked"'; - } else { - $active_class = 'elgg-state-inactive'; - $checked = ''; - } - - if ($can_activate) { - $disabled = ''; - } else { - $disabled = 'disabled="disabled"'; - $description .= '<p>' . elgg_echo('admin:plugins:simple:cannot_activate') . '</p>'; - } - - $description = elgg_view('output/longtext', array('value' => $description)); - - $plugin_footer = '<ul class="elgg-menu elgg-menu-footer">'; - - if ($author) { - $plugin_footer .= '<li>' . elgg_echo('admin:plugins:author', array($author)) . '</li>'; - } - - if ($version) { - $plugin_footer .= '<li>' . elgg_echo('admin:plugins:version', array($version)) . '</li>'; - } - - if ($website) { - $plugin_footer .= "<li><a href=\"$website\">" . elgg_echo('admin:plugins:plugin_website') . '</a></li>'; - } - - if (elgg_view_exists("settings/$plugin_id/edit")) { - $settings_href = elgg_get_site_url() . "pg/admin/plugin_settings/$plugin_id"; - $plugin_footer .= "<li><a class='plugin_settings link' href='$settings_href'>" . elgg_echo('settings') . "</a></li>"; - } - - $plugin_footer .= "</ul>"; - - echo <<<___END - <li class="elgg-plugin $active_class"> - <div class="elgg-grid"> - <div class="elgg-col elgg-col-1of5"> - <input type="checkbox" id="$plugin_guid" $checked $disabled name="active_plugin_guids[]" value="$plugin_guid"/> - <label for="$plugin_guid">$name</label> - </div> - <div class="elgg-col elgg-col-4of5"> - $description - $plugin_footer - </div> - </div> - </li> -___END; -} - -echo '</ul>'; -echo elgg_view('input/submit', array('value' => elgg_echo('save'))); -echo elgg_view('input/reset', array('value' => elgg_echo('reset'))); diff --git a/views/default/forms/admin/plugins/sort.php b/views/default/forms/admin/plugins/sort.php new file mode 100644 index 000000000..7f2246bad --- /dev/null +++ b/views/default/forms/admin/plugins/sort.php @@ -0,0 +1,26 @@ +<?php +/** + * Sort plugins form body + * + * @uses $vars['sort'] + * @uses $vars['sort_options'] + * @uses $vars['category'] + */ + +echo '<div class="mtm">'; +echo elgg_view('input/dropdown', array( + 'name' => 'sort', + 'options_values' => $vars['sort_options'], + 'value' => $vars['sort'], +)); + +echo elgg_view('input/hidden', array( + 'name' => 'category', + 'value' => $vars['category'], +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo('sort'), + 'class' => 'elgg-button elgg-button-action' +)); +echo '</div>'; diff --git a/views/default/forms/admin/site/regenerate_secret.php b/views/default/forms/admin/site/regenerate_secret.php new file mode 100644 index 000000000..af269b801 --- /dev/null +++ b/views/default/forms/admin/site/regenerate_secret.php @@ -0,0 +1,24 @@ +<?php + +$strength = $vars['strength']; + +?> +<p><?php echo elgg_echo('admin:site:secret:intro'); ?></p> + +<table class="elgg-table"> + <tr> + <th><?php echo elgg_echo('site_secret:current_strength'); ?></th> + <td class="elgg-strength-<?php echo $strength; ?>"> + <h4><?php echo elgg_echo("site_secret:strength:$strength"); ?></h4> + <div><?php echo elgg_echo("site_secret:strength_msg:$strength"); ?></div> + </td> + </tr> +</table> + +<div class="elgg-foot"> + <?php echo elgg_view('input/submit', array( + 'value' => elgg_echo('admin:site:secret:regenerate'), + 'class' => 'elgg-requires-confirmation elgg-button elgg-button-submit', + )); ?> + <p class="elgg-text-help mts"><?php echo elgg_echo('admin:site:secret:regenerate:help'); ?></p> +</div> diff --git a/views/default/forms/admin/site/update_advanced.php b/views/default/forms/admin/site/update_advanced.php index d3ae5e250..14b74e4f9 100644 --- a/views/default/forms/admin/site/update_advanced.php +++ b/views/default/forms/admin/site/update_advanced.php @@ -4,7 +4,7 @@ */ $form_body = ""; -foreach (array('wwwroot', 'path', 'dataroot', 'view') as $field) { +foreach (array('wwwroot', 'path', 'dataroot') as $field) { $form_body .= "<div>"; $form_body .= elgg_echo('installation:' . $field) . "<br />"; $warning = elgg_echo('installation:warning:' . $field); @@ -17,28 +17,34 @@ foreach (array('wwwroot', 'path', 'dataroot', 'view') as $field) { } $form_body .= "<div>" . elgg_echo('admin:site:access:warning') . "<br />"; -$form_body .= elgg_echo('installation:sitepermissions'); +$form_body .= "<label>" . elgg_echo('installation:sitepermissions') . "</label>"; $form_body .= elgg_view('input/access', array( + 'options_values' => array( + ACCESS_PRIVATE => elgg_echo("PRIVATE"), + ACCESS_FRIENDS => elgg_echo("access:friends:label"), + ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"), + ACCESS_PUBLIC => elgg_echo("PUBLIC") + ), 'name' => 'default_access', 'value' => elgg_get_config('default_access'), )) . "</div>"; $form_body .= "<div>" . elgg_echo('installation:allow_user_default_access:description') . "<br />"; $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:allow_user_default_access:label')), + 'options' => array(elgg_echo('installation:allow_user_default_access:label') => 1), 'name' => 'allow_user_default_access', - 'value' => (elgg_get_config('allow_user_default_access') ? elgg_echo('installation:allow_user_default_access:label') : ""), + 'value' => (elgg_get_config('allow_user_default_access') ? 1 : 0), )) . "</div>"; $form_body .= "<div>" . elgg_echo('installation:simplecache:description') . "<br />"; $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:simplecache:label')), + 'options' => array(elgg_echo('installation:simplecache:label') => 1), 'name' => 'simplecache_enabled', - 'value' => (elgg_get_config('simplecache_enabled') ? elgg_echo('installation:simplecache:label') : ""), + 'value' => (elgg_get_config('simplecache_enabled') ? 1 : 0), )) . "</div>"; -$form_body .= "<div>" . elgg_echo('installation:viewpathcache:description') . "<br />"; +$form_body .= "<div>" . elgg_echo('installation:systemcache:description') . "<br />"; $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:viewpathcache:label')), - 'name' => 'viewpath_cache_enabled', - 'value' => (elgg_get_config('viewpath_cache_enabled') ? elgg_echo('installation:viewpathcache:label') : ""), + 'options' => array(elgg_echo('installation:systemcache:label') => 1), + 'name' => 'system_cache_enabled', + 'value' => (elgg_get_config('system_cache_enabled') ? 1 : 0), )) . "</div>"; $debug_options = array('0' => elgg_echo('installation:debug:none'), 'ERROR' => elgg_echo('installation:debug:error'), 'WARNING' => elgg_echo('installation:debug:warning'), 'NOTICE' => elgg_echo('installation:debug:notice')); @@ -52,9 +58,9 @@ $form_body .= '</div>'; // control new user registration $options = array( - 'options' => array(elgg_echo('installation:registration:label')), + 'options' => array(elgg_echo('installation:registration:label') => 1), 'name' => 'allow_registration', - 'value' => elgg_get_config('allow_registration') ? elgg_echo('installation:registration:label') : '', + 'value' => elgg_get_config('allow_registration') ? 1 : 0, ); $form_body .= '<div>' . elgg_echo('installation:registration:description'); $form_body .= '<br />' .elgg_view('input/checkboxes', $options) . '</div>'; @@ -62,28 +68,25 @@ $form_body .= '<br />' .elgg_view('input/checkboxes', $options) . '</div>'; // control walled garden $walled_garden = elgg_get_config(walled_garden); $options = array( - 'options' => array(elgg_echo('installation:walled_garden:label')), + 'options' => array(elgg_echo('installation:walled_garden:label') => 1), 'name' => 'walled_garden', - 'value' => $walled_garden ? elgg_echo('installation:walled_garden:label') : '', + 'value' => $walled_garden ? 1 : 0, ); $form_body .= '<div>' . elgg_echo('installation:walled_garden:description'); $form_body .= '<br />' . elgg_view('input/checkboxes', $options) . '</div>'; $form_body .= "<div>" . elgg_echo('installation:httpslogin') . "<br />"; $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:httpslogin:label')), + 'options' => array(elgg_echo('installation:httpslogin:label') => 1), 'name' => 'https_login', - 'value' => (elgg_get_config('https_login') ? elgg_echo('installation:httpslogin:label') : "") + 'value' => (elgg_get_config('https_login') ? 1 : 0) )) . "</div>"; $form_body .= "<div>" . elgg_echo('installation:disableapi') . "<br />"; -$on = elgg_echo('installation:disableapi:label'); $disable_api = elgg_get_config('disable_api'); -if ($disable_api) { - $on = (disable_api ? "" : elgg_echo('installation:disableapi:label')); -} +$on = $disable_api ? 0 : 1; $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:disableapi:label')), + 'options' => array(elgg_echo('installation:disableapi:label') => 1), 'name' => 'api', 'value' => $on, )); @@ -91,8 +94,8 @@ $form_body .= "</div>"; $form_body .= elgg_view('input/hidden', array('name' => 'settings', 'value' => 'go')); -$form_body .= '<div class="bta">'; +$form_body .= '<div class="elgg-foot">'; $form_body .= elgg_view('input/submit', array('value' => elgg_echo("save"))); $form_body .= '</div>'; -echo $form_body;
\ No newline at end of file +echo $form_body; diff --git a/views/default/forms/admin/site/update_basic.php b/views/default/forms/admin/site/update_basic.php index eb4218810..88870bc60 100644 --- a/views/default/forms/admin/site/update_basic.php +++ b/views/default/forms/admin/site/update_basic.php @@ -24,7 +24,7 @@ $form_body .= elgg_view("input/dropdown", array( 'options_values' => $languages, )) . "</div>"; -$form_body .= '<div class="bta">'; +$form_body .= '<div class="elgg-foot">'; $form_body .= elgg_view('input/submit', array('value' => elgg_echo("save"))); $form_body .= '</div>'; diff --git a/views/default/forms/avatar/crop.php b/views/default/forms/avatar/crop.php index 380a4bb6c..3e798cb27 100644 --- a/views/default/forms/avatar/crop.php +++ b/views/default/forms/avatar/crop.php @@ -5,14 +5,29 @@ * @uses $vars['entity'] */ -$master_image = $vars['entity']->getIcon('master'); +elgg_load_js('jquery.imgareaselect'); +elgg_load_js('elgg.avatar_cropper'); +elgg_load_css('jquery.imgareaselect'); + +$master_img = elgg_view('output/img', array( + 'src' => $vars['entity']->getIconUrl('master'), + 'alt' => elgg_echo('avatar'), + 'class' => 'mrl', + 'id' => 'user-avatar-cropper', +)); + +$preview_img = elgg_view('output/img', array( + 'src' => $vars['entity']->getIconUrl('master'), + 'alt' => elgg_echo('avatar'), +)); ?> -<div> - <img id="user-avatar" src="<?php echo $master_image; ?>" alt="<?php echo elgg_echo('avatar'); ?>" /> +<div class="clearfix"> + <?php echo $master_img; ?> + <div id="user-avatar-preview-title"><label><?php echo elgg_echo('avatar:preview'); ?></label></div> + <div id="user-avatar-preview"><?php echo $preview_img; ?></div> </div> - -<div class="clearfloat"></div> +<div class="elgg-foot"> <?php $coords = array('x1', 'x2', 'y1', 'y2'); foreach ($coords as $coord) { @@ -24,45 +39,4 @@ echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity' echo elgg_view('input/submit', array('value' => elgg_echo('avatar:create'))); ?> -<!-- grab the required js for icon cropping --> -<script type="text/javascript" src="<?php echo elgg_get_site_url(); ?>vendors/jquery/jquery.imgareaselect-0.8.min.js"></script> -<?php //@todo JS 1.8: no ?> -<script type="text/javascript"> - - // display a preview of the users cropped section - function preview(img, selection) { - // catch for the first click on the image - if (selection.width == 0 || selection.height == 0) { - return; - } - - var origWidth = $("#user-avatar").width(); //get the width of the users master photo - var origHeight = $("#user-avatar").height(); //get the height of the users master photo - var scaleX = 100 / selection.width; - var scaleY = 100 / selection.height; - $('#user-avatar-preview > img').css({ - width: Math.round(scaleX * origWidth) + 'px', - height: Math.round(scaleY * origHeight) + 'px', - marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', - marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' - }); - } - - function selectChange(img, selection) { - // populate the form with the correct coordinates once a user has cropped their image - $('input[name=x1]').val(selection.x1); - $('input[name=x2]').val(selection.x2); - $('input[name=y1]').val(selection.y1); - $('input[name=y2]').val(selection.y2); - } - - $(document).ready(function() { - $('<div id="user-avatar-preview"><img src="<?php echo $master_image; ?>" /></div>').insertAfter($('#user-avatar')); - $('<div id="user-avatar-preview-title"><label><?php echo elgg_echo('avatar:preview'); ?></label></div>').insertBefore($('#user-avatar-preview')); - - // this produces the coordinates - $('#user-avatar').imgAreaSelect({ selectionOpacity: 0, onSelectEnd: selectChange }); - // show the preview - $('#user-avatar').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: preview }); - }); -</script> +</div> diff --git a/views/default/forms/avatar/upload.php b/views/default/forms/avatar/upload.php index 08db1f7e0..d91e8575e 100644 --- a/views/default/forms/avatar/upload.php +++ b/views/default/forms/avatar/upload.php @@ -5,11 +5,12 @@ * @uses $vars['entity'] */ -echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid)); ?> <div> <label><?php echo elgg_echo("avatar:upload"); ?></label><br /> <?php echo elgg_view("input/file",array('name' => 'avatar')); ?> -<br /> +</div> +<div class="elgg-foot"> + <?php echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid)); ?> <?php echo elgg_view('input/submit', array('value' => elgg_echo('upload'))); ?> </div> diff --git a/views/default/forms/comments/add.php b/views/default/forms/comments/add.php index 8a2b89f2d..9acabf3ea 100644 --- a/views/default/forms/comments/add.php +++ b/views/default/forms/comments/add.php @@ -4,20 +4,34 @@ * * @package Elgg * - * @uses $vars['entity'] + * @uses ElggEntity $vars['entity'] The entity to comment on + * @uses bool $vars['inline'] Show a single line version of the form? */ + if (isset($vars['entity']) && elgg_is_logged_in()) { + + $inline = elgg_extract('inline', $vars, false); + + if ($inline) { + echo elgg_view('input/text', array('name' => 'generic_comment')); + echo elgg_view('input/submit', array('value' => elgg_echo('comment'))); + } else { ?> -<div class="mbn"> - <label><?php echo elgg_echo("generic_comments:text"); ?></label> - <?php echo elgg_view('input/longtext', array('name' => 'generic_comment')); ?> -</div> + <div> + <label><?php echo elgg_echo("generic_comments:add"); ?></label> + <?php echo elgg_view('input/longtext', array('name' => 'generic_comment')); ?> + </div> + <div class="elgg-foot"> <?php - + echo elgg_view('input/submit', array('value' => elgg_echo("generic_comments:post"))); +?> + </div> +<?php + } + echo elgg_view('input/hidden', array( 'name' => 'entity_guid', 'value' => $vars['entity']->getGUID() )); - echo elgg_view('input/submit', array('value' => elgg_echo("generic_comments:post"))); } diff --git a/views/default/forms/comments/inline.php b/views/default/forms/comments/inline.php deleted file mode 100644 index 14b8a086d..000000000 --- a/views/default/forms/comments/inline.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * Inline comment form body - * - * @uses $vars['entity'] - */ - -if (isset($vars['entity']) && elgg_is_logged_in()) { - echo elgg_view('input/text', array('name' => 'generic_comment')); - echo elgg_view('input/hidden', array( - 'name' => 'entity_guid', - 'value' => $vars['entity']->getGUID() - )); - echo elgg_view('input/submit', array('value' => elgg_echo('comment'))); -} diff --git a/views/default/forms/friends/collectionfields.php b/views/default/forms/friends/collectionfields.php deleted file mode 100644 index 35db3a962..000000000 --- a/views/default/forms/friends/collectionfields.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * Elgg friend collections required hidden fields for js friends picker form - * - * @package Elgg - * @subpackage Core - */ - -if (isset($vars['collection'])) { -?> - - <input type="hidden" name="collection_id" value="<?php echo $vars['collection']->id; ?>" /> - -<?php -}
\ No newline at end of file diff --git a/views/default/forms/friends/collections/add.php b/views/default/forms/friends/collections/add.php new file mode 100644 index 000000000..04c87346b --- /dev/null +++ b/views/default/forms/friends/collections/add.php @@ -0,0 +1,53 @@ +<?php +/** + * Form body for editing or adding a friend collection + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['collection'] Optionally, the collection to edit + */ + +// Set title, form destination +if (isset($vars['collection'])) { + $title = $vars['collection']->name; + $highlight = 'default'; +} else { + $title = ""; + $highlight = 'all'; +} + +echo "<div class=\"mtm\"><label>" . elgg_echo("friends:collectionname") . "<br/>"; +echo elgg_view("input/text", array( + "name" => "collection_name", + "value" => $title, + )); +echo "</label></div>"; + +echo "<div>"; +if ($vars['collection_members']) { + echo elgg_echo("friends:collectionfriends") . "<br />"; + foreach ($vars['collection_members'] as $mem) { + echo elgg_view_entity_icon($mem, 'tiny'); + echo $mem->name; + } +} +echo "</div>"; + +echo "<div><label>" . elgg_echo("friends:addfriends") . "</label>"; +echo elgg_view('input/friendspicker', array( + 'entities' => $vars['friends'], + 'name' => 'friends_collection', + 'highlight' => $highlight, +)); +echo "</div>"; + +echo '<div class="elgg-foot">'; +if (isset($vars['collection'])) { + echo elgg_view('input/hidden', array( + 'name' => 'collection_id', + 'value' => $vars['collection']->id, + )); +} +echo elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('save'))); +echo '</div>'; diff --git a/views/default/forms/friends/edit.php b/views/default/forms/friends/edit.php deleted file mode 100644 index e3bc28cfc..000000000 --- a/views/default/forms/friends/edit.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Elgg friend collections add/edit - * - * @package Elgg - * @subpackage Core - * - * @uses $vars['object'] Optionally, the collection edit - * - * @todo FIXME Forms 1.8: views in the forms/ directory should not output the <form> wrapper itself - */ - -// var_export($vars['collection'][0]->id); - -// Set title, form destination -if (isset($vars['collection'])) { - $action = "friends/editcollection"; - $title = $vars['collection'][0]->name; - $highlight = 'default'; -} else { - $action = "friends/addcollection"; - $title = ""; - $highlight = 'all'; -} - - -$form_body = "<div class='contentWrapper'><div><label>" . elgg_echo("friends:collectionname") . "<br />" . - elgg_view("input/text", array( - "name" => "collection_name", - "value" => $title, - )) . "</label></div>"; - -$form_body .= "<div>"; - -if($vars['collection_members']){ - $form_body .= elgg_echo("friends:collectionfriends") . "<br />"; - foreach($vars['collection_members'] as $mem){ - $form_body .= elgg_view("profile/icon",array('entity' => $mem, 'size' => 'tiny')); - $form_body .= $mem->name; - } -} - -$form_body .= "</div>"; - -$form_body .= "<div><label>" . elgg_echo("friends:addfriends") . "</label>". - elgg_view('core/friends/picker',array('entities' => $vars['friends'], 'name' => 'friends_collection', 'highlight' => $highlight)) . "</div>"; - -$form_body .= "<div>"; -if (isset($vars['collection'])) { - $form_body .= elgg_view('input/hidden', array('name' => 'collection_id', 'value' => "{$vars['collection'][0]->id}")); -} -$form_body .= elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('save'))); -$form_body .= "</div></div>"; - -echo elgg_view('input/form', array('body' => $form_body, 'action' => "action/$action"));
\ No newline at end of file diff --git a/views/default/forms/login.php b/views/default/forms/login.php index a4d9e57c6..d2c6e6221 100644 --- a/views/default/forms/login.php +++ b/views/default/forms/login.php @@ -9,37 +9,41 @@ <div> <label><?php echo elgg_echo('loginusername'); ?></label> - <?php echo elgg_view('input/text', array('name' => 'username')); ?> + <?php echo elgg_view('input/text', array( + 'name' => 'username', + 'class' => 'elgg-autofocus', + )); + ?> </div> <div> <label><?php echo elgg_echo('password'); ?></label> <?php echo elgg_view('input/password', array('name' => 'password')); ?> </div> -<?php echo elgg_view('login/extend'); ?> - -<div> - <?php echo elgg_view('input/submit', array('value' => elgg_echo('login'))); ?> +<?php echo elgg_view('login/extend', $vars); ?> - <label class="right mtm"> +<div class="elgg-foot"> + <label class="mtm float-alt"> <input type="checkbox" name="persistent" value="true" /> <?php echo elgg_echo('user:persistent'); ?> </label> + <?php echo elgg_view('input/submit', array('value' => elgg_echo('login'))); ?> + <?php - if ($vars['returntoreferer']) { + if (isset($vars['returntoreferer'])) { echo elgg_view('input/hidden', array('name' => 'returntoreferer', 'value' => 'true')); } ?> -</div> -<ul class="elgg-menu elgg-menu-footer"> -<?php - if (elgg_get_config('allow_registration')) { - echo '<li><a class="registration_link" href="' . elgg_get_site_url() . 'pg/register/">' . elgg_echo('register') . '</a></li>'; - } -?> - <li><a class="forgotten_password_link" href="<?php echo elgg_get_site_url(); ?>pages/account/forgotten_password.php"> - <?php echo elgg_echo('user:password:lost'); ?> - </a></li> -</ul>
\ No newline at end of file + <ul class="elgg-menu elgg-menu-general mtm"> + <?php + if (elgg_get_config('allow_registration')) { + echo '<li><a class="registration_link" href="' . elgg_get_site_url() . 'register">' . elgg_echo('register') . '</a></li>'; + } + ?> + <li><a class="forgot_link" href="<?php echo elgg_get_site_url(); ?>forgotpassword"> + <?php echo elgg_echo('user:password:lost'); ?> + </a></li> + </ul> +</div> diff --git a/views/default/forms/members/name_search.php b/views/default/forms/members/name_search.php index 23e6c066e..5f6b9a4b6 100644 --- a/views/default/forms/members/name_search.php +++ b/views/default/forms/members/name_search.php @@ -2,6 +2,7 @@ $params = array( 'name' => 'name', + 'class' => 'mbm', ); echo elgg_view('input/text', $params); diff --git a/views/default/forms/members/tag_search.php b/views/default/forms/members/tag_search.php index 7badf8cda..4fe9bb32a 100644 --- a/views/default/forms/members/tag_search.php +++ b/views/default/forms/members/tag_search.php @@ -5,6 +5,7 @@ $params = array( 'name' => 'tag', + 'class' => 'mbm', ); echo elgg_view('input/text', $params); diff --git a/views/default/forms/plugins/settings/save.php b/views/default/forms/plugins/settings/save.php index 5125f3142..116529905 100644 --- a/views/default/forms/plugins/settings/save.php +++ b/views/default/forms/plugins/settings/save.php @@ -1,6 +1,6 @@ <?php /** - * Used to show plugin user settings. + * Used to show plugin settings for both users and admins. * * @package Elgg.Core * @subpackage Plugins @@ -17,10 +17,15 @@ if ($type != 'user') { $type = ''; } -echo elgg_view("{$type}settings/$plugin_id/edit", $vars); +if (elgg_view_exists("plugins/$plugin_id/{$type}settings")) { + echo elgg_view("plugins/$plugin_id/{$type}settings", $vars); +} elseif (elgg_view_exists("{$type}settings/$plugin_id/edit")) { + elgg_deprecated_notice("{$type}settings/$plugin_id/edit was deprecated in favor of plugins/$plugin_id/{$type}settings", 1.8); + echo elgg_view("{$type}settings/$plugin_id/edit", $vars); +} -echo "<div>"; +echo '<div class="elgg-foot">'; echo elgg_view('input/hidden', array('name' => 'plugin_id', 'value' => $plugin_id)); echo elgg_view('input/hidden', array('name' => 'user_guid', 'value' => $user_guid)); echo elgg_view('input/submit', array('value' => elgg_echo('save'))); -echo "</div>"; +echo '</div>'; diff --git a/views/default/forms/plugins/usersettings/save.php b/views/default/forms/plugins/usersettings/save.php index 8532cdfd1..ced88f818 100644 --- a/views/default/forms/plugins/usersettings/save.php +++ b/views/default/forms/plugins/usersettings/save.php @@ -1,4 +1,14 @@ <?php +/** + * Plugin user settings + * + * Calls the plugin admin settings form body with type set to 'user' + * + * @package Elgg.Core + * @subpackage Plugins + */ + $vars['type'] = 'user'; +// Can't use elgg_view_form() because it overrides the $vars['action'] parameter echo elgg_view('forms/plugins/settings/save', $vars);
\ No newline at end of file diff --git a/views/default/forms/profile/edit.php b/views/default/forms/profile/edit.php index aaf9ac01e..cb0a37ca4 100644 --- a/views/default/forms/profile/edit.php +++ b/views/default/forms/profile/edit.php @@ -13,12 +13,15 @@ </div> <?php +$sticky_values = elgg_get_sticky_values('profile:edit'); + $profile_fields = elgg_get_config('profile_fields'); if (is_array($profile_fields) && count($profile_fields) > 0) { foreach ($profile_fields as $shortname => $valtype) { $metadata = elgg_get_metadata(array( 'guid' => $vars['entity']->guid, - 'metadata_name' => $shortname + 'metadata_name' => $shortname, + 'limit' => false )); if ($metadata) { if (is_array($metadata)) { @@ -39,6 +42,14 @@ if (is_array($profile_fields) && count($profile_fields) > 0) { $access_id = ACCESS_DEFAULT; } + // sticky form values take precedence over saved ones + if (isset($sticky_values[$shortname])) { + $value = $sticky_values[$shortname]; + } + if (isset($sticky_values['accesslevel'][$shortname])) { + $access_id = $sticky_values['accesslevel'][$shortname]; + } + ?> <div> <label><?php echo elgg_echo("profile:{$shortname}") ?></label> @@ -58,8 +69,11 @@ if (is_array($profile_fields) && count($profile_fields) > 0) { <?php } } + +elgg_clear_sticky_form('profile:edit'); + ?> -<div> +<div class="elgg-foot"> <?php echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid)); echo elgg_view('input/submit', array('value' => elgg_echo('save'))); diff --git a/views/default/forms/profile/fields/add.php b/views/default/forms/profile/fields/add.php index c700cf7f5..2087ec299 100644 --- a/views/default/forms/profile/fields/add.php +++ b/views/default/forms/profile/fields/add.php @@ -1,29 +1,29 @@ <?php /** - * Elgg profile index - * - * @package ElggProfile + * Add a new field to the set of custom profile fields */ $label_text = elgg_echo('profile:label'); $type_text = elgg_echo('profile:type'); $label_control = elgg_view('input/text', array('name' => 'label')); -$type_control = elgg_view('input/pulldown', array('name' => 'type', 'options_values' => array( - 'text' => elgg_echo('text'), - 'longtext' => elgg_echo('longtext'), - 'tags' => elgg_echo('tags'), - 'url' => elgg_echo('url'), - 'email' => elgg_echo('email') +$type_control = elgg_view('input/dropdown', array('name' => 'type', 'options_values' => array( + 'text' => elgg_echo('profile:field:text'), + 'longtext' => elgg_echo('profile:field:longtext'), + 'tags' => elgg_echo('profile:field:tags'), + 'url' => elgg_echo('profile:field:url'), + 'email' => elgg_echo('profile:field:email'), + 'location' => elgg_echo('profile:field:location'), + 'date' => elgg_echo('profile:field:date'), ))); $submit_control = elgg_view('input/submit', array('name' => elgg_echo('add'), 'value' => elgg_echo('add'))); $formbody = <<< END - <p>$label_text: $label_control - $type_text: $type_control - $submit_control</p> + <div>$label_text: $label_control</div> + <div class="elgg-foot">$type_text: $type_control + $submit_control</div> END; -echo autop(elgg_echo('profile:explainchangefields')); +echo elgg_autop(elgg_echo('profile:explainchangefields')); echo $formbody; diff --git a/views/default/forms/profile/fields/reset.php b/views/default/forms/profile/fields/reset.php deleted file mode 100644 index deb2d48ef..000000000 --- a/views/default/forms/profile/fields/reset.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Reset profile fields form - */ - -$params = array( - 'value' => elgg_echo('profile:resetdefault'), - 'class' => 'elgg-button-action elgg-state-disabled', -); -echo elgg_view('input/submit', $params); diff --git a/views/default/forms/register.php b/views/default/forms/register.php index 8828e89e1..c0ee66f76 100644 --- a/views/default/forms/register.php +++ b/views/default/forms/register.php @@ -6,60 +6,75 @@ * @subpackage Core */ +elgg_load_js('elgg.register'); + +$password = $password2 = ''; $username = get_input('u'); $email = get_input('e'); $name = get_input('n'); -$admin_option = false; -if (elgg_is_admin_logged_in() && isset($vars['show_admin'])) { - $admin_option = true; +if (elgg_is_sticky_form('register')) { + extract(elgg_get_sticky_values('register')); + elgg_clear_sticky_form('register'); } ?> <div class="mtm"> - <label><?php echo elgg_echo('name'); ?></label> - <br /> - <?php echo elgg_view('input/text', array('name' => 'name', 'value' => $name)); ?> + <label><?php echo elgg_echo('name'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'name', + 'value' => $name, + 'class' => 'elgg-autofocus', + )); + ?> </div> <div> - <label><?php echo elgg_echo('email'); ?></label> - <br /> - <?php echo elgg_view('input/text', array('name' => 'email', 'value' => $email)); ?> + <label><?php echo elgg_echo('email'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'email', + 'value' => $email, + )); + ?> </div> <div> - <label><?php echo elgg_echo('username'); ?></label> - <br /> - <?php echo elgg_view('input/text', array('name' => 'username', 'value' => $username)); ?> + <label><?php echo elgg_echo('username'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'username', + 'value' => $username, + )); + ?> </div> <div> - <label><?php echo elgg_echo('password'); ?></label> - <br /> - <?php echo elgg_view('input/password', array('name' => 'password')); ?> + <label><?php echo elgg_echo('password'); ?></label><br /> + <?php + echo elgg_view('input/password', array( + 'name' => 'password', + 'value' => $password, + )); + ?> </div> <div> - <label><?php echo elgg_echo('passwordagain'); ?></label> - <br /> - <?php echo elgg_view('input/password', array('name' => 'password2')); ?> + <label><?php echo elgg_echo('passwordagain'); ?></label><br /> + <?php + echo elgg_view('input/password', array( + 'name' => 'password2', + 'value' => $password2, + )); + ?> </div> <?php // view to extend to add more fields to the registration form -echo elgg_view('register/extend'); +echo elgg_view('register/extend', $vars); // Add captcha hook -echo elgg_view('input/captcha'); - -if ($admin_option) { - echo elgg_view('input/checkboxes', array('name' => "admin", 'options' => array(elgg_echo('admin_option')))); -} +echo elgg_view('input/captcha', $vars); +echo '<div class="elgg-foot">'; echo elgg_view('input/hidden', array('name' => 'friend_guid', 'value' => $vars['friend_guid'])); echo elgg_view('input/hidden', array('name' => 'invitecode', 'value' => $vars['invitecode'])); echo elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('register'))); -?> -<?php //@todo JS 1.8: no ?> -<script type="text/javascript"> - $(document).ready(function() { - $('input[name=name]').focus(); - }); -</script>
\ No newline at end of file +echo '</div>'; diff --git a/views/default/forms/user/passwordreset.php b/views/default/forms/user/passwordreset.php index 7b13f120c..5946fa7c0 100644 --- a/views/default/forms/user/passwordreset.php +++ b/views/default/forms/user/passwordreset.php @@ -1,19 +1,20 @@ <?php +/** + * Reset user password form + */ -$user = $vars['user']; - -echo elgg_echo('user:resetpassword:reset_password_confirm') . "<br />"; +echo elgg_autop(elgg_echo('user:resetpassword:reset_password_confirm')); echo elgg_view('input/hidden', array( 'name' => 'u', - 'value' => $user->guid + 'value' => $vars['guid'], )); echo elgg_view('input/hidden', array( 'name' => 'c', - 'value' => $code + 'value' => $vars['code'], )); echo elgg_view('input/submit', array( 'value' => elgg_echo('resetpassword') -));
\ No newline at end of file +)); diff --git a/views/default/forms/user/requestnewpassword.php b/views/default/forms/user/requestnewpassword.php index f2f276417..c90971eaf 100644 --- a/views/default/forms/user/requestnewpassword.php +++ b/views/default/forms/user/requestnewpassword.php @@ -11,16 +11,14 @@ <?php echo elgg_echo('user:password:text'); ?> </div> <div> - <label><?php echo elgg_echo('username'); ?></label> - <?php echo elgg_view('input/text', array('name' => 'username')); ?> + <label><?php echo elgg_echo('loginusername'); ?></label><br /> + <?php echo elgg_view('input/text', array( + 'name' => 'username', + 'class' => 'elgg-autofocus', + )); + ?> </div> <?php echo elgg_view('input/captcha'); ?> -<div> +<div class="elgg-foot"> <?php echo elgg_view('input/submit', array('value' => elgg_echo('request'))); ?> </div> -<?php //@todo JS 1.8: no ?> -<script type="text/javascript"> - $(document).ready(function() { - $('input[name=username]').focus(); - }); -</script>
\ No newline at end of file diff --git a/views/default/forms/useradd.php b/views/default/forms/useradd.php index 1119d180f..4f337e4e4 100644 --- a/views/default/forms/useradd.php +++ b/views/default/forms/useradd.php @@ -5,39 +5,74 @@ * @package Elgg * @subpackage Core * - * @todo FIXME Forms 1.8: views in the forms/ directory should not be generating the <form> wrapper itself */ -$admin_option = false; -if ((elgg_get_logged_in_user_entity()->isAdmin()) && ($vars['show_admin'])) { - $admin_option = true; -} - -$form_body = "<div><label>" . elgg_echo('name') . "</label><br />" . elgg_view('input/text' , array('name' => 'name')) . "</div>"; -$form_body .= "<div><label>" . elgg_echo('username') . "</label><br />" . elgg_view('input/text' , array('name' => 'username')) . "</div>"; -$form_body .= "<div><label>" . elgg_echo('email') . "</label><br />" . elgg_view('input/text' , array('name' => 'email')) . "</div>"; -$form_body .= "<div><label>" . elgg_echo('password') . "</label><br />" . elgg_view('input/password' , array('name' => 'password')) . "</div>"; -$form_body .= "<div><label>" . elgg_echo('passwordagain') . "</label><br />" . elgg_view('input/password' , array('name' => 'password2')) . "</div>"; -$form_body .= "<div>"; +$name = $username = $email = $password = $password2 = $admin = ''; -if ($admin_option) { - $form_body .= elgg_view('input/checkboxes', array('name' => "admin", 'options' => array(elgg_echo('admin_option')))); - $form_body .= '</div><div>'; +if (elgg_is_sticky_form('useradd')) { + extract(elgg_get_sticky_values('useradd')); + elgg_clear_sticky_form('useradd'); + if (is_array($admin)) { + $admin = $admin[0]; + } } -$form_body .= elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('register'))) . "</div>"; ?> +<div> + <label><?php echo elgg_echo('name');?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'name', + 'value' => $name, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('username'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'username', + 'value' => $username, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('email'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'email', + 'value' => $email, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('password'); ?></label><br /> + <?php + echo elgg_view('input/password', array( + 'name' => 'password', + 'value' => $password, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('passwordagain'); ?></label><br /> + <?php + echo elgg_view('input/password', array( + 'name' => 'password2', + 'value' => $password2, + )); + ?> +</div> +<div> +<?php + echo elgg_view('input/checkboxes', array( + 'name' => "admin", + 'options' => array(elgg_echo('admin_option') => 1), + 'value' => $admin, + )); +?> +</div> -<div class="elgg-module elgg-module-inline"> - <div class="elgg-head"> - <h3><?php echo elgg_echo('adduser'); ?></h3> - </div> - <div class="elgg-body"> - <?php - echo elgg_view('input/form', array( - 'action' => "action/useradd", - 'body' => $form_body, - )); - ?> - </div> +<div class="elgg-foot"> + <?php echo elgg_view('input/submit', array('value' => elgg_echo('register'))); ?> </div>
\ No newline at end of file diff --git a/views/default/forms/usersettings/save.php b/views/default/forms/usersettings/save.php index 2a240d036..71323083f 100644 --- a/views/default/forms/usersettings/save.php +++ b/views/default/forms/usersettings/save.php @@ -1,7 +1,13 @@ <?php -$form_body = elgg_view("forms/account/settings"); +/** + * User account settings. + * + * Plugins should extend "forms/account/settings" to add to the settings. + */ -$form_body .= '<div class="bta">'; +$form_body = elgg_view("forms/account/settings", $vars); + +$form_body .= '<div class="elgg-foot">'; $form_body .= elgg_view('input/submit', array('value' => elgg_echo('save'))); $form_body .= '</div>'; diff --git a/views/default/forms/widgets/save.php b/views/default/forms/widgets/save.php index d16318cd1..6959b2a82 100644 --- a/views/default/forms/widgets/save.php +++ b/views/default/forms/widgets/save.php @@ -14,7 +14,7 @@ $custom_form_section = elgg_view($edit_view, array('entity' => $widget)); $access = ''; if ($show_access) { - $access = elgg_view('input/access', array( + $access = elgg_echo('access') . ': ' . elgg_view('input/access', array( 'name' => 'params[access_id]', 'value' => $widget->access_id, )); @@ -29,11 +29,13 @@ $submit = elgg_view('input/submit', array('value' => elgg_echo('save'))); $body = <<<___END $custom_form_section - $access <div> + $access + </div> + <div class="elgg-foot"> $hidden $submit </div> ___END; -echo $body;
\ No newline at end of file +echo $body; |
