This patch takes the feature implemented in the original patch
for Bug 5436 and reimplements it in a slightly more abstracted
way. The JavaScript can now be applied to any pair of elements
like this: a block with class "collapsed" followed by a link
with class "togglecollapse."

In the circ-menu include, both the address info block and the
link to show/hide it have unique ids ("contact" and "showcontact"
respectively) so that IntranetUserCSS can be used to force them
to show:

  #contact {
    display : block;
  }
  #showcontact {
    display : none;
  }

Revision adds compatibility for display of extended patron
attributes and makes changes consistent across includes,
including circ-menu.tt.
---
 .../intranet-tmpl/prog/en/css/staff-global.css     |   33 +++++++++++++++++++-
 .../intranet-tmpl/prog/en/includes/circ-menu.inc   |   21 ++++++++----
 .../intranet-tmpl/prog/en/includes/circ-menu.tt    |   17 ++++++---
 koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js |   11 ++++++
 .../intranet-tmpl/prog/img/more-right-arrow.gif    |  Bin 0 -> 81 bytes
 5 files changed, 68 insertions(+), 14 deletions(-)
 create mode 100644 koha-tmpl/intranet-tmpl/prog/img/more-right-arrow.gif

diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css 
b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
index 8b2b8f5..c53fa8a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -484,7 +484,7 @@ div.patroninfo ul {
        border-right : 1px solid #000;
        border-bottom : 0;
        border-top : 0;
-       padding : 0;
+       padding : .5em 0;
        margin : 0;
 }
 
@@ -496,6 +496,19 @@ div.patroninfo ul li, div.patronviews ul li {
        list-style-type : none;
 }
 
+#patronimage {
+       border-right : 1px solid #000;
+}
+
+#patronimage img {
+       max-width : 140px;
+       margin: .3em 0 .3em .3em;
+       padding: .2em;
+       border: 1px solid #CCCCCC;
+       width:auto !important;
+       width:130px;
+}
+
 div.patronviews {
        border-right :  1px solid #000;
        border-top : 1px solid #000;
@@ -1912,6 +1925,24 @@ ul.budget_hierarchy li:last-child:after {
 ul.budget_hierarchy li:first-child:after {
     content: "";
 }
+.collapse {
+       display : none;
+}
+.togglecollapse {
+       border-right : 1px solid #000;
+       font-size: 85%;
+    display: block;
+    padding: .2em .2em .2em 15px;
+    margin: 0;
+    cursor: pointer;
+}
+.toggleclosed {
+    background: #eee url(../../img/more-right-arrow.gif) 0 50% no-repeat;
+}
+.toggleopen {
+       background: #eee url(../../img/more-up-arrow.gif) 0 50% no-repeat;
+}
+
 .holdcount { font-size : 105%; line-height : 200%; }
 .holdcount a { border : 1px solid #a4bedd; background-color : #e4ecf5; 
font-weight : bold; -moz-border-radius: 4px; padding : .1em .4em; 
text-decoration : none; }
 .holdcount a:hover { background-color : #ebeff7; }
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc 
b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
index a9fd453..8ef3409 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
@@ -1,17 +1,19 @@
+
+
 [% IF ( borrowernumber ) %]
 <div class="patroninfo"><h5>[% firstname %] [% surname %] ([% cardnumber 
%])</h5>
 <!--[if IE 6]>
 <style type="tex/css">img { width: expression(this.width > 140 ? 140: true);
 }</style>
 <![endif]-->
-<ul>
 [% IF ( patronimages ) %]
 [% IF ( picture ) %]
-<li><img src="/cgi-bin/koha/members/patronimage.pl?crdnum=[% cardnumber %]" 
id="patronimage" alt="[% firstname %] [% surname %] ([% cardnumber %])" 
border="0" style="max-width : 140px; margin: .3em 0 .3em .3em; padding: .2em; 
border: 1px solid #CCCCCC; width:auto !important; width:130px;" /></li>
+<div id="patronimage"><img src="/cgi-bin/koha/members/patronimage.pl?crdnum=[% 
cardnumber %]" alt="[% firstname %] [% surname %] ([% cardnumber %])" /></div>
 [% ELSE %]
-<li><img src="/intranet-tmpl/prog/img/patron-blank.png" alt="[% firstname %] 
[% surname %] ([% cardnumber %])" border="0" style="margin: .3em 0 .3em .3em; 
padding: .2em; border: 1px solid #CCCCCC;" /></li>
+<div id="patronimage"><img src="/intranet-tmpl/prog/img/patron-blank.png" 
alt="[% firstname %] [% surname %] ([% cardnumber %])" /></div>
 [% END %]
 [% END %]
+<ul id="contact" class="collapse">
     <li>[% IF ( address ) %]
             [% address %]
     [% ELSE %]
@@ -22,7 +24,7 @@
     [% END %]<li> 
     [% IF ( city ) %]
             [% city %][% IF ( state ) %], [% state %][% END %]
-           [% zipcode %][% IF ( country ) %], [% country %][% END %]
+           [% zipcode %][% IF ( country ) %]<br />[% country %][% END %]
     [% ELSE %]
         <span class="empty">No city stored.</span>
     [% END %]</li>
@@ -48,6 +50,11 @@
             <li> <span class="empty">No email stored.</span>    </li>
         [% END %]
     [% END %]
+</ul>
+<a class="togglecollapse toggleclosed" id="showcontact" href="#">Contact 
Information</a>
+<ul id="libraryinfo" class="collapse">
+    <li>Category: [% categoryname %] ([% categorycode %])</li>
+    <li>Home Library: [% IF ( branchname ) %][% branchname %][% ELSE %][% 
branch %][% END %]</li>
     [% FOREACH extendedattribute IN extendedattributes %]
         [% IF ( extendedattribute.display_checkout ) %]
             [% IF ( extendedattribute.value ) %]
@@ -55,9 +62,9 @@
             [% END %]
         [% END %]
     [% END %]
-    <li>Category: [% categoryname %] ([% categorycode %])</li>
-    <li>Home Library: [% IF ( branchname ) %][% branchname %][% ELSE %][% 
branch %][% END %]</li>
-</ul></div>
+</ul>
+<a class="togglecollapse toggleclosed" id="showlibraryinfo" href="#">Library 
Information</a>
+</div>
 <div id="menu">
 <ul>
        [% IF ( circview ) %]<li class="active">[% ELSE %]<li>[% END %]<a 
href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% borrowernumber 
%]">Check Out</a></li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt 
b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
index 47c1290..0414cce 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
@@ -6,14 +6,14 @@ in the global namespace %]
 <style type="tex/css">img { width: expression(this.width > 140 ? 140: true);
 }</style>
 <![endif]-->
