PageRenderTime 26ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/User controls/CommentView.ascx

#
ASP.NET | 152 lines | 115 code | 21 blank | 16 comment | 9 complexity | cfec5cb80f10673f2a321ac8e645cc9a MD5 | raw file
  1<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CommentView.ascx.cs" Inherits="UserControls.CommentView" %>
  2<%@ Import Namespace="BlogEngine.Core" %>
  3
  4<% if (CommentCounter > 0)
  5   { %>
  6<h3 id="comment">
  7    <%=Resources.labels.comments %> (<%=CommentCounter%>)
  8    <a id="commenttoggle" style="float:right;width:20px;height:20px;border:1px solid #ccc;text-decoration:none;text-align:center" href="javascript:toggle_visibility('commentlist', 'commenttoggle');">-</a>
  9</h3>
 10<%} %>
 11
 12<div id="commentlist" style="display:block">
 13  <asp:PlaceHolder runat="server" ID="phComments" />  
 14</div>
 15
 16<asp:PlaceHolder runat="server" ID="phTrckbacks"></asp:PlaceHolder>
 17
 18<asp:PlaceHolder runat="Server" ID="phAddComment">
 19
 20<div id="comment-form">
 21
 22	<img src="<%=Utils.RelativeWebRoot %>pics/ajax-loader.gif" alt="Saving the comment" style="display:none" id="ajaxLoader" />  
 23	<span id="status"></span>
 24
 25	<div class="commentForm">
 26	  <h3 id="addcomment"><%=Resources.labels.addComment %></h3>
 27
 28	  <% if (NestingSupported){ %>
 29		<asp:HiddenField runat="Server" ID="hiddenReplyTo"  />
 30		<p id="cancelReply" style="display:none;"><a href="javascript:void(0);" onclick="BlogEngine.cancelReply();"><%=Resources.labels.cancelReply %></a></p>
 31	  <%} %>
 32      <p>
 33	      <label for="<%=this.NameInputId %>" class="lbl-user"><%=Resources.labels.name %>*</label>
 34	      <input type="text" class="txt-user" name="<%= this.NameInputId %>" id="<%= this.NameInputId %>" tabindex="2" value="<%= this.DefaultName %>" />
 35	      <span id="spnNameRequired" style="color:Red;display:none;"> <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:labels, required %>"></asp:Literal></span>
 36	      <span id="spnChooseOtherName" style="color:Red;display:none;"> <asp:Literal ID="Literal2" runat="server" Text="<%$Resources:labels, chooseOtherName %>"></asp:Literal></span>
 37      </p>
 38      <p>
 39	      <label for="<%=txtEmail.ClientID %>" class="lbl-email"><%=Resources.labels.email %>*</label>
 40	      <asp:TextBox runat="Server" CssClass="lbl-email" ID="txtEmail" TabIndex="3" ValidationGroup="AddComment" />
 41	      <span id="gravatarmsg"></span>
 42	      <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtEmail" ErrorMessage="<%$Resources:labels, required %>" Display="dynamic" ValidationGroup="AddComment" />
 43	      <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtEmail" ErrorMessage="<%$Resources:labels, enterValidEmail%>" Display="dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="AddComment" />
 44      </p>
 45      <% if (BlogSettings.Instance.EnableWebsiteInComments){ %>
 46	  <p>
 47          <label for="<%=txtWebsite.ClientID %>" class="lbl-website"><%=Resources.labels.website%></label>
 48	      <asp:TextBox runat="Server" CssClass="txt-website" ID="txtWebsite" TabIndex="4" ValidationGroup="AddComment" />
 49	      <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="Server" ControlToValidate="txtWebsite" ValidationExpression="(http://|https://|)([\w-]+\.)+[\w-]+(/[\w- ./?%&=;~]*)?" ErrorMessage="<%$Resources:labels, enterValidUrl %>" Display="Dynamic" ValidationGroup="AddComment" />
 50	  </p>
 51      <%} %>
 52
 53	  <% if(BlogSettings.Instance.EnableCountryInComments){ %>
 54	  <p>
 55          <label for="<%=ddlCountry.ClientID %>" class="lbl-country"><%=Resources.labels.country %></label>
 56	      <asp:DropDownList runat="server" CssClass="txt-country" ID="ddlCountry" onchange="BlogEngine.setFlag(this.value)" TabIndex="5" EnableViewState="false" ValidationGroup="AddComment" />&nbsp;
 57	      <span class="CommentFlag"><asp:Image runat="server" ID="imgFlag" AlternateText="Country flag" Width="16" Height="11" EnableViewState="false" /></span>
 58	  </p>
 59      <%} %>
 60
 61      <blog:SimpleCaptchaControl ID="simplecaptcha" runat="server" TabIndex="6" />
 62
 63      <%if (BlogEngine.Core.Web.Extensions.ExtensionManager.ExtensionEnabled("BBCode")){%>
 64	  <span class="bbcode<%=!BlogSettings.Instance.ShowLivePreview ? " bbcodeNoLivePreview" : ""%>" title="BBCode tags"><%=BBCodes()%></span>
 65	  <%}%>
 66      <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtContent" ErrorMessage="<%$Resources:labels, required %>" Display="dynamic" ValidationGroup="AddComment" /><br />
 67
 68	  <% if (BlogSettings.Instance.ShowLivePreview) { %>  
 69	  <ul id="commentMenu">
 70		<li id="compose" class="selected" onclick="BlogEngine.composeComment()"><%=Resources.labels.comment%></li>
 71		<li id="preview" onclick="BlogEngine.showCommentPreview()"><%=Resources.labels.livePreview%></li>
 72	  </ul>
 73	  <% } %>
 74	  <div id="commentCompose">
 75		<label for="<%=txtContent.ClientID %>" class="lbl-content" style="display:none"><%=Resources.labels.comment%></label>
 76		<asp:TextBox runat="server" CssClass="txt-content" ID="txtContent" TextMode="multiLine" Columns="50" Rows="10" TabIndex="7" ValidationGroup="AddComment" />
 77	  </div>
 78	  <div id="commentPreview">
 79		<img src="<%=Utils.RelativeWebRoot %>pics/ajax-loader.gif" style="display:none" alt="Loading" />  
 80	  </div>
 81	  
 82	  <p>
 83	      <input type="checkbox" id="cbNotify" class="cmnt-frm-notify" style="width: auto" tabindex="8" />
 84	      <label for="cbNotify" style="width:auto;float:none;display:inline;padding-left:5px"><%=Resources.labels.notifyOnNewComments %></label>
 85      </p>
 86	  <blog:RecaptchaControl ID="recaptcha" runat="server" TabIndex="9" />
 87      
 88
 89      <p>
 90	    <input type="button" id="btnSaveAjax" class="btn-save" style="margin-top:10px" value="<%=Resources.labels.saveComment %>" onclick="return BlogEngine.validateAndSubmitCommentForm()" tabindex="10" />
 91	    <asp:HiddenField runat="server" ID="hfCaptcha" />
 92      </p>
 93	</div>
 94
 95</div>
 96
 97<script type="text/javascript">
 98<!--//
 99function registerCommentBox(){
100	BlogEngine.comments.flagImage = BlogEngine.$("<%= imgFlag.ClientID %>");
101	BlogEngine.comments.contentBox = BlogEngine.$("<%=txtContent.ClientID %>");
102	BlogEngine.comments.moderation = <%=BlogSettings.Instance.EnableCommentsModeration.ToString().ToLowerInvariant() %>;
103	BlogEngine.comments.checkName = <%=(!Security.IsAuthenticated).ToString().ToLowerInvariant() %>;
104	BlogEngine.comments.postAuthor = "<%=Post.Author %>";
105	BlogEngine.comments.nameBox = BlogEngine.$("<%= this.NameInputId %>");
106	BlogEngine.comments.emailBox = BlogEngine.$("<%=txtEmail.ClientID %>");
107	BlogEngine.comments.websiteBox = BlogEngine.$("<%=txtWebsite.ClientID %>");
108	BlogEngine.comments.countryDropDown = BlogEngine.$("<%=ddlCountry.ClientID %>"); 
109	BlogEngine.comments.captchaField = BlogEngine.$('<%=hfCaptcha.ClientID %>');
110	BlogEngine.comments.controlId = '<%=this.UniqueID %>';
111	BlogEngine.comments.replyToId = BlogEngine.$("<%=hiddenReplyTo.ClientID %>"); 
112}
113//-->
114</script>
115
116<% if (BlogSettings.Instance.IsCoCommentEnabled){ %>
117<script type="text/javascript">
118    // this ensures coComment gets the correct values
119    coco =
120{
121    tool: "BlogEngine",
122    siteurl: "<%=Utils.AbsoluteWebRoot %>",
123    sitetitle: "<%=BlogSettings.Instance.Name %>",
124    pageurl: location.href,
125    pagetitle: "<%=this.Post.Title %>",
126    author: "<%=this.Post.Title %>",
127    formID: "<%=Page.Form.ClientID %>",
128    textareaID: "<%=txtContent.UniqueID %>",
129    buttonID: "btnSaveAjax"
130}
131</script>
132<script id="cocomment-fetchlet" src="http://www.cocomment.com/js/enabler.js" type="text/javascript"></script>
133<%} %>
134
135</asp:PlaceHolder>
136
137<script type="text/javascript">
138    function toggle_visibility(id, id2) {
139        var e = document.getElementById(id);
140        var h = document.getElementById(id2);
141        if (e.style.display == 'block') {
142            e.style.display = 'none';
143            h.innerHTML = "+";
144        }
145        else {
146            e.style.display = 'block';
147            h.innerHTML = "-";
148        }
149    }
150</script>
151
152<asp:label runat="server" id="lbCommentsDisabled" visible="false"><%=Resources.labels.commentsAreClosed %></asp:label>