"Fossies" - the Fresh Open Source Software Archive 
Member "RT-Extension-Assets-1.05/html/Asset/Create.html" (15 Apr 2015, 6338 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 syntax highlighting (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 <& /Elements/Header, Title => loc("Create a new asset in catalog [_1]", $catalog->Name),
49 RT->Config->Get('AssetBasicCustomFieldsOnCreate')
50 ? (
51 onload => "function () { hide('Asset-Create-details') }"
52 )
53 : (),
54 &>
55 <& /Elements/Tabs &>
56
57 <& /Elements/ListActions, actions => \@results &>
58
59 <span class="catalog <% CSSClass($catalog->Name) %>">
60 <form method="post" enctype="multipart/form-data" id="CreateAsset" action="Create.html">
61 <input type="hidden" name="id" value="new">
62 <input type="hidden" name="Catalog" value="<% $catalog->id %>">
63
64 <a name="basics"></a>
65 <div id="Asset-Create-basics" class="asset-metadata">
66 <table>
67 <tbody>
68 <tr>
69 <td>
70 <&| /Widgets/TitleBox, title => loc("Basics"), class => "asset-basics", title_class => "inverse" &>
71 <& Elements/EditBasics, %ARGS, AssetObj => $asset, CatalogObj => $catalog &>
72 </&>
73
74 <&| /Widgets/TitleBox, title => loc("People"), class => "asset-people", title_class => "inverse" &>
75 <& Elements/EditPeople, %ARGS, AssetObj => $asset &>
76 </&>
77 </td><td>
78 <&| /Widgets/TitleBox, title => loc("Links"), class => "asset-links", title_class => "inverse" &>
79 <& /Elements/AddLinks,
80 Object => $asset,
81 CustomFields => $catalog->AssetCustomFields &>
82 </&>
83 </td>
84
85 </tr>
86 </tbody>
87 </table>
88 </div>
89
90 <div id="Asset-Create-details">
91 <a name="details"></a>
92
93 <& /Elements/EditCustomFieldCustomGroupings,
94 Object => $asset,
95 TitleBoxARGS => { title_class => "inverse" },
96 KeepValue => 1,
97 CustomFieldGenerator => sub { $catalog->AssetCustomFields } &>
98 </div>
99
100 <& /Elements/Submit, Label => loc('Create asset') &>
101 </form>
102 </span>
103
104 <%args>
105 $id => ""
106 $Catalog => undef
107 </%args>
108 <%init>
109 my $asset = RT::Asset->new( $session{CurrentUser} );
110 my $catalog = RT::Catalog->new( $session{CurrentUser} );
111 $catalog->Load($Catalog);
112
113 Abort(loc("Unable to find catalog '[_1]'", $Catalog))
114 unless $catalog->id;
115
116 Abort(loc("You don't have permission to create assets in catalog [_1].",
117 $catalog->Name || $catalog->id))
118 unless $catalog->CurrentUserHasRight("CreateAsset");
119
120 # Update the current default with the latest selection
121 $session{'DefaultCatalog'} = $catalog->Id;
122
123 my @results;
124
125 if ($id eq "new") {
126 my $skip_create = 0;
127
128 my ($cf_ok, @cf_errors) = $m->comp(
129 '/Elements/ValidateCustomFields',
130 Object => $asset,
131 CustomFields => $catalog->AssetCustomFields,
132 ARGSRef => \%ARGS
133 );
134
135 $m->callback(
136 CallbackName => 'BeforeCreate',
137 AssetObj => $asset,
138 CatalogObj => $catalog,
139 results => \@results,
140 cf_ok => \$cf_ok,
141 skip_create => \$skip_create,
142 ARGSRef => \%ARGS
143 );
144
145 if ($cf_ok and not $skip_create) {
146 # Handle CFs and links
147 my %create = (
148 ProcessObjectCustomFieldUpdatesForCreate(
149 ARGSRef => \%ARGS,
150 ContextObject => $catalog,
151 ),
152 ProcessLinksForCreate( ARGSRef => \%ARGS ),
153 map {
154 $_ => $ARGS{$_}
155 } $asset->Roles,
156 );
157
158 # Handle basic fields
159 for ($asset->WritableAttributes) {
160 $create{$_} = $ARGS{$_} if exists $ARGS{$_};
161 }
162
163 $m->callback( %ARGS, AssetObj => $asset, CatalogObj => $catalog, Create => \%create, CallbackName => 'MassageCreate' );
164
165 my ($ok, $msg, $nonfatal) = $asset->Create( %create );
166 push @results, $msg, @{$nonfatal || []};
167
168 if ($ok) {
169 MaybeRedirectForResults(
170 Actions => \@results,
171 Path => "/Asset/Display.html",
172 Arguments => { id => $asset->id },
173 );
174 }
175 } else {
176 push @results, @cf_errors;
177 }
178 }
179
180 if ( RT->Config->Get('AssetBasicCustomFieldsOnCreate') ) {
181 PageMenu->child( basics => raw_html => q[<a href="#basics" onclick="return switchVisibility('Asset-Create-basics','Asset-Create-details');">] . loc('Basics') . q[</a>]);
182 PageMenu->child( details => raw_html => q[<a href="#details" onclick="return switchVisibility('Asset-Create-details','Asset-Create-basics');">] . loc('Details') . q[</a>]);
183 }
184
185 </%init>