Comments Box
Hi.
I've been working on my comments boxes for my sites blog.
I was wondering how you go about changing the formatting options link so that the options are just permanently displayed. like the tools on this blog? (see above) i'm sure its really simple.
thanks Matt
Hi Matthew,
This requires changing the HtmlField that is declared inside CommentsDetailsView. You should set a custom control in the definition of the module you want to change ( blogs).
You have to inherit from Telerik.Sitefinity.Modules.GenericContent.Web.UI.Views.CommentsDetailsView and override LayoutTemplateName property where you should return your custom template
<%@ Control Language="C#" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" TagPrefix="sf" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
<
asp:Panel
ID
=
"authenticatedUserContainer"
runat
=
"server"
CssClass
=
"sfcommentsFormWrp"
>
<
asp:Panel
ID
=
"moderationContainer"
runat
=
"server"
Visible
=
"false"
>
<
p
>
<
asp:Literal
ID
=
"Literal1"
runat
=
"server"
Text="<%$Resources:ContentResources, CommentMessageModeration %>" />
</
p
>
</
asp:Panel
>
<
h2
class
=
"sfcommentsTitle"
><
asp:Literal
ID
=
"Literal2"
runat
=
"server"
Text="<%$Resources:ContentResources, Comment%>" /></
h2
>
<
fieldset
class
=
"sfcommentsForm"
>
<
ol
class
=
"sfcommentsFieldsList"
>
<
li
id
=
"authorNameControlWrapper"
runat
=
"server"
class
=
"sfcommentsField"
>
<
sf:TextField
ID
=
"authorName"
runat
=
"server"
DisplayMode
=
"Write"
Title="<%$Resources:ContentResources, YourName%>">
<
ValidatorDefinition
Required
=
"true"
RequiredViolationMessage="<%$Resources:ContentResources, NameCannotBeEmpty %>"
MessageCssClass="sfError" />
</
sf:TextField
>
</
li
>
<
li
id
=
"emailControlWrapper"
runat
=
"server"
class
=
"sfcommentsField"
>
<
sf:TextField
ID
=
"email"
runat
=
"server"
DisplayMode
=
"Write"
Title="<%$Resources:ContentResources, EmailOptional %>">
<
ValidatorDefinition
RequiredViolationMessage="<%$Resources:ContentResources, EmailCannotBeEmpty %>"
RegularExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
Required="true"
MessageCssClass="sfError" />
</
sf:TextField
>
</
li
>
<
li
id
=
"websiteControlWrapper"
runat
=
"server"
class
=
"sfcommentsField"
>
<
sf:TextField
ID
=
"website"
runat
=
"server"
DisplayMode
=
"Write"
Title="<%$Resources:ContentResources, WebsiteOptional%>">
<
ValidatorDefinition
RequiredViolationMessage= "<%$Resources:ContentResources, WebSiteCannotBeEmpty %>"
Required="true"
MessageCssClass="sfError" />
</
sf:TextField
>
</
li
>
<
li
id
=
"contentControlWrapper"
runat
=
"server"
class
=
"sfcommentEditor sfcommentsField"
>
<
sf:HtmlField
ID
=
"content"
runat
=
"server"
DisplayMode
=
"Write"
EditorToolsConfiguration
=
"Minimal"
HtmlFieldEditModes
=
"Design"
Title="<%$Resources:ContentResources, Comment%>"
EditorContentFilters="DefaultFilters"
EditorStripFormattingOptions="AllExceptNewLines"
Height="200"
IsToOverrideDialogs="false">
<
ValidatorDefinition
RequiredViolationMessage="<%$Resources:ContentResources, CommentCannotBeEmpty %>"
Required="true"
MessageCssClass="sfError" />
</
sf:HtmlField
>
</
li
>
<
li
id
=
"captchaWrapper"
runat
=
"server"
class
=
"sfcommentsField sfcommentCaptcha"
>
<
telerik:RadCaptcha
ID
=
"captcha"
runat
=
"server"
ErrorMessage="<%$Resources:ContentResources, PageNotValid %>" Display="Dynamic" Skin="Sitefinity" />
</
li
>
</
ol
>
<
p
class
=
"sfcommentsSubmitBtnWrp"
>
<
asp:Button
ID
=
"submitBtn"
runat
=
"server"
Text="<%$Resources:ContentResources, Submit%>" CommandName="submitComment" CausesValidation="true" class="sfcommentsSubmitBtn" />
</
p
>
</
fieldset
>
</
asp:Panel
>
<
asp:Panel
ID
=
"anonymousUserContainer"
runat
=
"server"
Visible
=
"false"
>
<
p
>
<
asp:Literal
ID
=
"Literal3"
runat
=
"server"
Text="<%$Resources:ContentResources, PostingCommentsIsNotAllowed %>" />
</
p
>
</
asp:Panel
>