Advertisement
Guest User

Untitled

a guest
Aug 5th, 2009
665
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 7.85 KB | None | 0 0
  1. #set($superParentInode = $_commentContentInode)
  2. #set($user = $session.getAttribute("CMS_USER"))
  3. #set($commentForm = $session.getAttribute("commentsForm"))
  4. $session.removeAttribute("commentsForm")
  5. #set ($relatedMatches = $commentsapi.getComments($_commentContentInode))
  6. #if(!$webapi.isSet($emailTemplate))
  7.     #set($emailTemplate = 'static\comments\comments_email_template.html')
  8. #end
  9. #if($pdfExport == false)
  10. <script language="javascript">
  11.  
  12. /*
  13.  * http://jira.dotmarketing.net/browse/DOTCMS-1682
  14.  */
  15.  
  16. //This function deals with the replies and new comments
  17.  
  18.  function _dotReply(commentInode){
  19.  
  20.       document.getElementById('contentInode').value=commentInode;
  21.       document.getElementById('commentForm').style.display="";
  22.       var nameField = document.getElementById('name');
  23.         if(nameField){
  24.             nameField.focus();
  25.         }
  26.     }
  27.    
  28.    
  29.    
  30. //This function creates the form for posting the comments. Output HTML is returned at the end of the function since
  31. //there are different parts on the page that use this HTML to open a form to write a comment. When a link is clicked
  32. //to post a new comment, the div id just following the link is passed as an argument to this function.
  33.  
  34.  function _createPostCommentPlace(activatedDiv){
  35.      //activeDiv is the div which is being worked on. It gets its value from the hidden field selectedDiv which is
  36.      //"" initially
  37.         var activeDiv = document.getElementById("selectedDiv").value;
  38.  
  39.         if(activeDiv != "" && activeDiv != activatedDiv){
  40.             document.getElementById(activeDiv).innerHTML = " ";
  41.         }  
  42.  
  43.         var HTML = "<form action=\"/dotCMS/comments\" method=\"post\" id=\"commentsForm\" name=\"commentsForm\">";
  44.  
  45.         HTML += "<!--<div style=\"text-align: right;\">-->";
  46.         HTML += "<input type=\"hidden\" id=\"dispatch\" name=\"dispatch\" value=\"saveComments\" />";
  47.         HTML += "<input type=\"hidden\" id=\"commentAutoPublish\" name=\"commentAutoPublish\" value=\"$!commentAutoPublish\" />";
  48.         HTML += "<input type=\"hidden\" id=\"commentUseCaptcha\" name=\"commentUseCaptcha\" value=\"$!commentUseCaptcha\" />";
  49.         HTML += "<input type=\"hidden\" id=\"commentStripHtml\" name=\"commentStripHtml\" value=\"$!commentStripHtml\" />";
  50.         HTML += "<input type=\"hidden\" id=\"commentForceLogin\" name=\"commentForceLogin\" value=\"$!commentForceLogin\" />";
  51.         HTML += "<input type=\"hidden\" id=\"commentTitle\" name=\"commentTitle\" value=\"$!commentTitle\" />";
  52.         HTML += "<input type=\"hidden\" id=\"referrer\" name=\"referrer\" value=\"${VTLSERVLET_URI}?$!{request.getQueryString()}\" />";
  53.         HTML += "<input type=\"hidden\" id=\"contentInode\" name=\"contentInode\" value=\"$!superParentInode\" />";
  54.         HTML += "<input type=\"hidden\" id=\"emailTemplate\" name=\"emailTemplate\" value=\"$!emailTemplate\" />";
  55.         HTML += "<input type=\"hidden\" id=\"commentsModeration\" name=\"commentsModeration\" value=\"$!commentsModeration\" />";
  56.         HTML += "<input type=\"hidden\" id=\"commentUseAudioCaptcha\" name=\"commentUseAudioCaptcha\" value=\"$!commentUseAudioCaptcha\" />";
  57.  
  58.         #set($name = $commentForm.getName())
  59.         #if(!$UtilMethods.isSet($name) && $UtilMethods.isSet($user))
  60.             #set($name = $user.getFullName())
  61.         #end
  62.  
  63.                HTML += "<dl>";
  64.         HTML += "<dt><label for=\"name\">*Name:</label></dt>";
  65.         HTML += "<dd><input id=\"name\" name=\"name\" type=\"text\" value=\"$!name\" /></dd>";
  66.  
  67.         #set($commentEmail = $commentForm.getEmail())
  68.         #if(!$UtilMethods.isSet($commentEmail) && $UtilMethods.isSet($user))
  69.             #set($commentEmail = $user.getEmailAddress())
  70.         #end
  71.  
  72.         HTML += "<dt><label for=\"email\">*Email:</label></dt>";
  73.         HTML += "<dd><input id=\"email\" name=\"email\" type=\"text\" value=\"$!commentEmail\" /></dd>";
  74.  
  75.         HTML += "<dt><label for=\"website\">Website:</label></dt>";
  76.         HTML += "<dd><input id=\"website\" name=\"website\" type=\"text\" value=\"$!commentForm.getWebsite()\" /></dd>";
  77.  
  78.         HTML += "<dt class=\"wide\">Please notify me of upcoming comments via email.</dt>";
  79.         #set($checked = '')
  80.         #if($!commentForm.isNotify())
  81.             #set($checked = 'checked')
  82.         #end
  83.         HTML += "<dd class=\"wide\"><input name=\"notify\" id=\"notify\" value=\"yes\" type=\"checkbox\" $checked /> <label for=\"notify\">Yes</label></dd>";
  84.  
  85.         HTML += "<dt class=\"wide\">*Type your comments below</dt>";
  86.         #if($commentStripHtml)
  87.             HTML += "<span class=\"greyText\">(HTML not permitted)</span>";
  88.         #end
  89.         HTML += "<dd class=\"wide\"><textarea name=\"comment\" id=\"commentIdt\">$!commentForm.getComment()</textarea></dd>";
  90.  
  91.         #if($UtilMethods.isSet($commentUseCaptcha) == false)
  92.             #set($commentUseCaptcha = false)
  93.         #end
  94.         #if($UtilMethods.isSet($commentUseAudioCaptcha) == false)
  95.             #set($commentUseAudioCaptcha = false)
  96.         #end
  97.        
  98.  
  99.         #if($commentUseCaptcha == 'true' || $commentUseCaptcha == true)
  100.             HTML += "<dt><label for=\"captcha\">*Validation Image:</label></dt>";
  101.             HTML += "<dd><img src=\"/Captcha.jpg?$math.getRandom()\"><br /><input id=\"captcha\" name=\"captcha\" type=\"text\" /></dd>";
  102.         #end
  103.        
  104.         #if($commentUseAudioCaptcha == 'true' || $commentUseAudioCaptcha == true )
  105.             #if ($UtilMethods.isSet($commentUseAudioCaptchaHeight))
  106.                 #set ($commentUseAudioCaptchaHeight = 30)
  107.             #end
  108.             HTML += "<embed height=\"" + ${commentUseAudioCaptchaHeight} + "\" src=\"/audioCaptcha.wav\" autostart=\"false\"/><br>";
  109.             #if(!$commentUseCaptcha || $commentUseCaptcha == 'false')
  110.                 HTML += "<dt><label for=\"audioCaptcha\">*Validation Sound:</label></dt>";
  111.                 HTML += "<dd><input id=\"audioCaptcha\" name=\"audioCaptcha\" type=\"text\" /></dd>";
  112.             #end
  113.         #end
  114.  
  115.         HTML += "<div style=\"padding: 5px 0pt 10px 65px;\">*required fields</div>";
  116.  
  117.         #set($checked = '')
  118.         #if($!commentForm.isAccept())
  119.             #set($checked = 'checked')
  120.         #end
  121.  
  122.         HTML += "<input type=\"hidden\" name=\"accept\" value=\"yes\" >";
  123.         //This hidden field is sent with the form to fill the activeDiv property of CommentsForm
  124.         HTML += "<input type=\"hidden\" name=\"activeDiv\" value=\"" + activatedDiv + "\" >";
  125.         HTML += "<div class=\"clear\">&nbsp;</div>";
  126.         HTML += "<div id=\"commentButton\">";
  127.         HTML += "<input class=\"post\" name=\"submit\" value=\"Post Comment\" type=\"submit\">";
  128.         HTML += "</div>";
  129.         HTML += "</dl>";
  130.         HTML += "</form>";
  131.  
  132.         //The inner HTML of the div is set to the output HTML
  133.         document.getElementById(activatedDiv).innerHTML = HTML;
  134.        
  135.         document.getElementById("selectedDiv").value = activatedDiv;
  136.  
  137.         return HTML;
  138.     }
  139.  
  140. </script>
  141. #end
  142. <!-- COMMENTS START -->
  143. <div class="comments" id="commentsIdt">
  144.     <input type="hidden" id="selectedDiv" value="$!{commentForm.getActiveDiv()}" >
  145.     #parse('static/messages.html')
  146.     <a  name="comments"></a>
  147.     <div class="replies">
  148.         #if($commentTitle)
  149.         <h4>Your View?</h4>
  150.         <h5>$commentTitle</h5>
  151.         #end
  152.  
  153.         <ul>
  154.         #foreach($match in $relatedMatches)
  155.             #getContentDetail("$match.inode")
  156.             <li>
  157.               <div class="commentImg">
  158.                 <img src="/global/images/avatar.jpg" alt="Comment Author Avatar" />
  159.               </div>
  160.               <div class="commentMeta">
  161.                 <span class="commentAuthor">$author</span> |
  162.                             <span class="commentDate">Posted $UtilMethods.dateToHTMLDate($datePublished,'MMM dd, yyyy hh:mm a')</span>
  163.                           </div>
  164.                           <div class="commentText">
  165.                 $comment
  166.                       </div>
  167.             </li>
  168.         #end
  169.         </ul>
  170.        
  171.     </div>
  172.     <div class="commentForm">
  173.       <h4>Submit Your Comment</h4>
  174.       <div class="formBody">
  175.         <div id="formBody">
  176.            
  177.         </div>
  178.       </div>
  179.     </div>
  180.  
  181.     <div class="clear">&nbsp;</div>
  182. </div>
  183.  
  184. <script language="javascript">
  185.         #if($UtilMethods.isSet($!{commentForm.getActiveDiv()}))    
  186.             var sdiv = document.getElementById("selectedDiv").value;       
  187.             if(sdiv != null){              
  188.                 document.getElementById(sdiv).value = _createPostCommentPlace(sdiv);               
  189.             }
  190.         #end       
  191.     </script>
  192.    
  193. <script type="text/javascript">
  194.     _createPostCommentPlace('formBody');
  195. </script>
  196. <!--
  197.  
  198. //-->
  199. </script>
  200. <!-- COMMENTS ENDS -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement