From 10cd8fb6db0488f484424436bb771a8700a71d48 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 23 Jul 2012 12:56:20 -0400 Subject: [PATCH] Bug 8163 [REVISED] Click to populate XSLT preferences with "default" or empty values Content-Type: text/plain; charset="utf-8" This patch adds markup and JavaScript to the system preferences interface so that the user can click "default" or "empty" to populate an XSLT-related pref with those vaules. To test, open system preferences for the OPAC or staff client. In the description for an XSLT-related preference click the "default" link to populate the field with "default." Click the "leave empty" link to empty the field. Revised according to Julian Maurice's suggestion for a more generic, flexible way to implement it. --- .../intranet-tmpl/prog/en/js/pages/preferences.js | 13 ++++--------- .../prog/en/modules/admin/preferences/opac.pref | 4 ++-- .../en/modules/admin/preferences/staff_client.pref | 4 ++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js index 9f9f6f8..ba790b8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js @@ -59,15 +59,10 @@ $( document ).ready( function () { mark_modified.call(this); } ); - $(".default").click(function(){ - var action = $(this).attr("id").split("_"); - $("#pref_"+action[1]).attr("value","default"); - return false; - }); - - $(".leaveempty").click(function(){ - var action = $(this).attr("id").split("_"); - $("#pref_"+action[1]).removeAttr("value"); + $(".set_syspref").click(function() { + var s = $(this).attr('data-syspref'); + var v = $(this).attr('data-value'); + $("#pref_"+s).val(v); return false; }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 7114785..a4d1d5a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -59,12 +59,12 @@ OPAC: - 'Display OPAC results using XSLT stylesheet at: ' - pref: OPACXSLTResultsDisplay class: file - - '
Options:{langcode} will be replaced with current interface language' + - '
Options:{langcode} will be replaced with current interface language' - - 'Display OPAC details using XSLT stylesheet at: ' - pref: OPACXSLTDetailsDisplay class: file - - '
Options:{langcode} will be replaced with current interface language' + - '
Options:{langcode} will be replaced with current interface language' - - On pages displayed with XSLT stylesheets on the OPAC, - pref: DisplayOPACiconsXSLT diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref index eefb777..d9fc21a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref @@ -59,12 +59,12 @@ Staff Client: - 'Display results in the staff client using XSLT stylesheet at: ' - pref: XSLTResultsDisplay class: file - - '
Options:{langcode} will be replaced with current interface language' + - '
Options:{langcode} will be replaced with current interface language' - - 'Display details in the staff client using XSLT stylesheet at: ' - pref: XSLTDetailsDisplay class: file - - '
Options:{langcode} will be replaced with current interface language' + - '
Options:{langcode} will be replaced with current interface language' - - Use the Yahoo UI libraries - pref: yuipath -- 1.7.9.5