"Fossies" - the Fresh Open Source Software Archive

Member "RT-Extension-Assets-1.05/html/Asset/Search/Bulk.html" (17 Mar 2015, 7807 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("Assets") &>
   49 <& /Elements/Tabs &>
   50 
   51 % $m->callback(CallbackName => 'BeforeActionList', ARGSRef => \%ARGS, Assets => $assets, Actions => \@results);
   52 
   53 <& /Elements/ListActions, actions => \@results &>
   54 
   55 <form method="post" action="<% RT->Config->Get('WebPath') %>/Asset/Search/Bulk.html" enctype="multipart/form-data" name="BulkUpdate" id="BulkUpdate">
   56 % foreach my $var ( @{$search{'PassArguments'}} )  {
   57 <input type="hidden" class="hidden" name="<% $var %>" value="<% $ARGS{$var} || '' %>" />
   58 % }
   59 <& /Elements/CollectionList,
   60     %search,
   61     Collection      => $assets,
   62     AllowSorting    => 1,
   63     DisplayFormat   => $DisplayFormat,
   64     &>
   65 % if (not $assets->Count) {
   66 <em><&|/l&>No assets matching search criteria found.</&></em>
   67 % }
   68 
   69 <& /Elements/Submit,
   70     Name => 'Update',
   71     Label => loc('Update'),
   72     CheckboxNameRegex => '/^UpdateAsset(All)?$/',
   73     CheckAll => 1, ClearAll => 1,
   74 &>
   75 
   76 <&| /Widgets/TitleBox, title => loc("Basics"), class => "asset-basics asset-bulk-basics", title_class => "inverse" &>
   77 <table>
   78   <tr class="asset-catalog">
   79     <td class="label"><label for="UpdateCatalog"><&|/l&>Catalog</&></label></td>
   80     <td><& /Asset/Elements/SelectCatalog, Name => 'UpdateCatalog', Default => $catalog_obj->id, UpdateSession => 0, &></td>
   81   </tr>
   82   <tr class="asset-name">
   83     <td class="label"><label for="UpdateName"><&|/l&>Name</&></label></td>
   84     <td><input name="UpdateName" value="<% $ARGS{'Name'}||'' %>" size="40"></td>
   85   </tr>
   86   <tr class="asset-description">
   87     <td class="label"><label for="UpdateDescription"><&|/l&>Description</&></label></td>
   88     <td><input name="UpdateDescription" value="<% $ARGS{'Description'}||'' %>" size="40"></td>
   89   </tr>
   90   <tr class="asset-status">
   91     <td class="label"><label for="UpdateStatus"><&|/l&>Status</&></label></td>
   92     <td><& /Asset/Elements/SelectStatus, Name => 'UpdateStatus', DefaultValue => 1, CatalogObj => $catalog_obj &></td>
   93   </tr>
   94 </table>
   95 </&>
   96 
   97 <&| /Widgets/TitleBox, title => loc("People"), class => "asset-people asset-bulk-people", title_class => "inverse" &>
   98 <table>
   99 % for my $rname ( $asset->Roles( ACLOnly => 0 ) ) {
  100 % my $role = $asset->Role( $rname );
  101 % if ( $role->{'Single'} ) {
  102 % my $input = "SetRoleMember-$rname";
  103 <tr class="full-width">
  104 <td class="label"><label for="<% $input %>"><% loc($rname) %></label></td>
  105 <td><input type="text" value="<% $ARGS{ $input } || '' %>" name="<% $input %>" id="<% $input %>" data-autocomplete="Users" data-autocomplete-return="Name" /></td>
  106 </tr>
  107 % } else {
  108 <tr>
  109 % my $input = "AddRoleMember-$rname";
  110 <td class="label"><label for="<% $input %>"><% loc("Add [_1]", loc($rname)) %></label></td>
  111 <td><input type="text" value="<% $ARGS{ $input } || '' %>" name="<% $input %>" id="<% $input %>" data-autocomplete="Users" data-autocomplete-return="Name" /></td>
  112 </tr>
  113 
  114 <tr>
  115 % $input = "RemoveRoleMember-$rname";
  116 <td class="label"><label for="<% $input %>"><% loc("Remove [_1]", loc($rname)) %></label></td>
  117 <td>
  118   <input type="text" value="<% $ARGS{ $input } || '' %>" name="<% $input %>" id="<% $input %>" data-autocomplete="Users" data-autocomplete-return="Name" />
  119   <label>
  120     <input type="checkbox" name="RemoveAllRoleMembers-<% $rname %>" value="1"/>
  121     <em><&|/l&>(Check to delete all values)</&></em>
  122   </label>
  123 </td>
  124 </tr>
  125 % }
  126 % }
  127 </table>
  128 </&>
  129 
  130 % for my $group ( RT::CustomField->CustomGroupings( 'RT::Asset' ), '' ) {
  131 %   my $cfs = $catalog_obj->AssetCustomFields;
  132 %   $cfs->LimitToGrouping( 'RT::Asset' => $group);
  133 %   if ( $cfs->Count ) {
  134 <&| /Widgets/TitleBox, class=>'asset-bulk-grouping asset-bulk-cfs', title => loc('Edit [_1]', ($group? loc($group) : loc('Custom Fields')) ) &>
  135 <& /Elements/BulkCustomFields, CustomFields => $cfs, &>
  136 </&>
  137 %   }
  138 % }
  139 
  140 <&|/Widgets/TitleBox, title => loc('Edit Links'), color => "#336633"&>
  141 <& /Elements/BulkLinks, Collection => $assets, %ARGS &>
  142 </&>
  143 
  144 <& /Elements/Submit, Label => loc('Update'), Name => 'Update' &>
  145 </form>
  146 
  147 <%INIT>
  148 my @results;
  149 $m->callback(ARGSRef => \%ARGS, Results => \@results, CallbackName => 'Initial');
  150 
  151 my $catalog_obj = LoadDefaultCatalog($ARGS{'Catalog'} || '');
  152 $ARGS{'Catalog'} = $catalog_obj->Id;
  153 
  154 my $assets = RT::Assets->new($session{CurrentUser});
  155 my %search = ProcessAssetsSearchArguments(
  156     Assets => $assets, Catalog => $catalog_obj, ARGSRef => \%ARGS,
  157 );
  158 
  159 my $DisplayFormat = "'__CheckBox.{UpdateAsset}__',". $search{'Format'};
  160 $DisplayFormat =~ s/\s*,\s*('?__NEWLINE__'?)/,$1,''/gi;
  161 
  162 my $asset = RT::Asset->new( $session{'CurrentUser'} );
  163 
  164 delete $ARGS{$_} foreach grep { $ARGS{$_} =~ /^$/ } keys %ARGS;
  165 
  166 $DECODED_ARGS->{'UpdateAssetAll'} = 1 unless @UpdateAsset;
  167 
  168 if ( $ARGS{Update} ) {
  169     my @attributes  = $asset->WritableAttributes;
  170     @attributes = grep exists $ARGS{ 'Update'. $_ }, @attributes;
  171     my %basics = map { $_ => $ARGS{ 'Update'. $_ } } @attributes;
  172 
  173     foreach my $aid ( @UpdateAsset ) {
  174         my $asset = LoadAsset($aid);
  175 
  176         my @tmp_res;
  177         push @tmp_res, UpdateRecordObject(
  178             Object          => $asset,
  179             AttributesRef   => \@attributes,
  180             ARGSRef         => \%basics,
  181         );
  182         push @tmp_res, ProcessRoleMembers( $asset => %ARGS );
  183         push @tmp_res, ProcessObjectCustomFieldUpdates( Object => $asset, ARGSRef => \%ARGS );
  184         push @tmp_res, ProcessRecordLinks( RecordObj => $asset, RecordId => 'Asset', ARGSRef => \%ARGS );
  185         push @tmp_res, ProcessRecordBulkCustomFields( RecordObj => $asset, ARGSRef => \%ARGS );
  186         push @results, map { loc( "Asset #[_1]: [_2]", $asset->id, $_ ) } @tmp_res;
  187     }
  188 
  189     MaybeRedirectForResults(
  190         Actions     => \@results,
  191         Arguments   => { map { $_ => $ARGS{$_} } grep { defined $ARGS{$_} } @{$search{'PassArguments'}} },
  192     );
  193 }
  194 </%INIT>
  195 <%ARGS>
  196 @UpdateAsset => ()
  197 </%ARGS>