-<ul>
 [% IF ( patronimages ) %]
 [% IF borrower.has_picture %]
-<li><img src="/cgi-bin/koha/members/patronimage.pl?crdnum=[% 
borrower.cardnumber %]" id="patronimage" alt="[% borrower.firstname %] [% 
borrower.surname %] ([% borrower.cardnumber %])" border="0" style="max-width : 
140px; margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC; 
width:auto !important; width:130px;" /></li>
+<div id="patronimage"><img src="/cgi-bin/koha/members/patronimage.pl?crdnum=[% 
borrower.cardnumber %]" id="patronimage" alt="[% borrower.firstname %] [% 
borrower.surname %] ([% borrower.cardnumber %])" /></div>
 [% ELSE %]
-<li><img src="/intranet-tmpl/prog/img/patron-blank.png" alt="[% 
borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" 
border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid 
#CCCCCC;" /></li>
+<div id="patronimage"><img src="/intranet-tmpl/prog/img/patron-blank.png" 
alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber 
%])" /></div>
 [% END %]
 [% END %]
+<ul id="contact" class="collapse">
     <li>[% IF borrower.address %]
             [% borrower.address %]
     [% ELSE %]
@@ -50,6 +50,11 @@ in the global namespace %]
             <li> <span class="empty">No email stored.</span>    </li>
         [% END %]
     [% END %]
+</ul>
+<a class="togglecollapse toggleclosed" id="showcontact" href="#">Contact 
Information</a>
+<ul id="libraryinfo" class="collapse">
+    <li>Category: [% borrower.description %] ([% borrower.categorycode %])</li>
+    <li>Home Library: [% IF ( borrower.branchname ) %][% borrower.branchname 
%][% ELSE %][% borrower.branch %][% END %]</li>
     [% FOREACH extendedattribute IN borrower.extendedattributes %]
         [% IF ( extendedattribute.display_checkout ) %]
             [% IF ( extendedattribute.value ) %]
@@ -57,9 +62,9 @@ in the global namespace %]
             [% END %]
         [% END %]
     [% END %]
-    <li>Category: [% borrower.description %] ([% borrower.categorycode %])</li>
-    <li>Home Library: [% IF ( borrower.branchname ) %][% borrower.branchname 
%][% ELSE %][% borrower.branch %][% END %]</li>
-</ul></div>
+</ul>
+<a class="togglecollapse toggleclosed" id="showlibraryinfo" href="#">Library 
Information</a>
+</div>
 <div id="menu">
 <ul>
        [% IF ( circview ) %]<li class="active">[% ELSE %]<li>[% END %]<a 
href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% 
borrower.borrowernumber %]">Check Out</a></li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js 
b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js
index 463c28e..e5db978 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js
@@ -10,6 +10,17 @@ function _(s) { return s } // dummy function for gettext
        if($("#header_search #circ_search").length > 0){ 
$(document).bind('keydown','Alt+u',function (){ $("#header_search > 
ul").tabs("select","#circ_search"); $("#findborrower").focus(); }); } else { 
$(document).bind('keydown','Alt+u',function(){ 
location.href="/cgi-bin/koha/circ/circulation.pl"; }); }
        if($("#header_search #catalog_search").length > 0){ 
$(document).bind('keydown','Alt+q',function (){ $("#header_search > 
ul").tabs("select","#catalog_search"); $("#search-form").focus(); }); } else { 
$(document).bind('keydown','Alt+q',function(){ 
location.href="/cgi-bin/koha/catalogue/search.pl"; }); }
        $(".focus").focus();
+
+       // Toggle display of collapsed sections; Toggle appearance of 
"show/hide" links
+       $(".togglecollapse").toggle(
+               function(){
+                       $(this).prev(".collapse").slideDown(50);
+                       
$(this).removeClass("toggleclosed").addClass("toggleopen");
+               },
+               function(){
+                       $(this).prev(".collapse").slideUp(50);
+                       
$(this).removeClass("toggleopen").addClass("toggleclosed");
+       });
  });
  
              YAHOO.util.Event.onContentReady("header", function () {
diff --git a/koha-tmpl/intranet-tmpl/prog/img/more-right-arrow.gif 
b/koha-tmpl/intranet-tmpl/prog/img/more-right-arrow.gif
new file mode 100644
index 
0000000000000000000000000000000000000000..1729fafa7cb9d8d01a37a4dc55558255f3619549
GIT binary patch
literal 81
zcmZ?wbhEHb<YwSyXkcV8PMi7v|9{1Qg3d*$i6yBi3gww484B*6z5xu1KUo+V7#JCJ
i7=QqzoPkNWr+?*X*#`|Nn^tuRww=^_*W%5{U=0A}+!)vZ

literal 0
HcmV?d00001

-- 
1.7.3

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to