View | Details | Raw Unified | Return to bug 14686
Collapse All | Expand All

(-)a/Koha/Upload.pm (-2 / +2 lines)
Lines 170-176 sub get { Link Here
170
    my ( @rv, $res);
170
    my ( @rv, $res);
171
    foreach my $r ( @$temp ) {
171
    foreach my $r ( @$temp ) {
172
        undef $res;
172
        undef $res;
173
        foreach( qw[id hashvalue filesize uploadcategorycode public permanent] ) {
173
        foreach( qw[id hashvalue filesize uploadcategorycode public permanent owner] ) {
174
            $res->{$_} = $r->{$_};
174
            $res->{$_} = $r->{$_};
175
        }
175
        }
176
        $res->{name} = $r->{filename};
176
        $res->{name} = $r->{filename};
Lines 366-372 sub _lookup { Link Here
366
    my ( $self, $params ) = @_;
366
    my ( $self, $params ) = @_;
367
    my $dbh = C4::Context->dbh;
367
    my $dbh = C4::Context->dbh;
368
    my $sql = q|
368
    my $sql = q|
369
SELECT id,hashvalue,filename,dir,filesize,uploadcategorycode,public,permanent
369
SELECT id,hashvalue,filename,dir,filesize,uploadcategorycode,public,permanent,owner
370
FROM uploaded_files
370
FROM uploaded_files
371
    |;
371
    |;
372
    my @pars;
372
    my @pars;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc (+3 lines)
Lines 114-117 Link Here
114
    [% IF ( CAN_user_tools_edit_quotes ) %]
114
    [% IF ( CAN_user_tools_edit_quotes ) %]
115
       <li><a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a></li>
115
       <li><a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a></li>
116
    [% END %]
116
    [% END %]
117
    [% IF ( CAN_user_tools_upload_general_files ) %]
118
       <li><a href="/cgi-bin/koha/tools/upload.pl">Upload any file</a></li>
119
    [% END %]
117
</ul></div></div>
120
</ul></div></div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (+5 lines)
Lines 104-109 Link Here
104
    <dd>Use tool plugins</dd>
104
    <dd>Use tool plugins</dd>
105
    [% END %]
105
    [% END %]
106
106
107
    [% IF ( CAN_user_tools_upload_general_files ) %]
108
    <dt><a href="/cgi-bin/koha/tools/upload.pl">Upload</a></dt>
109
    <dd>Upload any type of file, manage uploads</dd>
110
    [% END %]
111
107
</dl>
112
</dl>
108
</div>
113
</div>
109
<div class="yui-u">
114
<div class="yui-u">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt (-3 / +10 lines)
Lines 182-188 Link Here
182
                <a href="" onclick="Choose('[% record.hashvalue %]'); return false;">Choose</a>&nbsp;
182
                <a href="" onclick="Choose('[% record.hashvalue %]'); return false;">Choose</a>&nbsp;
183
            [% END %]
183
            [% END %]
184
            <a href="" onclick="SubmitMe( 'download', [% record.id %] ); return false;">Download</a>&nbsp;
184
            <a href="" onclick="SubmitMe( 'download', [% record.id %] ); return false;">Download</a>&nbsp;
185
            <a href="" onclick="DeleteEntry( [% record.id %] ); return false;">Delete</a>
185
            [% IF record.owner == owner || CAN_user_tools_upload_manage %]
186
                <a href="" onclick="DeleteEntry( [% record.id %] ); return false;">Delete</a>
187
            [% END %]
186
        </td>
188
        </td>
187
   </tr>
189
   </tr>
188
   [% END %]
190
   [% END %]
Lines 334-340 $(document).ready(function() { Link Here
334
    <div class="yui-b">
336
    <div class="yui-b">
335
337
336
<h1>Upload</h1>
338
<h1>Upload</h1>
337
338
<div class="dialog alert" id="myalerts" style="display:none;"></div>
339
<div class="dialog alert" id="myalerts" style="display:none;"></div>
339
340
340
[% PROCESS submitter %]
341
[% PROCESS submitter %]
Lines 356-361 $(document).ready(function() { Link Here
356
357
357
</div>
358
</div>
358
</div>
359
</div>
359
</div>
360
360
361
[% IF !plugin %]
362
    <div class="yui-b noprint">
363
        [% INCLUDE 'tools-menu.inc' %]
364
    </div>
365
[% END %]
366
367
</div>
361
[% INCLUDE 'intranet-bottom.inc' %]
368
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/tools/upload.pl (-5 / +7 lines)
Lines 38-50 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
38
        query           => $input,
38
        query           => $input,
39
        type            => "intranet",
39
        type            => "intranet",
40
        authnotrequired => 0,
40
        authnotrequired => 0,
41
        flagsrequired   => { editcatalogue => '*' },
41
        flagsrequired   => { tools => 'upload_general_files' },
42
    }
42
    }
43
);
43
);
44
44
45
$template->param(
45
$template->param(
46
    plugin => $plugin,
46
    index      => $index,
47
    index  => $index,
47
    owner      => $loggedinuser,
48
    plugin     => $plugin,
48
);
49
);
49
50
50
my $upar = $plugin ? { public => 1 } : {};
51
my $upar = $plugin ? { public => 1 } : {};
Lines 54-59 if ( $op eq 'new' ) { Link Here
54
        uploadcategories => Koha::Upload->getCategories,
55
        uploadcategories => Koha::Upload->getCategories,
55
    );
56
    );
56
    output_html_with_http_headers $input, $cookie, $template->output;
57
    output_html_with_http_headers $input, $cookie, $template->output;
58
57
} elsif ( $op eq 'search' ) {
59
} elsif ( $op eq 'search' ) {
58
    my $h = $id ? { id => $id } : { term => $term };
60
    my $h = $id ? { id => $id } : { term => $term };
59
    my @uploads = Koha::Upload->new($upar)->get($h);
61
    my @uploads = Koha::Upload->new($upar)->get($h);
Lines 63-70 if ( $op eq 'new' ) { Link Here
63
        uploads => \@uploads,
65
        uploads => \@uploads,
64
    );
66
    );
65
    output_html_with_http_headers $input, $cookie, $template->output;
67
    output_html_with_http_headers $input, $cookie, $template->output;
66
} elsif ( $op eq 'delete' ) {
67
68
69
} elsif ( $op eq 'delete' ) {
68
    # delete only takes the id parameter
70
    # delete only takes the id parameter
69
    my $upl = Koha::Upload->new($upar);
71
    my $upl = Koha::Upload->new($upar);
70
    my ($fn) = $upl->delete( { id => $id } );
72
    my ($fn) = $upl->delete( { id => $id } );
Lines 79-84 if ( $op eq 'new' ) { Link Here
79
        uploadcategories => $upl->getCategories,
81
        uploadcategories => $upl->getCategories,
80
    );
82
    );
81
    output_html_with_http_headers $input, $cookie, $template->output;
83
    output_html_with_http_headers $input, $cookie, $template->output;
84
82
} elsif ( $op eq 'download' ) {
85
} elsif ( $op eq 'download' ) {
83
    my $upl = Koha::Upload->new($upar);
86
    my $upl = Koha::Upload->new($upar);
84
    my $rec = $upl->get( { id => $id, filehandle => 1 } );
87
    my $rec = $upl->get( { id => $id, filehandle => 1 } );
85
- 

Return to bug 14686