[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-220-g15286cb
Thomas Sibley
trs at bestpractical.com
Thu Aug 5 17:16:00 EDT 2010
The branch, 3.9-trunk has been updated
via 15286cbd5a708759bff1fa0b1ecada2d11bdd390 (commit)
from 0a594dff384c4f87ba4a48d01ce4a771f49d9e41 (commit)
Summary of changes:
share/html/Ticket/Elements/EditBasics | 118 +++++++++++++++++---------------
share/html/Ticket/Update.html | 64 +++++++++---------
2 files changed, 96 insertions(+), 86 deletions(-)
- Log -----------------------------------------------------------------
commit 15286cbd5a708759bff1fa0b1ecada2d11bdd390
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Aug 5 17:16:20 2010 -0400
Refactor Ticket/Update.html to use the more extensible EditBasics
EditBasics should probably be refactored further to better support both
use cases (Ticket/Update.html and Ticket/Basics.html) without having to
specify separate field specs.
diff --git a/share/html/Ticket/Elements/EditBasics b/share/html/Ticket/Elements/EditBasics
index 8521354..7f38ff4 100755
--- a/share/html/Ticket/Elements/EditBasics
+++ b/share/html/Ticket/Elements/EditBasics
@@ -47,66 +47,70 @@
%# END BPS TAGGED BLOCK }}}
<%ARGS>
$TicketObj => undef
+ at fields => ()
+$InTable => 0
</%ARGS>
<%INIT>
-my @fields = (
- { name => 'Subject',
- html => '<input name="Subject" value="'.$m->interp->apply_escapes( $TicketObj->Subject, 'h' ).'" size="50" />',
- },
- { name => 'Status',
- comp => '/Elements/SelectStatus',
- args => {
- Name => 'Status',
- DefaultLabel => loc("[_1] (Unchanged)",loc($TicketObj->Status)),
+unless ( @fields ) {
+ @fields = (
+ { name => 'Subject',
+ html => '<input name="Subject" value="'.$m->interp->apply_escapes( $TicketObj->Subject, 'h' ).'" size="50" />',
},
- },
- { name => 'Queue',
- comp => '/Elements/SelectQueue',
- args => {
- Name => 'Queue',
- Default => $TicketObj->QueueObj->Id,
- ShowNullOption => 0,
- }
- },
- { name => 'Owner',
- comp => '/Elements/SelectOwner',
- args => {
- Name => 'Owner',
- QueueObj => $TicketObj->QueueObj,
- TicketObj => $TicketObj,
- Default => $TicketObj->OwnerObj->Id,
- DefaultValue => 0,
- }
- },
- # Time Estimated, Worked, and Left
- (
- map {
- (my $field = $_) =~ s/ //g;
- {
- name => $_,
- comp => '/Elements/EditTimeValue',
- args => {
- Name => $field,
- Default => $TicketObj->$field,
- }
+ { name => 'Status',
+ comp => '/Elements/SelectStatus',
+ args => {
+ Name => 'Status',
+ DefaultLabel => loc("[_1] (Unchanged)",loc($TicketObj->Status)),
+ },
+ },
+ { name => 'Queue',
+ comp => '/Elements/SelectQueue',
+ args => {
+ Name => 'Queue',
+ Default => $TicketObj->QueueObj->Id,
+ ShowNullOption => 0,
}
- } ('Time Estimated', 'Time Worked', 'Time Left')
- ),
- # Priority and Final Priority
- (
- map {
- (my $field = $_) =~ s/ //g;
- {
- name => $_,
- comp => '/Elements/SelectPriority',
- args => {
- Name => $field,
- Default => $TicketObj->$field,
- }
+ },
+ { name => 'Owner',
+ comp => '/Elements/SelectOwner',
+ args => {
+ Name => 'Owner',
+ QueueObj => $TicketObj->QueueObj,
+ TicketObj => $TicketObj,
+ Default => $TicketObj->OwnerObj->Id,
+ DefaultValue => 0,
}
- } ('Priority', 'Final Priority')
- ),
-);
+ },
+ # Time Estimated, Worked, and Left
+ (
+ map {
+ (my $field = $_) =~ s/ //g;
+ {
+ name => $_,
+ comp => '/Elements/EditTimeValue',
+ args => {
+ Name => $field,
+ Default => $TicketObj->$field,
+ }
+ }
+ } ('Time Estimated', 'Time Worked', 'Time Left')
+ ),
+ # Priority and Final Priority
+ (
+ map {
+ (my $field = $_) =~ s/ //g;
+ {
+ name => $_,
+ comp => '/Elements/SelectPriority',
+ args => {
+ Name => $field,
+ Default => $TicketObj->$field,
+ }
+ }
+ } ('Priority', 'Final Priority')
+ ),
+ );
+}
$m->callback( CallbackName => 'MassageFields', %ARGS, TicketObj => $TicketObj, Fields => \@fields );
@@ -120,7 +124,9 @@ for my $field (@fields) {
}
</%INIT>
+% unless ($InTable) {
<table>
+% }
% for my $field (@fields) {
<tr>
<td class="label"><&|/l&><% $field->{'name'} %></&>:</td>
@@ -128,5 +134,7 @@ for my $field (@fields) {
</tr>
% }
% $m->callback( CallbackName => 'EndOfList', TicketObj => $TicketObj, %ARGS, Fields => \@fields );
+% unless ($InTable) {
</table>
+% }
diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index 4c1d1e0..741713b 100755
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -84,36 +84,38 @@
% $m->callback( %ARGS, CallbackName => 'AfterUpdateType' );
</td></tr>
-<tr>
- <td class="label"><&|/l&>Status</&>:</td>
- <td class="value">
- <& /Elements/SelectStatus, Name=>"Status", DefaultLabel => loc("[_1] (Unchanged)", loc($TicketObj->Status)), Default => $ARGS{'Status'} || ($TicketObj->Status eq $DefaultStatus ? undef : $DefaultStatus)&>
- </td>
-</tr>
-
-<tr>
- <td class="label"><&|/l&>Owner</&>:</td>
- <td class="value">
- <& /Elements/SelectOwner,
- Name => "Owner",
- TicketObj => $TicketObj,
- QueueObj => $TicketObj->QueueObj,
- DefaultLabel => loc("[_1] (Unchanged)", $TicketObj->OwnerObj->Name),
- Default => $ARGS{'Owner'}
- &>
- </td>
-</tr>
-
-<tr>
- <td class="label"><&|/l&>Worked</&>:</td>
- <td class="value">
- <& /Elements/EditTimeValue,
- Name => 'UpdateTimeWorked',
- Default => $ARGS{UpdateTimeWorked}||'',
- InUnits => $ARGS{'UpdateTimeWorked-TimeUnits'}||'minutes',
- &>
- </td>
-</tr>
+<& /Ticket/Elements/EditBasics,
+ TicketObj => $TicketObj,
+ InTable => 1,
+ fields => [
+ { name => 'Status',
+ comp => '/Elements/SelectStatus',
+ args => {
+ Name => 'Status',
+ DefaultLabel => loc("[_1] (Unchanged)", loc($TicketObj->Status)),
+ Default => $ARGS{'Status'} || ($TicketObj->Status eq $DefaultStatus ? undef : $DefaultStatus),
+ },
+ },
+ { name => 'Owner',
+ comp => '/Elements/SelectOwner',
+ args => {
+ Name => "Owner",
+ TicketObj => $TicketObj,
+ QueueObj => $TicketObj->QueueObj,
+ DefaultLabel => loc("[_1] (Unchanged)", $TicketObj->OwnerObj->Name),
+ Default => $ARGS{'Owner'}
+ }
+ },
+ { name => 'Worked',
+ comp => '/Elements/EditTimeValue',
+ args => {
+ Name => 'UpdateTimeWorked',
+ Default => $ARGS{UpdateTimeWorked}||'',
+ InUnits => $ARGS{'UpdateTimeWorked-TimeUnits'}||'minutes',
+ }
+ },
+ ]
+&>
% $m->callback( %ARGS, CallbackName => 'AfterWorked', Ticket => $TicketObj );
@@ -163,7 +165,7 @@
<& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket', id => 'SubmitTicket' &>
% if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
- <&|/Widgets/TitleBox, title => loc('Scrips and Recipients') &>
+ <&|/Widgets/TitleBox, title => loc('Scrips and Recipients'), id => 'previewscrips' &>
<& /Ticket/Elements/PreviewScrips, TicketObj => $TicketObj, %ARGS &>
</&>
% }
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list