From 223bd464bdfc6bcdff59e698ff3875eed7988207 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 5 Jul 2007 02:05:58 +0000 Subject: Bug 339437: Make flag requestee a select box and limit users to requestable only - Patch by Seth r/a=LpSolit --- template/en/default/attachment/edit.html.tmpl | 2 - template/en/default/flag/list.html.tmpl | 67 +++++++++++++++++++------ template/en/default/global/userselect.html.tmpl | 7 ++- 3 files changed, 59 insertions(+), 17 deletions(-) (limited to 'template') diff --git a/template/en/default/attachment/edit.html.tmpl b/template/en/default/attachment/edit.html.tmpl index 94581ab56..d0a75b3fd 100644 --- a/template/en/default/attachment/edit.html.tmpl +++ b/template/en/default/attachment/edit.html.tmpl @@ -40,8 +40,6 @@ table.attachment_info th { text-align: right; vertical-align: top; } table.attachment_info td { text-align: left; vertical-align: top; } #noview { text-align: left; vertical-align: middle; } - - table#flags th, table#flags td { font-size: small; vertical-align: baseline; text-align: left; } " %] diff --git a/template/en/default/flag/list.html.tmpl b/template/en/default/flag/list.html.tmpl index 61ecf2dfa..308552d25 100644 --- a/template/en/default/flag/list.html.tmpl +++ b/template/en/default/flag/list.html.tmpl @@ -45,10 +45,19 @@ function disableRequesteeFields() { var inputElements = document.getElementsByTagName("input"); + var selectElements = document.getElementsByTagName("select"); + //You cannot update Node lists, so you must create an array to combine the NodeLists + var allElements = []; + for( var i=0; i < inputElements.length; i++ ) { + allElements[allElements.length] = inputElements.item(i); + } + for( var i=0; i < selectElements.length; i++ ) { //Combine inputs with selects + allElements[allElements.length] = selectElements.item(i); + } var inputElement, id, flagField; - for ( var i=0 ; i [% IF type.is_active && type.is_requesteeble %] - () + [% IF Param('usemenuforusers') %] + [% INCLUDE global/userselect.html.tmpl + name => "requestee-$flag.id" + id => "requestee-$flag.id" + value => flag.requestee.login + multiple => 0 + emptyok => 1 + custom_userlist => flag.type.grant_list + %] + [% ELSE %] + () + [% END %] [% END %] @@ -173,9 +192,19 @@ [% IF type.is_requesteeble %] - () + [% IF Param('usemenuforusers') %] + [% INCLUDE global/userselect.html.tmpl + name => "requestee_type-$type.id" + id => "requestee_type-$type.id" + multiple => type.is_multiplicable * 3 + emptyok => !type.is_multiplicable + custom_userlist => type.grant_list + %] + [% ELSE %] + () + [% END %] [% END %] @@ -216,11 +245,21 @@ [% IF any_flags_requesteeble %] [% IF type.is_requesteeble %] - + + [% IF Param('usemenuforusers') %] + [% INCLUDE global/userselect.html.tmpl + name => "requestee_type-$type.id" + id => "requestee_type-$type.id" + multiple => type.is_multiplicable * 3 + emptyok => !type.is_multiplicable + custom_userlist => type.grant_list + %] + [% ELSE %] () - + [% END %] + [% END %] [% END %] diff --git a/template/en/default/global/userselect.html.tmpl b/template/en/default/global/userselect.html.tmpl index 398300b52..8fa7e0360 100644 --- a/template/en/default/global/userselect.html.tmpl +++ b/template/en/default/global/userselect.html.tmpl @@ -25,6 +25,7 @@ # emptyok: optional, select only; if true, prepend menu option to start of select # multiple: optional, do multiselect box, value is size (height) of box # do_not_change: optional, contains the string meaning "do not alter this role" + # custom_userlist: optional, specify a limited list of users to use #%] [% IF Param("usemenuforusers") %] @@ -45,7 +46,11 @@ [% END %] - [% FOREACH tmpuser = user.get_userlist %] + [% UNLESS custom_userlist %] + [% custom_userlist = user.get_userlist %] + [% END %] + + [% FOREACH tmpuser = custom_userlist %] [% IF tmpuser.visible OR value.match("\\b$tmpuser.login\\b") %]