Bug 14544: QA fixes - some minor bug fixes
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-review.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Comments on [% title |html %]</title>
3 <style type="text/css">
4   #custom-doc { width:37.08em;*width:36.16em;min-width:485px; margin:1em auto; text-align:left; }
5 </style>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% BLOCK cssinclude %][% END %]
8 </head>
9 [% INCLUDE 'bodytag.inc' bodyid='comment' bodyclass='popup' %]
10     <div class="main">
11         <div class="container-fluid">
12             <div class="row-fluid">
13                 <div class="span12">
14                     <div id="userreview">
15                         [% IF ( cgi_debug ) %]
16                             <div class="debug">CGI debug is on.</div>
17                         [% END %]
18                         [% IF ( ERRORS ) %]
19                             <div class="alert">
20                                 [% FOREACH ERROR IN ERRORS %]
21                                     [% IF ( ERROR.scrubbed ) %]
22                                         <p>Note: your comment contained illegal markup code. It has been saved with the markup removed, as below. You can edit the comment further, or cancel to retain the comment as is.</p>
23                                     [% END %]
24
25                                     [% IF ( ERROR.scrubbed_all ) %]
26                                         <p>Error!  Your comment was entirely illegal markup code.  It has NOT been added.</p>
27                                     [% END %]
28
29                                     [% IF ( ERROR.empty ) %]
30                                         <p>Error!  You cannot add an empty comment.  Please add content or cancel.</p>
31                                     [% END %]
32                                 [% END # / FOREACH ERROR %]
33                                 [% IF ( WINDOW_CLOSE ) %]
34                                     Note: this window will close automatically in 5 seconds.
35                                 [% END %]
36                             </div>
37                         [% END # / ERRORs %]
38
39                         <h1>Comments on <i>[% title |html %] [% subtitle %]</i></h1>
40                         [% IF ( author ) %]<h3>[% author |html %]</h3>[% END %]
41                         <form id="reviewf" action="/cgi-bin/koha/opac-review.pl[% IF ( cgi_debug ) %]?debug=1[% END %]" method="post">
42                             <input type="hidden" name="biblionumber" value="[% biblionumber | html%]" />
43                             [% IF ( reviewid ) %]<input type="hidden" name="reviewid" value="[% reviewid | html%]" />[% END %]
44                             <fieldset>
45                                 <textarea id="review" name="review" cols="60" rows="8">[% review %]</textarea>
46                             </fieldset>
47                             <p>Note: Your comment must be approved by a librarian. </p>
48                             <fieldset class="action">
49                                 <input type="submit" class="btn" value="Submit and close this window" />
50                                 <a class="cancel close" href="#">Cancel</a>
51                             </fieldset>
52                         </form>
53                     </div> <!-- / #usersendshelfform -->
54                 </div> <!-- / .span12 -->
55             </div> <!-- / .row-fluid -->
56         </div> <!-- / .container-fluid -->
57     </div> <!-- / .main -->
58
59 [% INCLUDE 'opac-bottom.inc' is_popup=1 %]
60 [% BLOCK jsinclude %]
61 <script type="text/javascript">
62     //<![CDATA[
63          $(document).ready(function() {
64             var inject_old = function(comment) {
65                 [% IF ( reviewid ) %]
66                 [% IF ( cgi_debug ) %]alert(_("injecting OLD comment: ")+comment);[% END %]
67                 parent.opener.$('#c[% reviewid %] p').prev("small").prev("h5").html(_("Your edited comment (preview, pending approval)"));
68                 parent.opener.$('#c[% reviewid %] p').html(comment);
69                 parent.opener.$('#c[% reviewid %] p').append(" <a href=\"#comment\" onclick=\"Dopop(\'/cgi-bin/koha/opac-review.pl?biblionumber=[% biblionumber | uri %]&amp;reviewid=[% reviewid | uri%]\');\">"+_("Edit")+"<\/a>");
70                 [% END %]
71                 return 1;
72             };
73             var inject_new = function(comment) {
74                 [% IF ( cgi_debug ) %]alert(_("injecting NEW comment: ") +comment);[% END %]
75                 parent.opener.$('#newcomment').attr("class","yours");
76                 parent.opener.$('#newcomment').html(
77                     "<h5>" + _("Your comment (preview, pending approval)") + "<\/h5>" +
78                     "<p>"+comment+"<\/p>" +
79                     "<a href=\"#comment\" onclick=\"Dopop(\'/cgi-bin/koha/opac-review.pl?biblionumber=[% biblionumber |uri%]\');\">"+_("Edit")+"<\/a><\/p>"
80                 );
81                 parent.opener.$("#addcomment").prev("p").remove();
82                 parent.opener.$("#addcomment").remove();
83             };
84             [% IF ( clean_review ) %]
85                 var clean_review = "[% clean_review |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]";        // TMPL var must not contain " quotes.
86                 [% IF ( reviewid ) %]
87                 inject_old(clean_review);
88                 [% ELSE %]
89                 inject_new(clean_review);
90                 [% END %]
91             [% END %]
92             [% IF ( WINDOW_CLOSE ) %]
93                 [% IF ( ERRORS ) %]
94                     // flash this page, then close.  Change warning in template if you change this value.
95                     setTimeout("window.close()",5000);
96                 [% ELSE %]
97                     window.close();
98                 [% END %]
99             [% END %]
100         });
101     //]]>
102 </script>
103 [% END %]