[Rt-commit] rt branch, 4.0/enhance-checkbox-select-all, created. rt-4.0.0-315-gea404eb
? sunnavy
sunnavy at bestpractical.com
Wed May 18 09:14:16 EDT 2011
The branch, 4.0/enhance-checkbox-select-all has been created
at ea404eb39cd45b6b4213616fc423b1e91e37e0f7 (commit)
- Log -----------------------------------------------------------------
commit ea404eb39cd45b6b4213616fc423b1e91e37e0f7
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed May 18 20:41:45 2011 +0800
support CheckboxNameRegex to filter by the regex, see also #13421
diff --git a/share/html/Elements/Submit b/share/html/Elements/Submit
index 011a871..2b7c6dd 100755
--- a/share/html/Elements/Submit
+++ b/share/html/Elements/Submit
@@ -52,10 +52,10 @@ id="<%$id%>"
>
<div class="extra-buttons">
% if ($CheckAll) {
- <input type="button" value="<%$CheckAllLabel%>" onclick="setCheckbox(this.form, '<% $CheckboxName %>', true);return false;" class="button" />
+ <input type="button" value="<%$CheckAllLabel%>" onclick="setCheckbox(this.form, <% length $CheckboxName ? qq{'$CheckboxName'} : length $CheckboxNameRegex ? $CheckboxNameRegex : q{''} %>, true);return false;" class="button" />
% }
% if ($ClearAll) {
- <input type="button" value="<%$ClearAllLabel%>" onclick="setCheckbox(this.form, '<% $CheckboxName %>', false);return false;" class="button" />
+ <input type="button" value="<%$ClearAllLabel%>" onclick="setCheckbox(this.form, <% length $CheckboxName ? qq{'$CheckboxName'} : length $CheckboxNameRegex ? $CheckboxNameRegex : q{''} %>, false);return false;" class="button" />
% }
% if ($Reset) {
<input type="reset" value="<%$ResetLabel%>" class="button" />
@@ -103,6 +103,7 @@ $CheckAllLabel => loc('Check All')
$ClearAll => undef
$ClearAllLabel => loc('Clear All')
$CheckboxName => ''
+$CheckboxNameRegex => ''
$Back => undef
$BackName => 'Back'
$BackLabel => loc('Back')
diff --git a/share/html/NoAuth/js/util.js b/share/html/NoAuth/js/util.js
index bf75734..b1a4a0b 100644
--- a/share/html/NoAuth/js/util.js
+++ b/share/html/NoAuth/js/util.js
@@ -130,8 +130,16 @@ function focusElementById(id) {
function setCheckbox(form, name, val) {
var myfield = form.getElementsByTagName('input');
for ( var i = 0; i < myfield.length; i++ ) {
- if ( name && myfield[i].name != name ) continue;
if ( myfield[i].type != 'checkbox' ) continue;
+ if ( name ) {
+ if ( name instanceof RegExp ) {
+ if ( ! myfield[i].name.match( name ) ) continue;
+ }
+ else {
+ if ( myfield[i].name != name ) continue;
+ }
+
+ }
myfield[i].checked = val;
}
diff --git a/share/html/Search/Bulk.html b/share/html/Search/Bulk.html
index c99bf41..bf87007 100755
--- a/share/html/Search/Bulk.html
+++ b/share/html/Search/Bulk.html
@@ -71,7 +71,7 @@
<hr />
-<& /Elements/Submit, Label => loc('Update'), CheckAll => 1, ClearAll => 1 &>
+<& /Elements/Submit, Label => loc('Update'), CheckboxNameRegex => '/^UpdateTicket\d+$/', CheckAll => 1, ClearAll => 1 &>
<br />
<&|/Widgets/TitleBox, title => $title &>
<table>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list