diff options
Diffstat (limited to 'mod/uservalidationbyemail')
7 files changed, 85 insertions, 61 deletions
diff --git a/mod/uservalidationbyemail/manifest.xml b/mod/uservalidationbyemail/manifest.xml index df0a7cb58..800dd2641 100644 --- a/mod/uservalidationbyemail/manifest.xml +++ b/mod/uservalidationbyemail/manifest.xml @@ -8,11 +8,10 @@ <description>Simple user account validation via email.</description> <website>http://www.elgg.org/</website> <copyright>See COPYRIGHT.txt</copyright> - <license>GNU Public License version 2</license> + <license>GNU General Public License version 2</license> <requires> - <type>elgg_version</type> - <version>2009033101</version> + <type>elgg_release</type> + <version>1.8</version> </requires> <activate_on_install>true</activate_on_install> - <admin_interface>advanced</admin_interface> </plugin_manifest> diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index d3d0c3488..8de5d0522 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -41,6 +41,7 @@ function uservalidationbyemail_init() { // admin interface to manually validate users elgg_register_admin_menu_item('administer', 'unvalidated', 'users'); + elgg_extend_view('css/admin', 'uservalidationbyemail/css'); elgg_extend_view('js/elgg', 'uservalidationbyemail/js'); $action_path = dirname(__FILE__) . '/actions'; @@ -149,6 +150,7 @@ function uservalidationbyemail_check_auth_attempt($credentials) { * Checks sent passed validation code and user guids and validates the user. * * @param array $page + * @return bool */ function uservalidationbyemail_page_handler($page) { @@ -162,7 +164,7 @@ function uservalidationbyemail_page_handler($page) { $user = get_entity($user_guid); - if (($code) && ($user)) { + if ($code && $user) { if (uservalidationbyemail_validate_email($user_guid, $code)) { elgg_push_context('uservalidationbyemail_validate_user'); @@ -184,7 +186,8 @@ function uservalidationbyemail_page_handler($page) { register_error(elgg_echo('email:confirm:fail')); } - forward(); + // forward to front page + forward(''); } /** diff --git a/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php b/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php index 8b72126ef..62a35d0bb 100644 --- a/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php +++ b/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php @@ -4,6 +4,6 @@ */ echo elgg_view_form('uservalidationbyemail/bulk_action', array( - 'name' => 'unvalidated-users', + 'id' => 'uservalidationbyemail-form', 'action' => 'action/uservalidationbyemail/bulk_action' )); diff --git a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php index 2872b7a0c..2afd6022d 100644 --- a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php +++ b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php @@ -46,56 +46,67 @@ $pagination = elgg_view('navigation/pagination',array( 'limit' => $limit, )); -echo $pagination; - -$bulk_actions_checkbox = '<label><input type="checkbox" class="unvalidated-users-checkall" />' +$bulk_actions_checkbox = '<label><input type="checkbox" id="uservalidationbyemail-checkall" />' . elgg_echo('uservalidationbyemail:check_all') . '</label>'; $validate = elgg_view('output/url', array( - 'is_action' => TRUE, - 'js' => 'title="' . elgg_echo('uservalidationbyemail:confirm_validate_checked') . '"', - 'href' => $vars['url'] . "action/uservalidationbyemail/validate/", + 'href' => 'action/uservalidationbyemail/validate/', 'text' => elgg_echo('uservalidationbyemail:admin:validate'), - 'class' => 'unvalidated-users-bulk-post', + 'title' => elgg_echo('uservalidationbyemail:confirm_validate_checked'), + 'class' => 'uservalidationbyemail-submit', + 'is_action' => true, + 'is_trusted' => true, )); $resend_email = elgg_view('output/url', array( - 'is_action' => TRUE, - 'js' => 'title="' . elgg_echo('uservalidationbyemail:confirm_resend_validation_checked') . '"', - 'href' => $vars['url'] . "action/uservalidationbyemail/resend_validation/", + 'href' => 'action/uservalidationbyemail/resend_validation/', 'text' => elgg_echo('uservalidationbyemail:admin:resend_validation'), - 'class' => 'unvalidated-users-bulk-post', + 'title' => elgg_echo('uservalidationbyemail:confirm_resend_validation_checked'), + 'class' => 'uservalidationbyemail-submit', + 'is_action' => true, + 'is_trusted' => true, )); $delete = elgg_view('output/url', array( - 'is_action' => TRUE, - 'js' => 'title="' . elgg_echo('uservalidationbyemail:confirm_delete_checked') . '"', - 'href' => $vars['url'] . "action/uservalidationbyemail/delete/", + 'href' => 'action/uservalidationbyemail/delete/', 'text' => elgg_echo('uservalidationbyemail:admin:delete'), - 'class' => 'unvalidated-users-bulk-post', + 'title' => elgg_echo('uservalidationbyemail:confirm_delete_checked'), + 'class' => 'uservalidationbyemail-submit', + 'is_action' => true, + 'is_trusted' => true, )); $bulk_actions = <<<___END -<div class="uvbe_bulk_actions"> - <div class="uvbe_admin_controls"> - $resend_email | $validate | $delete - </div> + <ul class="elgg-menu elgg-menu-general elgg-menu-hz float-alt"> + <li>$resend_email</li><li>$validate</li><li>$delete</li> + </ul> $bulk_actions_checkbox -</div> ___END; -//$bulk_actions = elgg_view('page_elements/contentwrapper', array('body' => $bulk_actions)); - -echo $bulk_actions; - - -foreach ($users as $user) { - echo elgg_view('uservalidationbyemail/unvalidated_user', array('user' => $user)); +if (is_array($users) && count($users) > 0) { + $html = '<ul class="elgg-list elgg-list-distinct">'; + foreach ($users as $user) { + $html .= "<li id=\"unvalidated-user-{$user->guid}\" class=\"elgg-item uservalidationbyemail-unvalidated-user-item\">"; + $html .= elgg_view('uservalidationbyemail/unvalidated_user', array('user' => $user)); + $html .= '</li>'; + } + $html .= '</ul>'; } +echo <<<___END +<div class="elgg-module elgg-module-inline uservalidation-module"> + <div class="elgg-head"> + $bulk_actions + </div> + <div class="elgg-body"> + $html + </div> +</div> +___END; + if ($count > 5) { echo $bulk_actions; } -echo $pagination;
\ No newline at end of file +echo $pagination; diff --git a/mod/uservalidationbyemail/views/default/uservalidationbyemail/css.php b/mod/uservalidationbyemail/views/default/uservalidationbyemail/css.php new file mode 100644 index 000000000..afe334713 --- /dev/null +++ b/mod/uservalidationbyemail/views/default/uservalidationbyemail/css.php @@ -0,0 +1,12 @@ +<?php +/** + * CSS for user validation by email + */ +?> + +.uservalidation-module > .elgg-head * { + color: white; +} +.uservalidation-module > .elgg-body * { + color: #333; +}
\ No newline at end of file diff --git a/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php b/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php index abd29c0e1..948a54651 100644 --- a/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php +++ b/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php @@ -2,17 +2,17 @@ elgg.provide('elgg.uservalidationbyemail'); elgg.uservalidationbyemail.init = function() { - $('.unvalidated-users-checkall').click(function() { - checked = $(this).attr('checked'); - $('form[name=unvalidated-users]').find('input[type=checkbox]').attr('checked', checked); + $('#uservalidationbyemail-checkall').click(function() { + var checked = $(this).attr('checked') == 'checked'; + $('#uservalidationbyemail-form .elgg-body').find('input[type=checkbox]').attr('checked', checked); }); - $('.unvalidated-users-bulk-post').click(function(event) { - $form = $('form[name=unvalidated-users]'); + $('.uservalidationbyemail-submit').click(function(event) { + var $form = $('#uservalidationbyemail-form'); event.preventDefault(); // check if there are selected users - if ($form.find('input[type=checkbox]:checked').length < 1) { + if ($('#uservalidationbyemail-form .elgg-body').find('input[type=checkbox]:checked').length < 1) { return false; } @@ -23,6 +23,6 @@ elgg.uservalidationbyemail.init = function() { $form.attr('action', $(this).attr('href')).submit(); }); -} +}; elgg.register_hook_handler('init', 'system', elgg.uservalidationbyemail.init); diff --git a/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php b/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php index 209dbe02b..5c652a637 100644 --- a/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php +++ b/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php @@ -8,13 +8,11 @@ $user = elgg_extract('user', $vars); -// doesn't work. -//$checkbox = elgg_view('input/checkboxes', array( -// 'name' => 'user_guids', -// 'options' => array("$user->username - \"$user->name\" <$user->email>" => $user->guid) -//)); -$checkbox = "<label><input type=\"checkbox\" value=\"$user->guid\" class=\"elgg-input-checkboxes\" name=\"user_guids[]\">" - . "$user->username - \"$user->name\" <$user->email></label>"; +$checkbox = elgg_view('input/checkbox', array( + 'name' => 'user_guids[]', + 'value' => $user->guid, + 'default' => false, +)); $created = elgg_echo('uservalidationbyemail:admin:user_created', array(elgg_view_friendly_time($user->time_created))); @@ -35,17 +33,18 @@ $delete = elgg_view('output/confirmlink', array( 'href' => "action/uservalidationbyemail/delete/?user_guids[]=$user->guid", 'text' => elgg_echo('uservalidationbyemail:admin:delete') )); - -?> - -<div class="admin_settings radius8 pas baa"> - <?php echo $checkbox; ?><br /> - - <div class="uservalidationbyemail_unvalidated_controls right"> - <?php echo "$resend_email | $validate | $delete"; ?> +$menu = 'test'; +$block = <<<___END + <label>$user->username: "$user->name" <$user->email></label> + <div class="uservalidationbyemail-unvalidated-user-details"> + $created </div> +___END; - <div class="uservalidationbyemail_unvalidated_user_details mll small"> - <?php echo $created; ?> - </div> -</div> +$menu = <<<__END + <ul class="elgg-menu elgg-menu-general elgg-menu-hz float-alt"> + <li>$resend_email</li><li>$validate</li><li>$delete</li> + </ul> +__END; + +echo elgg_view_image_block($checkbox, $block, array('image_alt' => $menu)); |