Bug 10405: add IDs for customizable OPAC regions

This patch adds unique IDs for:
opaccredits
opacheader
OPACMobileUserCSS
OpacNavBottom
OpacUserCSS
opacuserjs

This is an amended patch which includes the changes to CCSR which I
forgot to commit before. The patch does not add a unique ID for
opacheader to CCSR, since opacheader is positioned wrong.

This is most useful for previewing changes you make in the OPAC
preferences using the following javascript in your IntranetUserJS:

function showPreview(url) {
    $('#preview-loading').show();
    document.getElementById('opac-preview').src = url;
    $('#opac-preview').load(function () {
        $('#opac-preview').show();
        $('#region-opaccredits', $('#opac-preview').contents()).html($('#pref_opaccredits').val());
        $('#region-opacheader', $('#opac-preview').contents()).html($('#pref_opacheader').val());
        $('#opacmainuserblock', $('#opac-preview').contents()).html($('#pref_OpacMainUserBlock').val());
        $('#opacmainuserblockmobile', $('#opac-preview').contents()).html($('#pref_OpacMainUserBlockMobile').val());
        $('#region-opacnav', $('#opac-preview').contents()).html($('#pref_OpacNav').val());
        $('#region-opacnavbottom', $('#opac-preview').contents()).html($('#pref_OpacNavBottom').val());
        $('#opacrightsidebar', $('#opac-preview').contents()).html($('#pref_OpacNavRight').val());
        $('#noresultsfound', $('#opac-preview').contents()).html($('#pref_OPACNoResultsFound').val());
        $('#opacresultssidebar', $('#opac-preview').contents()).html($('#pref_OPACResultsSidebar').val());
        $('#region-opacusercss', $('#opac-preview').contents()).replaceWith('<style id="region-opacusercss" type="text/css">' + $('#pref_OPACUserCSS').val() + '</style>');

        $('#region-opacuserjs', $('#opac-preview').contents()).replaceWith('<script id="region-opacuserjs" type="text/javascript">' + $('#pref_opacuserjs').val() + '</script>');
        $('#preview-loading').hide();
    });
}

$(document).ready(function () {
    if ($('#pref_OpacNav').size() > 0) {
        $('#doc3').after('<div class="navbar navbar-fixed-bottom" style="z-index: 10000;"><div id="preview-pane" class="navbar-inner"><h4 style="float: left; margin-right: 2em;">Preview changes</h4><div class="btn-group" data-toggle="buttons-radio"><button type="button" class="btn" id="preview-main">Main page</button><button type="button" class="btn" id="preview-results">Results</button><button type="button" class="btn" id="preview-details">Details</button><button type="button" class="btn active" id="preview-hide">Hide</button></div><img id="preview-loading" style="display: none;" src="/intranet-tmpl/prog/img/loading-small.gif"><iframe id="opac-preview" style="height: 20em; width: 100%; display: none;"></iframe></div></div>');

        $('#preview-main').click(function () {
            showPreview('/cgi-bin/koha/opac/opac-main.pl');
        });
        $('#preview-results').click(function () {
            showPreview('/cgi-bin/koha/opac/opac-search.pl?idx=&q=pqf%3D%40attr+1%3D_ALLRECORDS+%40attr+2%3D103+%22%22&branch_group_limit=');
        });
        $('#preview-details').click(function () {
            showPreview('/cgi-bin/koha/opac/opac-detail.pl?biblionumber=1');
        });
        $('#preview-hide').click(function () {
            $('#opac-preview').hide();
            $('#preview-loading').hide();
        });
    }
});

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

Note: The provided JavaScript didn't work for me and resulted in an
error in Firebug. Ater talking to Jared it seems like there is more needed
than the bit of Javascript so make this work, but it might be a good
starting point, so I am leaving it in the commit message.

Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Jared Camins-Esakov 2013-06-08 16:16:07 -04:00 committed by Galen Charlton
parent 98bd9de54a
commit 6b5960cc2a
10 changed files with 34 additions and 32 deletions

View file

