Bugzilla – Attachment 69033 Details for
Bug 19592
Move admin templates JavaScript to the footer: Acquisitions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19592: Move admin templates JavaScript to the footer: Acquisitions
Bug-19592-Move-admin-templates-JavaScript-to-the-f.patch (text/plain), 46.42 KB, created by
Owen Leonard
on 2017-11-08 16:05:34 UTC
(
hide
)
Description:
Bug 19592: Move admin templates JavaScript to the footer: Acquisitions
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2017-11-08 16:05:34 UTC
Size:
46.42 KB
patch
obsolete
>From 5c310a6051174e4765c86f155cb09bdb82b3891a Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 8 Nov 2017 15:55:23 +0000 >Subject: [PATCH] Bug 19592: Move admin templates JavaScript to the footer: > Acquisitions > >This patch modifies the staff client acquisitions-related adminisration >templates so that JavaScript is included in the footer instead of the >header. > >To test, apply the patch and test the JavaScript-driven features of the >cart: All button controls, DataTables functionality, tabs, etc. >--- > .../prog/en/includes/acquisitions-menu.inc | 7 - > .../prog/en/modules/admin/admin-home.tt | 1 + > .../prog/en/modules/admin/aqbudgetperiods.tt | 286 ++++++------ > .../prog/en/modules/admin/aqbudgets.tt | 516 ++++++++++----------- > .../prog/en/modules/admin/aqcontract.tt | 86 ++-- > .../intranet-tmpl/prog/en/modules/admin/aqplan.tt | 114 ++--- > koha-tmpl/intranet-tmpl/prog/js/acq.js | 5 + > 7 files changed, 510 insertions(+), 505 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc >index 6ebe510..8d46d87 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc >@@ -1,10 +1,3 @@ >-<script type="text/javascript">//<![CDATA[ >- $(document).ready(function() { >- var path = location.pathname.substring(1); >- $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold'); >- }); >-//]]> >-</script> > <div id="navmenu"> > <div id="navmenulist"> > <h5>Acquisitions</h5> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >index 0d43e6f..b2f45f9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >@@ -1,4 +1,5 @@ > [% USE Koha %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration</title> > [% INCLUDE 'doc-head-close.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >index 3323b17..4d2d6bb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >@@ -1,6 +1,6 @@ > [% USE KohaDates %] > [% USE Price %] >- >+[% SET footerjs = 1 %] > [%- BLOCK action_menu %] > <div class="dropdown"> > <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#"> >@@ -33,152 +33,11 @@ > [% END -%] > > [% INCLUDE 'doc-head-open.inc' %] >-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> > [% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'calendar.inc' %] >-[% INCLUDE 'datatables.inc' %] >+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> > [% IF close_form %] > <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" /> >- <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script> > [% END %] >-<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script> >-<script type="text/javascript"> >-// ################################################################################# >-// Javascript >-// ################################################################################# >- function CheckDuplicateForm(f){ >- var ok=1; >- var _alertString=""; >- var alertString=""; >- if(!(isNotNull(f.budget_period_startdate,1))){ >- _alertString += "\n- " + _("Start date missing"); >- } >- if (!(isNotNull(f.budget_period_enddate,1))){ >- _alertString += "\n- " + _("End date missing"); >- } >- if( f.budget_period_startdate > f.budget_period_enddate ) { >- _alertString += "\n- " + _("Start date must be before end date"); >- } >- if (!(isNotNull(f.budget_period_description,1))){ >- _alertString += "\n- " + _("Budget description missing"); >- } >- >- if(_alertString.length==0){ >- f.submit(); >- } else { >- alertString += _("Form not submitted because of the following problem(s)"); >- alertString += "\n-----------------------------------------\n"; >- alertString += _alertString; >- alert(alertString); >- } >- } >- function Check(f) { >- var ok=1; >- var _alertString=""; >- var alertString2; >- >- if (!(isNotNull(f.budget_period_startdate,1))) { >- _alertString += "\n- " + _("Start date missing"); >- } >- >- if (!(isNotNull(f.budget_period_enddate,1))) { >- _alertString += "\n- " + _("End date missing"); >- } >- >- if ( f.budget_period_startdate > f.budget_period_enddate ) { >- _alertString += "\n- " + _("Start date must be before end date"); >- } >- >- if (!(isNotNull(f.budget_period_description,1))) { >- _alertString += "\n- " + _("Description missing"); >- } >- >- if (!(isNum(f.budget_period_total))) { >- _alertString += "\n- " + _("Amount must be a valid number, or empty"); >- } >- >-/* >- checkBudgetTotal(f) { >- } >-*/ >- >- if (_alertString.length==0) { >- f.submit(); >- } else { >- alertString2 = _("Form not submitted because of the following problem(s)"); >- alertString2 += "\n------------------------------------------------------------------------------------\n"; >- alertString2 += _alertString; >- alert(alertString2); >- } >- } >- >- $(document).ready(function() { >- var tabs = $('#budgetsTabs').tabs(); >- [% IF ( tab ) %] >- tabs.tabs("option", "active", [% tab %]); >- [% END %] >- $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >- { "sType": "title-string", "aTargets" : [ "title-string" ] } >- ], >- "sPaginationType": "four_button", >- 'bAutoWidth': false >- } ) ); >- >- [% IF close_form %] >- $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, { >- sDom: "t" >- })); >- $("#move_form").submit(function(){ >- var budget_from = "[% budget_period_description %]"; >- var budget_to = $("#to_budget_period_id").find("option:selected").html(); >- var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to); >- alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?"); >- return confirm ( alert_message ); >- }); >- [% END %] >- [% IF closed %] >- var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, { >- // The following is a c/p from aqbudgets.tt and is a candidate for refactoring. >- "fnDrawCallback": function ( oSettings ) { >- if ( oSettings.aiDisplay.length == 0 ) >- { >- return; >- } >- >- var nTrs = $('#closed_report tbody tr'); >- var iColspan = nTrs[1].getElementsByTagName('td').length; >- var sLastGroup = ""; >- for ( var i=0 ; i<nTrs.length ; i++ ) >- { >- var iDisplayIndex = oSettings._iDisplayStart + i; >- var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0]; >- if ( sGroup != sLastGroup ) >- { >- var nGroup = document.createElement( 'tr' ); >- var nCell = document.createElement( 'td' ); >- nCell.colSpan = iColspan; >- nCell.className = "group"; >- nCell.innerHTML = sGroup; >- nGroup.appendChild( nCell ); >- nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); >- sLastGroup = sGroup; >- } >- } >- }, >- "aoColumnDefs": [ >- { "bVisible": false, "aTargets": [ 0, 1 ] }, >- { "bSortable": false, "aTargets": ["_all"] } >- ], >- 'bSort': true, >- 'aaSortingFixed': [[ 1, 'asc' ]], >- "bAutoWidth": false, >- "sPaginationType": "full_numbers" >- })); >- [% END %] >- }); >-</script> > > <title> > Koha › Administration › Budgets >@@ -625,7 +484,6 @@ > </div> > [% END %] > >- > </div> > </div> > <div class="yui-b"> >@@ -633,4 +491,144 @@ > </div> > </div> > >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'datatables.inc' %] >+ [% IF close_form %] >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script> >+ [% END %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script> >+ <script type="text/javascript"> >+ // ################################################################################# >+ // Javascript >+ // ################################################################################# >+ function CheckDuplicateForm(f){ >+ var ok=1; >+ var _alertString=""; >+ var alertString=""; >+ if(!(isNotNull(f.budget_period_startdate,1))){ >+ _alertString += "\n- " + _("Start date missing"); >+ } >+ if (!(isNotNull(f.budget_period_enddate,1))){ >+ _alertString += "\n- " + _("End date missing"); >+ } >+ if( f.budget_period_startdate > f.budget_period_enddate ) { >+ _alertString += "\n- " + _("Start date must be before end date"); >+ } >+ if (!(isNotNull(f.budget_period_description,1))){ >+ _alertString += "\n- " + _("Budget description missing"); >+ } >+ >+ if(_alertString.length==0){ >+ f.submit(); >+ } else { >+ alertString += _("Form not submitted because of the following problem(s)"); >+ alertString += "\n-----------------------------------------\n"; >+ alertString += _alertString; >+ alert(alertString); >+ } >+ } >+ function Check(f) { >+ var ok=1; >+ var _alertString=""; >+ var alertString2; >+ >+ if (!(isNotNull(f.budget_period_startdate,1))) { >+ _alertString += "\n- " + _("Start date missing"); >+ } >+ >+ if (!(isNotNull(f.budget_period_enddate,1))) { >+ _alertString += "\n- " + _("End date missing"); >+ } >+ >+ if ( f.budget_period_startdate > f.budget_period_enddate ) { >+ _alertString += "\n- " + _("Start date must be before end date"); >+ } >+ >+ if (!(isNotNull(f.budget_period_description,1))) { >+ _alertString += "\n- " + _("Description missing"); >+ } >+ >+ if (!(isNum(f.budget_period_total))) { >+ _alertString += "\n- " + _("Amount must be a valid number, or empty"); >+ } >+ >+ if (_alertString.length==0) { >+ f.submit(); >+ } else { >+ alertString2 = _("Form not submitted because of the following problem(s)"); >+ alertString2 += "\n------------------------------------------------------------------------------------\n"; >+ alertString2 += _alertString; >+ alert(alertString2); >+ } >+ } >+ >+ $(document).ready(function() { >+ var tabs = $('#budgetsTabs').tabs(); >+ [% IF ( tab ) %] >+ tabs.tabs("option", "active", [% tab %]); >+ [% END %] >+ $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >+ { "sType": "title-string", "aTargets" : [ "title-string" ] } >+ ], >+ "sPaginationType": "four_button", >+ 'bAutoWidth': false >+ } ) ); >+ >+ [% IF close_form %] >+ $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, { >+ sDom: "t" >+ })); >+ $("#move_form").submit(function(){ >+ var budget_from = "[% budget_period_description %]"; >+ var budget_to = $("#to_budget_period_id").find("option:selected").html(); >+ var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to); >+ alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?"); >+ return confirm ( alert_message ); >+ }); >+ [% END %] >+ [% IF closed %] >+ var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, { >+ // The following is a c/p from aqbudgets.tt and is a candidate for refactoring. >+ "fnDrawCallback": function ( oSettings ) { >+ if ( oSettings.aiDisplay.length == 0 ) >+ { >+ return; >+ } >+ >+ var nTrs = $('#closed_report tbody tr'); >+ var iColspan = nTrs[1].getElementsByTagName('td').length; >+ var sLastGroup = ""; >+ for ( var i=0 ; i<nTrs.length ; i++ ) >+ { >+ var iDisplayIndex = oSettings._iDisplayStart + i; >+ var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0]; >+ if ( sGroup != sLastGroup ) >+ { >+ var nGroup = document.createElement( 'tr' ); >+ var nCell = document.createElement( 'td' ); >+ nCell.colSpan = iColspan; >+ nCell.className = "group"; >+ nCell.innerHTML = sGroup; >+ nGroup.appendChild( nCell ); >+ nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); >+ sLastGroup = sGroup; >+ } >+ } >+ }, >+ "aoColumnDefs": [ >+ { "bVisible": false, "aTargets": [ 0, 1 ] }, >+ { "bSortable": false, "aTargets": ["_all"] } >+ ], >+ 'bSort': true, >+ 'aaSortingFixed': [[ 1, 'asc' ]], >+ "bAutoWidth": false, >+ "sPaginationType": "full_numbers" >+ })); >+ [% END %] >+ }); >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >index a3c9ee9..21a3877 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >@@ -1,268 +1,14 @@ > [% USE AuthorisedValues %] > [% USE Branches %] > [% USE Price %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › Funds[% IF op == 'add_form' %] › [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title> >+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >+<link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" /> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >-var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n"; >-var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n"; >-var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n"; >-//]]> >-</script> >- >-<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script> >-[% IF op == 'add_form' %] >-<script type="text/javascript"> >-//<![CDATA[ >- >- function userPopup() { >- window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=add", >- 'PatronPopup', >- 'width=740,height=450,location=yes,toolbar=no,' >- + 'scrollbars=yes,resize=yes' >- ); >- } >- >- function ownerPopup() { >- window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select", >- 'PatronPopup', >- 'width=740,height=450,location=yes,toolbar=no,' >- + 'scrollbars=yes,resize=yes' >- ); >- } >- >- function select_user(borrowernumber, borrower) { >- ownerRemove(); >- var borrowername = borrower.firstname + ' ' + borrower.surname >- if (borrowernumber) { >- var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl' >- + '?borrowernumber=' + borrowernumber + '">' >- + borrowername + '</a>'; >- $('#budget_owner_name').html(ownerlink); >- $('#budget_owner_id').val(borrowernumber); >- } >- } >- >- function ownerRemove() { >- $('#budget_owner_name').empty(); >- $('#budget_owner_id').val(''); >- } >- >- function add_user(borrowernumber, borrowername) { >- var ids = $("#budget_users_id").val().split(':'); >- if(borrowernumber && ids.indexOf(borrowernumber) == -1) { >- var li = '<li id="user_' + borrowernumber + '">' >- + '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' >- + borrowernumber + '">' + borrowername + '</a> ' >- + ' • <a data-borrowernumber=" + borrowernumber +" class="del_user" href="#"><i class="fa fa-trash"></i> Remove</a> ' >- + '</li>'; >- $("#budget_users").prepend(li); >- ids.push(borrowernumber); >- $("#budget_users_id").val(ids.join(':')); >- } else { >- return -1; >- } >- return 0; >- } >- >- function del_user(borrowernumber) { >- var ids = $("#budget_users_id").val().split(':'); >- if (borrowernumber) { >- var idx = ids.indexOf(borrowernumber+''); >- if (idx != -1) { >- ids.splice(idx, 1); >- $("#budget_users_id").val(ids.join(':')); >- $("li#user_" + borrowernumber).remove(); >- } >- } >- } >- >- function Check(f) { >- var ok=1; >- var _alertString=""; >- var alertString2; >- >- if (!(isNotNull(f.budget_code,1))) { >- _alertString += _("- Budget code cannot be blank") + "\n"; >- } >- >- if (!(isNotNull(f.budget_name,1))) { >- _alertString += _("- Budget name cannot be blank") + "\n"; >- } >- >- if (!(isNotNull(f.budget_amount,1))) { >- _alertString += _("- Budget amount cannot be blank") + "\n"; >- } >- >- var budgetId; >- if (typeof(f.budget_id ) != "undefined") { >- budgetId = f.budget_id.value >- } >- >- var newBudgetParent; >- >-// hack to test if selected parent_id in scrolling-list... >-// if value == 'undef' its got a selected_parent :/ >- if(f.budget_parent_id){ >- var chkAdd = f.budget_parent_id.value ; >- if ( typeof(chkAdd ) != "undefined") { >- newBudgetParent = f.budget_parent_id.value >- } else { >- newBudgetParent = f.budget_parent_id.item(0).value >- } >- >- if (budgetId > 0) { ; //its a mod ... >- // if parent == curent-budget, fail... >- if ( newBudgetParent == budgetId ) { >- _alertString += _("- Budget parent is current budget") + "\n"; >- } >- >- else if (newBudgetParent) { >- var result = checkBudgetParent( budgetId , newBudgetParent ); >- if (result) { >- _alertString += result; >- } >- } >- } >- } >- >- // else do lookup >- var budgetTotal = Math.abs(f.budget_amount.value); >- var result = budgetExceedsParent (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value) >- if (result) { >- _alertString += result; >- } >- >- if (_alertString.length==0) { >- document.Aform.submit(); >- } else { >- alertString2 = _("Form not submitted because of the following problem(s)"); >- alertString2 += "\n------------------------------------------------------------------------------------\n\n"; >- alertString2 += _alertString; >- alert(alertString2); >- } >- } >- $(document).ready(function(){ >- $("#remove_owner").on("click",function(e){ >- e.preventDefault(); >- ownerRemove(); >- }); >- $("#edit_owner").on("click",function(e){ >- e.preventDefault(); >- ownerPopup(); >- }); >- $("body").on("click",".del_user",function(e){ >- e.preventDefault(); >- var borrowernumber = $(this).data("borrowernumber"); >- del_user(borrowernumber); >- }); >- $("#add_user_button").on("click",function(e){ >- e.preventDefault(); >- userPopup(); >- }); >- $("#edit_fund").on("submit",function(e){ >- e.preventDefault(); >- Check(this); >- }); >- }); >-//]]> >-</script> >-[% ELSIF op == 'list' %] >- <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >- [% INCLUDE 'datatables.inc' %] >- <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" /> >- <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script> >- >-<script type="text/javascript"> >-//<![CDATA[ >- // >- $(document).ready(function() { >- >- >- var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, { >- "fnDrawCallback": function ( oSettings ) { >- if ( oSettings.aiDisplay.length == 0 ) >- { >- return; >- } >- >- var nTrs = $('#budgeth tbody tr'); >- var iColspan = nTrs[0].getElementsByTagName('td').length; >- var sLastGroup = ""; >- for ( var i=0 ; i<nTrs.length ; i++ ) >- { >- var iDisplayIndex = oSettings._iDisplayStart + i; >- var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1]; >- if ( sGroup != sLastGroup ) >- { >- var nGroup = document.createElement( 'tr' ); >- var nCell = document.createElement( 'td' ); >- nCell.colSpan = iColspan; >- nCell.className = "group"; >- nCell.innerHTML = sGroup; >- nGroup.appendChild( nCell ); >- nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); >- sLastGroup = sGroup; >- } >- } >- }, >- "footerCallback": function ( row, data, start, end, display ) { >- var api = this.api(), data; >- footer_column_sum( api, [ 4, 6, 8, 10 ], 2 ); >- }, >- "aoColumnDefs": [ >- { "bVisible": false, "aTargets": [ 0, 1 ] }, >- { "bSortable": false, "aTargets": ["_all"] } >- ], >- 'dom': '<"top pager"ilpf>tr<"bottom pager"ip>', >- 'bSort': true, >- 'aaSortingFixed': [[ 1, 'asc' ]], >- 'bPaginate': false, >- "bAutoWidth": false >- })); >- >- $(oTable).treetable({ >- expandable: true >- }); >- $(oTable).treetable('expandAll'); >- $("#expand_all").click(function(e){ >- e.preventDefault(); >- $(oTable).treetable('expandAll'); >- }); >- $("#collapse_all").click(function(e){ >- e.preventDefault(); >- $(oTable).treetable('collapseAll'); >- }); >- >- [% UNLESS budget_period_id %] >- $("#hide_inactive").click(function(e){ >- e.preventDefault(); >- oTable.fnFilter( 1, 0 ); // Show only active=1 >- }); >- $("#show_inactive").click(function(e){ >- e.preventDefault(); >- oTable.fnFilter( '', 0 ); >- }); >- $("#hide_inactive").click(); >- [% END %] >- oTable.fnAddFilters("filter", 750); >- >- $("#filterbutton").click(function() { >- $("#fundfilters").slideToggle(0); >- }); >- >- $(".deletefund-disabled").tooltip().on("click", function(e){ >- e.preventDefault(); >- alert(_("This fund has children. It cannot be deleted.")); >- }); >- }); >-//]]> >-</script> >-[% END %] >- > </head> >+ > <body id="admin_aqbudgets" class="admin"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'budgets-admin-search.inc' %] >@@ -693,4 +439,258 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") > [% INCLUDE 'acquisitions-menu.inc' %] > </div> > </div> >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script> >+ <script type="text/javascript"> >+ var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n"; >+ var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n"; >+ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n"; >+ </script> >+ >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script> >+ [% IF op == 'add_form' %] >+ <script type="text/javascript"> >+ //<![CDATA[ >+ >+ function userPopup() { >+ window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=add", >+ 'PatronPopup', >+ 'width=740,height=450,location=yes,toolbar=no,' >+ + 'scrollbars=yes,resize=yes' >+ ); >+ } >+ >+ function ownerPopup() { >+ window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select", >+ 'PatronPopup', >+ 'width=740,height=450,location=yes,toolbar=no,' >+ + 'scrollbars=yes,resize=yes' >+ ); >+ } >+ >+ function select_user(borrowernumber, borrower) { >+ ownerRemove(); >+ var borrowername = borrower.firstname + ' ' + borrower.surname >+ if (borrowernumber) { >+ var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl' >+ + '?borrowernumber=' + borrowernumber + '">' >+ + borrowername + '</a>'; >+ $('#budget_owner_name').html(ownerlink); >+ $('#budget_owner_id').val(borrowernumber); >+ } >+ } >+ >+ function ownerRemove() { >+ $('#budget_owner_name').empty(); >+ $('#budget_owner_id').val(''); >+ } >+ >+ function add_user(borrowernumber, borrowername) { >+ var ids = $("#budget_users_id").val().split(':'); >+ if(borrowernumber && ids.indexOf(borrowernumber) == -1) { >+ var li = '<li id="user_' + borrowernumber + '">' >+ + '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' >+ + borrowernumber + '">' + borrowername + '</a> ' >+ + ' • <a data-borrowernumber=" + borrowernumber +" class="del_user" href="#"><i class="fa fa-trash"></i> Remove</a> ' >+ + '</li>'; >+ $("#budget_users").prepend(li); >+ ids.push(borrowernumber); >+ $("#budget_users_id").val(ids.join(':')); >+ } else { >+ return -1; >+ } >+ return 0; >+ } >+ >+ function del_user(borrowernumber) { >+ var ids = $("#budget_users_id").val().split(':'); >+ if (borrowernumber) { >+ var idx = ids.indexOf(borrowernumber+''); >+ if (idx != -1) { >+ ids.splice(idx, 1); >+ $("#budget_users_id").val(ids.join(':')); >+ $("li#user_" + borrowernumber).remove(); >+ } >+ } >+ } >+ >+ function Check(f) { >+ var ok=1; >+ var _alertString=""; >+ var alertString2; >+ >+ if (!(isNotNull(f.budget_code,1))) { >+ _alertString += _("- Budget code cannot be blank") + "\n"; >+ } >+ >+ if (!(isNotNull(f.budget_name,1))) { >+ _alertString += _("- Budget name cannot be blank") + "\n"; >+ } >+ >+ if (!(isNotNull(f.budget_amount,1))) { >+ _alertString += _("- Budget amount cannot be blank") + "\n"; >+ } >+ >+ var budgetId; >+ if (typeof(f.budget_id ) != "undefined") { >+ budgetId = f.budget_id.value >+ } >+ >+ var newBudgetParent; >+ >+ // hack to test if selected parent_id in scrolling-list... >+ // if value == 'undef' its got a selected_parent :/ >+ if(f.budget_parent_id){ >+ var chkAdd = f.budget_parent_id.value ; >+ if ( typeof(chkAdd ) != "undefined") { >+ newBudgetParent = f.budget_parent_id.value >+ } else { >+ newBudgetParent = f.budget_parent_id.item(0).value >+ } >+ >+ if (budgetId > 0) { ; //its a mod ... >+ // if parent == curent-budget, fail... >+ if ( newBudgetParent == budgetId ) { >+ _alertString += _("- Budget parent is current budget") + "\n"; >+ } >+ >+ else if (newBudgetParent) { >+ var result = checkBudgetParent( budgetId , newBudgetParent ); >+ if (result) { >+ _alertString += result; >+ } >+ } >+ } >+ } >+ >+ // else do lookup >+ var budgetTotal = Math.abs(f.budget_amount.value); >+ var result = budgetExceedsParent (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value) >+ if (result) { >+ _alertString += result; >+ } >+ >+ if (_alertString.length==0) { >+ document.Aform.submit(); >+ } else { >+ alertString2 = _("Form not submitted because of the following problem(s)"); >+ alertString2 += "\n------------------------------------------------------------------------------------\n\n"; >+ alertString2 += _alertString; >+ alert(alertString2); >+ } >+ } >+ $(document).ready(function(){ >+ $("#remove_owner").on("click",function(e){ >+ e.preventDefault(); >+ ownerRemove(); >+ }); >+ $("#edit_owner").on("click",function(e){ >+ e.preventDefault(); >+ ownerPopup(); >+ }); >+ $("body").on("click",".del_user",function(e){ >+ e.preventDefault(); >+ var borrowernumber = $(this).data("borrowernumber"); >+ del_user(borrowernumber); >+ }); >+ $("#add_user_button").on("click",function(e){ >+ e.preventDefault(); >+ userPopup(); >+ }); >+ $("#edit_fund").on("submit",function(e){ >+ e.preventDefault(); >+ Check(this); >+ }); >+ }); >+ //]]> >+ </script> >+ [% ELSIF op == 'list' %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script> >+ >+ <script type="text/javascript"> >+ //<![CDATA[ >+ // >+ $(document).ready(function() { >+ var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "fnDrawCallback": function ( oSettings ) { >+ if ( oSettings.aiDisplay.length == 0 ) >+ { >+ return; >+ } >+ >+ var nTrs = $('#budgeth tbody tr'); >+ var iColspan = nTrs[0].getElementsByTagName('td').length; >+ var sLastGroup = ""; >+ for ( var i=0 ; i<nTrs.length ; i++ ) >+ { >+ var iDisplayIndex = oSettings._iDisplayStart + i; >+ var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1]; >+ if ( sGroup != sLastGroup ) >+ { >+ var nGroup = document.createElement( 'tr' ); >+ var nCell = document.createElement( 'td' ); >+ nCell.colSpan = iColspan; >+ nCell.className = "group"; >+ nCell.innerHTML = sGroup; >+ nGroup.appendChild( nCell ); >+ nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); >+ sLastGroup = sGroup; >+ } >+ } >+ }, >+ "footerCallback": function ( row, data, start, end, display ) { >+ var api = this.api(), data; >+ footer_column_sum( api, [ 4, 6, 8, 10 ], 2 ); >+ }, >+ "aoColumnDefs": [ >+ { "bVisible": false, "aTargets": [ 0, 1 ] }, >+ { "bSortable": false, "aTargets": ["_all"] } >+ ], >+ 'dom': '<"top pager"ilpf>tr<"bottom pager"ip>', >+ 'bSort': true, >+ 'aaSortingFixed': [[ 1, 'asc' ]], >+ 'bPaginate': false, >+ "bAutoWidth": false >+ })); >+ >+ $(oTable).treetable({ >+ expandable: true >+ }); >+ $(oTable).treetable('expandAll'); >+ $("#expand_all").click(function(e){ >+ e.preventDefault(); >+ $(oTable).treetable('expandAll'); >+ }); >+ $("#collapse_all").click(function(e){ >+ e.preventDefault(); >+ $(oTable).treetable('collapseAll'); >+ }); >+ >+ [% UNLESS budget_period_id %] >+ $("#hide_inactive").click(function(e){ >+ e.preventDefault(); >+ oTable.fnFilter( 1, 0 ); // Show only active=1 >+ }); >+ $("#show_inactive").click(function(e){ >+ e.preventDefault(); >+ oTable.fnFilter( '', 0 ); >+ }); >+ $("#hide_inactive").click(); >+ [% END %] >+ oTable.fnAddFilters("filter", 750); >+ >+ $("#filterbutton").click(function() { >+ $("#fundfilters").slideToggle(0); >+ }); >+ >+ $(".deletefund-disabled").tooltip().on("click", function(e){ >+ e.preventDefault(); >+ alert(_("This fund has children. It cannot be deleted.")); >+ }); >+ }); >+ //]]> >+ </script> >+ [% END %] >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt >index 1cff513..0459beb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt >@@ -1,4 +1,5 @@ > [% USE KohaDates %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Acquisitions › Contracts › > [% IF ( add_form ) %] >@@ -10,48 +11,8 @@ > [% IF ( delete_confirm ) %]Confirm deletion of contract '[% contractnumber %]'[% END %] > [% IF ( delete_confirmed ) %]Contract deleted[% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'calendar.inc' %] >-<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script> >-<script type="text/javascript"> >-//<![CDATA[ >-// to check if the data are correctly entered. >-function Check(ff) { >- var ok=0; >- var _alertString=_("Form not submitted because of the following problem(s)"); >- _alertString +="\n-------------------------------------------------------------------\n\n"; >- if (!(isNotNull(ff.contractname,0))){ >- ok=1; >- _alertString += _("- Name missing") + "\n"; >- } >- var startDate = Date_from_syspref($("#from").val()); >- var endDate = Date_from_syspref($("#to").val()); >- if (!parseInt(startDate.getTime())) { >- ok=1; >- _alertString += _("- Start date missing or invalid.") + "\n"; >- } >- if (!parseInt(endDate.getTime())) { >- ok=1; >- _alertString += _("- End date missing or invalid.") + "\n"; >- } >- >- if (startDate > endDate) { >- ok=1; >- _alertString += _("Wrong date! start date cannot be after end date.") + "\n"; >- } >- if (endDate < (new Date)) { >- ok=1; >- _alertString += _("End date before today, Invalid end date!") + "\n"; >- } >- if (ok) { // if there is a problem >- alert(_alertString); >- return false; >-} >-// if all is good >- ff.submit(); >-} >-//]]> >-</script> > </head> >+ > <body id="acq_aqcontract" class="acq"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'contracts-admin-search.inc' %] >@@ -213,4 +174,47 @@ function Check(ff) { > [% INCLUDE 'vendor-menu.inc' %] > </div> > </div> >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'calendar.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script> >+ <script type="text/javascript"> >+ //<![CDATA[ >+ // to check if the data are correctly entered. >+ function Check(ff) { >+ var ok=0; >+ var _alertString=_("Form not submitted because of the following problem(s)"); >+ _alertString +="\n-------------------------------------------------------------------\n\n"; >+ if (!(isNotNull(ff.contractname,0))){ >+ ok=1; >+ _alertString += _("- Name missing") + "\n"; >+ } >+ var startDate = Date_from_syspref($("#from").val()); >+ var endDate = Date_from_syspref($("#to").val()); >+ if (!parseInt(startDate.getTime())) { >+ ok=1; >+ _alertString += _("- Start date missing or invalid.") + "\n"; >+ } >+ if (!parseInt(endDate.getTime())) { >+ ok=1; >+ _alertString += _("- End date missing or invalid.") + "\n"; >+ } >+ >+ if (startDate > endDate) { >+ ok=1; >+ _alertString += _("Wrong date! start date cannot be after end date.") + "\n"; >+ } >+ if (endDate < (new Date)) { >+ ok=1; >+ _alertString += _("End date before today, Invalid end date!") + "\n"; >+ } >+ if (ok) { // if there is a problem >+ alert(_alertString); >+ return false; >+ } >+ // if all is good >+ ff.submit(); >+ } >+ //]]> >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt >index 66f6b9f..cd629ef 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt >@@ -1,64 +1,11 @@ > [% USE Price %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › Budgets › Funds › Planning for [% budget_period_description %] by [% authcat %]</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> >-<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script> >-<script type="text/javascript"> >-//<![CDATA[ >- function Check(f) { >- var ok=1; >- var _alertString=""; >- var alertString2; >- var arr = document.getElementsByName('est_total') >- >- for ( var i=0, len=arr.length; i<len; ++i ){ >- var tot = arr[i].innerHTML; >- >- if (tot == 'NaN') { >- _alertString += "\n- " + _("One or more cell values is non-numeric"); >- } >- } >- >- if (_alertString.length==0) { >- >- var op = document.createElement('input'); >- op.setAttribute("type","hidden"); >- op.setAttribute("name","op"); >- op.setAttribute("value","save"); //ohh the pain... >- >- document.Aform.appendChild(op); >- document.Aform.submit() >- >- } else { >- alertString2 = _("Form not submitted because of the following problem(s)"); >- alertString2 += "\n------------------------------------------------------------------------------------\n"; >- alertString2 += _alertString; >- alert(alertString2); >- } >- } >- $(document).ready(function() { >- $("#selections input").on("change",function(e){ >- var num = $(this).attr("id"); >- if(num == 'showall'){ >- showAllColumns(); >- e.stopPropagation(); >- } else if(num == 'hideall'){ >- hideAllColumns(); >- e.stopPropagation(); >- } else { >- if($(this).prop("checked")){ >- showColumn(num); >- } else { >- hideColumn(num); >- } >- } >- }); >- }); >-//]]> >-</script> > <style type="text/css">td.locked { background-image: url('[% interface %]/[% theme %]/img/locked.png'); padding-left : 20px; background-repeat: no-repeat; background-position: 5px 5px; } a.control { font-size:85%;text-decoration:none; }</style> > </head> >+ > <body id="admin_aqplan" class="admin"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'budgets-admin-search.inc' %] >@@ -321,4 +268,61 @@ > [% INCLUDE 'acquisitions-menu.inc' %] > </div> > </div> >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script> >+ <script type="text/javascript"> >+ //<![CDATA[ >+ function Check(f) { >+ var ok=1; >+ var _alertString=""; >+ var alertString2; >+ var arr = document.getElementsByName('est_total') >+ >+ for ( var i=0, len=arr.length; i<len; ++i ){ >+ var tot = arr[i].innerHTML; >+ >+ if (tot == 'NaN') { >+ _alertString += "\n- " + _("One or more cell values is non-numeric"); >+ } >+ } >+ >+ if (_alertString.length==0) { >+ >+ var op = document.createElement('input'); >+ op.setAttribute("type","hidden"); >+ op.setAttribute("name","op"); >+ op.setAttribute("value","save"); //ohh the pain... >+ >+ document.Aform.appendChild(op); >+ document.Aform.submit() >+ >+ } else { >+ alertString2 = _("Form not submitted because of the following problem(s)"); >+ alertString2 += "\n------------------------------------------------------------------------------------\n"; >+ alertString2 += _alertString; >+ alert(alertString2); >+ } >+ } >+ $(document).ready(function() { >+ $("#selections input").on("change",function(e){ >+ var num = $(this).attr("id"); >+ if(num == 'showall'){ >+ showAllColumns(); >+ e.stopPropagation(); >+ } else if(num == 'hideall'){ >+ hideAllColumns(); >+ e.stopPropagation(); >+ } else { >+ if($(this).prop("checked")){ >+ showColumn(num); >+ } else { >+ hideColumn(num); >+ } >+ } >+ }); >+ }); >+ //]]> >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/acq.js b/koha-tmpl/intranet-tmpl/prog/js/acq.js >index 9d3983c..63575b3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/acq.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/acq.js >@@ -374,3 +374,8 @@ function hideAllColumns(){ > $("#plan td:nth-child(2),#plan th:nth-child(2)").nextUntil("th:nth-child("+(allCols-1)+"),td:nth-child("+(allCols-1)+")").hide(); // hide all but the last two columns > $("#hideall").prop("checked", true).parent().addClass("selected"); > } >+ >+$(document).ready(function() { >+ var path = location.pathname.substring(1); >+ $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold'); >+}); >-- >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 19592
:
69033
|
69048
|
69555