[Rt-commit] rt branch, 4.2/new-links-element, created. rt-4.1.6-112-g6c50b62

Thomas Sibley trs at bestpractical.com
Wed Jan 23 15:31:57 EST 2013


The branch, 4.2/new-links-element has been created
        at  6c50b62ca0fcb86d436e66a12489608279c68abe (commit)

- Log -----------------------------------------------------------------
commit 6c50b62ca0fcb86d436e66a12489608279c68abe
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Jan 18 19:50:49 2013 -0800

    Use the same "add links" form for both creating and editing tickets
    
    This refactors half of /Elements/EditLinks into /Elements/AddLinks.
    
    The added MaybeRedirectForResults() to ModifyLinks.html is necessary now
    that submitted values are preserved.

diff --git a/share/html/Elements/AddLinks b/share/html/Elements/AddLinks
new file mode 100644
index 0000000..84e3eec
--- /dev/null
+++ b/share/html/Elements/AddLinks
@@ -0,0 +1,110 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%args>
+$Object         => undef
+$CustomFields   => undef
+$Merge          => 0
+$ARGSRef        => $DECODED_ARGS
+</%args>
+<%init>
+my $id = ($Object and $Object->id)
+    ? $Object->id
+    : "new";
+</%init>
+% if (ref($Object) eq 'RT::Ticket') {
+<i><&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.</&>
+<br /><&|/l&>You may enter links to Articles as "a:###", where ### represents the number of the Article.</&>
+% $m->callback( CallbackName => 'ExtraLinkInstructions' );
+</i><br />
+% } elsif (ref($Object) eq 'RT::Queue') {
+<i><&|/l&>Enter queues or URIs to link queues to. Separate multiple entries with spaces.</&>
+</i><br />
+% } else {
+<i><&|/l&>Enter objects or URIs to link objects to. Separate multiple entries with spaces.</&></i><br />
+% }
+<table>
+% if ($Merge) {
+  <tr>
+    <td class="label"><&|/l&>Merge into</&>:</td>
+    <td class="entry"><input name="<%$id%>-MergeInto" value="<% $ARGSRef->{"$id-MergeInto"} || '' %>" /> <i><&|/l&>(only one ticket)</&></i></td>
+  </tr>
+% }
+  <tr>
+    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Depends on'), Relation => 'DependsOn' &>:</td>
+    <td class="entry"><input name="<%$id%>-DependsOn" value="<% $ARGSRef->{"$id-DependsOn"} || '' %>" /></td>
+  </tr>
+  <tr>
+    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Depended on by'), Relation => 'DependedOnBy' &>:</td>
+    <td class="entry"><input name="DependsOn-<%$id%>" value="<% $ARGSRef->{"DependsOn-$id"} || '' %>" /></td>
+  </tr>
+  <tr>
+    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Parents'), Relation => 'Parents' &>:</td>
+    <td class="entry"><input name="<%$id%>-MemberOf" value="<% $ARGSRef->{"$id-MemberOf"} || '' %>" /></td>
+  </tr>
+  <tr>
+    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Children'), Relation => 'Children' &>:</td>
+    <td class="entry"> <input name="MemberOf-<%$id%>" value="<% $ARGSRef->{"MemberOf-$id"} || '' %>" /></td>
+  </tr>
+  <tr>
+    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Refers to'), Relation => 'RefersTo' &>:</td>
+    <td class="entry"><input name="<%$id%>-RefersTo" value="<% $ARGSRef->{"$id-RefersTo"} || '' %>" /></td>
+  </tr>
+  <tr>
+    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Referred to by'), Relation => 'ReferredToBy' &>:</td>
+    <td class="entry"> <input name="RefersTo-<%$id%>" value="<% $ARGSRef->{"RefersTo-$id"} || '' %>" /></td>
+  </tr>
+  <& /Elements/EditCustomFields,
+        Object          => $Object,
+        Grouping        => 'Links',
+        InTable         => 1,
+        ($CustomFields
+            ? (CustomFields => $CustomFields)
+            : ()),
+        &>
+% $m->callback( CallbackName => 'NewLink' );
+</table>
diff --git a/share/html/Elements/EditLinks b/share/html/Elements/EditLinks
index 4ef3a57..ca3c150 100644
--- a/share/html/Elements/EditLinks
+++ b/share/html/Elements/EditLinks
@@ -116,65 +116,10 @@
 </td>
 <td valign="top">
 <h3><&|/l&>New Links</&></h3>
