my ( @rv, $res);
foreach my $r ( @$temp ) {
undef $res;
- foreach( qw[id hashvalue filesize uploadcategorycode public permanent] ) {
+ foreach( qw[id hashvalue filesize uploadcategorycode public permanent owner] ) {
$res->{$_} = $r->{$_};
}
$res->{name} = $r->{filename};
my ( $self, $params ) = @_;
my $dbh = C4::Context->dbh;
my $sql = q|
-SELECT id,hashvalue,filename,dir,filesize,uploadcategorycode,public,permanent
+SELECT id,hashvalue,filename,dir,filesize,uploadcategorycode,public,permanent,owner
FROM uploaded_files
|;
my @pars;
[% IF ( CAN_user_tools_edit_quotes ) %]
<li><a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a></li>
[% END %]
+ [% IF ( CAN_user_tools_upload_general_files ) %]
+ <li><a href="/cgi-bin/koha/tools/upload.pl">Upload any file</a></li>
+ [% END %]
</ul></div></div>
<dd>Manage EDIfact transmissions</dd>
[% END %]
+ [% IF ( CAN_user_tools_upload_general_files ) %]
+ <dt><a href="/cgi-bin/koha/tools/upload.pl">Upload</a></dt>
+ <dd>Upload any type of file, manage uploads</dd>
+ [% END %]
+
</dl>
</div>
<div class="yui-u">
<a href="" onclick="Choose('[% record.hashvalue %]'); return false;">Choose</a>
[% END %]
<a href="" onclick="SubmitMe( 'download', [% record.id %] ); return false;">Download</a>
- <a href="" onclick="DeleteEntry( [% record.id %] ); return false;">Delete</a>
+ [% IF record.owner == owner || CAN_user_tools_upload_manage %]
+ <a href="" onclick="DeleteEntry( [% record.id %] ); return false;">Delete</a>
+ [% END %]
</td>
</tr>
[% END %]
<div class="yui-b">
<h1>Upload</h1>
-
<div class="dialog alert" id="myalerts" style="display:none;"></div>
[% PROCESS submitter %]
</div>
</div>
-</div>
+[% IF !plugin %]
+ <div class="yui-b noprint">
+ [% INCLUDE 'tools-menu.inc' %]
+ </div>
+[% END %]
+
+</div>
[% INCLUDE 'intranet-bottom.inc' %]
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => { editcatalogue => '*' },
+ flagsrequired => { tools => 'upload_general_files' },
}
);
$template->param(
- plugin => $plugin,
- index => $index,
+ index => $index,
+ owner => $loggedinuser,
+ plugin => $plugin,
);
my $upar = $plugin ? { public => 1 } : {};
uploadcategories => Koha::Upload->getCategories,
);
output_html_with_http_headers $input, $cookie, $template->output;
+
} elsif ( $op eq 'search' ) {
my $h = $id ? { id => $id } : { term => $term };
my @uploads = Koha::Upload->new($upar)->get($h);
uploads => \@uploads,
);
output_html_with_http_headers $input, $cookie, $template->output;
-} elsif ( $op eq 'delete' ) {
+} elsif ( $op eq 'delete' ) {
# delete only takes the id parameter
my $upl = Koha::Upload->new($upar);
my ($fn) = $upl->delete( { id => $id } );
uploadcategories => $upl->getCategories,
);
output_html_with_http_headers $input, $cookie, $template->output;
+
} elsif ( $op eq 'download' ) {
my $upl = Koha::Upload->new($upar);
my $rec = $upl->get( { id => $id, filehandle => 1 } );