Bugzilla – Attachment 110785 Details for
Bug 24958
Remember last selected tab in SQL reports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24958: Remember last selected tab in SQL reports
Bug-24958-Remember-last-selected-tab-in-SQL-report.patch (text/plain), 7.24 KB, created by
Katrin Fischer
on 2020-09-26 17:30:08 UTC
(
hide
)
Description:
Bug 24958: Remember last selected tab in SQL reports
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-09-26 17:30:08 UTC
Size:
7.24 KB
patch
obsolete
>From 39c76f44edc77464c3cc99847318c86c8754ab73 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 14 Apr 2020 18:49:35 +0000 >Subject: [PATCH] Bug 24958: Remember last selected tab in SQL reports > >This patch modifies the saved reports page so that it remembers, for the >duration of the browser session, the last active tab. > >To test you should have multiple reports in multiple report groups. >Apply the patch and go to Reports -> Saved reports. > >- Select a tab to filter the table of saved reports to a particular > report group. >- Navigate away from the page >- Return to the save reports page. The tab you previously selected > should be selected again. >- Restart your browser and return to the saved reports page. The tab > should no longer be preselected. > >Update: The tabs filtering JavaScript has been moved to a separate >function so that the function can be triggered by both the "create" >event (when the tabs are initialized) and the "activate" event (when a >tab is selected). > >Update II: Persistence is now enable through localStorage instead of >Cookies. The localStorage item is now cleared during the logOut >function. > >Update III: The logOut() function in staff-global.js is now called by >auth.tt to ensure that tabs are not remembered across sessions. > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt | 4 +- > .../en/modules/reports/guided_reports_start.tt | 80 +++++++++++++--------- > koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 1 + > 3 files changed, 52 insertions(+), 33 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >index 699dd10eaf..ba3b266437 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >@@ -142,8 +142,8 @@ > if ( document.location.hash ) { > $( '#loginform' ).append( '<input name="auth_forwarded_hash" type="hidden" value="' + document.location.hash + '"/>' ); > } >- // if showLastPatron information was not cleared during logout, clear it now >- removeLastBorrower(); >+ // Clear last borrowers, rememberd sql reports, carts, etc. >+ logOut(); > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >index 153d7b7ced..c92785e81e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >@@ -1374,6 +1374,9 @@ > } > > $(document).ready(function(){ >+ >+ var activeTab = localStorage.getItem("sql_reports_activetab"); >+ > $("body").on('click',".fetch_chart_data",function(){ > if( [% unlimited_total || 0 | $raw %] > 1000 ){ > if( confirm("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you with to chart this report?") ){ >@@ -1559,39 +1562,17 @@ > }, > }, columns_settings); > >- var rtabs = $("#tabs").tabs(); >- rtabs.on("tabsactivate", function(e, ui) { >- $("#subgroup_filter option").each(function() { >- if($(this).val().length > 0) { >- $(this).remove(); >- } >- }); >- rtable.fnFilter('', 4); >- rtable.fnFilter('', 5); >- rtable.fnSetColumnVis(4, true); >- rtable.fnSetColumnVis(5, true); >- >- var g_id = $(ui.newTab).children().attr('id'); >- var g_name = $(ui.newTab).text(); >- if ( g_name == _("All") ) { >- g_id = ""; >- g_name = ""; >- } >- >- if (g_id && g_id.length > 0) { >- rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false); >- rtable.fnSetColumnVis(4, false); >- for(var i in group_subgroups[g_id]) { >- $("#subgroup_filter").append( >- '<option value="' + group_subgroups[g_id][i][0] + '">' >- + group_subgroups[g_id][i][1] + '</option>' >- ); >- } >- $("#subgroup_filter_block").show(); >- } else { >- $("#subgroup_filter_block").hide(); >+ var rtabs = $("#tabs").tabs({ >+ create: function( e, ui ){ >+ tabsInit( ui, rtable ); >+ }, >+ activate: function( e, ui ){ >+ tabsInit( ui, rtable ); > } > }); >+ if( activeTab ){ >+ $("#tabs").tabs("option","active", activeTab ); >+ } > $("#subgroup_filter_block").hide(); > > $("#subgroup_filter").change(function() { >@@ -1804,6 +1785,43 @@ > }); > }); > >+ function tabsInit( ui, rtable ){ >+ var thisTab = ui.newTab ? ui.newTab : ui.tab; >+ var activeTab = thisTab.index(); >+ localStorage.setItem("sql_reports_activetab", activeTab ); >+ >+ $("#subgroup_filter option").each(function() { >+ if($(this).val().length > 0) { >+ $(this).remove(); >+ } >+ }); >+ rtable.fnFilter('', 4); >+ rtable.fnFilter('', 5); >+ rtable.fnSetColumnVis(4, true); >+ rtable.fnSetColumnVis(5, true); >+ >+ var g_id = $(ui.newTab).children().attr('id'); >+ var g_name = $(ui.newTab).text(); >+ if ( g_name == _("All") ) { >+ g_id = ""; >+ g_name = ""; >+ } >+ >+ if (g_id && g_id.length > 0) { >+ rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false); >+ rtable.fnSetColumnVis(4, false); >+ for(var i in group_subgroups[g_id]) { >+ $("#subgroup_filter").append( >+ '<option value="' + group_subgroups[g_id][i][0] + '">' >+ + group_subgroups[g_id][i][1] + '</option>' >+ ); >+ } >+ $("#subgroup_filter_block").show(); >+ } else { >+ $("#subgroup_filter_block").hide(); >+ } >+ } >+ > function addColumn() { > $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected"); > } >diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >index 05681d3d8d..bc2702a15e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >@@ -177,6 +177,7 @@ function logOut(){ > } > clearHoldFor(); > removeLastBorrower(); >+ localStorage.removeItem("sql_reports_activetab"); > } > > function openHelp(){ >-- >2.11.0
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 24958
:
102463
|
102618
|
102940
|
103252
|
105890
|
106168
|
109967
|
110741
| 110785