-% if (ref($Object) eq 'RT::Ticket') {
-<i><&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.</&>
-<br /><&|/l&>You may enter links to Articles as "a:###", where ### represents the number of the Article.</&>
-% $m->callback( CallbackName => 'ExtraLinkInstructions' );
-</i><br />
-% } elsif (ref($Object) eq 'RT::Queue') {
-<i><&|/l&>Enter queues or URIs to link queues to. Separate multiple entries with spaces.</&>
-</i><br />
-% } else {
-<i><&|/l&>Enter objects or URIs to link objects to. Separate multiple entries with spaces.</&></i><br />
-% }
-<table>
-% if ($Merge) {
-  <tr>
-    <td class="label"><&|/l&>Merge into</&>:</td>
-    <td class="entry"><input name="<%$id%>-MergeInto" /> <i><&|/l&>(only one ticket)</&></i></td>
-  </tr>
-% }
-  <tr>
-    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Depends on'), Relation => 'DependsOn' &>:</td>
-    <td class="entry"><input name="<%$id%>-DependsOn" /></td>
-  </tr>
-  <tr>
-    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Depended on by'), Relation => 'DependedOnBy' &>:</td>
-    <td class="entry"><input name="DependsOn-<%$id%>" /></td>
-  </tr>
-  <tr>
-    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Parents'), Relation => 'Parents' &>:</td>
-    <td class="entry"><input name="<%$id%>-MemberOf" /></td>
-  </tr>
-  <tr>
-    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Children'), Relation => 'Children' &>:</td>
-    <td class="entry"> <input name="MemberOf-<%$id%>" /></td>
-  </tr>
-  <tr>
-    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Refers to'), Relation => 'RefersTo' &>:</td>
-    <td class="entry"><input name="<%$id%>-RefersTo" /></td>
-  </tr>
-  <tr>
-    <td class="label"><& ShowRelationLabel, Object => $Object, Label => loc('Referred to by'), Relation => 'ReferredToBy' &>:</td>
-    <td class="entry"> <input name="RefersTo-<%$id%>" /></td>
-  </tr>
-  <& /Elements/EditCustomFields, Object => $Object, Grouping => 'Links', InTable => 1 &>
-% $m->callback( CallbackName => 'NewLink' );
-</table>
+<& AddLinks, %ARGS &>
 </td>
 </tr>
 </table>
-
-<%INIT>
-my $id;
-if ($Object && $Object->Id) {
-    $id = $Object->Id;
-} else {
-    $id = 'new';
-}
-</%INIT>
-      
 <%ARGS>
 $Object => undef
-$Merge => 0
 </%ARGS>
diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index 9f014a1..e819938 100644
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -274,23 +274,11 @@
 <td valign="top" class="boxcontainer">
 <div class="ticket-info-links">
 <&| /Widgets/TitleBox, title => loc('Links'), title_class=> 'inverse' &>
-
-<em><&|/l&>(Enter ticket ids or URLs, separated with spaces)</&></em>
-<table border="0">
-<tr><td class="label"><&|/l&>Depends on</&></td><td><input size="10" name="new-DependsOn" value="<% $ARGS{'new-DependsOn'} || '' %>" /></td></tr>
-<tr><td class="label"><&|/l&>Depended on by</&></td><td><input size="10" name="DependsOn-new" value="<% $ARGS{'DependsOn-new'} || '' %>" /></td></tr>
-<tr><td class="label"><&|/l&>Parents</&></td><td><input size="10" name="new-MemberOf" value="<% $ARGS{'new-MemberOf'} || '' %>" /></td></tr>
-<tr><td class="label"><&|/l&>Children</&></td><td><input size="10" name="MemberOf-new" value="<% $ARGS{'MemberOf-new'} || '' %>" /></td></tr>
-<tr><td class="label"><&|/l&>Refers to</&></td><td><input size="10" name="new-RefersTo" value="<% $ARGS{'new-RefersTo'} || '' %>" /></td></tr>
-<tr><td class="label"><&|/l&>Referred to by</&></td><td><input size="10" name="RefersTo-new" value="<% $ARGS{'RefersTo-new'} || '' %>" /></td></tr>
-<& /Elements/EditCustomFields,
-    %ARGS,
-    Object => $ticket,
-    CustomFields => $QueueObj->TicketCustomFields,
-    Grouping => 'Links',
-    InTable => 1,
-&>
-</table>
+<& /Elements/AddLinks,
+    Object          => $ticket,
+    CustomFields    => $QueueObj->TicketCustomFields,
+    ARGSRef         => \%ARGS,
+    &>
 </&>
 </div>
 <br />
diff --git a/share/html/Ticket/ModifyLinks.html b/share/html/Ticket/ModifyLinks.html
index 73537e8..677733d 100644
--- a/share/html/Ticket/ModifyLinks.html
+++ b/share/html/Ticket/ModifyLinks.html
@@ -66,7 +66,6 @@
 
 
 <%INIT>
-
 my $Ticket = LoadTicket($id);
 
 my @results;  
@@ -74,7 +73,11 @@ $m->callback( TicketObj => $Ticket, ARGSRef => \%ARGS, Results => \@results );
 push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS );
 push @results, ProcessObjectCustomFieldUpdates( TicketObj => $Ticket, ARGSRef => \%ARGS );
 $Ticket->ApplyTransactionBatch;
-    
+
+MaybeRedirectForResults(
+    Actions     => \@results,
+    Arguments   => { id => $id },
+);
 </%INIT>
       
       

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


More information about the Rt-commit mailing list