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