summaryrefslogtreecommitdiff
path: root/rt/html/Elements
diff options
context:
space:
mode:
authorivan <ivan>2008-03-03 23:07:58 +0000
committerivan <ivan>2008-03-03 23:07:58 +0000
commit479339313bbda612f8fe939217fd067999ef36d4 (patch)
treea47e2fbdc0107910bbbd3b57dc0cbfc357f76aa3 /rt/html/Elements
parent642d85fc54b066e6364b66644b95c7b123ba8e24 (diff)
merge in rt 3.4.6. *gulp*!
Diffstat (limited to 'rt/html/Elements')
-rw-r--r--rt/html/Elements/CollectionAsTable/ParseFormat8
-rw-r--r--rt/html/Elements/EditCustomFieldSelect2
-rw-r--r--rt/html/Elements/QuickCreate2
-rw-r--r--rt/html/Elements/Quicksearch10
-rw-r--r--rt/html/Elements/SelectNewTicketQueue2
-rw-r--r--rt/html/Elements/ShowCustomFields40
6 files changed, 35 insertions, 29 deletions
diff --git a/rt/html/Elements/CollectionAsTable/ParseFormat b/rt/html/Elements/CollectionAsTable/ParseFormat
index 57434efe2..be56dea76 100644
--- a/rt/html/Elements/CollectionAsTable/ParseFormat
+++ b/rt/html/Elements/CollectionAsTable/ParseFormat
@@ -48,7 +48,7 @@ $Format
</%ARGS>
<%init>
-use Regexp::Common;
+use Regexp::Common qw/delimited/;
my @Columns;
while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) {
@@ -59,7 +59,9 @@ while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) {
substr($col,-1,1) = "";
}
- my $colref;
+ my $colref = {
+ title => '',
+ };
if ( $col =~ s!/STYLE:([^/]+)!!io ) {
$colref->{'style'} = $1;
@@ -88,7 +90,7 @@ while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) {
$colref->{'attribute'} = $col;
}
- if ( !$colref->{'title'} && grep { /^__(.*?)__$/io }
+ if ( !$colref->{'title'} && grep { /^__(.+?)__$/io }
@{ $colref->{'output'} } )
{
$colref->{'title'} = $1;
diff --git a/rt/html/Elements/EditCustomFieldSelect b/rt/html/Elements/EditCustomFieldSelect
index 2a2a64a1d..5dd4d0d69 100644
--- a/rt/html/Elements/EditCustomFieldSelect
+++ b/rt/html/Elements/EditCustomFieldSelect
@@ -51,7 +51,7 @@
% while ($CFVs and my $value = $CFVs->Next ) {
<option value="<%$value->Name%>"
% if ($Values) {
- <% $Values->HasEntry($value->Name) && ($selected = 1) && 'SELECTED' %>
+ <% ($Values->HasEntry($value->Name)||'') && ($selected = 1) && 'SELECTED' %>
% } elsif ($Default) {
<% (ref $Default ? (grep {$_ eq $value->Name} @{$Default}) : ($Default eq $value->Name))
&& ($selected = 1) && 'SELECTED' %>
diff --git a/rt/html/Elements/QuickCreate b/rt/html/Elements/QuickCreate
index 0b97121a4..8fdce4cbc 100644
--- a/rt/html/Elements/QuickCreate
+++ b/rt/html/Elements/QuickCreate
@@ -52,7 +52,7 @@
<font size="-2"><&|/l&>Subject</&>:<br><input size="30" name="Subject"></font>
</td>
<td>
-<font size="-2"><&|/l&>Queue</&>:<br><& /Elements/SelectQueue, Name => 'Queue', ShowNullOption => 0 &></font>
+<font size="-2"><&|/l&>Queue</&>:<br><& /Elements/SelectNewTicketQueue, Name => 'Queue' &></font>
</td>
<td>
<font size="-2"><&|/l&>Owner</&>:<br>
diff --git a/rt/html/Elements/Quicksearch b/rt/html/Elements/Quicksearch
index d54f72e88..5f1af0f2d 100644
--- a/rt/html/Elements/Quicksearch
+++ b/rt/html/Elements/Quicksearch
@@ -57,12 +57,10 @@ my $i;
while (my $queue = $Queues->Next) {
next unless ($queue->CurrentUserHasRight('ShowTicket'));
- my $name = $queue->Name;
- $name =~ s|(['\\])|\\$1|g;
-
- my $new_q = "Queue = '$name' AND Status = 'new'";
- my $open_q = "Queue = '$name' AND Status = 'open'";
- my $all_q = "Queue = '$name' AND (Status = 'open' OR Status = 'new')";
+ my $qid = $queue->Id;
+ my $new_q = "Queue = '$qid' AND Status = 'new'";
+ my $open_q = "Queue = '$qid' AND Status = 'open'";
+ my $all_q = "Queue = '$qid' AND (Status = 'open' OR Status = 'new')";
$Tickets->FromSQL($open_q);
my $open = $Tickets->Count();
diff --git a/rt/html/Elements/SelectNewTicketQueue b/rt/html/Elements/SelectNewTicketQueue
index d47b58a83..51b89b2a6 100644
--- a/rt/html/Elements/SelectNewTicketQueue
+++ b/rt/html/Elements/SelectNewTicketQueue
@@ -48,7 +48,7 @@
% foreach my $queue (@{$session{'create_in_queues'}}) {
<OPTION
VALUE="<%$queue->{'id'}%>"
- <%$Default && ($queue->{'id'} == $Default) && 'SELECTED'%>>
+ <% $Default && $queue->{'id'} == $Default ? 'SELECTED': ''%>>
<%$queue->{'Name'}%>
% if (($Verbose) and ($queue->{'Description'}) ){
(<%$queue->{'Description'}%>)
diff --git a/rt/html/Elements/ShowCustomFields b/rt/html/Elements/ShowCustomFields
index 986184120..199fe3606 100644
--- a/rt/html/Elements/ShowCustomFields
+++ b/rt/html/Elements/ShowCustomFields
@@ -44,36 +44,42 @@
%#
%# END BPS TAGGED BLOCK }}}
<table>
-% my @entry_fields;
-% while (my $CustomField = $CustomFields->Next()) {
-% my $Values = $Object->CustomFieldValues($CustomField->Id);
+% while ( my $CustomField = $CustomFields->Next ) {
+% my $Values = $Object->CustomFieldValues( $CustomField->Id );
+% my $count = $Values->Count;
<tr>
- <td class="label"><%$CustomField->Name%>:</td>
+ <td class="label"><% $CustomField->Name %>:</td>
<td class="value">
+% unless ( $count ) {
+<i><&|/l&>(no value)</&></i>
+% } elsif ( $count == 1 ) {
+% $print_value->( $CustomField, $Values->First );
+% } else {
<ul>
-% while (my $Value = $Values->Next()) {
-<li>
-% my $comp = "ShowCustomField".$CustomField->Type;
-% if ($m->comp_exists($comp)) {
-<& $comp, Object => $Value &>
-% } else {
-<%$Value->Content%>
-% }
-</li>
-% }
-% unless ($Values->Count()) {
-<li><i><&|/l&>(no value)</&></i></li>
+% while ( my $Value = $Values->Next ) {
+<li><% $print_value->( $CustomField, $Value ) |n %></li>
% }
</ul>
+% }
</td>
</tr>
% }
</table>
<%INIT>
my $CustomFields = $Object->CustomFields;
- $m->comp('/Elements/Callback', _CallbackName => 'MassageCustomFields',
+$m->comp('/Elements/Callback', _CallbackName => 'MassageCustomFields',
CustomFields => $CustomFields);
+my $print_value = sub {
+ my ($cf, $value) = @_;
+ my $comp = "ShowCustomField". $cf->Type;
+ if ( $m->comp_exists( $comp ) ) {
+ $m->comp( $comp, Object => $value );
+ } else {
+ $m->print( $value->Content );
+ }
+};
+
</%INIT>
<%ARGS>
$Object => undef