"Fossies" - the Fresh Open Source Software Archive 
Member "RT-Extension-Assets-1.05/html/Ticket/Elements/ShowAssets" (15 Oct 2014, 6841 Bytes) of package /linux/misc/RT-Extension-Assets-1.05.tar.gz:
The requested HTML page contains a <FORM> tag that is unusable on "Fossies" in "automatic" (rendered) mode so that page is shown as HTML source code (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %#
3 %# COPYRIGHT:
4 %#
5 %# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
6 %# <sales@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., 51 Franklin Street, Fifth Floor, Boston, MA
26 %# 02110-1301 or visit their web page on the internet at
27 %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
28 %#
29 %#
30 %# CONTRIBUTION SUBMISSION POLICY:
31 %#
32 %# (The following paragraph is not intended to limit the rights granted
33 %# to you to modify and distribute this software under the terms of
34 %# the GNU General Public License and is only of importance to you if
35 %# you choose to contribute your changes and enhancements to the
36 %# community by submitting them to Best Practical Solutions, LLC.)
37 %#
38 %# By intentionally submitting any modifications, corrections or
39 %# derivatives to this work, or any other work intended for use with
40 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 %# you are the copyright holder for those contributions and you grant
42 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43 %# royalty-free, perpetual, license to use, copy, create derivative
44 %# works based on those contributions, and sublicense and distribute
45 %# those contributions and any derivatives thereof.
46 %#
47 %# END BPS TAGGED BLOCK }}}
48 <%args>
49 $Ticket
50 $ShowRelatedTickets => 10
51 </%args>
52 <%init>
53 my $target_assets = $Ticket->Links("Base")->Clone;
54 $target_assets->Limit(
55 FIELD => "Target",
56 OPERATOR => "STARTSWITH",
57 VALUE => RT::URI::asset->LocalURIPrefix,
58 );
59 my $base_assets = $Ticket->Links("Target")->Clone;
60 $base_assets->Limit(
61 FIELD => "Base",
62 OPERATOR => "STARTSWITH",
63 VALUE => RT::URI::asset->LocalURIPrefix,
64 );
65
66 my @linked_assets;
67 push @linked_assets, grep { defined } map { $_->TargetURI->IsLocal }
68 @{ $target_assets->ItemsArrayRef };
69 push @linked_assets, grep { defined } map { $_->BaseURI->IsLocal }
70 @{ $base_assets->ItemsArrayRef };
71
72 my $asset_queue;
73 if (RT->Config->Get('AssetQueues')) {
74 $asset_queue = 1 if grep {$_ eq $Ticket->QueueObj->Name} @{RT->Config->Get('AssetQueues')}
75 } else {
76 $asset_queue = 1;
77 }
78 return unless @linked_assets or ($Ticket->CurrentUserHasRight("ModifyTicket")
79 and $asset_queue);
80
81 my $assets = RT::Assets->new( $session{CurrentUser} );
82 $assets->OrderBy( FIELD => "Name", ORDER => "ASC" );
83 if ( @linked_assets ) {
84 $assets->Limit(
85 FIELD => "id",
86 OPERATOR => "IN",
87 VALUE => \@linked_assets,
88 );
89 }
90
91 my $Format = RT->Config->Get("AssetSummaryFormat") || q[
92 '<a href="__WebHomePath__/Asset/Display.html?id=__id__">__Name__</a>/TITLE:Name',
93 Description,
94 Status,
95 Catalog,
96 ];
97
98 $m->callback(
99 CallbackName => 'ModifyCollection',
100 Ticket => $Ticket,
101 Assets => $assets,
102 Format => \$Format,
103 );
104
105
106 </%init>
107 <&| /Widgets/TitleBox,
108 title => loc('Assets'),
109 class => 'ticket-assets',
110 title_class => "inverse",
111 &>
112
113 <form action="<% RT->Config->Get("WebPath") %>/Ticket/Display.html" method="POST" enctype="multipart/form-data">
114 <input type="hidden" name="id" value="<% $Ticket->id %>">
115
116 % $m->callback( CallbackName => "Start", Ticket => $Ticket, Assets => $assets );
117
118 <div id="assets-accordion" class="rt-accordion">
119 % my $display_path = $session{'CurrentUser'}->Privileged ? 'Asset' : 'SelfService/Asset';
120 % while (my $asset = $assets->Next) {
121 <h3><a href="<% RT->Config->Get('WebPath') %>/<% $display_path %>/Display.html?id=<% $asset->id %>"><&|/l, $asset->id, $asset->Name &>#[_1]: [_2]</&></a>
122 <%perl>
123 if ($Ticket->CurrentUserHasRight("ModifyTicket")) {
124 my $targets = $asset->Links("Target")->Clone;
125 $targets->Limit(
126 FIELD => "LocalBase",
127 VALUE => $Ticket->id,
128 );
129 my $bases = $asset->Links("Base")->Clone;
130 $bases->Limit(
131 FIELD => "LocalTarget",
132 VALUE => $Ticket->id,
133 );
134
135 my %params;
136 $params{join("-", "DeleteLink", "", $_->Type, $_->Target)} = 1
137 for @{ $targets->ItemsArrayRef };
138 $params{join("-", "DeleteLink", $_->Base, $_->Type, "")} = 1
139 for @{ $bases->ItemsArrayRef };
140
141 my $delete_url = RT->Config->Get("WebPath")
142 . "/Ticket/Display.html?"
143 . $m->comp("/Elements/QueryString", id => $Ticket->id, %params);
144 </%perl>
145 <a href="<% $delete_url %>" class="unlink-asset ui-icon ui-icon-circle-close" title="Unlink asset">X</a>
146 % }
147 </h3>
148 <div class="details">
149 <& /Elements/ShowRecord,
150 Object => $asset,
151 Format => $Format,
152 TrustFormat => 1,
153 &>
154 % $m->callback( CallbackName => "BeforeTickets", Ticket => $Ticket, Asset => $asset );
155 <%perl>
156 if ($ShowRelatedTickets) {
157 my %search = (
158 Query => "id != '@{[$Ticket->id]}' AND LinkedTo = 'asset:@{[$asset->id]}'",
159 OrderBy => "LastUpdated",
160 Order => "DESC",
161 );
162 my $url = RT->Config->Get("WebPath")
163 . "/Search/Results.html?"
164 . $m->comp("/Elements/QueryString", %search);
165 </%perl>
166 <div class="related-tickets">
167 <span class="label">
168 <a href="<% $url %>">
169 <&|/l, $ShowRelatedTickets &>[_1] most recently updated related tickets</&>
170 </a>
171 </span>
172 <& /Elements/CollectionList,
173 %search,
174 Class => "RT::Tickets",
175 Format => RT->Config->Get("AssetSummaryRelatedTicketsFormat"),
176 Rows => $ShowRelatedTickets,
177 ShowHeader => 0,
178 AllowSorting => 0,
179 ShowNavigation => 0,
180 &>
181 </div>
182 % }
183
184 % $m->callback( CallbackName => "PerAsset", Ticket => $Ticket, Asset => $asset );
185
186 </div>
187 % }
188 </div>
189
190 % if ($Ticket->CurrentUserHasRight("ModifyTicket")) {
191 <div class="add-asset">
192 <label>
193 <&|/l&>Add an asset to this ticket</&>
194 <input size="5" name="<% $Ticket->id %>-RefersTo" placeholder="<&|/l&>Asset #</&>" type="text">
195 </label>
196 <input type="submit" value="+">
197 </div>
198 % }
199
200 % $m->callback( CallbackName => "End", Ticket => $Ticket, Assets => $assets );
201
202 </form>
203
204 </&>