Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #set($superParentInode = $_commentContentInode)
- #set($user = $session.getAttribute("CMS_USER"))
- #set($commentForm = $session.getAttribute("commentsForm"))
- $session.removeAttribute("commentsForm")
- #set ($relatedMatches = $commentsapi.getComments($_commentContentInode))
- #if(!$webapi.isSet($emailTemplate))
- #set($emailTemplate = 'static\comments\comments_email_template.html')
- #end
- #if($pdfExport == false)
- <script language="javascript">
- /*
- * http://jira.dotmarketing.net/browse/DOTCMS-1682
- */
- //This function deals with the replies and new comments
- function _dotReply(commentInode){
- document.getElementById('contentInode').value=commentInode;
- document.getElementById('commentForm').style.display="";
- var nameField = document.getElementById('name');
- if(nameField){
- nameField.focus();
- }
- }
- //This function creates the form for posting the comments. Output HTML is returned at the end of the function since
- //there are different parts on the page that use this HTML to open a form to write a comment. When a link is clicked
- //to post a new comment, the div id just following the link is passed as an argument to this function.
- function _createPostCommentPlace(activatedDiv){
- //activeDiv is the div which is being worked on. It gets its value from the hidden field selectedDiv which is
- //"" initially
- var activeDiv = document.getElementById("selectedDiv").value;
- if(activeDiv != "" && activeDiv != activatedDiv){
- document.getElementById(activeDiv).innerHTML = " ";
- }
- var HTML = "<form action=\"/dotCMS/comments\" method=\"post\" id=\"commentsForm\" name=\"commentsForm\">";
- HTML += "<!--<div style=\"text-align: right;\">-->";
- HTML += "<input type=\"hidden\" id=\"dispatch\" name=\"dispatch\" value=\"saveComments\" />";
- HTML += "<input type=\"hidden\" id=\"commentAutoPublish\" name=\"commentAutoPublish\" value=\"$!commentAutoPublish\" />";
- HTML += "<input type=\"hidden\" id=\"commentUseCaptcha\" name=\"commentUseCaptcha\" value=\"$!commentUseCaptcha\" />";
- HTML += "<input type=\"hidden\" id=\"commentStripHtml\" name=\"commentStripHtml\" value=\"$!commentStripHtml\" />";
- HTML += "<input type=\"hidden\" id=\"commentForceLogin\" name=\"commentForceLogin\" value=\"$!commentForceLogin\" />";
- HTML += "<input type=\"hidden\" id=\"commentTitle\" name=\"commentTitle\" value=\"$!commentTitle\" />";
- HTML += "<input type=\"hidden\" id=\"referrer\" name=\"referrer\" value=\"${VTLSERVLET_URI}?$!{request.getQueryString()}\" />";
- HTML += "<input type=\"hidden\" id=\"contentInode\" name=\"contentInode\" value=\"$!superParentInode\" />";
- HTML += "<input type=\"hidden\" id=\"emailTemplate\" name=\"emailTemplate\" value=\"$!emailTemplate\" />";
- HTML += "<input type=\"hidden\" id=\"commentsModeration\" name=\"commentsModeration\" value=\"$!commentsModeration\" />";
- HTML += "<input type=\"hidden\" id=\"commentUseAudioCaptcha\" name=\"commentUseAudioCaptcha\" value=\"$!commentUseAudioCaptcha\" />";
- #set($name = $commentForm.getName())
- #if(!$UtilMethods.isSet($name) && $UtilMethods.isSet($user))
- #set($name = $user.getFullName())
- #end
- HTML += "<dl>";
- HTML += "<dt><label for=\"name\">*Name:</label></dt>";
- HTML += "<dd><input id=\"name\" name=\"name\" type=\"text\" value=\"$!name\" /></dd>";
- #set($commentEmail = $commentForm.getEmail())
- #if(!$UtilMethods.isSet($commentEmail) && $UtilMethods.isSet($user))
- #set($commentEmail = $user.getEmailAddress())
- #end
- HTML += "<dt><label for=\"email\">*Email:</label></dt>";
- HTML += "<dd><input id=\"email\" name=\"email\" type=\"text\" value=\"$!commentEmail\" /></dd>";
- HTML += "<dt><label for=\"website\">Website:</label></dt>";
- HTML += "<dd><input id=\"website\" name=\"website\" type=\"text\" value=\"$!commentForm.getWebsite()\" /></dd>";
- HTML += "<dt class=\"wide\">Please notify me of upcoming comments via email.</dt>";
- #set($checked = '')
- #if($!commentForm.isNotify())
- #set($checked = 'checked')
- #end
- HTML += "<dd class=\"wide\"><input name=\"notify\" id=\"notify\" value=\"yes\" type=\"checkbox\" $checked /> <label for=\"notify\">Yes</label></dd>";
- HTML += "<dt class=\"wide\">*Type your comments below</dt>";
- #if($commentStripHtml)
- HTML += "<span class=\"greyText\">(HTML not permitted)</span>";
- #end
- HTML += "<dd class=\"wide\"><textarea name=\"comment\" id=\"commentIdt\">$!commentForm.getComment()</textarea></dd>";
- #if($UtilMethods.isSet($commentUseCaptcha) == false)
- #set($commentUseCaptcha = false)
- #end
- #if($UtilMethods.isSet($commentUseAudioCaptcha) == false)
- #set($commentUseAudioCaptcha = false)
- #end
- #if($commentUseCaptcha == 'true' || $commentUseCaptcha == true)
- HTML += "<dt><label for=\"captcha\">*Validation Image:</label></dt>";
- HTML += "<dd><img src=\"/Captcha.jpg?$math.getRandom()\"><br /><input id=\"captcha\" name=\"captcha\" type=\"text\" /></dd>";
- #end
- #if($commentUseAudioCaptcha == 'true' || $commentUseAudioCaptcha == true )
- #if ($UtilMethods.isSet($commentUseAudioCaptchaHeight))
- #set ($commentUseAudioCaptchaHeight = 30)
- #end
- HTML += "<embed height=\"" + ${commentUseAudioCaptchaHeight} + "\" src=\"/audioCaptcha.wav\" autostart=\"false\"/><br>";
- #if(!$commentUseCaptcha || $commentUseCaptcha == 'false')
- HTML += "<dt><label for=\"audioCaptcha\">*Validation Sound:</label></dt>";
- HTML += "<dd><input id=\"audioCaptcha\" name=\"audioCaptcha\" type=\"text\" /></dd>";
- #end
- #end
- HTML += "<div style=\"padding: 5px 0pt 10px 65px;\">*required fields</div>";
- #set($checked = '')
- #if($!commentForm.isAccept())
- #set($checked = 'checked')
- #end
- HTML += "<input type=\"hidden\" name=\"accept\" value=\"yes\" >";
- //This hidden field is sent with the form to fill the activeDiv property of CommentsForm
- HTML += "<input type=\"hidden\" name=\"activeDiv\" value=\"" + activatedDiv + "\" >";
- HTML += "<div class=\"clear\"> </div>";
- HTML += "<div id=\"commentButton\">";
- HTML += "<input class=\"post\" name=\"submit\" value=\"Post Comment\" type=\"submit\">";
- HTML += "</div>";
- HTML += "</dl>";
- HTML += "</form>";
- //The inner HTML of the div is set to the output HTML
- document.getElementById(activatedDiv).innerHTML = HTML;
- document.getElementById("selectedDiv").value = activatedDiv;
- return HTML;
- }
- </script>
- #end
- <!-- COMMENTS START -->
- <div class="comments" id="commentsIdt">
- <input type="hidden" id="selectedDiv" value="$!{commentForm.getActiveDiv()}" >
- #parse('static/messages.html')
- <a name="comments"></a>
- <div class="replies">
- #if($commentTitle)
- <h4>Your View?</h4>
- <h5>$commentTitle</h5>
- #end
- <ul>
- #foreach($match in $relatedMatches)
- #getContentDetail("$match.inode")
- <li>
- <div class="commentImg">
- <img src="/global/images/avatar.jpg" alt="Comment Author Avatar" />
- </div>
- <div class="commentMeta">
- <span class="commentAuthor">$author</span> |
- <span class="commentDate">Posted $UtilMethods.dateToHTMLDate($datePublished,'MMM dd, yyyy hh:mm a')</span>
- </div>
- <div class="commentText">
- $comment
- </div>
- </li>
- #end
- </ul>
- </div>
- <div class="commentForm">
- <h4>Submit Your Comment</h4>
- <div class="formBody">
- <div id="formBody">
- </div>
- </div>
- </div>
- <div class="clear"> </div>
- </div>
- <script language="javascript">
- #if($UtilMethods.isSet($!{commentForm.getActiveDiv()}))
- var sdiv = document.getElementById("selectedDiv").value;
- if(sdiv != null){
- document.getElementById(sdiv).value = _createPostCommentPlace(sdiv);
- }
- #end
- </script>
- <script type="text/javascript">
- _createPostCommentPlace('formBody');
- </script>
- <!--
- //-->
- </script>
- <!-- COMMENTS ENDS -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement