[Rt-commit] rtir branch, 2.9-trunk, updated. ba5ef7a7b7ee36f3a20a0f5ff95aaf2c4d0510a2

Ruslan Zakirov ruz at bestpractical.com
Wed Jul 20 20:02:22 EDT 2011


The branch, 2.9-trunk has been updated
       via  ba5ef7a7b7ee36f3a20a0f5ff95aaf2c4d0510a2 (commit)
       via  d92fefa7b8651462d1e7fe10c6828bd04711e19c (commit)
       via  d4753fce12682c16b00168ae638fd21dba2ca151 (commit)
       via  6d6fc68289d9bce81ca257222048ee402845944f (commit)
       via  56ba745932895290a1629d050407a4c16c00977f (commit)
       via  7e44e3d3ea535b01d959103dcd3cf18cf1ddec69 (commit)
       via  f2adb6166a562760e6d465b4f32cae7106db3231 (commit)
       via  08c99ee5c958479d5de860ea4871d38fad6feb06 (commit)
      from  2548b9999799e618336e7fff135faca235bc0912 (commit)

Summary of changes:
 TODO.porting_over_RT4                   |    3 -
 html/RTIR/Advanced.html                 |   24 +-
 html/RTIR/Create.html                   |  339 ++++++++++++++++++-------------
 html/RTIR/Edit.html                     |    5 +-
 html/RTIR/Elements/UpdateData           |    2 +-
 html/RTIR/Incident/Create.html          |   14 +-
 html/RTIR/Incident/Edit.html            |    5 +-
 html/RTIR/Incident/Elements/Create      |    2 +-
 html/RTIR/Incident/Elements/ReplyForm   |    6 +-
 html/RTIR/Investigation/Elements/Create |   14 +-
 html/RTIR/Update.html                   |    5 +-
 11 files changed, 247 insertions(+), 172 deletions(-)

- Log -----------------------------------------------------------------
commit 08c99ee5c958479d5de860ea4871d38fad6feb06
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Jul 13 15:39:41 2011 +0400

    use EmailInput to get autocompletion

diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 9799eeb..10bfcf3 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -115,23 +115,30 @@
   </tr>
   <tr>
     <td class="label"><&|/l&>Correspondents</&>:</td>
-    <td class="value"><input name="Requestors" value="<% $ARGS{'Requestors'} || '' %>" size="40" /></td>
+    <td class="value"><& /Elements/EmailInput,
+        Name => 'Requestors', Default => $ARGS{'Requestors'}, Size => undef,
+    &></td>
     <td class="label">
       <input type="checkbox" name="SkipNotification" value="Requestors" <% (grep $_ eq 'Requestors', @SkipNotification)? 'checked': '' %> />
       <&|/l&>Don't send any emails to correspondents.</&>
     </td>
   </tr>
+
 % $m->callback( CallbackName => 'AfterRequestors', ARGSRef => \%ARGS );
   <tr>
     <td class="label"><&|/l&>Cc</&>:</td>
-    <td class="value"><input name="Cc" value="<% $ARGS{'Cc'} || '' %>" size="40" /></td>
+    <td class="value"><& /Elements/EmailInput,
+        Name => 'Cc', Default => $ARGS{'Cc'}, Size => undef,
+    &></td>
     <td><i><font size="-2">
         <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people <b>will</b> receive future updates.)</&>
     </font></i></td>
   </tr>
   <tr>
     <td class="label"><&|/l&>Admin Cc</&>:</td>
-    <td class="value"><input name="AdminCc" value="<% $ARGS{'AdminCc'} || '' %>" size="40" /></td>
+    <td class="value"><& /Elements/EmailInput,
+        Name => 'AdminCc', Default => $ARGS{'AdminCc'}, Size => undef,
+    &></td>
     <td><i><font size="-2">
         <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people <b>will</b> receive future updates.)</&>
     </font></i></td>

commit f2adb6166a562760e6d465b4f32cae7106db3231
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Jul 13 15:57:30 2011 +0400

    move elements on create page to follow RT

diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 10bfcf3..e487282 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -48,132 +48,148 @@
 
 <& /Elements/GnuPG/SignEncryptWidget:ShowIssues, self => $gnupg_widget &>
 
-<&| /Widgets/TitleBox, title => $Title &>
-<table border="0" cellpadding="0" cellspacing="2">
+<div id="ticket-create-metadata">
+<&| /Widgets/TitleBox, title => loc("Basics"), class=>'ticket-info-basics' &>
+<table width="100%" border="0">
+
 % if ( $Incident ) {
-  <tr>
-    <td align="right"><&|/l&>Incident</&>:</td>
-    <td colspan="2"><% $Incident %><input type="hidden" name="Incident" value="<% $Incident || '' %>" /></td>
+  <tr class="incident">
+    <td class="label"><&|/l&>Incident</&>:</td>
+    <td class="value"><% $Incident %><input type="hidden" name="Incident" value="<% $Incident || '' %>" /></td>
   </tr>
 % } elsif ( $SplitObj ) {
-  <tr>
-    <td align="right"><&|/l&>Split from</&>:</td>
-    <td colspan="2"><% $SplitObj->id %></td>
+  <tr class="split">
+    <td class="label"><&|/l&>Split from</&>:</td>
+    <td class="value"><% $SplitObj->id %></td>
   </tr>
 % if ( $parentvalue ) {
-  <tr>
-    <td align="right"><&|/l&>Will be linked to Incident(s)</&>:</td>
-    <td colspan="2"><% $parentvalue %></td>
+  <tr class="incident">
+    <td class="label"><&|/l&>Will be linked to Incident(s)</&>:</td>
+    <td class="value"><% $parentvalue %></td>
   </tr>
 % }
 % } else {
-  <tr>
+  <tr class="incident">
     <td class="label"><&|/l&>Incident</&>:</td>
     <td class="value"><input name="Incident" size="16" maxsize="16" value="<% $Incident || '' %>" /></td>
-    <td><i><font size="-2">
-        (<&|/l&>Id of an Incident to link a new ticket to</&>. <% $Type eq 'Block'? '<strong>'.loc('Required').'</strong>': loc('Optional') |n %>.)
-    </font></i></td>
   </tr>
-% }
   <tr>
-    <td class="label"><&|/l&>Status</&>:</td>
-    <td colspan="2">
-      <& /Elements/SelectStatus,
-          Name => 'Status',
-          QueueObj => $QueueObj,
-          DefaultValue => 0,
-#          Default => 'new',
-      &>
+    <td class="label">&nbsp;</td>
+    <td class="comment">
+        (<&|/l&>Id of an Incident to link a new ticket to</&>. <% $Type eq 'Block'? '<strong>'.loc('Required').'</strong>': loc('Optional') |n %>.)
     </td>
   </tr>
+% }
+
+  <& /Ticket/Elements/EditBasics,
+    InTable => 1,
+    fields  => [
+        {
+            name => 'Status',
+            comp => '/Elements/SelectStatus',
+            args => {
+                Name         => "Status",
+                Default      => $ARGS{Status} || $QueueObj->Lifecycle->DefaultOnCreate,
+                DefaultValue => 0,
+                SkipDeleted  => 1,
+                QueueObj     => $QueueObj,
+            },
+        },
+        {
+            name => 'Owner',
+            comp => '/Elements/SelectOwner',
+            args => {
+                Name            => "Owner",
+                Default         => $ARGS{Owner} || $session{'CurrentUser'}->id || RT->Nobody->Id,
+                DefaultValue    => 0,
+                QueueObj        => $QueueObj,
+            },
+        },
+    ],
+  &>
+
+% if ( $constituency_cf ) {
   <tr>
-    <td class="label"><&|/l&>Owner</&>:</td>
-    <td colspan="2">
-      <& /Elements/SelectOwner, 
-          Name => "Owner", 
-          QueueObj => $QueueObj, 
-          Default => $ARGS{Owner}||$session{'CurrentUser'}->Id||undef &>
+    <td class="label"><&|/l&>Constituency</&>:</td>
+    <td class="value">
+% if ( !$Incident || RT->Config->Get('_RTIR_Constituency_Propagation') eq 'no' ) {
+% my $default;
+% $default = $IncidentObj->FirstCustomFieldValue('Constituency') if $Incident;
+% $default ||= RT::IR::DefaultConstituency( $QueueObj );
+% $default ||= scalar RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
+      <& /RTIR/Elements/EditRTIRField, 
+         QueueObj => $QueueObj, 
+         Name     => 'Constituency',
+         Default  => $default &>
+% } else {
+% #TODO: hacks, we need way to define CF value on Create, but don't allow user to change it
+      <input type="hidden" class="hidden" name="<% $constituency_field %>-Magic" value="1" />
+      <input type="hidden" class="hidden" name="<% $constituency_field %>" value="<% $IncidentObj->FirstCustomFieldValue('Constituency') %>" />
+      <& /RTIR/Elements/ShowRTIRField, Ticket => $IncidentObj, Name => 'Constituency' &>
+% }
     </td>
   </tr>
+% }
+
+  <& /RTIR/Elements/EditCustomFields, 
+    TicketObj => $SplitObj, 
+    QueueObj => $QueueObj,
+    $Split ? ( OnCreate => 1 ) : (),
+    $IncidentObj ? ( IncidentObj => $IncidentObj ) : (),
+    AsTable => 1,
+  &>
+</table></&></div>
+
+<div id="ticket-create-message">
+<&| /Widgets/TitleBox, title => $Title, class => 'messagedetails' &>
+<table width="100%" border="0">
+
   <tr>
     <td class="label"><&|/l&>Subject</&>:</td>
     <td class="value" colspan="2">
       <input name="Subject" size="60" maxsize="100" value="<% $Subject || ''%>" />
     </td>
   </tr>
-  <tr>
-    <td align="right" class="label"><&|/l&>Time Worked</&>:</td>
-    <td colspan="2">
-      <table>
-      <tr>
-        <td><input size="3" name="TimeWorked" value="<% $ARGS{'TimeWorked'} || '' %>" /></td>
-        <td align="right" class="label"><&|/l&>Time Left</&>:</td>
-        <td><input size="3" name="TimeLeft" value="<% $ARGS{'TimeLeft'} || '' %>" /></td>
-      </tr>
-      </table>
-    </td>
-  </tr>
+
   <tr>
     <td class="label"><&|/l&>Correspondents</&>:</td>
     <td class="value"><& /Elements/EmailInput,
         Name => 'Requestors', Default => $ARGS{'Requestors'}, Size => undef,
     &></td>
-    <td class="label">
+  </tr>
+  <tr>
+    <td class="label">&nbsp;</td>
+    <td class="comment">
       <input type="checkbox" name="SkipNotification" value="Requestors" <% (grep $_ eq 'Requestors', @SkipNotification)? 'checked': '' %> />
       <&|/l&>Don't send any emails to correspondents.</&>
     </td>
   </tr>
-
 % $m->callback( CallbackName => 'AfterRequestors', ARGSRef => \%ARGS );
+
   <tr>
     <td class="label"><&|/l&>Cc</&>:</td>
     <td class="value"><& /Elements/EmailInput,
         Name => 'Cc', Default => $ARGS{'Cc'}, Size => undef,
     &></td>
-    <td><i><font size="-2">
+  </tr>
+  <tr>
+    <td class="label">&nbsp;</td>
+    <td class="comment"><i><font size="-2">
         <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people <b>will</b> receive future updates.)</&>
     </font></i></td>
   </tr>
+
   <tr>
     <td class="label"><&|/l&>Admin Cc</&>:</td>
     <td class="value"><& /Elements/EmailInput,
         Name => 'AdminCc', Default => $ARGS{'AdminCc'}, Size => undef,
     &></td>
-    <td><i><font size="-2">
-        <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people <b>will</b> receive future updates.)</&>
-    </font></i></td>
-  </tr>
-% if ( $constituency_cf ) {
-  <tr>
-    <td class="labeltop"><&|/l&>Constituency</&>:</td>
-    <td class="value" colspan="2">
-% if ( !$Incident || RT->Config->Get('_RTIR_Constituency_Propagation') eq 'no' ) {
-% my $default;
-% $default = $IncidentObj->FirstCustomFieldValue('Constituency') if $Incident;
-% $default ||= RT::IR::DefaultConstituency( $QueueObj );
-% $default ||= scalar RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
-      <& /RTIR/Elements/EditRTIRField, 
-         QueueObj => $QueueObj, 
-         Name     => 'Constituency',
-         Default  => $default &>
-% } else {
-% #TODO: hacks, we need way to define CF value on Create, but don't allow user to change it
-      <input type="hidden" class="hidden" name="<% $constituency_field %>-Magic" value="1" />
-      <input type="hidden" class="hidden" name="<% $constituency_field %>" value="<% $IncidentObj->FirstCustomFieldValue('Constituency') %>" />
-      <& /RTIR/Elements/ShowRTIRField, Ticket => $IncidentObj, Name => 'Constituency' &>
-% }
-    </td>
   </tr>
-% }
   <tr>
-    <td colspan="3">
-      <& /RTIR/Elements/EditCustomFields, 
-        TicketObj => $SplitObj, 
-        QueueObj => $QueueObj,
-        $Split ? ( OnCreate => 1 ) : (),
-        $IncidentObj ? ( IncidentObj => $IncidentObj ) : (),
-      &>
-    </td>
+    <td class="label">&nbsp;</td>
+    <td class="comment"><i><font size="-2">
+        <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people <b>will</b> receive future updates.)</&>
+    </font></i></td>
   </tr>
 
   <tr><td colspan="3"><& SELF:AttachmentsForm &></td><tr>
@@ -240,8 +256,21 @@
     </&>
     </td>
   </tr>
-</table>
-</&>
+
+  <tr>
+    <td align="right" class="label"><&|/l&>Time Worked</&>:</td>
+    <td colspan="2">
+      <table>
+      <tr>
+        <td><input size="3" name="TimeWorked" value="<% $ARGS{'TimeWorked'} || '' %>" /></td>
+        <td align="right" class="label"><&|/l&>Time Left</&>:</td>
+        <td><input size="3" name="TimeLeft" value="<% $ARGS{'TimeLeft'} || '' %>" /></td>
+      </tr>
+      </table>
+    </td>
+  </tr>
+
+</table></&></div>
 
 <& /Elements/Submit, Name => "Create", Label => $SubmitCaption &>
 </form>

commit 7e44e3d3ea535b01d959103dcd3cf18cf1ddec69
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Jul 14 04:47:07 2011 +0400

    support RT's DeleteAttach-XXX and Attach arguments
    
    RT has /Ticket/Elements/AddAttachments we can re-use, but
    arguments are old and we have to support them

diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index e487282..8066f1a 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -450,30 +450,36 @@ $Attachment => '';
 
 my @results;
 
-$session{'Attachments'} ||= {};
-
 # deal with deleting uploaded attachments
-foreach ( grep $_ && exists $session{'Attachments'}{ $_ }, @DeleteAttachments ) {
+foreach (
+    grep $_ && exists $session{'Attachments'}{ $_ },
+    @DeleteAttachments,
+    map { /^DeleteAttach-(.*)$/; $1 } keys %ARGS,
+) {
     delete $session{'Attachments'}{ $_ };
     push @results, loc("Deleted attachment '[_1]'", $_ );
     $session{'i'}++;
 }
 
 # store the uploaded attachment in session
-if ( $Attachment ) {
-    my $filename = "$Attachment";
+foreach my $field ( 'Attach', 'Attachment' ) {
+    next unless $ARGS{ $field };
+
+    my $filename = "$ARGS{ $field }";
     $filename =~ s{^.*[\\/]}{};
 
     my $entity = MakeMIMEEntity(
         Subject             => $filename,
         Body                => '',
-        AttachmentFieldName => 'Attachment'
+        AttachmentFieldName => $field,
     );
     $session{'Attachments'}{ $filename } = $entity;
     push @results, loc("Added attachment '[_1]'", $filename );
     $session{'i'}++;
 }
 
+delete $session{'Attachments'} if $session{'Attachments'} && !%{ $session{'Attachments'} };
+
 return @results;
 </%INIT>
 </%METHOD>

commit 56ba745932895290a1629d050407a4c16c00977f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Jul 14 04:51:42 2011 +0400

    use RT's AddAttachments element

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index a4e080b..d468a73 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -36,9 +36,6 @@
 
 * scan code for hardcoded statuses
 
-* look at attachments processing, however new cool attachments processing
-  code is only in 4.2 branch
-
 * protection from mail loops by filtering watchers' email addresses on
   Create/PeopleModify, like we have in RT
 
diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 8066f1a..d25c682 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -192,8 +192,6 @@
     </font></i></td>
   </tr>
 
-  <tr><td colspan="3"><& SELF:AttachmentsForm &></td><tr>
-
 % if ( $Type eq "Investigation" && $IncidentObj ) {
   <tr><td colspan="3"><& /RTIR/Elements/AttachReports, Ticket => $IncidentObj &></td><tr>
 % }
@@ -240,8 +238,10 @@
 % }
     </td>
   </tr>
-  <tr>
-    <td valign="top" colspan="3">
+
+  <& /Ticket/Elements/AddAttachments, %ARGS, QueueObj => $QueueObj &>
+
+  <tr><td colspan="2">
     <&| /Widgets/TitleBox, title => loc("Dates"), class => 'ticket-info-dates' &>
       <table border="0">
         <tr>
@@ -483,30 +483,3 @@ delete $session{'Attachments'} if $session{'Attachments'} && !%{ $session{'Attac
 return @results;
 </%INIT>
 </%METHOD>
-
-<%METHOD AttachmentsForm>
-
-<table>
-
-% my $has_files = exists $session{'Attachments'} && keys %{ $session{'Attachments'} };
-% if ( $has_files ) {
-<tr><td><&|/l&>Attached file</&>:</td>
-<td>
-<&|/l&>Check box to delete</&><br />
-<ul class="files">
-% foreach my $name ( keys %{$session{'Attachments'}} ) {
-<li><input type="checkbox" name="DeleteAttachments" value="<% $name %>" /><% $name %></li>
-% }
-</ul>
-</td></tr>
-% }
-
-<tr><td class="label"><&|/l&>Attach file</&>:</td>
-<td class="value">
-<input type="file" name="Attachment" />
-<input type="submit" name="AddAttachment" value="<% $has_files? loc('Add/Delete Files'): loc('Add More Files') %>" />
-</td></tr>
-
-</table>
-
-</%METHOD>
diff --git a/html/RTIR/Elements/UpdateData b/html/RTIR/Elements/UpdateData
index 1b1a66c..38b4df7 100644
--- a/html/RTIR/Elements/UpdateData
+++ b/html/RTIR/Elements/UpdateData
@@ -27,7 +27,7 @@
 <& /Ticket/Elements/UpdateCc, %ARGS, TicketObj => $Ticket &>
 % }
 
-<tr><td colspan="2"><& /RTIR/Create.html:AttachmentsForm &></td></tr>
+<& /Ticket/Elements/AddAttachments, %ARGS, QueueObj => $Ticket->QueueObj &>
 
 % if ( $Ticket ) {
 <tr><td colspan="2"><& /RTIR/Elements/AttachReports, Ticket => $Ticket &></td></tr>
diff --git a/html/RTIR/Incident/Elements/Create b/html/RTIR/Incident/Elements/Create
index d9d1724..d89bf69 100644
--- a/html/RTIR/Incident/Elements/Create
+++ b/html/RTIR/Incident/Elements/Create
@@ -60,7 +60,7 @@
     ChildObj => $ChildObj,
 &></td></tr>
 
-<tr><td colspan="2"><& /RTIR/Create.html:AttachmentsForm &></td></tr>
+<& /Ticket/Elements/AddAttachments, %ARGS, QueueObj => $QueueObj &>
 
 <%INIT>
 my $constituency_cf = RT::IR->CustomFields( 'Constituency', Queue => $QueueObj->Name );

commit 6d6fc68289d9bce81ca257222048ee402845944f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Jul 21 01:17:15 2011 +0400

    split RTIR's create page into basics and details

diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index d25c682..1338256 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -22,7 +22,10 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<& /RTIR/Elements/Header, Title => $Title &>
+<& /RTIR/Elements/Header,
+    Title => $Title,
+    onload => "function () { hide('Ticket-Create-details') }",
+&>
 <& /Elements/Tabs &>
 
 % $m->callback(CallbackName => 'BeforeActionList', %ARGS, Actions => \@results, ARGSRef => \%ARGS, Ticket => $SplitObj);
@@ -46,7 +49,12 @@
 
 <a name="top"></a>
 
+% if ( $gnupg_widget ) {
 <& /Elements/GnuPG/SignEncryptWidget:ShowIssues, self => $gnupg_widget &>
+% }
+
+<div id="Ticket-Create-basics">
+<a name="basics"></a>
 
 <div id="ticket-create-metadata">
 <&| /Widgets/TitleBox, title => loc("Basics"), class=>'ticket-info-basics' &>
@@ -145,13 +153,6 @@
 <table width="100%" border="0">
 
   <tr>
-    <td class="label"><&|/l&>Subject</&>:</td>
-    <td class="value" colspan="2">
-      <input name="Subject" size="60" maxsize="100" value="<% $Subject || ''%>" />
-    </td>
-  </tr>
-
-  <tr>
     <td class="label"><&|/l&>Correspondents</&>:</td>
     <td class="value"><& /Elements/EmailInput,
         Name => 'Requestors', Default => $ARGS{'Requestors'}, Size => undef,
@@ -192,19 +193,20 @@
     </font></i></td>
   </tr>
 
-% if ( $Type eq "Investigation" && $IncidentObj ) {
-  <tr><td colspan="3"><& /RTIR/Elements/AttachReports, Ticket => $IncidentObj &></td><tr>
-% }
+  <tr>
+    <td class="label"><&|/l&>Subject</&>:</td>
+    <td class="value"><input type="text" name="Subject" maxsize="200" value="<% $Subject || '' %>" /></td>
+  </tr>
 
 % if ( $gnupg_widget ) {
-  <tr><td>&nbsp;</td><td colspan="2">
+  <tr><td>&nbsp;</td><td class="value">
   <& /Elements/GnuPG/SignEncryptWidget, self => $gnupg_widget, QueueObj => $QueueObj &>
   </td></tr>
 % }
 
   <tr>
-    <td class="labeltop"><&|/l&>Message</&>:</td>
-    <td colspan="2">
+    <td class="label"><&|/l&>Message</&>:</td>
+    <td class="value">
 % my $include_signature = 1;
 % unless (exists $ARGS{Content}) {
 %   my $Transactions;
@@ -241,38 +243,76 @@
 
   <& /Ticket/Elements/AddAttachments, %ARGS, QueueObj => $QueueObj &>
 
-  <tr><td colspan="2">
-    <&| /Widgets/TitleBox, title => loc("Dates"), class => 'ticket-info-dates' &>
-      <table border="0">
-        <tr>
-        <td align="right"><&|/l&>Starts</&>:</td>
-          <td><input size="10" name="Starts" value="<% $ARGS{Starts} || '' %>" /></td>
-        </tr>
-        <tr>
-        <td align="right"><&|/l&>Due</&>:</td>
-        <td><input size="10" name="Due" value="<% $ARGS{Due} || '' %>" /></td>
-        </tr>
-      </table>
-    </&>
-    </td>
-  </tr>
+</table></&>
 
-  <tr>
-    <td align="right" class="label"><&|/l&>Time Worked</&>:</td>
-    <td colspan="2">
-      <table>
-      <tr>
-        <td><input size="3" name="TimeWorked" value="<% $ARGS{'TimeWorked'} || '' %>" /></td>
-        <td align="right" class="label"><&|/l&>Time Left</&>:</td>
-        <td><input size="3" name="TimeLeft" value="<% $ARGS{'TimeLeft'} || '' %>" /></td>
-      </tr>
-      </table>
-    </td>
-  </tr>
+<& /Elements/Submit, Name => "Create", Label => $SubmitCaption &>
+</div></div>
 
-</table></&></div>
+<div id="Ticket-Create-details">
+<a name="details"></a>
+
+
+<&| /Widgets/TitleBox, title => loc("Dates"), class=>'ticket-info-dates' &>
+<table width="100%" border="0">
+<& /Ticket/Elements/EditBasics,
+    InTable => 1,
+    fields  => [
+        {
+            name => 'Starts',
+            comp => '/Elements/SelectDate',
+            args => { Name => 'Starts', Default => $ARGS{'Starts'} || '' },
+        },
+        {
+            name => 'Due',
+            comp => '/Elements/SelectDate',
+            args => { Name => 'Due', Default => $ARGS{'Due'} || '' },
+        },
+    ],
+&>
+</table></&>
+
+<&| /Widgets/TitleBox, title => loc("Time"), class=>'ticket-info-time' &>
+<table width="100%" border="0">
+<& /Ticket/Elements/EditBasics,
+    InTable => 1,
+    fields  => [
+        {
+            name => 'Time Estimated',
+            comp => '/Elements/EditTimeValue',
+            args => {
+                Name    => "TimeEstimated",
+                Default => $ARGS{'TimeEstimated'} || '',
+                InUnits => $ARGS{'TimeEstimated-TimeUnits'},
+            },
+        },
+        {
+            name => 'Time Worked',
+            comp => '/Elements/EditTimeValue',
+            args => {
+                Name    => "TimeWorked",
+                Default => $ARGS{'TimeWorked'} || '',
+                InUnits => $ARGS{'TimeWorked-TimeUnits'},
+            },
+        },
+        {
+            name => 'Time Left',
+            comp => '/Elements/EditTimeValue',
+            args => {
+                Name    => "TimeLeft",
+                Default => $ARGS{'TimeLeft'} || '',
+                InUnits => $ARGS{'TimeLeft-TimeUnits'},
+            },
+        },
+    ],
+&>
+</table></&>
+
+% if ( $Type eq "Investigation" && $IncidentObj ) {
+  <& /RTIR/Elements/AttachReports, Ticket => $IncidentObj &>
+% }
+
+</div>
 
-<& /Elements/Submit, Name => "Create", Label => $SubmitCaption &>
 </form>
 
 <%INIT>
@@ -426,6 +466,9 @@ if ( $Split ) {
     }
 }
 
+PageMenu->child( basics => raw_html =>  q[<a href="#basics" onclick="return switchVisibility('Ticket-Create-basics','Ticket-Create-details');">] . loc('Basics') . q[</a>]);
+PageMenu->child( details => raw_html =>  q[<a href="#details" onclick="return switchVisibility('Ticket-Create-details','Ticket-Create-basics');">] . loc('Details') . q[</a>]);
+
 </%INIT>
 
 <%ARGS>

commit d4753fce12682c16b00168ae638fd21dba2ca151
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Jul 21 01:23:40 2011 +0400

    use SelectDate comp instead of plain inputs

diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 2dccbb2..6ab00b5 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -174,10 +174,10 @@ unless ( exists $ARGS{'Content'} ) {
 <table border="0">
 
     <tr><td align="right"><&|/l&>Starts</&>:</td>
-    <td><input size="10" name="Starts" value="<% $ARGS{'Starts'} || '' %>" /></td></tr>
+    <td><& /Elements/SelectDate, Name => 'Starts', Default => $ARGS{'Starts'} || '' &></td></tr>
     
     <tr><td align="right"><&|/l&>Due</&>:</td>
-    <td><input size="10" name="Due" value="<% $ARGS{'Due'} || '' %>" /></td></tr>
+    <td><& /Elements/SelectDate, Name => 'Due', Default => $ARGS{'Due'} || '' &></td></tr>
 
 </table>
 </&>
diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index 1717258..963a6c5 100644
--- a/html/RTIR/Investigation/Elements/Create
+++ b/html/RTIR/Investigation/Elements/Create
@@ -99,10 +99,10 @@ email addresses. These people <b>will</b> receive future updates.)</&></font></i
 &><table>
 
 <tr><td class="label"><&|/l&>Starts</&>:</td>
-<td class="value"><input size="10" name="<% $NamePrefix %>Starts" value="<% $value_cb->('Starts') %>" /></td></tr>
+<td class="value"><& /Elements/SelectDate, Name => $NamePrefix .'Starts', Default => $value_cb->('Starts') || '' &></td></tr>
 
 <tr><td class="label"><&|/l&>Due</&>:</td>
-<td class="value"><input size="10" name="<% $NamePrefix %>Due" value="<% $value_cb->('Due') %>" /></td></tr>
+<td class="value"><& /Elements/SelectDate, Name => $NamePrefix .'Due', Default => $value_cb->('Due') || '' &></td></tr>
 
 </table></&></td></tr>
 % }

commit d92fefa7b8651462d1e7fe10c6828bd04711e19c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Jul 21 04:00:44 2011 +0400

    InUnits argument is not used, drop it

diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 1338256..ca03938 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -282,7 +282,6 @@
             args => {
                 Name    => "TimeEstimated",
                 Default => $ARGS{'TimeEstimated'} || '',
-                InUnits => $ARGS{'TimeEstimated-TimeUnits'},
             },
         },
         {
@@ -291,7 +290,6 @@
             args => {
                 Name    => "TimeWorked",
                 Default => $ARGS{'TimeWorked'} || '',
-                InUnits => $ARGS{'TimeWorked-TimeUnits'},
             },
         },
         {
@@ -300,7 +298,6 @@
             args => {
                 Name    => "TimeLeft",
                 Default => $ARGS{'TimeLeft'} || '',
-                InUnits => $ARGS{'TimeLeft-TimeUnits'},
             },
         },
     ],

