Bugzilla – Attachment 69427 Details for
Bug 19653
Move tools templates JavaScript to the footer: Additional tools
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19653: Move tools templates JavaScript to the footer: Additional tools
Bug-19653-Move-tools-templates-JavaScript-to-the-f.patch (text/plain), 93.93 KB, created by
Claire Gravely
on 2017-12-01 10:55:38 UTC
(
hide
)
Description:
Bug 19653: Move tools templates JavaScript to the footer: Additional tools
Filename:
MIME Type:
Creator:
Claire Gravely
Created:
2017-12-01 10:55:38 UTC
Size:
93.93 KB
patch
obsolete
>From c3c7932aed7f346ae8a74a6780d0379be830b454 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 28 Nov 2017 15:41:54 +0000 >Subject: [PATCH] Bug 19653: Move tools templates JavaScript to the footer: > Additional tools > >This patch modifies the staff client "Additional tools" templates so >that JavaScript is included in the footer instead of the header: > >- Calendar >- CSV profiles >- Log viewer >- News >- Task scheduler >- Edit quotes for QOTD feature >- Upload > >Note that the log viewer template has been modified so that the >"interface" variable (passed to the template to provide the correct path >to staff client assets) isn't overwritten by an "interface" variable >required by the log viewer. > >To test, apply the patch and test the JavaScript-driven features of >each modified template: All button controls, DataTables functionality, >form validation, etc. > >Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> >--- > .../prog/en/modules/tools/csv-profiles.tt | 56 +- > .../prog/en/modules/tools/holidays.tt | 402 +++++++------- > .../prog/en/modules/tools/koha-news.tt | 134 ++--- > .../prog/en/modules/tools/quotes-upload.tt | 602 ++++++++++----------- > .../intranet-tmpl/prog/en/modules/tools/quotes.tt | 352 ++++++------ > .../prog/en/modules/tools/scheduler.tt | 21 +- > .../intranet-tmpl/prog/en/modules/tools/upload.tt | 323 +++++------ > .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 19 +- > 8 files changed, 969 insertions(+), 940 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt >index cdbaab9..e9d97d3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt >@@ -1,28 +1,7 @@ >-[% INCLUDE 'doc-head-open.inc' %]<title>Koha › Tools › CSV export profiles</title>[% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >-function reloadPage(p) { >- var id = p.value; >- if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; } >-} >- $(document).ready(function() { >- $("#type").change(function(){ >- if ( $(this).find("option:selected").val() == "marc" ) { >- $("li.marc_specific").show(); >- $("#marc_content").attr("required", "required"); >- $("li.sql_specific").hide(); >- $("#sql_content").removeAttr("required"); >- } else { >- $("li.marc_specific").hide(); >- $("#marc_content").removeAttr("required"); >- $("li.sql_specific").show(); >- $("#sql_content").attr("required", "required"); >- } >- }); >- $("#type").change(); >- }); >-//]]> >-</script> >+[% SET footerjs = 1 %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Tools › CSV export profiles</title> >+[% INCLUDE 'doc-head-close.inc' %] > </head> > > <body id="tools_csv-profiles" class="tools"> >@@ -304,4 +283,31 @@ function reloadPage(p) { > [% INCLUDE 'tools-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ <script type="text/javascript"> >+ function reloadPage(p) { >+ var id = p.value; >+ if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; } >+ } >+ $(document).ready(function() { >+ $("#type").change(function(){ >+ if ( $(this).find("option:selected").val() == "marc" ) { >+ $("li.marc_specific").show(); >+ $("#marc_content").attr("required", "required"); >+ $("li.sql_specific").hide(); >+ $("#sql_content").removeAttr("required"); >+ } else { >+ $("li.marc_specific").hide(); >+ $("#marc_content").removeAttr("required"); >+ $("li.sql_specific").show(); >+ $("#sql_content").attr("required", "required"); >+ } >+ }); >+ $("#type").change(); >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >index e81b14f..98c24cd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >@@ -1,207 +1,9 @@ > [% USE Branches %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › [% Branches.GetName( branch ) %] calendar</title> > [% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'calendar.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >- var weekdays = new Array(_("Sundays"),_("Mondays"),_("Tuesdays"),_("Wednesdays"),_("Thursdays"),_("Fridays"),_("Saturdays")); >- >- /* Creates all the structures to deal with all different kinds of holidays */ >- var week_days = new Array(); >- var holidays = new Array(); >- var holidates = new Array(); >- var exception_holidays = new Array(); >- var day_month_holidays = new Array(); >- var hola= "[% code %]"; >- [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %] >- week_days["[% WEEK_DAYS_LOO.KEY %]"] = {title:"[% WEEK_DAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"}; >- [% END %] >- [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %] >- holidates.push("[% HOLIDAYS_LOO.KEY %]"); >- holidays["[% HOLIDAYS_LOO.KEY %]"] = {title:"[% HOLIDAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"}; >- [% END %] >- [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %] >- exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"}; >- [% END %] >- [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %] >- day_month_holidays["[% DAY_MONTH_HOLIDAYS_LOO.KEY %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"}; >- [% END %] >- >- function holidayOperation(formObject, opType) { >- var op = document.getElementsByName('operation'); >- op[0].value = opType; >- formObject.submit(); >- } >- >- // This function shows the "Show Holiday" panel // >- function showHoliday (exceptionPosibility, dayName, day, month, year, weekDay, title, description, holidayType) { >- $("#newHoliday").slideUp("fast"); >- $("#showHoliday").slideDown("fast"); >- $('#showDaynameOutput').html(dayName); >- $('#showDayname').val(dayName); >- $('#showBranchNameOutput').html($("#branch :selected").text()); >- $('#showBranchName').val($("#branch").val()); >- $('#showDayOutput').html(day); >- $('#showDay').val(day); >- $('#showMonthOutput').html(month); >- $('#showMonth').val(month); >- $('#showYearOutput').html(year); >- $('#showYear').val(year); >- $('#showDescription').val(description); >- $('#showWeekday:first').val(weekDay); >- $('#showTitle').val(title); >- $('#showHolidayType').val(holidayType); >- >- if (holidayType == 'exception') { >- $("#showOperationDelLabel").html(_("Delete this exception.")); >- $("#holtype").attr("class","key exception").html(_("Holiday exception")); >- } else if(holidayType == 'weekday') { >- $("#showOperationDelLabel").html(_("Delete this holiday.")); >- $("#holtype").attr("class","key repeatableweekly").html(_("Holiday repeating weekly")); >- } else if(holidayType == 'daymonth') { >- $("#showOperationDelLabel").html(_("Delete this holiday.")); >- $("#holtype").attr("class","key repeatableyearly").html(_("Holiday repeating yearly")); >- } else { >- $("#showOperationDelLabel").html(_("Delete this holiday.")); >- $("#holtype").attr("class","key holiday").html(_("Unique holiday")); >- } >- >- if (exceptionPosibility == 1) { >- $("#exceptionPosibility").parent().show(); >- } else { >- $("#exceptionPosibility").parent().hide(); >- } >- } >- >- // This function shows the "Add Holiday" panel // >- function newHoliday (dayName, day, month, year, weekDay) { >- $("#showHoliday").slideUp("fast"); >- $("#newHoliday").slideDown("fast"); >- $("#newDaynameOutput").html(dayName); >- $("#newDayname").val(dayName); >- $("#newBranchNameOutput").html($('#branch :selected').text()); >- $("#newBranchName").val($('#branch').val()); >- $("#newDayOutput").html(day); >- $("#newDay").val(day); >- $("#newMonthOutput").html(month); >- $("#newMonth").val(month); >- $("#newYearOutput").html(year); >- $("#newYear").val(year); >- $("#newWeekday:first").val(weekDay); >- } >- >- function hidePanel(aPanelName) { >- $("#"+aPanelName).slideUp("fast"); >- } >- >- function changeBranch () { >- var branch = $("#branch option:selected").val(); >- location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "[% calendardate %]"; >- } >- >- function Help() { >- newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes'); >- } >- >- /* This function gives css clases to each kind of day */ >- function dateStatusHandler(date) { >- date = new Date(date); >- var day = date.getDate(); >- var month = date.getMonth() + 1; >- var year = date.getFullYear(); >- var weekDay = date.getDay(); >- var dayMonth = month + '/' + day; >- var dateString = year + '/' + month + '/' + day; >- if (exception_holidays[dateString] != null) { >- return [true, "exception", _("Exception: %s").format(exception_holidays[dateString].title)]; >- } else if ( week_days[weekDay] != null ){ >- return [true, "repeatableweekly", _("Weekly holiday: %s").format(week_days[weekDay].title)]; >- } else if ( day_month_holidays[dayMonth] != null ) { >- return [true, "repeatableyearly", _("Yearly holiday: %s").format(day_month_holidays[dayMonth].title)]; >- } else if (holidays[dateString] != null) { >- return [true, "holiday", _("Single holiday: %s").format(holidays[dateString].title)]; >- } else { >- return [true, "normalday", _("Normal day")]; >- } >- } >- >- /* This function is in charge of showing the correct panel considering the kind of holiday */ >- function dateChanged(calendar) { >- calendar = new Date(calendar); >- var day = calendar.getDate(); >- var month = calendar.getMonth() + 1; >- var year = calendar.getFullYear(); >- var weekDay = calendar.getDay(); >- var dayName = weekdays[weekDay]; >- var dayMonth = month + '/' + day; >- var dateString = year + '/' + month + '/' + day; >- if (holidays[dateString] != null) { >- showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description, 'ymd'); >- } else if (exception_holidays[dateString] != null) { >- showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description, 'exception'); >- } else if (week_days[weekDay] != null) { >- showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description, 'weekday'); >- } else if (day_month_holidays[dayMonth] != null) { >- showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description, 'daymonth'); >- } else { >- newHoliday(dayName, day, month, year, weekDay); >- } >- }; >- >- $(document).ready(function() { >- >- $(".hint").hide(); >- $("#branch").change(function(){ >- changeBranch(); >- }); >- $("#holidayweeklyrepeatable>tbody>tr").each(function(){ >- var first_td = $(this).find('td').first(); >- first_td.html(weekdays[first_td.html()]); >- }); >- $("#holidayweeklyrepeatable").dataTable($.extend(true, {}, dataTablesDefaults, { >- "sDom": 't', >- "bPaginate": false >- })); >- $("#holidayexceptions,#holidaysyearlyrepeatable,#holidaysunique").dataTable($.extend(true, {}, dataTablesDefaults, { >- "sDom": 't', >- "aoColumns": [ >- { "sType": "title-string" },null,null >- ], >- "bPaginate": false >- })); >- $("a.helptext").click(function(){ >- $(this).parent().find(".hint").toggle(); return false; >- }); >- $("#dateofrange").datepicker(); >- $("#datecancelrange").datepicker(); >- $("#dateofrange").each(function () { this.value = "" }); >- $("#datecancelrange").each(function () { this.value = "" }); >- $("#jcalendar-container").datepicker({ >- beforeShowDay: function(thedate) { >- var day = thedate.getDate(); >- var month = thedate.getMonth() + 1; >- var year = thedate.getFullYear(); >- var dateString = year + '/' + month + '/' + day; >- return dateStatusHandler(dateString); >- }, >- onSelect: function(dateText, inst) { >- dateChanged($(this).datepicker("getDate")); >- }, >- defaultDate: new Date("[% keydate %]") >- }); >- $(".hidePanel").on("click",function(){ >- if( $(this).hasClass("showHoliday") ){ >- hidePanel("showHoliday"); >- } else { >- hidePanel("newHoliday"); >- } >- }) >- }); >-//]]> >-</script> > <style type="text/css"> .key { padding : 3px; white-space:nowrap; line-height:230%; } > .ui-datepicker { font-size : 150%; } > .ui-datepicker th, .ui-datepicker .ui-datepicker-title select { font-size : 80%; } >@@ -534,4 +336,206 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl > [% INCLUDE 'tools-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ <script type="text/javascript"> >+ var weekdays = new Array(_("Sundays"),_("Mondays"),_("Tuesdays"),_("Wednesdays"),_("Thursdays"),_("Fridays"),_("Saturdays")); >+ >+ /* Creates all the structures to deal with all different kinds of holidays */ >+ var week_days = new Array(); >+ var holidays = new Array(); >+ var holidates = new Array(); >+ var exception_holidays = new Array(); >+ var day_month_holidays = new Array(); >+ var hola= "[% code %]"; >+ [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %] >+ week_days["[% WEEK_DAYS_LOO.KEY %]"] = {title:"[% WEEK_DAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"}; >+ [% END %] >+ [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %] >+ holidates.push("[% HOLIDAYS_LOO.KEY %]"); >+ holidays["[% HOLIDAYS_LOO.KEY %]"] = {title:"[% HOLIDAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"}; >+ [% END %] >+ [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %] >+ exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"}; >+ [% END %] >+ [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %] >+ day_month_holidays["[% DAY_MONTH_HOLIDAYS_LOO.KEY %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"}; >+ [% END %] >+ >+ function holidayOperation(formObject, opType) { >+ var op = document.getElementsByName('operation'); >+ op[0].value = opType; >+ formObject.submit(); >+ } >+ >+ // This function shows the "Show Holiday" panel // >+ function showHoliday (exceptionPosibility, dayName, day, month, year, weekDay, title, description, holidayType) { >+ $("#newHoliday").slideUp("fast"); >+ $("#showHoliday").slideDown("fast"); >+ $('#showDaynameOutput').html(dayName); >+ $('#showDayname').val(dayName); >+ $('#showBranchNameOutput').html($("#branch :selected").text()); >+ $('#showBranchName').val($("#branch").val()); >+ $('#showDayOutput').html(day); >+ $('#showDay').val(day); >+ $('#showMonthOutput').html(month); >+ $('#showMonth').val(month); >+ $('#showYearOutput').html(year); >+ $('#showYear').val(year); >+ $('#showDescription').val(description); >+ $('#showWeekday:first').val(weekDay); >+ $('#showTitle').val(title); >+ $('#showHolidayType').val(holidayType); >+ >+ if (holidayType == 'exception') { >+ $("#showOperationDelLabel").html(_("Delete this exception.")); >+ $("#holtype").attr("class","key exception").html(_("Holiday exception")); >+ } else if(holidayType == 'weekday') { >+ $("#showOperationDelLabel").html(_("Delete this holiday.")); >+ $("#holtype").attr("class","key repeatableweekly").html(_("Holiday repeating weekly")); >+ } else if(holidayType == 'daymonth') { >+ $("#showOperationDelLabel").html(_("Delete this holiday.")); >+ $("#holtype").attr("class","key repeatableyearly").html(_("Holiday repeating yearly")); >+ } else { >+ $("#showOperationDelLabel").html(_("Delete this holiday.")); >+ $("#holtype").attr("class","key holiday").html(_("Unique holiday")); >+ } >+ >+ if (exceptionPosibility == 1) { >+ $("#exceptionPosibility").parent().show(); >+ } else { >+ $("#exceptionPosibility").parent().hide(); >+ } >+ } >+ >+ // This function shows the "Add Holiday" panel // >+ function newHoliday (dayName, day, month, year, weekDay) { >+ $("#showHoliday").slideUp("fast"); >+ $("#newHoliday").slideDown("fast"); >+ $("#newDaynameOutput").html(dayName); >+ $("#newDayname").val(dayName); >+ $("#newBranchNameOutput").html($('#branch :selected').text()); >+ $("#newBranchName").val($('#branch').val()); >+ $("#newDayOutput").html(day); >+ $("#newDay").val(day); >+ $("#newMonthOutput").html(month); >+ $("#newMonth").val(month); >+ $("#newYearOutput").html(year); >+ $("#newYear").val(year); >+ $("#newWeekday:first").val(weekDay); >+ } >+ >+ function hidePanel(aPanelName) { >+ $("#"+aPanelName).slideUp("fast"); >+ } >+ >+ function changeBranch () { >+ var branch = $("#branch option:selected").val(); >+ location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "[% calendardate %]"; >+ } >+ >+ function Help() { >+ newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes'); >+ } >+ >+ /* This function gives css clases to each kind of day */ >+ function dateStatusHandler(date) { >+ date = new Date(date); >+ var day = date.getDate(); >+ var month = date.getMonth() + 1; >+ var year = date.getFullYear(); >+ var weekDay = date.getDay(); >+ var dayMonth = month + '/' + day; >+ var dateString = year + '/' + month + '/' + day; >+ if (exception_holidays[dateString] != null) { >+ return [true, "exception", _("Exception: %s").format(exception_holidays[dateString].title)]; >+ } else if ( week_days[weekDay] != null ){ >+ return [true, "repeatableweekly", _("Weekly holiday: %s").format(week_days[weekDay].title)]; >+ } else if ( day_month_holidays[dayMonth] != null ) { >+ return [true, "repeatableyearly", _("Yearly holiday: %s").format(day_month_holidays[dayMonth].title)]; >+ } else if (holidays[dateString] != null) { >+ return [true, "holiday", _("Single holiday: %s").format(holidays[dateString].title)]; >+ } else { >+ return [true, "normalday", _("Normal day")]; >+ } >+ } >+ >+ /* This function is in charge of showing the correct panel considering the kind of holiday */ >+ function dateChanged(calendar) { >+ calendar = new Date(calendar); >+ var day = calendar.getDate(); >+ var month = calendar.getMonth() + 1; >+ var year = calendar.getFullYear(); >+ var weekDay = calendar.getDay(); >+ var dayName = weekdays[weekDay]; >+ var dayMonth = month + '/' + day; >+ var dateString = year + '/' + month + '/' + day; >+ if (holidays[dateString] != null) { >+ showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description, 'ymd'); >+ } else if (exception_holidays[dateString] != null) { >+ showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description, 'exception'); >+ } else if (week_days[weekDay] != null) { >+ showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description, 'weekday'); >+ } else if (day_month_holidays[dayMonth] != null) { >+ showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description, 'daymonth'); >+ } else { >+ newHoliday(dayName, day, month, year, weekDay); >+ } >+ }; >+ >+ $(document).ready(function() { >+ >+ $(".hint").hide(); >+ $("#branch").change(function(){ >+ changeBranch(); >+ }); >+ $("#holidayweeklyrepeatable>tbody>tr").each(function(){ >+ var first_td = $(this).find('td').first(); >+ first_td.html(weekdays[first_td.html()]); >+ }); >+ $("#holidayweeklyrepeatable").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "sDom": 't', >+ "bPaginate": false >+ })); >+ $("#holidayexceptions,#holidaysyearlyrepeatable,#holidaysunique").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "sDom": 't', >+ "aoColumns": [ >+ { "sType": "title-string" },null,null >+ ], >+ "bPaginate": false >+ })); >+ $("a.helptext").click(function(){ >+ $(this).parent().find(".hint").toggle(); return false; >+ }); >+ $("#dateofrange").datepicker(); >+ $("#datecancelrange").datepicker(); >+ $("#dateofrange").each(function () { this.value = "" }); >+ $("#datecancelrange").each(function () { this.value = "" }); >+ $("#jcalendar-container").datepicker({ >+ beforeShowDay: function(thedate) { >+ var day = thedate.getDate(); >+ var month = thedate.getMonth() + 1; >+ var year = thedate.getFullYear(); >+ var dateString = year + '/' + month + '/' + day; >+ return dateStatusHandler(dateString); >+ }, >+ onSelect: function(dateText, inst) { >+ dateChanged($(this).datepicker("getDate")); >+ }, >+ defaultDate: new Date("[% keydate %]") >+ }); >+ $(".hidePanel").on("click",function(){ >+ if( $(this).hasClass("showHoliday") ){ >+ hidePanel("showHoliday"); >+ } else { >+ hidePanel("newHoliday"); >+ } >+ }) >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index dd1ae84..24fe1bf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -1,76 +1,14 @@ > [% USE KohaDates %] > [% USE Branches %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › News</title> > [% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'calendar.inc' %] > [% IF ( opac_news_count ) %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >- [% INCLUDE 'datatables.inc' %] >- <script type="text/javascript">//<![CDATA[ >- $(document).ready(function() { >- $("#newst").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "aTargets": [ 0,-1,-2 ], "bSortable": false }, >- { "aTargets": [ 0, -1 ], "bSearchable": false }, >- { 'sType': "title-string", 'aTargets' : [ 'title-string'] } >- ], >- "sPaginationType": "full_numbers" >- })); >- $(".delete_news").on("click", function(){ >- return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") ); >- }); >- >- function Checkbox(){ >- var form = document.getElementById('del_form'); >- var inputs = form.getElementsByTagName('input'); >- var checked = false; >- for (var i=0; i<inputs.length; i++) { >- if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') { >- checked = inputs[i].checked; >- if (checked) return true; >- } >- } >- } >- >- $("#del_form").on("submit",function(){ >- if ( Checkbox() ) { >- return confirmDelete( _("Are you sure you want to delete the selected news?") ); >- } else { >- alert(_("Please select a news item to delete.")); >- return false; >- } >- }); >- }); >- //]]> >- </script> > [% END %] >-<script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script> >-<script type="text/javascript">//<![CDATA[ >-tinyMCE.init({ >- mode : "textareas", >- theme : "advanced", >- convert_urls : false, >- relative_urls : false, >- content_css : "[% interface %]/[% theme %]/css/tinymce.css", >- plugins : "table,save,advhr,advlink,searchreplace,print,contextmenu", >- theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,search,replace,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,|,print", >- theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap", >- theme_advanced_buttons3 : "", >- theme_advanced_toolbar_location : "top", >- theme_advanced_toolbar_align : "left", >- theme_advanced_path_location : "bottom", >- theme_advanced_resizing : true, >- plugin_insertdate_dateFormat : "%Y-%m-%d", >- plugin_insertdate_timeFormat : "%H:%M:%S", >- apply_source_formatting : true, >- height : "300", >- width : "700" >-//]]> >-}); >-//]]> >-</script> > </head> >+ > <body id="tools_koha-news" class="tools"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] >@@ -278,4 +216,72 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > </div> > [% END %] > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'calendar.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ [% IF ( opac_news_count ) %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ $("#newst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ 0,-1,-2 ], "bSortable": false }, >+ { "aTargets": [ 0, -1 ], "bSearchable": false }, >+ { 'sType': "title-string", 'aTargets' : [ 'title-string'] } >+ ], >+ "sPaginationType": "full_numbers" >+ })); >+ $(".delete_news").on("click", function(){ >+ return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") ); >+ }); >+ >+ function Checkbox(){ >+ var form = document.getElementById('del_form'); >+ var inputs = form.getElementsByTagName('input'); >+ var checked = false; >+ for (var i=0; i<inputs.length; i++) { >+ if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') { >+ checked = inputs[i].checked; >+ if (checked) return true; >+ } >+ } >+ } >+ >+ $("#del_form").on("submit",function(){ >+ if ( Checkbox() ) { >+ return confirmDelete( _("Are you sure you want to delete the selected news?") ); >+ } else { >+ alert(_("Please select a news item to delete.")); >+ return false; >+ } >+ }); >+ }); >+ </script> >+ [% END %] >+ <script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script> >+ <script type="text/javascript"> >+ tinyMCE.init({ >+ mode : "textareas", >+ theme : "advanced", >+ convert_urls : false, >+ relative_urls : false, >+ content_css : "[% interface %]/[% theme %]/css/tinymce.css", >+ plugins : "table,save,advhr,advlink,searchreplace,print,contextmenu", >+ theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,search,replace,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,|,print", >+ theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap", >+ theme_advanced_buttons3 : "", >+ theme_advanced_toolbar_location : "top", >+ theme_advanced_toolbar_align : "left", >+ theme_advanced_path_location : "bottom", >+ theme_advanced_resizing : true, >+ plugin_insertdate_dateFormat : "%Y-%m-%d", >+ plugin_insertdate_timeFormat : "%H:%M:%S", >+ apply_source_formatting : true, >+ height : "300", >+ width : "700" >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >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 >index 088b730..50c10c7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt >@@ -1,311 +1,12 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Quote uploader</title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/uploader.css" /> > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/quotes.css" /> > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >- [% INCLUDE 'datatables.inc' %] >- <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.jeditable.mini.js"></script> >- <script type="text/javascript"> >- //<![CDATA[ >- var oTable; //DataTable object >- $(document).ready(function() { >- >- $("#cancel_upload").on("click",function(e){ >- e.preventDefault(); >- fnAbortRead(); >- }); >- $("#cancel_quotes").on("click",function(){ >- return confirm( _("Are you sure you want to cancel this import?") ); >- }); >- >- // Credits: >- // FileReader() code copied and hacked from: >- // http://www.html5rocks.com/en/tutorials/file/dndfiles/ >- // fnCSVToArray() gratefully borrowed from: >- // http://www.bennadel.com/blog/1504-Ask-Ben-Parsing-CSV-Strings-With-Javascript-Exec-Regular-Expression-Command.htm >- >- var reader; >- var progress = document.querySelector('.percent'); >- $("#server_response").hide(); >- >- function yuiGetData() { >- fnGetData(document.getElementById('quotes_editor')); >- } >- >- function fnAbortRead() { >- reader.abort(); >- } >- >- function fnErrorHandler(evt) { >- switch(evt.target.error.code) { >- case evt.target.error.NOT_FOUND_ERR: >- alert('File Not Found!'); >- break; >- case evt.target.error.NOT_READABLE_ERR: >- alert('File is not readable'); >- break; >- case evt.target.error.ABORT_ERR: >- break; // noop >- default: >- alert('An error occurred reading this file.'); >- }; >- } >- >- function fnUpdateProgress(evt) { >- // evt is an ProgressEvent. >- if (evt.lengthComputable) { >- var percentLoaded = Math.round((evt.loaded / evt.total) * 100); >- // Increase the progress bar length. >- if (percentLoaded < 100) { >- progress.style.width = percentLoaded + '%'; >- progress.textContent = percentLoaded + '%'; >- } >- } >- } >- >- function fnCSVToArray( strData, strDelimiter ){ >- // This will parse a delimited string into an array of >- // arrays. The default delimiter is the comma, but this >- // can be overriden in the second argument. >- >- // Check to see if the delimiter is defined. If not, >- // then default to comma. >- strDelimiter = (strDelimiter || ","); >- >- // Create a regular expression to parse the CSV values. >- var objPattern = new RegExp( >- ( >- // Delimiters. >- "(\\" + strDelimiter + "|\\r?\\n|\\r|^)" + >- // Quoted fields. >- "(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|" + >- // Standard fields. >- "([^\"\\" + strDelimiter + "\\r\\n]*))" >- ), >- "gi" >- ); >- >- // Create an array to hold our data. Give the array >- // a default empty first row. >- var arrData = [[]]; >- >- // Create an array to hold our individual pattern >- // matching groups. >- var arrMatches = null; >- >- // Keep looping over the regular expression matches >- // until we can no longer find a match. >- while (arrMatches = objPattern.exec( strData )){ >- >- // Get the delimiter that was found. >- var strMatchedDelimiter = arrMatches[ 1 ]; >- >- // Check to see if the given delimiter has a length >- // (is not the start of string) and if it matches >- // field delimiter. If it does not, then we know >- // that this delimiter is a row delimiter. >- if ( strMatchedDelimiter.length && (strMatchedDelimiter != strDelimiter) ){ >- // Since we have reached a new row of data, >- // add an empty row to our data array. >- // Note: if there is not more data, we will have to remove this row later >- arrData.push( [] ); >- } >- >- // Now that we have our delimiter out of the way, >- // let's check to see which kind of value we >- // captured (quoted or unquoted). >- if (arrMatches[ 2 ]){ >- // We found a quoted value. When we capture >- // this value, unescape any double quotes. >- var strMatchedValue = arrMatches[ 2 ].replace( >- new RegExp( "\"\"", "g" ), >- "\"" >- ); >- } else if (arrMatches[3]){ >- // We found a non-quoted value. >- var strMatchedValue = arrMatches[ 3 ]; >- } else { >- // There is no more valid data so remove the row we added earlier >- // Is there a better way? Perhaps a look-ahead regexp? >- arrData.splice(arrData.length-1, 1); >- } >- >- // Now that we have our value string, let's add >- // it to the data array. >- arrData[ arrData.length - 1 ].push( strMatchedValue ); >- } >- >- // Return the parsed data. >- return( arrData ); >- } >- >- function fnDataTable(aaData) { >- for(var i=0; i<aaData.length; i++) { >- aaData[i].unshift(i+1); // Add a column w/quote number >- } >- >- >- /* Transition from the quote file uploader to the quote file editor interface */ >- $('#toolbar').css("visibility","visible"); >- $('#toolbar').css("position",""); >- $('#file_editor_inst').css("visibility", "visible"); >- $('#file_editor_inst').css("position", ""); >- $('#file_uploader_inst').css("visibility", "hidden"); >- $('#save_quotes').css("visibility","visible"); >- $('#file_uploader').css("visibility","hidden"); >- $('#file_uploader').css("position","absolute"); >- $('#file_uploader').css("top","-150px"); >- $('#quotes_editor').css("visibility","visible"); >- $("#save_quotes").on("click", yuiGetData); >- $("#delete_quote").on("click", fnClickDeleteRow); >- >- >- >- oTable = $('#quotes_editor').dataTable( { >- "bAutoWidth" : false, >- "bPaginate" : true, >- "bSort" : false, >- "sPaginationType" : "full_numbers", >- "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">', >- "aaData" : aaData, >- "aoColumns" : [ >- { >- "sTitle" : "Number", >- "sWidth" : "2%", >- }, >- { >- "sTitle" : "Source", >- "sWidth" : "15%", >- }, >- { >- "sTitle" : "Quote", >- "sWidth" : "83%", >- }, >- ], >- "fnPreDrawCallback": function(oSettings) { >- return true; >- }, >- "fnRowCallback": function( nRow, aData, iDisplayIndex ) { >- /* do foo on various cells in the current row */ >- var quoteNum = $('td', nRow)[0].innerHTML; >- $(nRow).attr("id", quoteNum); /* set row ids to quote number */ >- $('td:eq(0)', nRow).click(function() {$(this.parentNode).toggleClass('selected',this.clicked);}); /* add row selectors */ >- $('td:eq(0)', nRow).attr("title", _("Click ID to select/deselect quote")); >- /* apply no_edit id to noEditFields */ >- noEditFields = [0]; /* number */ >- for (i=0; i<noEditFields.length; i++) { >- $('td', nRow)[noEditFields[i]].setAttribute("id","no_edit"); >- } >- return nRow; >- }, >- "fnDrawCallback": function(oSettings) { >- /* Apply the jEditable handlers to the table on all fields w/o the no_edit id */ >- $('#quotes_editor tbody td[id!="no_edit"]').editable( function(value, settings) { >- var cellPosition = oTable.fnGetPosition( this ); >- oTable.fnUpdate(value, cellPosition[0], cellPosition[1], false, false); >- return(value); >- }, >- { >- "callback" : function( sValue, y ) { >- oTable.fnDraw(false); /* no filter/sort or we lose our pagination */ >- }, >- "height" : "14px", >- }); >- }, >- }); >- $('#footer').css("visibility","visible"); >- } >- >- function fnHandleFileSelect(evt) { >- // Reset progress indicator on new file selection. >- progress.style.width = '0%'; >- progress.textContent = '0%'; >- >- reader = new FileReader(); >- reader.onerror = fnErrorHandler; >- reader.onprogress = fnUpdateProgress; >- reader.onabort = function(e) { >- alert('File read cancelled'); >- parent.location='quotes-upload.pl'; >- }; >- reader.onloadstart = function(e) { >- $('#cancel_upload').show(); >- $('#progress_bar').addClass("loading"); >- }; >- reader.onload = function(e) { >- // Ensure that the progress bar displays 100% at the end. >- progress.style.width = '100%'; >- progress.textContent = '100%'; >- $('#cancel_upload').hide(); >- quotes = fnCSVToArray(e.target.result, ','); >- fnDataTable(quotes); >- } >- >- // perform various sanity checks on the target file prior to uploading... >- var fileType = evt.target.files[0].type || 'unknown'; >- var fileSizeInK = Math.round(evt.target.files[0].size/1024); >- >- if (!fileType.match(/comma-separated-values|csv|excel|calc/i)) { >- alert(_("Uploads limited to csv. Incorrect filetype: %s").format(fileType)); >- parent.location='quotes-upload.pl'; >- return; >- } >- if (fileSizeInK > 512) { >- if (!confirm(_("%s %s KB Do you really want to upload this file?").format(evt.target.files[0].name, fileSizeInK))) { >- parent.location='quotes-upload.pl'; >- return; >- } >- } >- // Read in the image file as a text string. >- reader.readAsText(evt.target.files[0]); >- } >- >- $('#file_upload').one('change', fnHandleFileSelect); >- >- }); >- >- function fnGetData(element) { >- var jqXHR = $.ajax({ >- url : "/cgi-bin/koha/tools/quotes/quotes-upload_ajax.pl", >- type : "POST", >- contentType : "application/x-www-form-urlencoded", // we must claim this mimetype or CGI will not decode the URL encoding >- dataType : "json", >- data : { >- "quote" : encodeURI ( JSON.stringify(oTable.fnGetData()) ), >- "action" : "add", >- }, >- success : function(){ >- var response = JSON.parse(jqXHR.responseText); >- if (response.success) { >- alert(_("%s quotes saved.").format(response.records)); >- window.location.reload(true); // is this the best route? >- } >- else { >- alert(_("%s quotes saved, but an error has occurred. Please ask your administrator to check the server log for more details.").format(response.records)); >- window.location.reload(true); // is this the best route? >- } >- }, >- }); >- } >- >- function fnClickDeleteRow() { >- var idsToDelete = oTable.$('.selected').map(function() { >- return this.id; >- }).get().join(', '); >- if (!idsToDelete) { >- alert(_("Please select a quote(s) by clicking the quote id(s) you desire to delete.")); >- } >- else if (confirm(_("Are you sure you wish to delete quote(s) %s?").format(idsToDelete))) { >- oTable.$('.selected').each(function(){ >- oTable.fnDeleteRow(this); >- }); >- } >- } >- >- //]]> >- </script> > </head> >+ > <body id="tools_quotes" class="tools"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] >@@ -370,4 +71,303 @@ > [% INCLUDE 'tools-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.jeditable.mini.js"></script> >+ <script type="text/javascript"> >+ var oTable; //DataTable object >+ $(document).ready(function() { >+ >+ $("#cancel_upload").on("click",function(e){ >+ e.preventDefault(); >+ fnAbortRead(); >+ }); >+ $("#cancel_quotes").on("click",function(){ >+ return confirm( _("Are you sure you want to cancel this import?") ); >+ }); >+ >+ // Credits: >+ // FileReader() code copied and hacked from: >+ // http://www.html5rocks.com/en/tutorials/file/dndfiles/ >+ // fnCSVToArray() gratefully borrowed from: >+ // http://www.bennadel.com/blog/1504-Ask-Ben-Parsing-CSV-Strings-With-Javascript-Exec-Regular-Expression-Command.htm >+ >+ var reader; >+ var progress = document.querySelector('.percent'); >+ $("#server_response").hide(); >+ >+ function yuiGetData() { >+ fnGetData(document.getElementById('quotes_editor')); >+ } >+ >+ function fnAbortRead() { >+ reader.abort(); >+ } >+ >+ function fnErrorHandler(evt) { >+ switch(evt.target.error.code) { >+ case evt.target.error.NOT_FOUND_ERR: >+ alert('File Not Found!'); >+ break; >+ case evt.target.error.NOT_READABLE_ERR: >+ alert('File is not readable'); >+ break; >+ case evt.target.error.ABORT_ERR: >+ break; // noop >+ default: >+ alert('An error occurred reading this file.'); >+ }; >+ } >+ >+ function fnUpdateProgress(evt) { >+ // evt is an ProgressEvent. >+ if (evt.lengthComputable) { >+ var percentLoaded = Math.round((evt.loaded / evt.total) * 100); >+ // Increase the progress bar length. >+ if (percentLoaded < 100) { >+ progress.style.width = percentLoaded + '%'; >+ progress.textContent = percentLoaded + '%'; >+ } >+ } >+ } >+ >+ function fnCSVToArray( strData, strDelimiter ){ >+ // This will parse a delimited string into an array of >+ // arrays. The default delimiter is the comma, but this >+ // can be overriden in the second argument. >+ >+ // Check to see if the delimiter is defined. If not, >+ // then default to comma. >+ strDelimiter = (strDelimiter || ","); >+ >+ // Create a regular expression to parse the CSV values. >+ var objPattern = new RegExp( >+ ( >+ // Delimiters. >+ "(\\" + strDelimiter + "|\\r?\\n|\\r|^)" + >+ // Quoted fields. >+ "(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|" + >+ // Standard fields. >+ "([^\"\\" + strDelimiter + "\\r\\n]*))" >+ ), >+ "gi" >+ ); >+ >+ // Create an array to hold our data. Give the array >+ // a default empty first row. >+ var arrData = [[]]; >+ >+ // Create an array to hold our individual pattern >+ // matching groups. >+ var arrMatches = null; >+ >+ // Keep looping over the regular expression matches >+ // until we can no longer find a match. >+ while (arrMatches = objPattern.exec( strData )){ >+ >+ // Get the delimiter that was found. >+ var strMatchedDelimiter = arrMatches[ 1 ]; >+ >+ // Check to see if the given delimiter has a length >+ // (is not the start of string) and if it matches >+ // field delimiter. If it does not, then we know >+ // that this delimiter is a row delimiter. >+ if ( strMatchedDelimiter.length && (strMatchedDelimiter != strDelimiter) ){ >+ // Since we have reached a new row of data, >+ // add an empty row to our data array. >+ // Note: if there is not more data, we will have to remove this row later >+ arrData.push( [] ); >+ } >+ >+ // Now that we have our delimiter out of the way, >+ // let's check to see which kind of value we >+ // captured (quoted or unquoted). >+ if (arrMatches[ 2 ]){ >+ // We found a quoted value. When we capture >+ // this value, unescape any double quotes. >+ var strMatchedValue = arrMatches[ 2 ].replace( >+ new RegExp( "\"\"", "g" ), >+ "\"" >+ ); >+ } else if (arrMatches[3]){ >+ // We found a non-quoted value. >+ var strMatchedValue = arrMatches[ 3 ]; >+ } else { >+ // There is no more valid data so remove the row we added earlier >+ // Is there a better way? Perhaps a look-ahead regexp? >+ arrData.splice(arrData.length-1, 1); >+ } >+ >+ // Now that we have our value string, let's add >+ // it to the data array. >+ arrData[ arrData.length - 1 ].push( strMatchedValue ); >+ } >+ >+ // Return the parsed data. >+ return( arrData ); >+ } >+ >+ function fnDataTable(aaData) { >+ for(var i=0; i<aaData.length; i++) { >+ aaData[i].unshift(i+1); // Add a column w/quote number >+ } >+ >+ /* Transition from the quote file uploader to the quote file editor interface */ >+ $('#toolbar').css("visibility","visible"); >+ $('#toolbar').css("position",""); >+ $('#file_editor_inst').css("visibility", "visible"); >+ $('#file_editor_inst').css("position", ""); >+ $('#file_uploader_inst').css("visibility", "hidden"); >+ $('#save_quotes').css("visibility","visible"); >+ $('#file_uploader').css("visibility","hidden"); >+ $('#file_uploader').css("position","absolute"); >+ $('#file_uploader').css("top","-150px"); >+ $('#quotes_editor').css("visibility","visible"); >+ $("#save_quotes").on("click", yuiGetData); >+ $("#delete_quote").on("click", fnClickDeleteRow); >+ >+ oTable = $('#quotes_editor').dataTable( { >+ "bAutoWidth" : false, >+ "bPaginate" : true, >+ "bSort" : false, >+ "sPaginationType" : "full_numbers", >+ "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">', >+ "aaData" : aaData, >+ "aoColumns" : [ >+ { >+ "sTitle" : "Number", >+ "sWidth" : "2%", >+ }, >+ { >+ "sTitle" : "Source", >+ "sWidth" : "15%", >+ }, >+ { >+ "sTitle" : "Quote", >+ "sWidth" : "83%", >+ }, >+ ], >+ "fnPreDrawCallback": function(oSettings) { >+ return true; >+ }, >+ "fnRowCallback": function( nRow, aData, iDisplayIndex ) { >+ /* do foo on various cells in the current row */ >+ var quoteNum = $('td', nRow)[0].innerHTML; >+ $(nRow).attr("id", quoteNum); /* set row ids to quote number */ >+ $('td:eq(0)', nRow).click(function() {$(this.parentNode).toggleClass('selected',this.clicked);}); /* add row selectors */ >+ $('td:eq(0)', nRow).attr("title", _("Click ID to select/deselect quote")); >+ /* apply no_edit id to noEditFields */ >+ noEditFields = [0]; /* number */ >+ for (i=0; i<noEditFields.length; i++) { >+ $('td', nRow)[noEditFields[i]].setAttribute("id","no_edit"); >+ } >+ return nRow; >+ }, >+ "fnDrawCallback": function(oSettings) { >+ /* Apply the jEditable handlers to the table on all fields w/o the no_edit id */ >+ $('#quotes_editor tbody td[id!="no_edit"]').editable( function(value, settings) { >+ var cellPosition = oTable.fnGetPosition( this ); >+ oTable.fnUpdate(value, cellPosition[0], cellPosition[1], false, false); >+ return(value); >+ }, >+ { >+ "callback" : function( sValue, y ) { >+ oTable.fnDraw(false); /* no filter/sort or we lose our pagination */ >+ }, >+ "height" : "14px", >+ }); >+ }, >+ }); >+ $('#footer').css("visibility","visible"); >+ } >+ >+ function fnHandleFileSelect(evt) { >+ // Reset progress indicator on new file selection. >+ progress.style.width = '0%'; >+ progress.textContent = '0%'; >+ >+ reader = new FileReader(); >+ reader.onerror = fnErrorHandler; >+ reader.onprogress = fnUpdateProgress; >+ reader.onabort = function(e) { >+ alert('File read cancelled'); >+ parent.location='quotes-upload.pl'; >+ }; >+ reader.onloadstart = function(e) { >+ $('#cancel_upload').show(); >+ $('#progress_bar').addClass("loading"); >+ }; >+ reader.onload = function(e) { >+ // Ensure that the progress bar displays 100% at the end. >+ progress.style.width = '100%'; >+ progress.textContent = '100%'; >+ $('#cancel_upload').hide(); >+ quotes = fnCSVToArray(e.target.result, ','); >+ fnDataTable(quotes); >+ } >+ >+ // perform various sanity checks on the target file prior to uploading... >+ var fileType = evt.target.files[0].type || 'unknown'; >+ var fileSizeInK = Math.round(evt.target.files[0].size/1024); >+ >+ if (!fileType.match(/comma-separated-values|csv|excel|calc/i)) { >+ alert(_("Uploads limited to csv. Incorrect filetype: %s").format(fileType)); >+ parent.location='quotes-upload.pl'; >+ return; >+ } >+ if (fileSizeInK > 512) { >+ if (!confirm(_("%s %s KB Do you really want to upload this file?").format(evt.target.files[0].name, fileSizeInK))) { >+ parent.location='quotes-upload.pl'; >+ return; >+ } >+ } >+ // Read in the image file as a text string. >+ reader.readAsText(evt.target.files[0]); >+ } >+ >+ $('#file_upload').one('change', fnHandleFileSelect); >+ >+ }); >+ >+ function fnGetData(element) { >+ var jqXHR = $.ajax({ >+ url : "/cgi-bin/koha/tools/quotes/quotes-upload_ajax.pl", >+ type : "POST", >+ contentType : "application/x-www-form-urlencoded", // we must claim this mimetype or CGI will not decode the URL encoding >+ dataType : "json", >+ data : { >+ "quote" : encodeURI ( JSON.stringify(oTable.fnGetData()) ), >+ "action" : "add", >+ }, >+ success : function(){ >+ var response = JSON.parse(jqXHR.responseText); >+ if (response.success) { >+ alert(_("%s quotes saved.").format(response.records)); >+ window.location.reload(true); // is this the best route? >+ } else { >+ alert(_("%s quotes saved, but an error has occurred. Please ask your administrator to check the server log for more details.").format(response.records)); >+ window.location.reload(true); // is this the best route? >+ } >+ }, >+ }); >+ } >+ >+ function fnClickDeleteRow() { >+ var idsToDelete = oTable.$('.selected').map(function() { >+ return this.id; >+ }).get().join(', '); >+ if (!idsToDelete) { >+ alert(_("Please select a quote(s) by clicking the quote id(s) you desire to delete.")); >+ } >+ else if (confirm(_("Are you sure you wish to delete quote(s) %s?").format(idsToDelete))) { >+ oTable.$('.selected').each(function(){ >+ oTable.fnDeleteRow(this); >+ }); >+ } >+ } >+ </script> >+[% END %] >+ > [% 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 f0d4bd8..a3db7c8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt >@@ -1,99 +1,155 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Quote editor</title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/quotes.css" /> > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >+</head> >+ >+<body id="tools_quotes" class="tools"> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'cat-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Quote editor</div> >+ >+<div id="doc3" class="yui-t2"> >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ [% INCLUDE 'quotes-toolbar.inc' %] >+ <h2>Quote editor</h2> >+ <div id="instructions"> >+ <fieldset id="quote_editor_help" class="rows"> >+ <legend>Instructions</legend> >+ <div id="quote_editor_inst"> >+ <ul> >+ <li>Click on the 'Add quote' button to add a single quote; Press the <Enter> key to save the quote.<br /> >+ <b>Note: </b>Both the 'source' and 'text' fields must have content in order for the quote to be saved.</li> >+ <li>Click on any field to edit the contents; Press the <Enter> key to save edit.</li> >+ <li>Click on one or more quote numbers to select entire quotes for deletion; Click the 'Delete quote(s)' button to delete selected quotes.</li> >+ <li>Click the 'Import quotes' button in the toolbar to import a CSV file of quotes.</li> >+ </ul> >+ </div> >+ </fieldset> >+ </div> >+ <table id="quotes_editor"> >+ <thead> >+ <tr> >+ <th><span style="cursor: help" id="id_help">ID</span></th> >+ <th>Source</th> >+ <th>Text</th> >+ <th>Last displayed</th> >+ </tr> >+ </thead> >+ <tbody> >+ <!-- tbody content is generated by DataTables --> >+ <tr> >+ <td></td> >+ <td></td> >+ <td>Loading data...</td> >+ <td></td> >+ </tr> >+ </tbody> >+ </table> >+ <fieldset id="footer" class="action"> >+ </fieldset> >+ </div> >+ </div> >+ <div class="yui-b noprint"> >+ [% INCLUDE 'tools-menu.inc' %] >+ </div> >+</div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> > [% INCLUDE 'datatables.inc' %] > <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/dataTables.fnReloadAjax.js"></script> > <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.jeditable.mini.js"></script> > <script type="text/javascript"> >- //<![CDATA[ >- >- var oTable; /* oTable needs to be global */ >- var sEmptyTable = _("No quotes available. Please use the 'Add quote' button to add a quote."); /* override the default message in datatables.inc */ >- $(document).ready(function() { >- /* NOTE: This is an ajax-source datatable and *not* a server-side sourced datatable. */ >- /* See the datatable docs if you don't understand this difference. */ >- oTable = $("#quotes_editor").dataTable({ >- "bAutoWidth" : false, >- "bProcessing" : true, >- "bPaginate" : true, >- "sPaginationType" : "full_numbers", >- "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">', >- "sAjaxSource" : "/cgi-bin/koha/tools/quotes/quotes_ajax.pl", >- "aoColumns" : [ >- { "sWidth": "3%" }, >- { "sWidth": "11%" }, >- { "sWidth": "75%" }, >- { "sWidth": "11%" }, >- ], >- "oLanguage" : { >- "oPaginate": { >- "sFirst": MSG_DT_FIRST, >- "sLast": MSG_DT_LAST, >- "sNext": MSG_DT_NEXT, >- "sPrevious": MSG_DT_PREVIOUS, >- }, >- "sEmptyTable": MSG_DT_EMPTY_TABLE, >- "sInfo": MSG_DT_INFO, >- "sInfoEmpty": MSG_DT_INFO_EMPTY, >- "sInfoFiltered": MSG_DT_INFO_FILTERED, >- "sLengthMenu": MSG_DT_LENGTH_MENU, >- "sLoadingRecords": MSG_DT_LOADING_RECORDS, >- "sProcessing": MSG_DT_PROCESSING, >- "sSearch": MSG_DT_SEARCH, >- "sZeroRecords": MSG_DT_ZERO_RECORDS, >+ var oTable; /* oTable needs to be global */ >+ var sEmptyTable = _("No quotes available. Please use the 'Add quote' button to add a quote."); /* override the default message in datatables.inc */ >+ $(document).ready(function() { >+ /* NOTE: This is an ajax-source datatable and *not* a server-side sourced datatable. */ >+ /* See the datatable docs if you don't understand this difference. */ >+ oTable = $("#quotes_editor").dataTable({ >+ "bAutoWidth" : false, >+ "bProcessing" : true, >+ "bPaginate" : true, >+ "sPaginationType" : "full_numbers", >+ "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">', >+ "sAjaxSource" : "/cgi-bin/koha/tools/quotes/quotes_ajax.pl", >+ "aoColumns" : [ >+ { "sWidth": "3%" }, >+ { "sWidth": "11%" }, >+ { "sWidth": "75%" }, >+ { "sWidth": "11%" }, >+ ], >+ "oLanguage" : { >+ "oPaginate": { >+ "sFirst": MSG_DT_FIRST, >+ "sLast": MSG_DT_LAST, >+ "sNext": MSG_DT_NEXT, >+ "sPrevious": MSG_DT_PREVIOUS, >+ }, >+ "sEmptyTable": MSG_DT_EMPTY_TABLE, >+ "sInfo": MSG_DT_INFO, >+ "sInfoEmpty": MSG_DT_INFO_EMPTY, >+ "sInfoFiltered": MSG_DT_INFO_FILTERED, >+ "sLengthMenu": MSG_DT_LENGTH_MENU, >+ "sLoadingRecords": MSG_DT_LOADING_RECORDS, >+ "sProcessing": MSG_DT_PROCESSING, >+ "sSearch": MSG_DT_SEARCH, >+ "sZeroRecords": MSG_DT_ZERO_RECORDS, >+ }, >+ "fnPreDrawCallback": function(oSettings) { >+ return true; >+ }, >+ "fnRowCallback": function( nRow, aData, iDisplayIndex ) { >+ /* do foo on the current row and its child nodes */ >+ var noEditFields = []; >+ var quoteID = $('td', nRow)[0].innerHTML; >+ $(nRow).attr("id", quoteID); /* set row ids to quote id */ >+ $('td:eq(0)', nRow).click(function() {$(this.parentNode).toggleClass('selected',this.clicked);}); /* add row selectors */ >+ $('td:eq(0)', nRow).attr("title", _("Click ID to select/deselect quote")); >+ $('td', nRow).attr("id",quoteID); /* FIXME: this is a bit of a hack */ >+ if (isNaN(quoteID)) { >+ noEditFields = [0,1,2,3]; /* all fields when adding a quote */ >+ } else { >+ noEditFields = [0,3]; /* id, timestamp */ >+ } >+ /* apply no_edit id to noEditFields */ >+ for (i=0; i<noEditFields.length; i++) { >+ $('td', nRow)[noEditFields[i]].setAttribute("id","no_edit"); >+ } >+ return nRow; >+ }, >+ "fnDrawCallback": function(oSettings) { >+ /* Apply the jEditable handlers to the table on all fields w/o the no_edit id */ >+ $('#quotes_editor tbody td[id!="no_edit"]').editable( "/cgi-bin/koha/tools/quotes/quotes_ajax.pl", { >+ "submitdata" : function ( value, settings ) { >+ return { >+ "column" : oTable.fnGetPosition( this )[2], >+ "action" : "edit", >+ }; > }, >- "fnPreDrawCallback": function(oSettings) { >- return true; >- }, >- "fnRowCallback": function( nRow, aData, iDisplayIndex ) { >- /* do foo on the current row and its child nodes */ >- var noEditFields = []; >- var quoteID = $('td', nRow)[0].innerHTML; >- $(nRow).attr("id", quoteID); /* set row ids to quote id */ >- $('td:eq(0)', nRow).click(function() {$(this.parentNode).toggleClass('selected',this.clicked);}); /* add row selectors */ >- $('td:eq(0)', nRow).attr("title", _("Click ID to select/deselect quote")); >- $('td', nRow).attr("id",quoteID); /* FIXME: this is a bit of a hack */ >- if (isNaN(quoteID)) { >- noEditFields = [0,1,2,3]; /* all fields when adding a quote */ >- } >- else { >- noEditFields = [0,3]; /* id, timestamp */ >- } >- /* apply no_edit id to noEditFields */ >- for (i=0; i<noEditFields.length; i++) { >- $('td', nRow)[noEditFields[i]].setAttribute("id","no_edit"); >- } >- return nRow; >- }, >- "fnDrawCallback": function(oSettings) { >- /* Apply the jEditable handlers to the table on all fields w/o the no_edit id */ >- $('#quotes_editor tbody td[id!="no_edit"]').editable( "/cgi-bin/koha/tools/quotes/quotes_ajax.pl", { >- "submitdata" : function ( value, settings ) { >- return { >- "column" : oTable.fnGetPosition( this )[2], >- "action" : "edit", >- }; >- }, >- "height" : "14px", >- "placeholder" : "Saving data...", >- }); >- }, >- }); >- $("#add_quote").click(function(){ >- fnClickAddRow(); >- return false; >- }); >- $("#delete_quote").click(function(){ >- fnClickDeleteRow(); >- return false; >- }); >- $("#id_help").on("click",function(e){ >- e.stopPropagation(); >- alert( _("Click on the quote's id to select or deselect the quote. Multiple quotes may be selected.") ); >+ "height" : "14px", >+ "placeholder" : "Saving data...", >+ }); >+ }, >+ }); >+ $("#add_quote").click(function(){ >+ fnClickAddRow(); >+ return false; >+ }); >+ $("#delete_quote").click(function(){ >+ fnClickDeleteRow(); >+ return false; >+ }); >+ $("#id_help").on("click",function(e){ >+ e.stopPropagation(); >+ alert( _("Click on the quote's id to select or deselect the quote. Multiple quotes may be selected.") ); >+ }); > }); >- }); > > function fnClickAddQuote(e, node) { > if (e.charCode) { >@@ -110,33 +166,30 @@ > url: "/cgi-bin/koha/tools/quotes/quotes_ajax.pl", > type: "POST", > data: { >- "source" : quoteSource, >- "text" : quoteText, >- "action" : "add", >+ "source" : quoteSource, >+ "text" : quoteText, >+ "action" : "add", > }, > success: function(data){ >- var newQuote = data[0]; >- var aRow = oTable.fnUpdate( >- newQuote, >- node, >- undefined, >- false, >- false >- ); >- oTable.fnPageChange( 'last' ); >- $('.add_quote_button').attr('onclick', 'fnClickAddRow()'); // re-enable add button >- } >+ var newQuote = data[0]; >+ var aRow = oTable.fnUpdate( >+ newQuote, >+ node, >+ undefined, >+ false, >+ false >+ ); >+ oTable.fnPageChange( 'last' ); >+ $('.add_quote_button').attr('onclick', 'fnClickAddRow()'); // re-enable add button >+ } > }); >- } >- else { >+ } else { > alert(_("Please supply both the text and source of the quote before saving.")); > } >- } >- else if (e.keyCode == 27) { >+ } else if (e.keyCode == 27) { > if (confirm(_("Are you sure you want to cancel adding this quote?"))) { > oTable.fnDeleteRow(node); >- } >- else { >+ } else { > return; > } > } >@@ -163,83 +216,28 @@ > }).get().join(', '); > if (!idsToDelete) { > alert(_("Please select a quote(s) by clicking the quote id(s) you desire to delete.")); >- } >- else if (confirm(_("Are you sure you wish to delete quote(s) %s?").format(idsToDelete))) { >+ } else if (confirm(_("Are you sure you wish to delete quote(s) %s?").format(idsToDelete))) { > oTable.$('.selected').each(function(){ >- var quoteID = $(this).attr('id'); >- $.ajax({ >- url: "/cgi-bin/koha/tools/quotes/quotes_ajax.pl", >- type: "POST", >- data: { >- "id" : quoteID, >- "action" : "delete", >- }, >- /* Delete the row from the datatable */ >- success: function(){ >- oTable.fnDeleteRow(this); >- oTable.fnReloadAjax(null, null, true); >- } >- }); >+ var quoteID = $(this).attr('id'); >+ $.ajax({ >+ url: "/cgi-bin/koha/tools/quotes/quotes_ajax.pl", >+ type: "POST", >+ data: { >+ "id" : quoteID, >+ "action" : "delete", >+ }, >+ /* Delete the row from the datatable */ >+ success: function(){ >+ oTable.fnDeleteRow(this); >+ oTable.fnReloadAjax(null, null, true); >+ } > }); >- } >- else { >+ }); >+ } else { > return; > } > } >- //]]> > </script> >-</head> >-<body id="tools_quotes" class="tools"> >-[% INCLUDE 'header.inc' %] >-[% INCLUDE 'cat-search.inc' %] >- >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Quote editor</div> >+[% END %] > >-<div id="doc3" class="yui-t2"> >- <div id="bd"> >- <div id="yui-main"> >- <div class="yui-b"> >- [% INCLUDE 'quotes-toolbar.inc' %] >- <h2>Quote editor</h2> >- <div id="instructions"> >- <fieldset id="quote_editor_help" class="rows"> >- <legend>Instructions</legend> >- <div id="quote_editor_inst"> >- <ul> >- <li>Click on the 'Add quote' button to add a single quote; Press the <Enter> key to save the quote.<br /> >- <b>Note: </b>Both the 'source' and 'text' fields must have content in order for the quote to be saved.</li> >- <li>Click on any field to edit the contents; Press the <Enter> key to save edit.</li> >- <li>Click on one or more quote numbers to select entire quotes for deletion; Click the 'Delete quote(s)' button to delete selected quotes.</li> >- <li>Click the 'Import quotes' button in the toolbar to import a CSV file of quotes.</li> >- </ul> >- </div> >- </fieldset> >- </div> >- <table id="quotes_editor"> >- <thead> >- <tr> >- <th><span style="cursor: help" id="id_help">ID</span></th> >- <th>Source</th> >- <th>Text</th> >- <th>Last displayed</th> >- </tr> >- </thead> >- <tbody> >- <!-- tbody content is generated by DataTables --> >- <tr> >- <td></td> >- <td></td> >- <td>Loading data...</td> >- <td></td> >- </tr> >- </tbody> >- </table> >- <fieldset id="footer" class="action"> >- </fieldset> >- </div> >- </div> >- <div class="yui-b noprint"> >- [% INCLUDE 'tools-menu.inc' %] >- </div> >-</div> > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/scheduler.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/scheduler.tt >index 31a0084..cf3853c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/scheduler.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/scheduler.tt >@@ -1,15 +1,9 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Task scheduler</title> > [% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'calendar.inc' %] >-<script type="text/JavaScript"> >-//<![CDATA[ >- $(document).ready(function(){ >- $("#startdate").datepicker({ minDate: "+0D" }); >- }); >-//]]> >-</script> > </head> >+ > <body id="tools_scheduler" class="tools"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'circ-search.inc' %] >@@ -95,4 +89,15 @@ > [% INCLUDE 'guided-reports-view.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ [% INCLUDE 'calendar.inc' %] >+ <script type="text/javascript"> >+ $(document).ready(function(){ >+ $("#startdate").datepicker({ minDate: "+0D" }); >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >index 1223213..d380cf9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >@@ -1,5 +1,6 @@ >-[% INCLUDE 'doc-head-open.inc' %] > [% USE Koha %] >+[% SET footerjs = 1 %] >+[% INCLUDE 'doc-head-open.inc' %] > [% IF plugin %] > <title>Upload plugin</title> > [% ELSE %] >@@ -186,172 +187,13 @@ > </table> > [% END %] > >-[% INCLUDE 'datatables.inc' %] > <style type="text/css"> > #fileuploadstatus,#fileuploadfailed { display : none; } > #fileuploadstatus { margin:.4em; } > #fileuploadprogress { width:150px;height:10px;border:1px solid #666;background:url('[% interface %]/[% theme %]/img/progress.png') -300px 0px no-repeat; } > </style> > >-<script type="text/javascript"> >-//<![CDATA[ >- var errMESSAGES = [ >- "Error 0: Not in use", >- _("This file already exists (in this category)."), >- _("File could not be created. Check permissions."), >- _("Your koha-conf.xml does not contain a valid upload_path."), >- _("No temporary directory found."), >- _("File could not be read."), >- _("File has been deleted."), >- _("File or upload record could not be deleted."), >- ]; >-//]]> >-</script> >-<script type="text/javascript" src="[% interface %]/[% theme %]/js/file-upload.js"></script> >-<script type="text/javascript"> >-//<![CDATA[ >-function StartUpload() { >- if( $('#fileToUpload').prop('files').length == 0 ) return; >- $('#fileToUpload').prop('disabled',true); >- $('#fileuploadbutton').hide(); >- $("#fileuploadcancel").show(); >- $("#fileuploadfailed").html(''); >- $("#myalerts").hide(''); >- $("#myalerts").html(''); >- $("#fileuploadstatus").show(); >- $("#uploadedfileid").val(''); >- $("#searchfile").hide(); >- $("#lastbreadcrumb").text( _("Add a new upload") ); > >- var cat, xtra=''; >- if( $("#uploadcategory").val() ) >- cat = encodeURIComponent( $("#uploadcategory").val() ); >- if( cat ) xtra= 'category=' + cat + '&'; >- [% IF plugin %] >- xtra = xtra + 'public=1&temp=0'; >- [% ELSE %] >- if( !cat ) xtra = 'temp=1&'; >- if( $('#public').prop('checked') ) xtra = xtra + 'public=1'; >- [% END %] >- xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), xtra, cbUpload ); >-} >-function CancelUpload() { >- if( xhr ) xhr.abort(); >- $("#fileuploadstatus").hide(); >- $('#fileToUpload').prop('disabled', false); >- $('#fileuploadbutton').show(); >- $("#fileuploadcancel").hide(); >- $("#fileuploadfailed").show(); >- $("#fileuploadfailed").text( _("Upload status: Cancelled ") ); >-} >-function cbUpload( status, fileid, err ) { >- $('#fileToUpload').prop('disabled', false); >- if( status=='done' ) { >- var e = err? JSON.stringify(err): ''; >- SubmitMe( 'search', fileid, e ); >- } else { >- $('#fileuploadbutton').show(); >- $("#fileuploadcancel").hide(); >- $("#fileuploadstatus").hide(); >- $("#fileuploadfailed").show(); >- $("#fileuploadfailed").html( _("Upload status: ") + >- ( status=='failed'? _("Failed"): >- ( status=='denied'? _("Denied"): status )) >- ); >- ShowAlerts( err ); >- } >-} >-function ShowAlerts(err) { >- var str = ''; >- for( var file in err ) { >- str= str + '<p>' + file + ': ' + >- errMESSAGES[ err[file].code ] + '</p>'; >- } >- if( str ) { >- $('#myalerts').html(str); >- $('#myalerts').show(); >- } >-} >-function CheckSearch() { >- if( $("#term").val()=="" ) { >- alert( _("Please enter a search term.") ); >- return false; >- } >- return true; >-} >-function SubmitMe(op, id, msg ) { >- $("#submitter #op").val( op ); >- $("#submitter #id").val( id ); >- $("#submitter #msg").val( msg ); >- $("#submitter").submit(); >-} >-function DeleteEntry(id) { >- if( !confirm( _("Do you really want to delete this upload?") )) >- return false; >- ClearField(); >- SubmitMe( 'delete', id ); >-} >-function ClearField() { >- [% IF plugin %] >- $(window.opener.document).find('#[% index %]').val( '' ); >- [% END %] >-} >-function Choose(hashval) { >- var res = '[% Koha.Preference('OPACBaseURL') %]'; >- res = res.replace( /\/$/, ''); >- res = res + '/cgi-bin/koha/opac-retrieve-file.pl?id=' + hashval; >- [% IF index %] >- $(window.opener.document).find('#[% index %]').val( res ); >- [% END %] >- window.close(); >-} >-$(document).ready(function() { >- $("#uploadresults").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { 'bSortable': false, 'aTargets': [ 'nosort' ] } >- ], >- "sPaginationType": "four_button" >- })); >- [% IF msg %] >- ShowAlerts( [% msg %] ); >- [% END %] >- $("#fileuploadcancel").hide(); >- $("#public_cb").click(function() { >- $("#public").click(); >- }); >- $("#fileuploadbutton").on("click",function(e){ >- e.preventDefault(); >- StartUpload(); >- }); >- $("#fileuploadcancel").on("click",function(e){ >- e.preventDefault(); >- CancelUpload(); >- }); >- $("#searchbutton").on("click",function(){ >- return CheckSearch(); >- }); >- $(".choose_entry").on("click",function(e){ >- e.preventDefault(); >- var record_hashvalue = $(this).data("record-hashvalue"); >- Choose( record_hashvalue ); >- }); >- $(".download_entry").on("click",function(e){ >- e.preventDefault(); >- var record_id = $(this).data("record-id"); >- SubmitMe( 'download', record_id ); >- }); >- $(".delete_entry").on("click",function(e){ >- e.preventDefault(); >- var record_id = $(this).data("record-id"); >- DeleteEntry( record_id ); >- }); >- $("#new_search").on("click",function(e){ >- e.preventDefault(); >- SubmitMe('new'); >- }); >-}); >-//]]> >-</script> > </head> > > [% IF ( plugin ) %] >@@ -402,4 +244,165 @@ $(document).ready(function() { > [% END %] > > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript"> >+ var errMESSAGES = [ >+ "Error 0: Not in use", >+ _("This file already exists (in this category)."), >+ _("File could not be created. Check permissions."), >+ _("Your koha-conf.xml does not contain a valid upload_path."), >+ _("No temporary directory found."), >+ _("File could not be read."), >+ _("File has been deleted."), >+ _("File or upload record could not be deleted."), >+ ]; >+ </script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/file-upload.js"></script> >+ <script type="text/javascript"> >+ function StartUpload() { >+ if( $('#fileToUpload').prop('files').length == 0 ) return; >+ $('#fileToUpload').prop('disabled',true); >+ $('#fileuploadbutton').hide(); >+ $("#fileuploadcancel").show(); >+ $("#fileuploadfailed").html(''); >+ $("#myalerts").hide(''); >+ $("#myalerts").html(''); >+ $("#fileuploadstatus").show(); >+ $("#uploadedfileid").val(''); >+ $("#searchfile").hide(); >+ $("#lastbreadcrumb").text( _("Add a new upload") ); >+ >+ var cat, xtra=''; >+ if( $("#uploadcategory").val() ) >+ cat = encodeURIComponent( $("#uploadcategory").val() ); >+ if( cat ) xtra= 'category=' + cat + '&'; >+ [% IF plugin %] >+ xtra = xtra + 'public=1&temp=0'; >+ [% ELSE %] >+ if( !cat ) xtra = 'temp=1&'; >+ if( $('#public').prop('checked') ) xtra = xtra + 'public=1'; >+ [% END %] >+ xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), xtra, cbUpload ); >+ } >+ function CancelUpload() { >+ if( xhr ) xhr.abort(); >+ $("#fileuploadstatus").hide(); >+ $('#fileToUpload').prop('disabled', false); >+ $('#fileuploadbutton').show(); >+ $("#fileuploadcancel").hide(); >+ $("#fileuploadfailed").show(); >+ $("#fileuploadfailed").text( _("Upload status: Cancelled ") ); >+ } >+ function cbUpload( status, fileid, err ) { >+ $('#fileToUpload').prop('disabled', false); >+ if( status=='done' ) { >+ var e = err? JSON.stringify(err): ''; >+ SubmitMe( 'search', fileid, e ); >+ } else { >+ $('#fileuploadbutton').show(); >+ $("#fileuploadcancel").hide(); >+ $("#fileuploadstatus").hide(); >+ $("#fileuploadfailed").show(); >+ $("#fileuploadfailed").html( _("Upload status: ") + >+ ( status=='failed'? _("Failed"): >+ ( status=='denied'? _("Denied"): status )) >+ ); >+ ShowAlerts( err ); >+ } >+ } >+ function ShowAlerts(err) { >+ var str = ''; >+ for( var file in err ) { >+ str= str + '<p>' + file + ': ' + >+ errMESSAGES[ err[file].code ] + '</p>'; >+ } >+ if( str ) { >+ $('#myalerts').html(str); >+ $('#myalerts').show(); >+ } >+ } >+ function CheckSearch() { >+ if( $("#term").val()=="" ) { >+ alert( _("Please enter a search term.") ); >+ return false; >+ } >+ return true; >+ } >+ function SubmitMe(op, id, msg ) { >+ $("#submitter #op").val( op ); >+ $("#submitter #id").val( id ); >+ $("#submitter #msg").val( msg ); >+ $("#submitter").submit(); >+ } >+ function DeleteEntry(id) { >+ if( !confirm( _("Do you really want to delete this upload?") )) >+ return false; >+ ClearField(); >+ SubmitMe( 'delete', id ); >+ } >+ function ClearField() { >+ [% IF plugin %] >+ $(window.opener.document).find('#[% index %]').val( '' ); >+ [% END %] >+ } >+ function Choose(hashval) { >+ var res = '[% Koha.Preference('OPACBaseURL') %]'; >+ res = res.replace( /\/$/, ''); >+ res = res + '/cgi-bin/koha/opac-retrieve-file.pl?id=' + hashval; >+ [% IF index %] >+ $(window.opener.document).find('#[% index %]').val( res ); >+ [% END %] >+ window.close(); >+ } >+ $(document).ready(function() { >+ $("#uploadresults").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { 'bSortable': false, 'aTargets': [ 'nosort' ] } >+ ], >+ "sPaginationType": "four_button" >+ })); >+ [% IF msg %] >+ ShowAlerts( [% msg %] ); >+ [% END %] >+ $("#fileuploadcancel").hide(); >+ $("#public_cb").click(function() { >+ $("#public").click(); >+ }); >+ $("#fileuploadbutton").on("click",function(e){ >+ e.preventDefault(); >+ StartUpload(); >+ }); >+ $("#fileuploadcancel").on("click",function(e){ >+ e.preventDefault(); >+ CancelUpload(); >+ }); >+ $("#searchbutton").on("click",function(){ >+ return CheckSearch(); >+ }); >+ $(".choose_entry").on("click",function(e){ >+ e.preventDefault(); >+ var record_hashvalue = $(this).data("record-hashvalue"); >+ Choose( record_hashvalue ); >+ }); >+ $(".download_entry").on("click",function(e){ >+ e.preventDefault(); >+ var record_id = $(this).data("record-id"); >+ SubmitMe( 'download', record_id ); >+ }); >+ $(".delete_entry").on("click",function(e){ >+ e.preventDefault(); >+ var record_id = $(this).data("record-id"); >+ DeleteEntry( record_id ); >+ }); >+ $("#new_search").on("click",function(e){ >+ e.preventDefault(); >+ SubmitMe('new'); >+ }); >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >index e5706c6..a711dde 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -1,6 +1,7 @@ > [% USE Koha %] > [% USE AuthorisedValues %] > [% USE Branches %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title> > Koha › Tools › >@@ -11,8 +12,8 @@ > [% END %] > </title> > [% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'calendar.inc' %] > </head> >+ > <body id="tools_viewlog" class="tools"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] >@@ -56,12 +57,12 @@ > [% END %] > > [% BLOCK translate_log_interface %] >-[% SWITCH interface %] >+[% SWITCH log_interface %] > [% CASE 'INTRANET' %]Intranet > [% CASE 'OPAC' %]OPAC > [% CASE 'SIP' %]SIP > [% CASE 'COMMANDLINE' %]Command-line >-[% CASE %][% interface %] >+[% CASE %][% log_interface %] > [% END %] > [% END %] > >@@ -145,9 +146,9 @@ > > [% FOREACH interf IN [ 'INTRANET' 'OPAC' 'SIP' 'COMMANDLINE' ] %] > [% IF interfaces.grep(interf).size %] >- <option value="[% interf %]" selected="selected">[% PROCESS translate_log_interface interface=interf %]</option> >+ <option value="[% interf %]" selected="selected">[% PROCESS translate_log_interface log_interface=interf %]</option> > [% ELSE %] >- <option value="[% interf %]">[% PROCESS translate_log_interface interface=interf %]</option> >+ <option value="[% interf %]">[% PROCESS translate_log_interface log_interface=interf %]</option> > [% END %] > [% END %] > </select> >@@ -244,7 +245,7 @@ > [% loopro.info |html %] > [% END %] > </td> >- <td>[% PROCESS translate_log_interface interface=loopro.interface %]</td> >+ <td>[% PROCESS translate_log_interface log_interface=loopro.interface %]</td> > </tr> > [% END %] > </tbody> >@@ -276,4 +277,10 @@ > [% END %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'calendar.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19653
:
69416
|
69427
|
69557
|
69558
|
69559