@ -27,8 +27,8 @@
[% IF ( bidi ) %]
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/right-to-left.css" />
[% END %]
[% IF ( OPACMobileUserCSS ) %]<style type="text/css" media="screen and (max-width:700px)">[% OPACMobileUserCSS %]</style>[% END %]
[% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
<style id="region-opacmobileusercss" type="text/css" media="screen and (max-width:700px)">[% OPACMobileUserCSS %]</style>
<style id="region-opacusercss" type="text/css">[% OPACUserCSS %]</style>
[% IF persona %]
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/persona-buttons.css" />
[% END %]

View file

@ -239,11 +239,9 @@
You did not specify any search criteria.
[% END %]
</p>
[% IF ( OPACNoResultsFound ) %]
<div id="noresultsfound">
[% OPACNoResultsFound %]
</div>
[% END %]
</div>
[% END %]</p>[% END %]</div>

View file

@ -1,5 +1,9 @@
<div id="region-opacnav">
[% OpacNav %]
</div>
[% IF IsPatronPage %]
[% INCLUDE usermenu.inc %]
[% END %]
[% OpacNav %]
<div id="region-opacnavbottom">
[% OpacNavBottom %]
</div>

View file

@ -1,8 +1,6 @@
[% IF ( opaccredits ) %]
<div class="ft">
[% opaccredits %]
</div>
[% END %]
<div class="ft">
[% opaccredits %]
</div>
</div>
<div class="clear"></div>
@ -82,8 +80,10 @@
<script type="text/javascript" src="/opac-tmpl/lib/jquery/plugins/jquery.jqtransform_select.js"></script>
<script id="region-opacuserjs" type="text/javascript">
[% opacuserjs %]
</script>
<script type="text/javascript">
[% IF ( opacuserjs ) %][% opacuserjs %][% END %]
$(function() {
//find all form with class jqtransform and apply the plugin
$("form#searchform").jqTransform();

View file

@ -23,11 +23,11 @@
[% IF persona %]
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/persona-buttons.css" />
[% END %]
[% IF ( OPACMobileUserCSS ) %]<style type="text/css" media="screen and (max-width:700px)">[% OPACMobileUserCSS %]</style>[% END %]
<style id="region-opacmobileusercss" type="text/css" media="screen and (max-width:700px)">[% OPACMobileUserCSS %]</style>
[% IF ( bidi ) %]
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/right-to-left.css" />
[% END %]
[% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
<style id="region-opacusercss" type="text/css">[% OPACUserCSS %]</style>
<!-- yui js -->
<script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script>
<script type="text/javascript" src="[% yuipath %]/container/container-min.js"></script>
@ -94,8 +94,12 @@
[% IF ( SyndeticsCoverImages ) %]$(window).load(function() {
verify_images();
});[% END %]
[% IF ( opacuserjs ) %][% opacuserjs %][% END %]
//]]>
//]]>
</script>
<script id="region-opacuserjs" type="text/javascript">
[% opacuserjs %]
</script>
<script type="text/javascript">
[% IF ( opacbookbag ) %]</script><script type="text/javascript" src="[% themelang %]/js/basket.js">
[% ELSIF ( virtualshelves ) %]</script><script type="text/javascript" src="[% themelang %]/js/basket.js">
[% ELSE %]</script><script type="text/javascript">var readCookie;[% END %]</script>

View file

@ -14,9 +14,9 @@
</ul>
[% END %]
</div>
[% IF ( opacheader ) %]
[% opacheader %]
[% END %]
<div id="region-opacheader">
[% opacheader %]
</div>
<div id="opac-main-search" class="yui-g">
[% IF ( opacsmallimage ) %]
<h1 id="libraryname" style="background-image: url('[% opacsmallimage %]');">
@ -202,11 +202,9 @@
You did not specify any search criteria.
[% END %]
</p>
[% IF ( OPACNoResultsFound ) %]
<div id="noresultsfound">
[% OPACNoResultsFound %]
</div>
[% END %]
</div>
[% END %]</p>[% END %]</div>

View file

@ -1,6 +1,9 @@
<div id="region-opacnav">
[% OpacNav %]
</div>
[% IF IsPatronPage %]
[% INCLUDE usermenu.inc %]
[% END %]
<div id="region-opacnavbottom">
[% OpacNavBottom %]
</div>

View file

@ -1,8 +1,6 @@
[% IF ( opaccredits ) %]
<div class="ft">
[% opaccredits %]
</div>
[% END %]
<div id="region-opaccredits" class="ft">
[% opaccredits %]
</div>
</div>
[% IF ( opaclanguagesdisplay || OpacKohaUrl ) %]

View file

@ -29,10 +29,7 @@
[% END %]
</ul>
</div>
[% IF ( OPACResultsSidebar ) %]
<div id="opacresultssidebar">
[% OPACResultsSidebar %]
</div>
[% END %]
[% END %]
[% END %]

View file

@ -37,8 +37,8 @@
<div id="daily-quote" class="container"><h1>Quote of the Day</h1><div><span id="daily-quote-text">[% daily_quote.text %]</span><span id="daily-quote-sep"> ~ </span><span id="daily-quote-source">[% daily_quote.source %]</span></div></div>
[% END %]
[% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock" class="container">[% OpacMainUserBlock %]</div>[% END %]
[% IF ( OpacMainUserBlockMobile ) %]<div id="opacmainuserblockmobile" class="container">[% OpacMainUserBlockMobile %]</div>[% END %]
<div id="opacmainuserblock" class="container">[% OpacMainUserBlock %]</div>
<div id="opacmainuserblockmobile" class="container">[% OpacMainUserBlockMobile %]</div>
</div>
@ -69,7 +69,7 @@
[% END %]
[% END %]
[% END %]
[% IF ( OpacNavRight ) %]<div id="opacrightsidebar" class="container">[% OpacNavRight %]</div>[% END %]
<div id="opacrightsidebar" class="container">[% OpacNavRight %]</div>
</div>
[% END %]
</div>