diff options
author | Byron Jones <bjones@mozilla.com> | 2012-05-17 09:06:42 +0200 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2012-05-17 09:06:42 +0200 |
commit | 41513b56e105085d701591a7de9a13cb2310e02f (patch) | |
tree | 4e227046a1914ce95e198a570b05e770408bbbc8 | |
parent | 9bc1a835aff5b65e9f827d90b6f9a0db12c16fe9 (diff) | |
download | bugzilla-41513b56e105085d701591a7de9a13cb2310e02f.tar.gz bugzilla-41513b56e105085d701591a7de9a13cb2310e02f.tar.xz |
Bug 737405: add user-menu to all logged in users
-rw-r--r-- | extensions/BMO/template/en/default/hook/global/header-start.html.tmpl | 2 | ||||
-rw-r--r-- | extensions/BMO/web/js/edituser_menu.js | 16 | ||||
-rw-r--r-- | template/en/default/global/user.html.tmpl | 6 |
3 files changed, 15 insertions, 9 deletions
diff --git a/extensions/BMO/template/en/default/hook/global/header-start.html.tmpl b/extensions/BMO/template/en/default/hook/global/header-start.html.tmpl index 369f3aeff..e265d0bb6 100644 --- a/extensions/BMO/template/en/default/hook/global/header-start.html.tmpl +++ b/extensions/BMO/template/en/default/hook/global/header-start.html.tmpl @@ -33,7 +33,7 @@ [% END %] [% END %] -[% IF user.in_group('editusers') || user.bless_groups.size > 0 %] +[% IF user.in_group('canconfirm') %] [% yui.push('container', 'menu') %] [% style_urls.push('js/yui/assets/skins/sam/menu.css') %] [% javascript_urls.push('extensions/BMO/web/js/edituser_menu.js') %] diff --git a/extensions/BMO/web/js/edituser_menu.js b/extensions/BMO/web/js/edituser_menu.js index 0b6fed5f8..f9f20d959 100644 --- a/extensions/BMO/web/js/edituser_menu.js +++ b/extensions/BMO/web/js/edituser_menu.js @@ -3,23 +3,27 @@ var admin_usermenu; YAHOO.util.Event.onDOMReady(function() { admin_usermenu = new YAHOO.widget.Menu('admin_usermenu', { position : 'dynamic' }); admin_usermenu.addItems([ - { text: 'Edit', url: '#', target: '_blank' }, { text: 'Activity', url: '#', target: '_blank' }, - { text: 'Mail', url: '#', target: '_blank' } + { text: 'Mail', url: '#', target: '_blank' }, + { text: 'Edit', url: '#', target: '_blank' } ]); admin_usermenu.render(document.body); }); -function show_admin_usermenu(event, id, email) { +function show_admin_usermenu(event, id, email, show_edit) { if (!admin_usermenu) return; - admin_usermenu.getItem(0).cfg.setProperty('url', 'editusers.cgi?action=edit&userid=' + id); - admin_usermenu.getItem(1).cfg.setProperty('url', + admin_usermenu.getItem(0).cfg.setProperty('url', 'page.cgi?id=user_activity.html&action=run' + '&from=' + YAHOO.util.Date.format(new Date(new Date() - (1000 * 60 * 60 * 24 * 14)), {format: '%Y-%m-%d'}) + '&to=' + YAHOO.util.Date.format(new Date(), {format: '%Y-%m-%d'}) + '&who=' + encodeURIComponent(email)); - admin_usermenu.getItem(2).cfg.setProperty('url', 'mailto:' + encodeURIComponent(email)); + admin_usermenu.getItem(1).cfg.setProperty('url', 'mailto:' + encodeURIComponent(email)); + if (show_edit) { + admin_usermenu.getItem(2).cfg.setProperty('url', 'editusers.cgi?action=edit&userid=' + id); + } else { + admin_usermenu.removeItem(2); + } admin_usermenu.cfg.setProperty('xy', YAHOO.util.Event.getXY(event)); admin_usermenu.show(); } diff --git a/template/en/default/global/user.html.tmpl b/template/en/default/global/user.html.tmpl index 50014bb29..433a9803d 100644 --- a/template/en/default/global/user.html.tmpl +++ b/template/en/default/global/user.html.tmpl @@ -27,8 +27,10 @@ [% FILTER collapse %] [% IF user.id %] <a class="email" href="mailto:[% who.email FILTER html %]" - [% IF who.id && (user.in_group('editusers') || user.bless_groups.size > 0) %] - onclick="show_admin_usermenu(event, [% who.id FILTER none %], '[% who.email FILTER js %]'); return false" + [% IF who.id && user.in_group('canconfirm') %] + onclick="show_admin_usermenu(event, [% who.id FILTER none %], '[% who.email FILTER js %]', + [% IF (user.in_group('editusers') || user.bless_groups.size > 0) %]true[% ELSE %]false[% END %]); + return false" [% END %] title="[% who.identity FILTER html %]"> [%- END -%] |