File: ExtractFromTicket.html

package info (click to toggle)
rtfm 2.0.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 812 kB
  • ctags: 220
  • sloc: perl: 3,426; sh: 153; makefile: 144
file content (70 lines) | stat: -rw-r--r-- 2,424 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
%# BEGIN LICENSE BLOCK
%# 
%#  Copyright (c) 2002-2003 Jesse Vincent <jesse@bestpractical.com>
%#  
%#  This program is free software; you can redistribute it and/or modify
%#  it under the terms of version 2 of the GNU General Public License 
%#  as published by the Free Software Foundation.
%# 
%#  A copy of that license should have arrived with this
%#  software, but in any event can be snarfed from www.gnu.org.
%# 
%#  This program 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.
%# 
%# END LICENSE BLOCK

<& /RTFM/Elements/Tabs, Title => loc('Extract article from ticket #[_1] into class [_2]',$Ticket, $ClassObj->Name) &> 
<form action="Edit.html" method="post">
<input type="hidden" name="Class" value="<%$ARGS{'Class'}%>">
<input type="hidden" name="Summary" value="<%$ticket->Subject%>">
<input type="hidden" name="new-RefersTo" value="<%$ticket->URI%>">
<table width="100%" valign="top" border=0 cellspacing=0>

<p><&|/l&>Use the dropdown menus to select which transactions you want to extract into a new RTFM article</&></p>

<tr>
<th>Custom field</th>
<th>Ticket update</th>
</tr>
% my $i;
% while ( my $trans = $transactions->Next ) { 
% next unless $trans->Content;
<TR class="<% ($i++)%2 ? 'oddline' : 'evenline'%>" >                                
<td valign="top">
<select name="Transaction-<%$trans->Id%>">
<option value="">-</option>
% while (my $cf = $CustomFields->Next) {
<option value="<%$cf->Id%>"><%$cf->Name%></option>
% }
</select>
</td>
<td><b><%$trans->CreatedObj->AsString%>: <%$trans->Description%></b><br>
<pre><%$trans->Content%></pre>
</td>
</tr>
% } 
</table>
      
<& /Elements/Submit, Label => loc('Create'), color => "#993333" &>
</form>
<%INIT>

my $ticket=LoadTicket($Ticket);
my $transactions = $ticket->Transactions;

my $ClassObj = RT::FM::Class->new($session{'CurrentUser'});
$ClassObj->Load($Class);
unless ($ClassObj->Id) {
    $m->comp("/RTFM/Elements/Error", Why => "'%1' isn't a valid class identifier", $Class);
}
my     $CustomFields = $ClassObj->CustomFields();
$CustomFields->Limit(FIELD => 'Type', OPERATOR => '=', VALUE => 'TextSingle');
$CustomFields->Limit(FIELD => 'Type', OPERATOR => '=', VALUE => 'WikiTextSingle');
</%init>
<%ARGS>
$Class=>undef
$Ticket => undef
</%ARGS>