From 805569ea70b82a60cc98bc52691d830b5a1cb8f3 Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Fri, 20 Apr 2012 16:12:26 -0400 Subject: [PATCH] QOTD uploader to enable uploading csv files containing quotes Content-Type: text/plain; charset="utf-8" This series will add a DataTable's based upload/editor with which to upload csv files containing quotes to be used by the QOTD feature. The file should be formatted thusly: "source","text-of-quote" "source","text-of-quote" ... Note: This work serves as a good example of potential improvements in all other "editor" and file upload areas of Koha. This patch is a squash of the following work: --Adding code to parse CSV file contents and push it into a DataTable --Adding in jEditable to enable table editing --Adding ajax to post data back to the server to be saved --Fixing edit and adding delete functionality --Adding some missing css as well as server feedback on save --Fixing a bug which limited the number of quotes which could be uploaded --Also fixing a minor bug with fnCSVToArray and doing some style cleanup. --Adding sanity checks to verify file type and size --Implements YUI button widget/toolbar --Improved handling of hiding uploader UI --Adds row selectability --Adds multi-delete capability --Adds YUI button/toolbar widget --Fixing capitalization in quote uploader --Implements improvments suggested by jcamins and oleonard --- koha-tmpl/intranet-tmpl/prog/en/css/datatables.css | 12 + koha-tmpl/intranet-tmpl/prog/en/css/uploader.css | 49 +++ .../prog/en/includes/quotes-upload-toolbar.inc | 42 +++ .../prog/en/modules/tools/quotes-upload.tt | 337 ++++++++++++++++++++ .../intranet-tmpl/prog/en/modules/tools/quotes.tt | 8 +- koha-tmpl/intranet-tmpl/prog/img/x_alt_16x16.png | Bin 0 -> 215 bytes tools/quotes-upload.pl | 44 +++ tools/quotes/quotes-upload_ajax.pl | 68 ++++ 8 files changed, 558 insertions(+), 2 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/css/uploader.css create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/quotes-upload-toolbar.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/img/x_alt_16x16.png create mode 100755 tools/quotes-upload.pl create mode 100755 tools/quotes/quotes-upload_ajax.pl diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css b/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css index 2a78678..a54c612 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css @@ -191,6 +191,18 @@ div.dataTables_paginate.paging_four_button { width: 250px; } +input { + border-radius: 5px; +} + +tr.odd.selected td { + background-color: #D3D3D3; +} + +tr.even.selected td { + background-color: #D3D3D3; +} + /* table.display { width: 100%; diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/uploader.css b/koha-tmpl/intranet-tmpl/prog/en/css/uploader.css new file mode 100644 index 0000000..e747255 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/css/uploader.css @@ -0,0 +1,49 @@ +#progress_bar { + margin: 10px 0; + padding: 3px; + border: 1px solid #000; + font-size: 14px; + clear: both; + opacity: 0; + -moz-transition: opacity 1s linear; + -o-transition: opacity 1s linear; + -webkit-transition: opacity 1s linear; +} +#progress_bar.loading { + opacity: 1.0; +} +#progress_bar .percent { + color: #E6F0F2; + background-color: #004D99; + height: auto; + width: 0; +} +#server_response { + background-color: white; + background-image: url("../../img/x_alt_16x16.png"); + background-repeat: no-repeat; + background-origin: padding-box; + background-position: right top; + border: 1px solid #DDDDDD; + color: #999999; + font-size: 14px; + height: 30px; + left: 50%; + margin-left: -125px; + margin-top: -15px; + padding: 14px 0 2px; + position: fixed; + text-align: center; + top: 50%; + width: 250px; +} + +#file_uploader { + position: relative; + top: -24px; +} + +#file_upload { + position: relative; + top: -1px; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/quotes-upload-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/quotes-upload-toolbar.inc new file mode 100644 index 0000000..f32e8b1 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/quotes-upload-toolbar.inc @@ -0,0 +1,42 @@ + +
+ +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt new file mode 100644 index 0000000..f2cb169 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt @@ -0,0 +1,337 @@ + [% INCLUDE 'doc-head-open.inc' %] + Koha › Tools › Quote uploader + [% INCLUDE 'doc-head-close.inc' %] + + + + [% INCLUDE 'datatables-strings.inc' %] + + + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %] + + + +
+
+
+
+ [% INCLUDE 'quotes-upload-toolbar.inc' %] +

Quote uploader

+
+ Upload quotes +
+ + +
0%
+
+
+
Server Response
+ + + + + + + + + + + + + + + + + + +
+
+
+ [% INCLUDE 'tools-menu.inc' %] +
+
+[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt index 7d020b5..59127a5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt @@ -6,8 +6,8 @@ [% INCLUDE 'datatables-strings.inc' %] - - + +