[Rt-commit] [svn] r1960 - in rt/branches/3.3-TESTING: . html/SelfService html/SelfService/Elements

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Mon Dec 6 02:11:55 EST 2004


Author: jesse
Date: Mon Dec  6 02:11:55 2004
New Revision: 1960

Added:
   rt/branches/3.3-TESTING/html/SelfService/CreateTicketInQueue.html   (contents, props changed)
Modified:
   rt/branches/3.3-TESTING/   (props changed)
   rt/branches/3.3-TESTING/html/SelfService/Create.html
   rt/branches/3.3-TESTING/html/SelfService/Display.html
   rt/branches/3.3-TESTING/html/SelfService/Elements/Tabs
Log:
 r9505 at tinbook:  jesse | 2004-12-06T07:11:01.358418Z
 SelfService: Added support for setting custom fields on creation and viewing custom fields the user has the right to see.
 


Modified: rt/branches/3.3-TESTING/html/SelfService/Create.html
==============================================================================
--- rt/branches/3.3-TESTING/html/SelfService/Create.html	(original)
+++ rt/branches/3.3-TESTING/html/SelfService/Create.html	Mon Dec  6 02:11:55 2004
@@ -50,43 +50,49 @@
 
 <TABLE>
 <TR>
-<TD>
+<TD class="label">
 <&|/l&>Queue</&>:
-</TD>
-<TD>
-<& /Elements/SelectNewTicketQueue, Verbose => 'True' &>
+</td>
+<td class="value">
+    <input type="hidden" name="Queue" value="<%$queue_obj->id%>">
+    <b><%$queue_obj->Name%></b> (<%$queue_obj->Description%>)
 </TD>
 </TR>
 <TR>
-<TD>
+<TD class="label">
 <&|/l&>Requestors</&>:
 </TD>
-<TD>
+<TD class="value">
 <INPUT Name="Requestors" Value="<%$session{CurrentUser}->EmailAddress%>" SIZE=20>
 </TD>
 </TR>
 <TR>
-<TD>
+<TD class="label">
 <&|/l&>Cc</&>:
 </TD>
-<TD>
+<TD class="value">
  <INPUT NAME="Cc" SIZE=20>
 </TD>
 </TR>
 <TR>
-<TD>
+<TD class="label">
 <&|/l&>Subject</&>:
 </TD>
-<TD>
+<TD class="value">
 <INPUT Name="Subject" SIZE=60 MAXSIZE=100 value="">
 </TD>
 </TR>
-<TR>
-<TD>
+<tr>
+    <td colspan="2">
+        <& /Ticket/Elements/EditCustomFields, QueueObj => $queue_obj &>
+    </td>
+</tr>
+<tr>
+<TD class="label">
 <&|/l&>Attach file</&>:
 </TD>
-<TD>
-<INPUT Name="Attach" type=file>
+<TD class="value">
+<INPUT Name="Attach" type="file">
 </TD>
 </TR>
 <TR>
@@ -100,3 +106,10 @@
 
 
 </FORM>
+<%args>
+$Queue => undef
+</%args>
+<%init>
+my $queue_obj = RT::Queue->new($session{'CurrentUser'});
+$queue_obj->Load($Queue);
+</%init>

Added: rt/branches/3.3-TESTING/html/SelfService/CreateTicketInQueue.html
==============================================================================
--- (empty file)
+++ rt/branches/3.3-TESTING/html/SelfService/CreateTicketInQueue.html	Mon Dec  6 02:11:55 2004
@@ -0,0 +1,61 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%# 
+%# COPYRIGHT:
+%#  
+%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+%#                                          <jesse 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+%# 
+%# 
+%# 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 }}}
+<& Elements/Header, Title => loc("Create a ticket") &>
+
+<h1><&|/l&>Select a queue for your new ticket</&></h1>
+
+<dl>
+% while (my $queue = $queues->Next) {    
+% next unless $queue->CurrentUserHasRight('CreateTicket');
+
+<dt><a href="<%$RT::WebPath%>/SelfService/Create.html?Queue=<%$queue->id%>"><%$queue->Name%></a></dt>
+<dd><%$queue->Description%></dd>
+% }
+</dl>
+<%init>
+my $queues = RT::Queues->new($session{'CurrentUser'});
+$queues->UnLimit;
+</%init>

