[Bps-public-commit] rt-extension-formtools branch, master, updated. 0.15-4-g53e11cd
Alex Vandiver
alexmv at bestpractical.com
Wed May 7 21:13:32 EDT 2014
The branch, master has been updated
via 53e11cdcf27e0f871b5bd5be8847df17b36cbf5f (commit)
via 8e65309b293ac6d01efd6f0b6dd0f84857a79ac6 (commit)
via 918aa29040f4f84feb6de868245315c439d3bf5a (commit)
via b70f5ea47135fc7e505fc4c717838fd2645c2f80 (commit)
from 04db8203c29f148e9701ee1e77a23dbc7ca2317a (commit)
Summary of changes:
META.yml | 2 +-
html/FormTools/Field | 36 +++++++++++++++++++++---------------
lib/RT/Extension/FormTools.pm | 2 +-
3 files changed, 23 insertions(+), 17 deletions(-)
- Log -----------------------------------------------------------------
commit b70f5ea47135fc7e505fc4c717838fd2645c2f80
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed May 7 20:50:34 2014 -0400
Use GetCustomFieldInputName when possible (4.2.3 and later)
diff --git a/html/FormTools/Field b/html/FormTools/Field
index 8052769..4037e2c 100644
--- a/html/FormTools/Field
+++ b/html/FormTools/Field
@@ -28,10 +28,6 @@ my @values;
$queue = $ticket->QueueObj
if !$queue && $ticket;
-my $NamePrefix = "Object-RT::Ticket-"
- . ($ticket ? $ticket->id : '')
- . "-CustomField-";
-
my $input_name = '';
if ( RT::Extension::FormTools::is_core_field($name) ) {
$field_type = 'core';
@@ -63,7 +59,17 @@ if ( RT::Extension::FormTools::is_core_field($name) ) {
$default ||= $values[0];
}
- $input_name = $NamePrefix . $cf->id .'-Value';
+ if (RT::Interface::Web->can("GetCustomFieldInputName")) {
+ $input_name = GetCustomFieldInputName(
+ Object => $ticket,
+ CustomField => $cf,
+ );
+ } else {
+ $input_name = "Object-RT::Ticket-"
+ . ($ticket ? $ticket->id : '')
+ . "-CustomField-" . $cf->id .'-Value';
+ $input_name .= "s" if $render_as =~ /^(radio|check|boolean)/
+ }
}
@@ -164,14 +170,14 @@ $ } else {
% } else { # CF
% unless ($render_as eq 'normal') {
-<input type="hidden" class="hidden" name="<%$NamePrefix . $cf->Id %>-Values-Magic" value="1" />
+<input type="hidden" class="hidden" name="<% $input_name %>-Magic" value="1" />
% }
% if ($render_as eq 'hidden') {
<input type="hidden" class="hidden" name=<% $input_name %> value="<% $default %>">
% } elsif ($render_as eq 'normal') {
- <& /Elements/EditCustomField, Object => $queue, CustomField => $cf, NamePrefix => $NamePrefix,
+ <& /Elements/EditCustomField, Object => $queue, CustomField => $cf,
($cf->Type =~ /text/i) ? (Cols => $cols ||60) : (),
($cf->Type =~ /freeform/i) ? (Cols => $cols ||30) : (),
Rows => $rows || 6,
@@ -184,7 +190,7 @@ $ } else {
% } elsif ($render_as =~ /^radio/) {
% my $selected = 0;
% if ($empty_allowed) {
- <input type="radio" name="<% $input_name %>s" value="" <% !$default ? 'CHECKED' : '' %>><span class="radio-label"><&|/l&>(no value)</&></span>
+ <input type="radio" name="<% $input_name %>" value="" <% !$default ? 'CHECKED' : '' %>><span class="radio-label"><&|/l&>(no value)</&></span>
% if ($render_as =~ /vertical/) {
<br/>
% }
@@ -192,7 +198,7 @@ $ } else {
% }
% my $CFVs = $cf->Values;
% while ($CFVs and my $value = $CFVs->Next ) {
- <input type="radio" name="<% $input_name %>s" value="<%$value->Name%>"
+ <input type="radio" name="<% $input_name %>" value="<%$value->Name%>"
% if ($default) {
% if (ref $default) {
<% (grep { $_ eq $value->Name} @$default) ? 'CHECKED' : '' %>
@@ -210,7 +216,7 @@ $ } else {
% } elsif ($render_as =~ /^check/i) {
% my $CFVs = $cf->Values;
% while ($CFVs and my $value = $CFVs->Next ) {
- <input type="checkbox" name="<% $input_name %>s" value="<%$value->Name%>"
+ <input type="checkbox" name="<% $input_name %>" value="<%$value->Name%>"
% if ($default) {
% if (ref $default) {
<% (grep { $_ eq $value->Name} @$default) ? 'CHECKED' : '' %>
@@ -231,7 +237,7 @@ $ } else {
% }
% } elsif ($render_as =~ /^boolean/i) {
% my $value = 'Yes';
- <input type="checkbox" name="<% $input_name %>s" value="<% $value %>"
+ <input type="checkbox" name="<% $input_name %>" value="<% $value %>"
% my $checked = 0;
% if ($default) {
% $checked = ref $default? (grep { $_ eq $value} @$default) : $default eq $value;
commit 918aa29040f4f84feb6de868245315c439d3bf5a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed May 7 20:55:07 2014 -0400
Don't use ->can on DBIx::SearchBuilder::Record objects, as they build methods on the fly
diff --git a/html/FormTools/Field b/html/FormTools/Field
index 4037e2c..9f8953b 100644
--- a/html/FormTools/Field
+++ b/html/FormTools/Field
@@ -34,7 +34,7 @@ if ( RT::Extension::FormTools::is_core_field($name) ) {
my $res = $m->notes(
core_fields_on_page => [ @{$m->notes('core_fields_on_page')||[]}, $name ] );
$field_label ||= $name;
- $default ||= $ticket->$name if $ticket && $ticket->can($name);
+ $default ||= $ticket->$name if $ticket && $ticket->_Accessible($name, 'read');
$input_name = $name;
} else {
commit 8e65309b293ac6d01efd6f0b6dd0f84857a79ac6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed May 7 20:59:46 2014 -0400
Use EmailInput for email addresses, for autocompletion
diff --git a/html/FormTools/Field b/html/FormTools/Field
index 9f8953b..af51f88 100644
--- a/html/FormTools/Field
+++ b/html/FormTools/Field
@@ -159,12 +159,12 @@ $default = '' unless defined $default;
% }
% }
+% } elsif ($name =~ /^(Requestors|Cc|AdminCc)$/ ) {
+<& /Elements/EmailInput, Name => $name, Size => ($cols||20), Default => $default, AutocompleteMultiple => 1 &>
% } elsif ( $name eq "Due" ) {
<& /Elements/SelectDate, Name => $name, Default => $default, current => 0, Size => ($cols || 20) &>
$ } else {
-
-<input type="text" name=<%$name%> size="<% $cols || 20 %>" value="<%$default%>">
-
+<input type="text" name="<%$name%>" size="<% $cols || 20 %>" value="<%$default%>">
% }
% } else { # CF
commit 53e11cdcf27e0f871b5bd5be8847df17b36cbf5f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed May 7 21:12:19 2014 -0400
Releng for 0.16
diff --git a/META.yml b/META.yml
index 3666893..f56a62a 100644
--- a/META.yml
+++ b/META.yml
@@ -16,4 +16,4 @@ no_index:
directory:
- html
- inc
-version: 0.14
+version: 0.16
diff --git a/lib/RT/Extension/FormTools.pm b/lib/RT/Extension/FormTools.pm
index 385be09..1774a36 100644
--- a/lib/RT/Extension/FormTools.pm
+++ b/lib/RT/Extension/FormTools.pm
@@ -3,7 +3,7 @@ use strict;
package RT::Extension::FormTools;
-our $VERSION = '0.15';
+our $VERSION = '0.16';
=head2 is_core_field
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list