import rt 3.2.2
[freeside.git] / rt / html / Ticket / ModifyAll.html
1 %# {{{ BEGIN BPS TAGGED BLOCK
2 %# 
3 %# COPYRIGHT:
4 %#  
5 %# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
6 %#                                          <jesse@bestpractical.com>
7 %# 
8 %# (Except where explicitly superseded by other copyright notices)
9 %# 
10 %# 
11 %# LICENSE:
12 %# 
13 %# This work is made available to you under the terms of Version 2 of
14 %# the GNU General Public License. A copy of that license should have
15 %# been provided with this software, but in any event can be snarfed
16 %# from www.gnu.org.
17 %# 
18 %# This work is distributed in the hope that it will be useful, but
19 %# WITHOUT ANY WARRANTY; without even the implied warranty of
20 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 %# General Public License for more details.
22 %# 
23 %# You should have received a copy of the GNU General Public License
24 %# along with this program; if not, write to the Free Software
25 %# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 %# 
27 %# 
28 %# CONTRIBUTION SUBMISSION POLICY:
29 %# 
30 %# (The following paragraph is not intended to limit the rights granted
31 %# to you to modify and distribute this software under the terms of
32 %# the GNU General Public License and is only of importance to you if
33 %# you choose to contribute your changes and enhancements to the
34 %# community by submitting them to Best Practical Solutions, LLC.)
35 %# 
36 %# By intentionally submitting any modifications, corrections or
37 %# derivatives to this work, or any other work intended for use with
38 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
39 %# you are the copyright holder for those contributions and you grant
40 %# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
41 %# royalty-free, perpetual, license to use, copy, create derivative
42 %# works based on those contributions, and sublicense and distribute
43 %# those contributions and any derivatives thereof.
44 %# 
45 %# }}} END BPS TAGGED BLOCK
46 <& /Elements/Header, Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>
47 <& /Ticket/Elements/Tabs, 
48     Ticket => $Ticket, 
49     current_tab => "Ticket/ModifyAll.html?id=".$Ticket->Id, 
50     Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>
51
52 <& /Elements/ListActions, actions => \@results &>
53
54 <FORM METHOD=POST ACTION="ModifyAll.html" ENCTYPE="multipart/form-data">
55 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>">
56
57
58 <& /Elements/TitleBoxStart, title => loc('Modify ticket # [_1]', $Ticket->Id),   color=> "#993333", width => "100%" &>
59 <& Elements/EditBasics, TicketObj => $Ticket &>
60 <& Elements/EditCustomFields, TicketObj => $Ticket &>
61 <& /Elements/TitleBoxEnd &>
62
63 <BR>
64
65 <& /Elements/TitleBoxStart, title => loc('Dates'),  width => "100%", color => "#663366"  &>
66 <& Elements/EditDates, TicketObj => $Ticket &>
67 <& /Elements/TitleBoxEnd &>
68
69 <BR>
70
71
72 <& /Elements/TitleBoxStart, title => loc('People'),width => "100%", color=> "#333399" &>
73 <& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp &>
74 <& /Elements/TitleBoxEnd &>
75
76 <BR>
77
78 <& /Elements/TitleBoxStart, title => loc('Links'), color => "#336633"&>
79 <& /Elements/EditLinks, Object => $Ticket, Merge => 1 &>
80 <& /Elements/TitleBoxEnd &>
81
82 <BR>
83
84 <& /Elements/TitleBoxStart, title => loc('Update ticket') &>
85 <table>
86   <tr>
87     <td class="label"><&|/l&>Update Type</&>:</td>
88     <td class="entry">
89       <select name="UpdateType">
90 % if ($CanComment) {
91         <option value="private" ><&|/l&>Comments (Not sent to requestors)</&></option>
92 % }
93 % if ($CanRespond) {
94         <option value="response"><&|/l&>Reply to requestors</&></option>
95 % }
96       </select> 
97     </td>
98   </tr>
99   <tr>
100     <td class="label"><&|/l&>Subject</&>:</td>
101     <td class="entry"><input name="UpdateSubject" size=60 value="<%$Ticket->Subject%>"></td>
102   </tr>
103   <tr>
104     <td class="label"><&|/l&>Attach</&>:</td>
105     <td class="entry"><input name="UpdateAttachment" type=file></td>
106   </tr>
107   <tr>
108     <td class="labeltop"><&|/l&>Content</&>:</td>
109     <td class="entry"><& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &></td>
110   </tr>
111 </table>
112 <& /Elements/TitleBoxEnd &>
113   
114
115 <& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
116 </form>
117
118 <%INIT>
119
120
121
122 my $Ticket = LoadTicket($id);
123
124 my $CanRespond = 0;
125 my $CanComment = 0;
126
127
128 $CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
129                      $Ticket->CurrentUserHasRight('ModifyTicket') ); 
130
131 $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
132                      $Ticket->CurrentUserHasRight('ModifyTicket') );
133
134
135 my (@wresults, @results,  @dresults, @lresults, @cf_results);
136
137 unless ($OnlySearchForPeople) {
138     @wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
139     @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
140  @cf_results = ProcessTicketCustomFieldUpdates( TicketObj => $Ticket, ARGSRef => \%ARGS);
141     @dresults = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
142     @lresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
143
144     if ($ARGS{'UpdateAttachment'}) {
145         my $subject = "$ARGS{'UpdateAttachment'}";
146         # since CGI.pm deutf8izes the magic field, we need to add it back.
147         Encode::_utf8_on($subject);
148         # strip leading directories
149         $subject =~ s#^.*[\\/]##;
150
151         my $attachment = MakeMIMEEntity(
152            Subject             => $subject,
153            Body                => "",
154            AttachmentFieldName => 'UpdateAttachment'
155         );
156         delete $ARGS{'UpdateAttachment'};
157         $ARGS{'UpdateAttachments'}->{ $subject } = $attachment;
158     }
159
160     $ARGS{'UpdateContent'} =~ s/\r+\n/\n/g;
161
162     if ($ARGS{'UpdateAttachments'} || (
163         $ARGS{'UpdateContent'} &&
164         $ARGS{'UpdateContent'} ne  "-- \n" . 
165                                 $session{'CurrentUser'}->UserObj->Signature
166        )) {
167          ProcessUpdateMessage(TicketObj => $Ticket, 
168                               ARGSRef=>\%ARGS, 
169                               Actions=>\@results);
170         }
171 }
172 push @results, @wresults;
173 push @results, @dresults;
174 push @results, @lresults;
175 push @results, @cf_results;
176
177 # If they've gone and moved the ticket to somewhere they can't see, etc...
178 # TODO: display the results, even if we can't display the ticket.
179
180 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
181    Abort("No permission to view ticket");
182 }
183
184
185 </%INIT>
186
187
188
189 <%ARGS>
190 $OnlySearchForPeople => undef
191 $UserField => undef
192 $UserOp => undef
193 $UserString => undef
194 $id => undef
195 </%ARGS>
196