Merge remote-tracking branch 'origin/new/bug_6328'
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / opac-tags.tt
1 [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog › Tags
2 [% INCLUDE 'doc-head-close.inc' %]
3 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
4 <style type="text/css">
5         fieldset { padding : .3em;margin:.3em 0;}
6         #tagcloud    {background-color: #F3F3F3; text-align: justify;padding:7px;}
7         .tag a       {text-decoration: none;}
8         .tag a:hover {text-decoration: underline;}
9         .tag         {display: block; padding-left: 1em;}
10         .tagcount    {display: none;}
11         .cloudweight {display: none;}
12         .tagweight {
13                 display: none;
14                 position: relative;
15                 bottom: 0.4em;
16                 color: red;
17                 font-size: 12px;
18         }
19 </style>
20 <script type="text/javascript">
21 //<![CDATA[
22         var fontsizes = new Array (12,14,16,18,20,22,24,26,28,30);
23         var fontcount = fontsizes.length;
24         var maxcloudweight = 1;
25         $(document).ready(function() {
26                 // $('#tagcloud').css('background-color','lightgrey');
27                 // $('#tagcloud .tag').css('border','1px solid black');
28                 $('#tagcloud .tag').each(function() {
29                         if (maxcloudweight < this.title) { maxcloudweight = this.title; }
30                         // have to run through the set of tags once to get the max: cannot be combined w/ 2nd pass
31                 });
32                 $('#tagcloud .tag').each(function(i) {
33                         var pos = this.id;
34                         var weight = this.title;        // "cloudweight"
35                         weight = (! weight) ? 1 : (weight > maxcloudweight) ? maxcloudweight : weight ;
36                         var index = Math.round(fontcount * weight/maxcloudweight) - 1;
37                         index  = (! index ) ? 0 : ( index > fontcount     ) ? fontcount      : index  ;
38                         var newsize = fontsizes[index];
39                         // alert(pos+ " (" +i+ ") weight = " +weight+ " of " +maxcloudweight+ ", fontsize[" +index+ " of " +fontcount+ "] = " +newsize);
40                         $('#' + pos).css({"font-size":(newsize + 'px'), display:"inline"});
41                 });
42                 $("#mytagst").tablesorter({[% IF ( dateformat == 'metric' ) %]
43     dateFormat: 'uk',[% END %]
44             widgets : ['zebra'],
45                         headers: { 3: { sorter: false }},
46             sortList: [[2,0]]
47         });
48         });
49 //]]>
50 </script>
51 </head>
52 [% IF ( loggedinusername ) %]<body id="opac-usertags">[% ELSE %]<body id="opac-tags">[% END %]
53 [% IF ( OpacNav||loggedinusername ) %]<div id="doc3" class="yui-t1">[% ELSE %]<div id="doc3" class="yui-t7">[% END %]
54 <div id="bd">
55 [% INCLUDE 'masthead.inc' %]
56
57 <div id="yui-main">
58   <div class="yui-b"><div class="yui-g">
59         <div id="usertags" class="container">
60         [% IF ( ERRORS ) %]
61         [% FOREACH ERROR IN ERRORS %]
62                 <div class="dialog alert">There was a problem with this operation:
63                 [% IF ( ERROR.tagsdisabled ) %]Sorry, tags are not enabled on this system.
64                 [% ELSIF ( ERROR.badparam ) %]ERROR: illegal parameter [% ERROR.badparam %]
65                 [% ELSIF ( ERROR.login ) %]ERROR: You must log in to complete that action.
66                 [% ELSIF ( ERROR.failed_delete ) %]ERROR: You cannot delete the tag [% ERROR.failed_delete %].
67                                         <br />Note: you can only delete your own tags.
68                 [% ELSIF ( ERROR.scrubbed ) %]Note: your tag contained markup code that was removed. 
69                                         <br />The tag was added as &quot;[% ERROR.scrubbed %]&quot;.
70                 [% ELSIF ( ERROR.scrubbed_all_bad ) %]Note: your tag was entirely markup code.  It was NOT added.
71                                         <br />Please try again with plain text.
72                 [% ELSE %]Unrecognized error.
73                 [% END %]
74                 </div>
75         [% END %]
76         [% END %]
77         <h1>All Tags</h1>
78         
79                 <form method="get" action="opac-tags.pl">
80                 <fieldset>Show up to <input type="text" name="limit" style="text-align: right;" maxlength="4" size="4" value="[% limit or "100" %]" />
81                         tags[% IF ( opacuserlogin ) %] from other users[% END %].
82                         <input type="submit" value="OK" />
83             [% IF ( opacuserlogin ) %][% UNLESS ( loggedinusername ) %]
84             <a href="/cgi-bin/koha/opac-user.pl">Log in</a> to see your own saved tags.
85             [% END %][% END %]</fieldset>
86                 </form>
87         
88         [% IF ( TAGLOOP ) %]
89         <div id="tagcloud">
90         [% FOREACH TAGLOO IN TAGLOOP %]
91         <span class="tag" id="tag[% loop.count %]" title="[% TAGLOO.cloudweight %]">
92                 <a href="/cgi-bin/koha/opac-search.pl?tag=[% TAGLOO.term |url %]&amp;q=[% TAGLOO.term |url %]">
93                 [% TAGLOO.term |html %]</a>
94                         <span class="tagweight">[% TAGLOO.weight_total %]</span>
95         </span>
96         [% END %]
97         </div>
98         [% END %]
99         [% IF ( add_op ) %]
100           [% IF ( added_count ) %]
101                 <div class="dialog message">[% added_count %] [% IF ( added_count ==1 ) %] tag[% ELSE %]tags[% END %] successfully added.</div>
102           [% END %]
103           [% IF ( deleted_count ) %]
104                 <div class="dialog message">[% deleted_count %][% IF ( deleted_count ==1 ) %] tag[% ELSE %]tags[% END %] successfully deleted.</div>
105           [% END %]
106         [% END %]
107
108         [% IF ( MY_TAGS ) %]
109                 <form method="post" action="opac-tags.pl">
110                 <h2>My Tags</h2>
111                 <table id="mytagst">
112                 <thead><tr><th>Term</th><th>Title</th><th>Date Added</th><th>Delete</th>
113                 </tr></thead>
114         <tbody>[% FOREACH MY_TAG IN MY_TAGS %]
115                 <tr><td><a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |url %]&amp;q=[% MY_TAG.term |url %]">
116                                 [% MY_TAG.term |html %]</a>
117                         </td>
118                         <td><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% MY_TAG.biblionumber %]">
119                                 [% MY_TAG.bib_summary |html %]</a></td>
120                         <td>[% MY_TAG.date_created_display %]</td>
121                         <td><input type="submit" name="del[% MY_TAG.tag_id %]" value="Delete" /></td>
122                 </tr>
123         [% END %]</tbody>
124                 </table>
125                 </form>
126         [% END %]
127
128 </div>
129 </div>
130 </div>
131 </div>
132 [% IF ( OpacNav||loggedinusername ) %]
133 <div class="yui-b"><div id="leftmenus" class="container">
134 [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
135 </div></div>
136 [% END %]
137 </div>
138 [% INCLUDE 'opac-bottom.inc' %]
139