From 58a63971df5665556f66445164cdd6497a39b1ad Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Thu, 26 Sep 2013 11:45:19 -0400 Subject: [PATCH] Bug 6874 - kohastructure.sql, jquery.js, refocus, and more Two problems were discovered while doing a fresh install of Koha. These problems in the kohastructure.sql file are addressed with this patch. Clicking the plug-in icon should cause the popup window to refocus. This adds the refocus code to the upload.pl file. The path to the jquery.js script was wrong in the upload_delete_file.tt file. Changed [% themelang %] to [% interface %]. After some validation was added, it was extended to include other cases. This serves to patch 6874 to a state where sign off should be possible. --- 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(-) diff --git a/cataloguing/value_builder/upload.pl b/cataloguing/value_builder/upload.pl index 966f0b3..9b66657 100755 --- a/cataloguing/value_builder/upload.pl +++ b/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; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index f6eddf9..1fba56a 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/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, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt index 63849f8..b8fca6b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt +++ b/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 %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload_delete_file.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload_delete_file.tt index 7817bbe..928b954 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload_delete_file.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload_delete_file.tt @@ -4,7 +4,7 @@ Upload plugin - +