@@ -, +, @@ --- cataloguing/value_builder/upload.pl | 13 ++++- installer/data/mysql/kohastructure.sql | 3 +- .../en/modules/cataloguing/value_builder/upload.tt | 51 ++++++++++++++------ .../value_builder/upload_delete_file.tt | 2 +- 4 files changed, 50 insertions(+), 19 deletions(-) --- a/cataloguing/value_builder/upload.pl +++ a/cataloguing/value_builder/upload.pl @@ -49,7 +49,8 @@ sub plugin_javascript { if(id.match(/id=([0-9a-f]+)/)){ id = RegExp.\$1; } - window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=upload.pl&index=\"+index+\"&id=\"+id, 'upload', 'width=600,height=400,toolbar=false,scrollbars=no'); + var newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=upload.pl&index=\"+index+\"&id=\"+id+\"&from_popup=0\", 'upload', 'width=600,height=400,toolbar=false,scrollbars=no'); + newin.focus(); } @@ -64,6 +65,7 @@ sub plugin { my $id = $input->param('id'); my $delete = $input->param('delete'); my $uploaded_file = $input->param('uploaded_file'); + my $from_popup = $input->param('from_popup'); my $template_name = ($id || $delete) ? "upload_delete_file.tt" @@ -129,14 +131,21 @@ sub plugin { $template->param( error_upload_path_not_configured => 1 ); } + if (!$uploaded_file && !$dir && $from_popup) { + $template->param(error_nothing_selected => 1); + } + elsif (!$uploaded_file && $dir) { + $template->param(error_no_file_selected => 1); + } if ($uploaded_file and not $dir) { $template->param(error_no_dir_selected => 1); } + } $template->param( index => $index, - id => $id + id => $id, ); output_html_with_http_headers $input, $cookie, $template->output; --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -3198,12 +3198,13 @@ CREATE TABLE IF NOT EXISTS `borrower_modifications` ( PRIMARY KEY (`verification_token`,`borrowernumber`), KEY `verification_token` (`verification_token`), KEY `borrowernumber` (`borrowernumber`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Table structure for table uploaded_files -- -DROP TABLE IF EXISTS uploaded_files +DROP TABLE IF EXISTS uploaded_files; CREATE TABLE uploaded_files ( id CHAR(40) NOT NULL PRIMARY KEY, filename TEXT NOT NULL, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt @@ -7,18 +7,32 @@ @@ -73,17 +87,24 @@

Configuration variable 'upload_path' is not configured.

Please configure it in your koha-conf.xml

[% ELSE %] + [% IF (error_nothing_selected) %] +

Error: You have to choose the file to upload and select where to upload the file.

+ [% END %] + [% IF (error_no_file_selected) %] +

Error: You have to choose the file to upload.

+ [% END %] [% IF (error_no_dir_selected) %] -

Error: You have to select the destination of uploaded file.

+

Error: You have to select where to upload the file.

[% END %]

Please select the file to upload :

-
+ [% filefield %] -

Choose where to upload file

+

Choose where to upload the file

[% INCLUDE list_dirs dirs = dirs_tree %] + - +
[% END %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload_delete_file.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload_delete_file.tt @@ -4,7 +4,7 @@ Upload plugin - +