using
System.Web.Security;
using
System.Web.UI.WebControls;
using
Telerik.Cms.Web.UI;
using
Telerik.Cms.Engine;
using
System.Web.UI.HtmlControls;
using
Telerik.Workflow;
using
System.Web.Profile;
using
System.Web.UI;
using
System.ComponentModel;
using
System;
namespace
App_Code.Modules.Members.MembersModule.WebControls.Public {
/// <summary>
/// Summary description for MemberLogin
/// </summary>
public
class
MemberLogin : SimpleControl {
public
MemberLogin() {}
#region Fields
private
string
_strSectionHyperLink;
#endregion
#region Properties
public
override
string
LayoutTemplatePath {
get
{
return
"~/lib/controls/membersModule/frontend/MemberLogin.ascx"
; }
}
[Category(
"Misc"
)]
[Description(
"Select the page this section should link to"
)]
[DisplayName(
"Page: "
)]
[WebEditor(
"Telerik.Cms.Web.UI.CmsUrlWebEditor, Telerik.Cms"
)]
public
string
sectionHyperlink {
get
{
return
this
._strSectionHyperLink;
}
set
{
this
._strSectionHyperLink = value;
}
}
#endregion
#region Method_Overrides
protected
override
void
InitializeControls(System.Web.UI.Control controlContainer) {
//set login control properties
this
.oLogin.DestinationPageUrl =
this
.Context.Request.QueryString[
"ReturnUrl"
];
this
.oPasswordRecoveryHyperlink.NavigateUrl =
this
._strSectionHyperLink;
this
.oPasswordRecoveryHyperlink.Text =
"Retrieve password"
;
this
.oLogin.LoginError +=
new
System.EventHandler(oLogin_LoginError);
base
.InitializeControls(controlContainer);
}
//this simple piece of code prevents the composite control from creating a <span></span> wrapper
protected
override
void
Render(HtmlTextWriter writer) {
RenderContents(writer);
}
protected
override
void
OnLoad(System.EventArgs e) {
base
.OnLoad(e);
//add css and js to head of document
HtmlLink oUniFormCss =
new
HtmlLink();
oUniFormCss.Attributes.Add(
"href"
,
"/lib/plugins/uni-form/css/uni-form.css"
);
oUniFormCss.Attributes.Add(
"rel"
,
"stylesheet"
);
oUniFormCss.Attributes.Add(
"type"
,
"text/css"
);
oUniFormCss.Attributes.Add(
"charset"
,
"utf-8"
);
oUniFormCss.Attributes.Add(
"media"
,
"screen"
);
this
.Page.Header.Controls.Add(oUniFormCss);
HtmlLink oUniFormDefaultCss =
new
HtmlLink();
oUniFormDefaultCss.Attributes.Add(
"href"
,
"/lib/plugins/uni-form/css/default.uni-form.css"
);
oUniFormDefaultCss.Attributes.Add(
"rel"
,
"stylesheet"
);
oUniFormDefaultCss.Attributes.Add(
"type"
,
"text/css"
);
oUniFormDefaultCss.Attributes.Add(
"charset"
,
"utf-8"
);
oUniFormDefaultCss.Attributes.Add(
"media"
,
"screen"
);
this
.Page.Header.Controls.Add(oUniFormDefaultCss);
}
void
oLogin_LoginError(
object
sender, System.EventArgs e) {
HtmlGenericControl oMessageContainer =
new
HtmlGenericControl();
oMessageContainer.TagName =
"p"
;
oMessageContainer.Attributes.Add(
"class"
,
"fontRed"
);
oMessageContainer.InnerText =
this
.oLogin.FailureText;
this
.Controls.Add(oMessageContainer);
//add the control to the page
this
.oLoginMessagePlaceHolder.Controls.Add(oMessageContainer);
}
#endregion
#region Virtual_Controls
protected
virtual
Login oLogin {
get
{
return
base
.Container.GetControl<Login>(
"Login1"
,
true
);
}
}
protected
virtual
PlaceHolder oLoginMessagePlaceHolder {
get
{
return
this
.oLogin.FindControl(
"plhLoginMessage"
)
as
PlaceHolder;
}
}
protected
virtual
Literal oFailureTextLiteral {
get
{
return
this
.oLogin.FindControl(
"FailureText"
)
as
Literal;
}
}
protected
virtual
HyperLink oPasswordRecoveryHyperlink {
get
{
return
this
.oLogin.FindControl(
"hplPasswordRecovery"
)
as
HyperLink;
}
}
#endregion
}
}