commit ba5ef7a7b7ee36f3a20a0f5ff95aaf2c4d0510a2
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Jul 21 04:01:14 2011 +0400

    use EditTimeValue component

diff --git a/html/RTIR/Advanced.html b/html/RTIR/Advanced.html
index 5deb2f4..76d0d2a 100644
--- a/html/RTIR/Advanced.html
+++ b/html/RTIR/Advanced.html
@@ -19,24 +19,24 @@
 
   <tr>
     <td class="label"><&|/l&>Time Estimated</&>:</td>
-    <td class="value">
-      <input name="TimeEstimated" value="<% $Ticket->TimeEstimated %>" size="5" />
-      <& /Elements/SelectTimeUnits, Name =>'TimeEstimated' &>
-    </td>
+    <td class="value"><& /Elements/EditTimeValue,
+        Name => 'TimeEstimated',
+        Default => $ARGS{'TimeEstimated'} || $Ticket->TimeEstimated || '',
+    &></td>
   </tr>
   <tr>
     <td class="label"><&|/l&>Time Worked</&>:</td>
-    <td class="value">
-      <input name="TimeWorked" value="<% $Ticket->TimeWorked %>" size="5" />
-      <& /Elements/SelectTimeUnits, Name =>'TimeWorked' &>
-    </td>
+    <td class="value"><& /Elements/EditTimeValue,
+        Name => 'TimeWorked',
+        Default => $ARGS{'TimeWorked'} || $Ticket->TimeWorked || '',
+    &></td>
   </tr>
   <tr>
     <td class="label"><&|/l&>Time Left</&>:</td>
