| 37 |
37 |
<asp:RegularExpressionValidator runat="server" ControlToValidate="txtEmail" ErrorMessage="<%$Resources:labels, enterValidEmail %>" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="AddComment" /><br /> |
| 38 |
38 |
|
| 39 |
39 |
<label for="<%=txtWebsite.ClientID %>"><%=Resources.labels.website %></label> |
| 40 |
40 |
<asp:TextBox runat="Server" ID="txtWebsite" TabIndex="3" ValidationGroup="AddComment" /> |
| 41 |
41 |
<asp:RegularExpressionValidator runat="Server" ControlToValidate="txtWebsite" ValidationExpression="(http://|https://|)([\w-]+\.)+[\w-]+(/[\w- ./?%&=;~]*)?" ErrorMessage="<%$Resources:labels, enterValidUrl %>" Display="Dynamic" ValidationGroup="AddComment" /><br /> |
| 42 |
42 |
|
| |
43 |
Enter the word |
| |
44 |
<table style="display:inline"> |
| |
45 |
<tr><td> |
| |
46 |
<asp:Image ID="Image1" runat="server" ImageUrl="/images/captcha word.png" AlternateText="captcha word" /> |
| |
47 |
</td></tr> |
| |
48 |
<tr><td> |
| |
49 |
(<a href="/audio/captcha word.mp3">hear it spoken</a>) |
| |
50 |
</td></tr> |
| |
51 |
</table> |
| |
52 |
<asp:TextBox runat="Server" ID="txtNaiveCaptcha" Width="150" TabIndex="3" ValidationGroup="AddComment" /> |
| |
53 |
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtNaiveCaptcha" ErrorMessage="Please enter the correct word" Display="dynamic" ValidationGroup="AddComment" /> |
| |
54 |
<%-- <asp:RegularExpressionValidator runat="Server" EnableClientScript="false" ControlToValidate="txtNaiveCaptcha" ValidationExpression="chicken" ErrorMessage="Please enter the correct word" ValidationGroup="AddComment" /> --%> |
| |
55 |
<br /><br /> |
| |
56 |
|
| 43 |
57 |
<% if(BlogSettings.Instance.EnableCountryInComments){ %> |
| 44 |
58 |
<label for="<%=ddlCountry.ClientID %>"><%=Resources.labels.country %></label> |
| 45 |
59 |
<asp:DropDownList runat="server" ID="ddlCountry" onchange="SetFlag(this.value)" TabIndex="4" EnableViewState="false" ValidationGroup="AddComment" /> |
| 46 |
60 |
<asp:Image runat="server" ID="imgFlag" AlternateText="Country flag" Width="16" Height="11" EnableViewState="false" /><br /><br /> |
| 47 |
61 |
<%} %> |
| 48 |
62 |
|
| |
| 74 |
88 |
|
| 75 |
89 |
|
| 76 |
90 |
|
| 77 |
91 |
|
| 78 |
92 |
|
| 79 |
93 |
|
| |
94 |
var naiveCaptchaBox = $("<%= txtNaiveCaptcha.ClientID %>"); |
| 80 |
95 |
|
| 81 |
96 |
|
| 82 |
97 |
|
| 83 |
98 |
|
| 84 |
99 |
|
| 85 |
100 |
|
| 50 |
50 |
string country = args[3]; |
| 51 |
51 |
string content = args[4]; |
| 52 |
52 |
bool notify = bool.Parse(args[5]); |
| 53 |
53 |
bool isPreview = bool.Parse(args[6]); |
| 54 |
54 |
string sentCaptcha = args[7]; |
| 55 |
55 |
string storedCaptcha = hfCaptcha.Value; |
| |
56 |
string word = args[8]; |
| 56 |
57 |
|
| 57 |
58 |
if (sentCaptcha != storedCaptcha) |
| 58 |
59 |
return; |
| |
60 |
if (!isPreview && word != "chicken") |
| |
61 |
{ |
| |
62 |
_Callback = "failedCaptcha"; |
| |
63 |
return; |
| |
64 |
} |
| 59 |
65 |
|
| 60 |
66 |
Comment comment = new Comment(); |
| 61 |
67 |
comment.Id = Guid.NewGuid(); |
| 62 |
68 |
comment.Author = Server.HtmlEncode(author); |
| 63 |
69 |
comment.Email = email; |
| 64 |
70 |
comment.Content = Server.HtmlEncode(content); |
| 52 |
52 |
var email = emailBox.value; |
| 53 |
53 |
var website = websiteBox.value; |
| 54 |
54 |
var country = countryDropDown ? countryDropDown.value : ""; |
| 55 |
55 |
var content = contentBox.value; |
| 56 |
56 |
var notify = $("cbNotify").checked; |
| 57 |
57 |
var captcha = captchaField.value; |
| |
58 |
var naiveCaptcha = naiveCaptchaBox.value; |
| 58 |
59 |
|
| 59 |
60 |
var callback = isPreview ? EndShowPreview : AppendComment; |
| 60 |
|
var argument = author + "-|-" + email + "-|-" + website + "-|-" + country + "-|-" + content + "-|-" + notify + "-|-" + isPreview + "-|-" + captcha; |
| |
61 |
var argument = author + "-|-" + email + "-|-" + website + "-|-" + country + "-|-" + content + "-|-" + notify + "-|-" + isPreview + "-|-" + captcha + "-|-" + naiveCaptcha; |
| 61 |
62 |
|
| 62 |
63 |
WebForm_DoCallback('ctl00$cphBody$CommentView1',argument, callback,'comment',null,false); |
| 63 |
64 |
|
| 64 |
65 |
if (!isPreview && typeof OnComment != "undefined") |
| 65 |
66 |
OnComment(author, email, website, country, content); |
| 66 |
67 |
} |
| 67 |
68 |
|
| 68 |
69 |
function AppendComment(args, context) |
| 69 |
70 |
{ |
| 70 |
71 |
if (context == "comment") |
| 71 |
72 |
{ |
| 72 |
|
var commentList = $("commentlist"); |
| 73 |
|
|
| 74 |
|
if (commentList.innerHTML.length < 10) |
| 75 |
|
commentList.innerHTML = "<h1 id='comment'>" + KEYcomments + "</h1>" |
| 76 |
|
|
| 77 |
|
commentList.innerHTML += args; |
| 78 |
|
commentList.style.display = 'block'; |
| 79 |
|
contentBox.value = ""; |
| 80 |
|
$("ajaxLoader").style.display = "none"; |
| 81 |
|
$("status").className = "success"; |
| 82 |
|
|
| 83 |
|
if (!moderation) |
| 84 |
|
$("status").innerHTML = KEYcommentWasSaved; |
| 85 |
|
else |
| 86 |
|
$("status").innerHTML = KEYcommentWaitingModeration; |
| |
73 |
|
| |
74 |
if (args != "failedCaptcha") { |
| |
75 |
var commentList = $("commentlist"); |
| |
76 |
|
| |
77 |
if (commentList.innerHTML.length < 10) |
| |
78 |
commentList.innerHTML = "<h1 id='comment'>" + KEYcomments + "</h1>" |
| |
79 |
|
| |
80 |
commentList.innerHTML += args; |
| |
81 |
commentList.style.display = 'block'; |
| |
82 |
contentBox.value = ""; |
| |
83 |
$("status").className = "success"; |
| |
84 |
|
| |
85 |
if (!moderation) |
| |
86 |
$("status").innerHTML = KEYcommentWasSaved; |
| |
87 |
else |
| |
88 |
$("status").innerHTML = KEYcommentWaitingModeration; |
| |
89 |
} |
| |
90 |
else { |
| |
91 |
$("status").innerHTML = "<span style=\"color: red; font-weight: bold\">Please enter the correct word</span>"; |
| |
92 |
} |
| |
93 |
|
| |
94 |
$("ajaxLoader").style.display = "none"; |
| 87 |
95 |
} |
| 88 |
96 |
|
| 89 |
97 |
$("btnSaveAjax").disabled = false; |
| 90 |
98 |
} |
| 91 |
99 |
|
| 92 |
100 |
function CheckAuthorName(sender, args) |