Adding a couple of missing YUI js files; Adding comment preview to comments system (needs review).

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Owen Leonard 2008-03-28 14:23:43 -05:00 committed by Joshua Ferraro
parent 68a7738026
commit ed35df0eb4
5 changed files with 54 additions and 10 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -310,11 +310,12 @@
<!-- TMPL_IF NAME="reviewson" -->
<div id="comments">
<div id="newcomment"></div>
<!-- TMPL_IF NAME="reviews" -->
<!--TMPL_LOOP NAME="reviews"-->
<!-- TMPL_IF NAME="loggedinusername" -->
<!-- TMPL_IF EXPR="userid eq loggedinusername" -->
<div class="commentline yours">
<div class="commentline yours" id="c<!-- TMPL_VAR NAME="reviewid" -->">
<h5>
Your Comment
</h5>
@ -322,7 +323,7 @@
<!--TMPL_VAR NAME="datereviewed"-->
</small>
<p>
<!--TMPL_VAR NAME="review"--> <a href="#" onclick="Dopop('/cgi-bin/koha/opac-review.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber"-->');">Edit</a>
<!--TMPL_VAR NAME="review"--> <a href="#" onclick="Dopop('/cgi-bin/koha/opac-review.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber"-->&amp;reviewid=<!-- TMPL_VAR NAME="reviewid" -->');">Edit</a>
</p></div>
<!-- TMPL_ELSE -->
<div class="commentline">

View file

@ -8,22 +8,37 @@
<div id="custom-doc" class="yui-t7">
<h3> </h3>
<form action="/cgi-bin/koha/opac-review.pl" method="post" onsubmit="return closeWindow();">
<form id="reviewf" action="/cgi-bin/koha/opac-review.pl" method="post">
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
<input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
<fieldset class="brief">
<legend>Comments on <i><!--TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" --></i><!-- TMPL_IF NAME="author" -->by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF --></legend>
<ol><li><textarea name="review" cols="60" rows="8"><!--TMPL_VAR NAME="review"--></textarea></li></ol>
<ol><li><textarea id="review" name="review" cols="60" rows="8"><!--TMPL_VAR NAME="review"--></textarea></li></ol>
</fieldset>
<p>Note: Your comment must be approved by a librarian. </p>
<fieldset class="action"> <input type="submit" value="Submit and close this window" /> <a class="cancel close" href="#">Cancel</a></fieldset>
</form>
<script type="text/javascript" language="javascript">
function closeWindow() {
window.close();
return true;
}
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$(document).ready(function() {
$('#reviewf').submit( function() {
<!-- TMPL_IF NAME="reviewid" -->
parent.opener.$('#c<!-- TMPL_VAR NAME="reviewid" --> p').prev("small").prev("h5").html("Your Edited Comment (preview, pending approval)");
parent.opener.$('#c<!-- TMPL_VAR NAME="reviewid" --> p').html($("#review").val());
parent.opener.$('#c<!-- TMPL_VAR NAME="reviewid" --> p').append(" <a href=\"#comment\" onclick=\"Dopop(\'/cgi-bin/koha/opac-review.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber"-->&amp;reviewid=<!-- TMPL_VAR NAME="reviewid" -->\');\">Edit</a>");
window.close();
<!-- TMPL_ELSE -->
parent.opener.$('#newcomment').attr("class","yours");
parent.opener.$('#newcomment').html("<h5>Your Comment (preview, pending approval)</h5>");
parent.opener.$('#newcomment').append("<p>"+$("#review").val());
parent.opener.$('#newcomment p').append(" <a href=\"#comment\" onclick=\"Dopop(\'/cgi-bin/koha/opac-review.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber"-->&amp;reviewid=<!-- TMPL_VAR NAME="reviewid" -->\');\">Edit</a></p>");
parent.opener.$("#addcomment").prev("p").remove();
parent.opener.$("#addcomment").remove();
window.close();
<!-- /TMPL_IF -->
});
});
//]]>
</script>
</div>

View file

@ -31,6 +31,7 @@ my $query = new CGI;
my $biblionumber = $query->param('biblionumber');
my $type = $query->param('type');
my $review = $query->param('review');
my $reviewid = $query->param('reviewid');
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
template_name => "opac-review.tmpl",
@ -61,6 +62,7 @@ $template->param(
'borrowernumber' => $borrowernumber,
'type' => $type,
'review' => $reviewdata,
'reviewid' => $reviewid,
'title' => $biblio->{'title'},
);