Modified: rt/branches/3.3-TESTING/html/SelfService/Display.html
==============================================================================
--- rt/branches/3.3-TESTING/html/SelfService/Display.html	(original)
+++ rt/branches/3.3-TESTING/html/SelfService/Display.html	Mon Dec  6 02:11:55 2004
@@ -54,6 +54,7 @@
                 title_class=> 'inverse',  
                 color => "#993333" &>
                 <& /Ticket/Elements/ShowBasics, Ticket => $Ticket &>
+                <& /Ticket/Elements/ShowCustomFields, Ticket => $Ticket &>
           <& /Elements/TitleBoxEnd &>
 </TD>
         <TD VALIGN=TOP WIDTH="50%" class="boxcontainer">
@@ -97,106 +98,106 @@
 
     unless ( $Queue->CurrentUserHasRight('CreateTicket') ) {
         $m->comp( 'Error.html',
-             Why =>
-               loc('You have no permission to create tickets in that queue.') );
+            Why =>
+              loc('You have no permission to create tickets in that queue.') );
         $m->abort;
     }
 
-    my @Requestors = split ( /\s*,\s*/, $ARGS{'Requestors'} );
-    my @Cc         = split ( /\s*,\s*/, $ARGS{'Cc'} );
+    ( $Ticket, @results ) =
+    CreateTicket( Attachments => $session{'Attachments'}, %ARGS, Status => 'new' );
 
-    my $MIMEObj = MakeMIMEEntity( Subject             => $ARGS{'Subject'},
-                                  From                => $ARGS{'From'},
-                                  Cc                  => $ARGS{'Cc'},
-                                  Body                => $ARGS{'Content'},
-                                  AttachmentFieldName => 'Attach' );
-
-    #TODO in Create_Details.html: priorities and due-date
-    my ( $id, $Trans, $ErrMsg ) = $Ticket->Create( Queue     => $ARGS{Queue},
-                                                   Requestor => \@Requestors,
-                                                   Cc        => \@Cc,
-                                                   Subject   => $ARGS{Subject},
-                                                   MIMEObj   => $MIMEObj );
-    unless ( $id && $Trans ) {
-        $m->comp( 'Error.html', Why => $ErrMsg );
-        $m->abort();
-    }
+    unless ( $Ticket->id ) {
+        $m->comp( 'Error.html', Why => join( "\n", @results ));
+              $m->abort();
+        }
+
+        # }}}
+
+        # delete temporary storage entry to make WebUI clean
+        unless ( keys %{ $session{'Attachments'} } and $ARGS{'UpdateAttach'} ) {
+            delete $session{'Attachments'};
+        }
 
-    push ( @results, $ErrMsg );
+        # }}}
+    }
+    else {
+        unless ( $Ticket->Load( $id[0] ) ) {
+            $m->comp( 'Error.html',
+                Why => loc( "Couldn't load ticket '[_1]'", $id ) );
+            $m->abort();
+        }
+    }
 
     # }}}
 
-# delete temporary storage entry to make WebUI clean
-unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
-    delete $session{'Attachments'};
-}
-# }}}
-}
-else {
-    unless ( $Ticket->Load( $id[0] ) ) {
+    unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
         $m->comp( 'Error.html',
-                  Why => loc( "Couldn't load ticket '[_1]'", $id ) );
+            Why => loc("No permission to display that ticket") );
         $m->abort();
     }
-}
 
-# }}}
+    my ( $code, $msg );
+
+    #Update the status
+    if (    ( defined $ARGS{'Status'} )
+        and $ARGS{'Status'}
+        and ( $ARGS{'Status'} ne $Ticket->Status ) )
+    {
+        ( $code, $msg ) = $Ticket->SetStatus( $ARGS{'Status'} );
+        push @results, "$msg";
+    }
+
+    # {{{ store the uploaded attachment in session
+    if ( $ARGS{'Attach'} ) {    # attachment?
+        $session{'Attachments'} = {} unless defined $session{'Attachments'};
+
+        my $subject = "$ARGS{'Attach'}";
+
+        # since CGI.pm deutf8izes the magic field, we need to add it back.
+        Encode::_utf8_on($subject);
+
+        # strip leading directories
+        $subject =~ s#^.*[\\/]##;
+
+        my $attachment = MakeMIMEEntity(
+            Subject             => $subject,
+            Body                => "",
+            AttachmentFieldName => 'Attach'
+        );
+
+        $session{'Attachments'} =
+          { %{ $session{'Attachments'} || {} },
+            $ARGS{'Attach'} => $attachment };
+    }
+
+    # }}}
 
-unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
-    $m->comp( 'Error.html',
-              Why => loc("No permission to display that ticket") );
-    $m->abort();
-}
-
-my ( $code, $msg );
-
-#Update the status
-if (     ( defined $ARGS{'Status'} ) and $ARGS{'Status'}
-     and ( $ARGS{'Status'} ne $Ticket->Status ) ) {
-    ( $code, $msg ) = $Ticket->SetStatus( $ARGS{'Status'} );
-    push @results, "$msg";
-}
-
-# {{{ store the uploaded attachment in session
-if ($ARGS{'Attach'}) {			# attachment?
-    $session{'Attachments'} = {} unless defined $session{'Attachments'};
-
-    my $subject = "$ARGS{'Attach'}";
-    # since CGI.pm deutf8izes the magic field, we need to add it back.
-    Encode::_utf8_on($subject);
-    # strip leading directories
-    $subject =~ s#^.*[\\/]##;
-
-    my $attachment = MakeMIMEEntity(
-        Subject             => $subject,
-        Body                => "",
-        AttachmentFieldName => 'Attach'
+    if (
+        $session{'Attachments'}
+        || (   $ARGS{'UpdateContent'} ne ''
+            && $ARGS{'UpdateContent'} ne "-- \n"
+            . $session{'CurrentUser'}->UserObj->Signature )
+      )
+    {
+        $ARGS{UpdateAttachments} = $session{'Attachments'};
+    }
+    ProcessUpdateMessage(
+        ARGSRef   => \%ARGS,
+        Actions   => \@results,
+        TicketObj => $Ticket
     );
 
-    $session{'Attachments'} = { %{$session{'Attachments'} || {}},
-				$ARGS{'Attach'} => $attachment };
-}
-# }}}
-
-if ( $session{'Attachments'} || 
-     (   $ARGS{'UpdateContent'} ne ''
-	 && $ARGS{'UpdateContent'} ne "-- \n"
-	 . $session{'CurrentUser'}->UserObj->Signature )) {
-    $ARGS{UpdateAttachments} = $session{'Attachments'};
-}
-ProcessUpdateMessage( ARGSRef   => \%ARGS,
-                      Actions   => \@results,
-                      TicketObj => $Ticket );
-
-# delete temporary storage entry to make WebUI clean
-unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
-    delete $session{'Attachments'};
-}
-# }}}
+    # delete temporary storage entry to make WebUI clean
+    unless ( keys %{ $session{'Attachments'} } and $ARGS{'UpdateAttach'} ) {
+        delete $session{'Attachments'};
+    }
+
+    # }}}
 
-my $Transactions = $Ticket->Transactions;
+    my $Transactions = $Ticket->Transactions;
 
-my $attachments = $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket);
+    my $attachments =
+      $m->comp( '/Ticket/Elements/FindAttachments', Ticket => $Ticket );
 
 </%INIT>
 

Modified: rt/branches/3.3-TESTING/html/SelfService/Elements/Tabs
==============================================================================
--- rt/branches/3.3-TESTING/html/SelfService/Elements/Tabs	(original)
+++ rt/branches/3.3-TESTING/html/SelfService/Elements/Tabs	Mon Dec  6 02:11:55 2004
@@ -67,7 +67,7 @@
                          path => 'SelfService/Closed.html',
                        },
              C => { title => loc('New ticket'),
-                    path => 'SelfService/Create.html'
+                    path => 'SelfService/CreateTicketInQueue.html'
                     },
              Z => { title => loc('Preferences'),
                     path => 'SelfService/Prefs.html'


More information about the Rt-commit mailing list