-    <td class="value">
-      <input name="TimeLeft" value="<% $Ticket->TimeLeft %>" size="5" />
-      <& /Elements/SelectTimeUnits, Name =>'TimeLeft' &>
-    </td>
+    <td class="value"><& /Elements/EditTimeValue,
+        Name => 'TimeLeft',
+        Default => $ARGS{'TimeLeft'} || $Ticket->TimeLeft || '',
+    &></td>
   </tr>
 
   <tr>
diff --git a/html/RTIR/Edit.html b/html/RTIR/Edit.html
index de7d304..15c5e3e 100644
--- a/html/RTIR/Edit.html
+++ b/html/RTIR/Edit.html
@@ -78,7 +78,10 @@
   </tr>
   <tr>
     <td class="label"><&|/l&>Time Worked</&>:</td>
-    <td class="value"><input name="TimeWorked" value="<%$Ticket->TimeWorked|h%>" size="5" /></td>
+    <td class="value"><& /Elements/EditTimeValue,
+        Name => 'TimeWorked',
+        Default => $ARGS{'TimeWorked'} || $Ticket->TimeWorked || '',
+    &></td>
   </tr>
 % if ( $constituency_cf && ($constituency_propagation ne 'reject' || !$has_parent) ) {
   <tr>
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 6ab00b5..fe3e7a1 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -160,10 +160,16 @@ unless ( exists $ARGS{'Content'} ) {
 </td></tr>
 
     <tr><td align="right"><&|/l&>Time Worked</&>:</td>
-    <td><input size="3" name="TimeWorked" value="<% $ARGS{TimeWorked} || '0' %>" /></td></tr>
+    <td class="value"><& /Elements/EditTimeValue,
+        Name => 'TimeWorked',
+        Default => $ARGS{'TimeWorked'} || '',
+    &></td></tr>
 
     <tr><td align="right"><&|/l&>Time Left</&>:</td>
-    <td><input size="3" name="TimeLeft" value="<% $ARGS{TimeLeft} || '0' %>" /></td></tr>
+    <td class="value"><& /Elements/EditTimeValue,
+        Name => 'TimeLeft',
+        Default => $ARGS{'TimeLeft'} || '',
+    &></td></tr>
 </table>
 </&>
 
diff --git a/html/RTIR/Incident/Edit.html b/html/RTIR/Incident/Edit.html
index 048d481..bc85ecc 100644
--- a/html/RTIR/Incident/Edit.html
+++ b/html/RTIR/Incident/Edit.html
@@ -62,7 +62,10 @@
   </tr>
   <tr>
     <td class="label"><&|/l&>Time Worked</&>:</td>
-    <td class="value"><input name="TimeWorked" value="<%$Ticket->TimeWorked|h%>" size="5" /></td>
+    <td class="value"><& /Elements/EditTimeValue,
+        Name => 'TimeWorked',
+        Default => $ARGS{'TimeWorked'} || $Ticket->TimeWorked || '',
+    &></td>
   </tr>
 % if ( $constituency_cf && ( $constituency_propagation ne 'reject' || !$has_children )) {
   <tr>
diff --git a/html/RTIR/Incident/Elements/ReplyForm b/html/RTIR/Incident/Elements/ReplyForm
index 3b62ac5..197a513 100644
--- a/html/RTIR/Incident/Elements/ReplyForm
+++ b/html/RTIR/Incident/Elements/ReplyForm
@@ -36,8 +36,10 @@
     Default => $Owner || $session{'CurrentUser'}->Id || undef,
 &>
 <&|/l&>Worked</&>:
-<input size="4" name="UpdateTimeWorked" value="<% $ARGS{UpdateTimeWorked} %>" />
-<& /Elements/SelectTimeUnits, Name => 'UpdateTimeWorked-TimeUnits' &>
+<& /Elements/EditTimeValue,
+    Name => 'UpdateTimeWorked',
+    Default => $ARGS{'UpdateTimeWorked'} || '',
+&>
 </td></tr>
 
 <& /RTIR/Elements/UpdateData, %ARGS, Ticket => $TicketObj &>
diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index 963a6c5..a189176 100644
--- a/html/RTIR/Investigation/Elements/Create
+++ b/html/RTIR/Investigation/Elements/Create
@@ -23,9 +23,15 @@
 % unless ( $SkipField{'TimeFields'} ) {
 <tr><td colspan="2"><table><tr>
     <td align="right"><&|/l&>Time Worked</&>:</td>
-    <td><input size="3" name="<% $NamePrefix %>TimeWorked" value="<% $value_cb->('TimeWorked') %>" /></td>
+    <td><& /Elements/EditTimeValue,
+        Name => $NamePrefix .'TimeWorked',
+        Default => $value_cb->('TimeWorked') || '',
+    &></td>
     <td align="right"><&|/l&>Time Left</&>:</td>
-	<td><input size="3" name="<% $NamePrefix %>TimeLeft" value="<% $value_cb->('TimeLeft') %>" /></td>
+    <td><& /Elements/EditTimeValue,
+        Name => $NamePrefix .'TimeLeft',
+        Default => $value_cb->('TimeLeft') || '',
+    &></td>
 </tr></table></td></tr>
 % }
 
diff --git a/html/RTIR/Update.html b/html/RTIR/Update.html
index 22ac64e..91aa1b5 100644
--- a/html/RTIR/Update.html
+++ b/html/RTIR/Update.html
@@ -80,7 +80,10 @@
     Default => ($ARGS{Owner}||$Ticket->Owner()||$session{'CurrentUser'}->Id||undef), 
     QueueObj => $Ticket->QueueObj, 
     TicketObj => $Ticket &>
-<&|/l&>Worked</&>: <input size="4" name="UpdateTimeWorked" value="<% $ARGS{'UpdateTimeWorked'} || '' %>" /><&|/l&>minutes</&>
+<&|/l&>Worked</&>: <& /Elements/EditTimeValue,
+    Name    => 'UpdateTimeWorked',
+    Default => $ARGS{'UpdateTimeWorked'} || $Ticket->TimeWorked || '',
+&>
 </td></tr>
 <tr><td align="right"><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size="60" value="<% $Subject || '' %>" /></td></tr>
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list