private Control GetCtrl(string CtrlFile, Control X) { ControlUtilities cu = new ControlUtilities(this); string sCtrl = cu.GetResourceText("Carrotware.CMS.UI.Controls." + CtrlFile + ".ascx"); sCtrl = sCtrl.Replace("{WIDGETCONTAINER_ID}", this.ID); Control userControl = cu.CreateControlFromString(sCtrl); return userControl; }
private Control GetCtrl(string CtrlFile, Control X) { ControlUtilities cu = new ControlUtilities(this); string sCtrl = cu.GetResourceText("Carrotware.CMS.UI.Controls." + CtrlFile + ".ascx"); sCtrl = ScrubCtrl(sCtrl); Control userControl = cu.CreateControlFromString(sCtrl); return(userControl); }
private Control GetCtrl(string CtrlFile, Control X) { ControlUtilities cu = new ControlUtilities(this); string sCtrl = cu.GetResourceText("Carrotware.CMS.UI.Controls." + CtrlFile + ".ascx"); sCtrl = sCtrl.Replace("{WIDGETCONTAINER_ID}", this.ID); Control userControl = cu.CreateControlFromString(sCtrl); return(userControl); }
private Control GetCtrl(Control X) { cu = new ControlUtilities(this); string sCtrl = cu.GetResourceText("Carrotware.CMS.UI.Controls.ucAdminContentContainer.ascx"); sCtrl = sCtrl.Replace("{ZONE_ID}", this.ClientID); sCtrl = sCtrl.Replace("{ZONE_CHAR}", this.ZoneChar); sCtrl = sCtrl.Replace("{ZONE_TYPE}", this.TextZone.ToString()); Control userControl = cu.CreateControlFromString(sCtrl); return(userControl); }
protected override void OnPreRender(EventArgs e) { this.SetText(); if (!this.UseDefaultText) { ControlUtilities cu = new ControlUtilities(this.Page); PagedDataNextPrevText txt = (PagedDataNextPrevText)cu.FindControl(typeof(PagedDataNextPrevText), this); if (txt != null) { txt.NavDirection = this.NavDirection; } } base.OnPreRender(e); }
private Control GetCtrl(Control X, string MenuText, string MenuFunc) { ControlUtilities cu = new ControlUtilities(this); string sCtrl = cu.GetResourceText("Carrotware.CMS.UI.Controls.ucAdminWidgetMenuItem.ascx"); sCtrl = ScrubCtrl(sCtrl); sCtrl = sCtrl.Replace("{WIDGET_MENU_TEXT}", MenuText); sCtrl = sCtrl.Replace("{WIDGET_MENU_JS}", MenuFunc); Control userControl = cu.CreateControlFromString(sCtrl); return(userControl); }
protected override void OnPreRender(EventArgs e) { this.SetText(); if (!this.UseDefaultText) { ControlUtilities cu = new ControlUtilities(this.Page); PagedDataNextPrevText txt = (PagedDataNextPrevText)cu.FindControl(typeof(PagedDataNextPrevText), this); if (txt != null) { txt.NavDirection = this.NavDirection; } } base.OnPreRender(e); }
protected override void OnPreRender(EventArgs e) { string sFieldValue = string.Empty; SiteData sd = SiteData.CurrentSite; if (sd != null) { sFieldValue = sd.DefaultCanonicalURL; ControlUtilities cu = new ControlUtilities(); ContentPage cp = cu.GetContainerContentPage(this); if (cp != null) { if (cp.NavOrder == 0) { sFieldValue = sd.MainCanonicalURL; } else { sFieldValue = sd.DefaultCanonicalURL; } } } else { sFieldValue = SiteData.DefaultDirectoryFilename; } this.Text = String.Format("<link rel=\"canonical\" href=\"{0}\" />\r\n", sFieldValue); if (this.Enable301Redirect) { HttpContext ctx = HttpContext.Current; if (!SiteData.CurrentSite.MainCanonicalURL.ToLowerInvariant().Contains(@"://" + CMSConfigHelper.DomainName.ToLowerInvariant())) { ctx.Response.Status = "301 Moved Permanently"; ctx.Response.AddHeader("Location", sFieldValue); } } base.OnPreRender(e); }
protected override void RenderContents(HtmlTextWriter output) { string sTrackback = ControlUtilities.GetManifestResourceStream("Carrotware.CMS.UI.Controls.Trackback.txt"); ContentPage cp = cu.GetContainerContentPage(this); if (cp != null) { sTrackback = sTrackback.Replace("{URL}", SiteData.CurrentSite.ConstructedCanonicalURL(cp)); sTrackback = sTrackback.Replace("{TB_TITLE}", cp.NavMenuText); sTrackback = sTrackback.Replace("{TB_URL_ID}", SiteData.CurrentSite.ConstructedCanonicalURL(TrackBackURI) + "?id=" + HttpUtility.UrlEncode(cp.FileName)); output.Write(sTrackback); } if (IsPostBack && EnableDirectTrackback) { TrackbackHelper tbh = new TrackbackHelper(); tbh.ProcessTrackback(HttpContext.Current, false); } }
protected PagedDataNextPrevLinkPair FindPrevNextCtrl(string sCtrlName) { PagedDataNextPrevLinkPair pair = new PagedDataNextPrevLinkPair(); try { ControlUtilities cu = new ControlUtilities(this.Page); Control ctrl = cu.FindControl(sCtrlName, this.Page); pair.LinkWrapper = (PagedDataNextPrevLinkWrapper)ctrl; if (pair.LinkWrapper == null) { pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(sCtrlName, this.Page); } else { pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(typeof(PagedDataNextPrevLink), pair.LinkWrapper); } } catch (Exception ex) { } return(pair); }
private Control GetCtrl(Control X) { cu = new ControlUtilities(X); Control userControl = cu.CreateControlFromResource("Carrotware.CMS.UI.Controls.ucSimplePager1.ascx"); return userControl; }
private Control GetCtrl(Control X) { cu = new ControlUtilities(X); Control userControl = cu.CreateControlFromResource("Carrotware.CMS.UI.Controls.ucCommentDisplay.ascx"); return userControl; }
private Control GetCtrl(Control X) { ControlUtilities cu = new ControlUtilities(X); Control userControl = cu.CreateControlFromResource("Carrotware.CMS.UI.Controls.ucSearchForm.ascx"); return userControl; }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); //this.ControlPath = this.WidgetSettings.ControlPath; //this.ControlTitle = this.WidgetSettings.ControlPath; //this.Order = this.WidgetSettings.WidgetOrder; this.DatabaseKey = this.WidgetData.Root_WidgetID; if (!this.WidgetData.IsWidgetActive) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.InactivePagePrefix, this.ControlTitle); } if (this.WidgetData.IsRetired) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.RetiredPagePrefix, this.ControlTitle); } if (this.WidgetData.IsUnReleased) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.UnreleasedPagePrefix, this.ControlTitle); } if (this.WidgetData.IsWidgetPendingDelete) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.PendingDeletePrefix, this.ControlTitle); } if (SiteData.IsWebView) { ControlUtilities cu = new ControlUtilities(); if (this.IsAdminMode) { ctrl1 = GetCtrl("ucAdminWidget1", this); ctrl2 = GetCtrl("ucAdminWidget2", this); if (this.JSEditFunctions != null && this.JSEditFunctions.Any()) { PlaceHolder phMenuItems = (PlaceHolder)cu.FindControl("phMenuItems", ctrl1); foreach (KeyValuePair<string, string> f in this.JSEditFunctions) { Control itm = GetCtrl(this, f.Key, f.Value); phMenuItems.Controls.Add(itm); } this.JSEditFunction = null; } HtmlGenericControl remove = (HtmlGenericControl)cu.FindControl("liRemove", ctrl1); HtmlGenericControl act = (HtmlGenericControl)cu.FindControl("liActivate", ctrl1); act.Visible = !this.WidgetData.IsWidgetActive; remove.Visible = this.WidgetData.IsWidgetActive; if (String.IsNullOrEmpty(this.JSEditFunction)) { HtmlGenericControl edit = (HtmlGenericControl)cu.FindControl("liEdit", ctrl1); HtmlGenericControl hist = (HtmlGenericControl)cu.FindControl("liHistory", ctrl1); edit.Visible = false; hist.Visible = false; } } else { ctrl1 = new Literal { Text = "\r\n" }; ctrl2 = new Literal { Text = "\r\n" }; #if DEBUG ctrl1 = new Literal { Text = "<span style=\"display: none;\" id=\"BEGIN-" + this.ClientID + "\"></span>\r\n" }; ctrl2 = new Literal { Text = "<span style=\"display: none;\" id=\"END-" + this.ClientID + "\"></span>\r\n" }; #endif } } }
private Control GetCtrl(Control X, string MenuText, string MenuFunc) { ControlUtilities cu = new ControlUtilities(this); string sCtrl = cu.GetResourceText("Carrotware.CMS.UI.Controls.ucAdminWidgetMenuItem.ascx"); sCtrl = ScrubCtrl(sCtrl); sCtrl = sCtrl.Replace("{WIDGET_MENU_TEXT}", MenuText); sCtrl = sCtrl.Replace("{WIDGET_MENU_JS}", MenuFunc); Control userControl = cu.CreateControlFromString(sCtrl); return userControl; }
private Control GetCtrl(Control X) { cu = new ControlUtilities(this); string sCtrl = cu.GetResourceText("Carrotware.CMS.UI.Controls.ucAdminContentContainer.ascx"); sCtrl = sCtrl.Replace("{ZONE_ID}", this.ClientID); sCtrl = sCtrl.Replace("{ZONE_CHAR}", this.ZoneChar); sCtrl = sCtrl.Replace("{ZONE_TYPE}", this.TextZone.ToString()); Control userControl = cu.CreateControlFromString(sCtrl); return userControl; }
protected override void OnPreRender(EventArgs e) { string sFieldValue = string.Empty; SiteData sd = SiteData.CurrentSite; if (sd != null) { sFieldValue = sd.DefaultCanonicalURL; ControlUtilities cu = new ControlUtilities(); ContentPage cp = cu.GetContainerContentPage(this); if (cp != null) { if (cp.NavOrder == 0) { sFieldValue = sd.MainCanonicalURL; } else { sFieldValue = sd.DefaultCanonicalURL; } } } else { sFieldValue = SiteData.DefaultDirectoryFilename; } this.Text = String.Format("<link rel=\"canonical\" href=\"{0}\" />\r\n", sFieldValue); if (this.Enable301Redirect) { HttpContext ctx = HttpContext.Current; if (!SiteData.CurrentSite.MainCanonicalURL.ToLowerInvariant().Contains(@"://" + CMSConfigHelper.DomainName.ToLowerInvariant())) { ctx.Response.Status = "301 Moved Permanently"; ctx.Response.AddHeader("Location", sFieldValue); } } base.OnPreRender(e); }
protected PagedDataNextPrevLinkPair FindPrevNextCtrl(string sCtrlName) { PagedDataNextPrevLinkPair pair = new PagedDataNextPrevLinkPair(); try { ControlUtilities cu = new ControlUtilities(this.Page); Control ctrl = cu.FindControl(sCtrlName, this.Page); pair.LinkWrapper = (PagedDataNextPrevLinkWrapper)ctrl; if (pair.LinkWrapper == null) { pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(sCtrlName, this.Page); } else { pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(typeof(PagedDataNextPrevLink), pair.LinkWrapper); } } catch (Exception ex) { } return pair; }
private Repeater GetCtrl(Control ctrl) { Repeater r = new Repeater(); try { ControlUtilities cu = new ControlUtilities(ctrl); Control userControl = cu.CreateControlFromResource("Carrotware.CMS.UI.Controls.ucFancyPager.ascx"); r = (Repeater)cu.FindControl("rpPager", userControl); } catch { } return r; }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); //this.ControlPath = this.WidgetSettings.ControlPath; //this.ControlTitle = this.WidgetSettings.ControlPath; //this.Order = this.WidgetSettings.WidgetOrder; this.DatabaseKey = this.WidgetData.Root_WidgetID; if (!this.WidgetData.IsWidgetActive) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.InactivePagePrefix, this.ControlTitle); } if (this.WidgetData.IsRetired) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.RetiredPagePrefix, this.ControlTitle); } if (this.WidgetData.IsUnReleased) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.UnreleasedPagePrefix, this.ControlTitle); } if (this.WidgetData.IsWidgetPendingDelete) { this.ControlTitle = String.Format("{0} {1}", CMSConfigHelper.PendingDeletePrefix, this.ControlTitle); } if (SiteData.IsWebView) { ControlUtilities cu = new ControlUtilities(); if (this.IsAdminMode) { ctrl1 = GetCtrl("ucAdminWidget1", this); ctrl2 = GetCtrl("ucAdminWidget2", this); if (this.JSEditFunctions != null && this.JSEditFunctions.Any()) { PlaceHolder phMenuItems = (PlaceHolder)cu.FindControl("phMenuItems", ctrl1); foreach (KeyValuePair <string, string> f in this.JSEditFunctions) { Control itm = GetCtrl(this, f.Key, f.Value); phMenuItems.Controls.Add(itm); } this.JSEditFunction = null; } HtmlGenericControl remove = (HtmlGenericControl)cu.FindControl("liRemove", ctrl1); HtmlGenericControl act = (HtmlGenericControl)cu.FindControl("liActivate", ctrl1); act.Visible = !this.WidgetData.IsWidgetActive; remove.Visible = this.WidgetData.IsWidgetActive; if (String.IsNullOrEmpty(this.JSEditFunction)) { HtmlGenericControl edit = (HtmlGenericControl)cu.FindControl("liEdit", ctrl1); HtmlGenericControl hist = (HtmlGenericControl)cu.FindControl("liHistory", ctrl1); edit.Visible = false; hist.Visible = false; } } else { ctrl1 = new Literal { Text = "<span style=\"display: none;\" id=\"BEGIN-" + this.ClientID + "\"></span>\r\n" }; ctrl2 = new Literal { Text = "<span style=\"display: none;\" id=\"END-" + this.ClientID + "\"></span>\r\n" }; } } }
private void ParseCSS() { if (String.IsNullOrEmpty(this.OverrideCSS) && !this.AutoStylingDisabled && String.IsNullOrEmpty(cssText.Text)) { string sCSSText = ControlUtilities.GetManifestResourceStream("Carrotware.CMS.UI.Controls.TopMenu.txt"); if (this.AttemptResponsiveCSS) { string sCSS1 = ControlUtilities.GetManifestResourceStream("Carrotware.CMS.UI.Controls.TopMenuRes.txt"); sCSSText = sCSS1.Replace("{DESKTOP_CSS}", sCSSText); } if (!String.IsNullOrEmpty(sCSSText)) { sCSSText = sCSSText.Replace("{FORE_HEX}", ColorTranslator.ToHtml(this.ForeColor).ToLowerInvariant()); sCSSText = sCSSText.Replace("{BG_HEX}", ColorTranslator.ToHtml(this.BGColor).ToLowerInvariant()); sCSSText = sCSSText.Replace("{HOVER_FORE_HEX}", ColorTranslator.ToHtml(this.HoverFGColor).ToLowerInvariant()); sCSSText = sCSSText.Replace("{HOVER_BG_HEX}", ColorTranslator.ToHtml(this.HoverBGColor).ToLowerInvariant()); sCSSText = sCSSText.Replace("{SEL_FORE_HEX}", ColorTranslator.ToHtml(this.SelFGColor).ToLowerInvariant()); sCSSText = sCSSText.Replace("{SEL_BG_HEX}", ColorTranslator.ToHtml(this.SelBGColor).ToLowerInvariant()); sCSSText = sCSSText.Replace("{UNSEL_FORE_HEX}", ColorTranslator.ToHtml(this.UnSelFGColor).ToLowerInvariant()); sCSSText = sCSSText.Replace("{UNSEL_BG_HEX}", ColorTranslator.ToHtml(this.UnSelBGColor).ToLowerInvariant()); sCSSText = sCSSText.Replace("{SUB_FORE_HEX}", ColorTranslator.ToHtml(this.SubFGColor).ToLowerInvariant()); sCSSText = sCSSText.Replace("{SUB_BG_HEX}", ColorTranslator.ToHtml(this.SubBGColor).ToLowerInvariant()); if (this.FontSize.Value > 0) { sCSSText = sCSSText.Replace("{FONT_SIZE}", this.FontSize.ToString()); } else { sCSSText = sCSSText.Replace("{FONT_SIZE}", "inherit"); } if (this.MenuFontSize.Value > 0) { sCSSText = sCSSText.Replace("{MAIN_FONT_SIZE}", this.MenuFontSize.ToString()); } else { sCSSText = sCSSText.Replace("{MAIN_FONT_SIZE}", "inherit"); } if (this.MobileWidth.Value > 50) { sCSSText = sCSSText.Replace("{MOBILE_WIDTH}", this.MobileWidth.ToString()); } else { sCSSText = sCSSText.Replace("{MOBILE_WIDTH}", "100%"); } if (this.MobileWidth.Value > 50) { sCSSText = sCSSText.Replace("{DESK_WIDTH}", (this.MobileWidth.Value + 1).ToString() + this.MobileWidth.Type); } else { sCSSText = sCSSText.Replace("{DESK_WIDTH}", "100%"); } sCSSText = sCSSText.Replace("{MENU_SELECT_CLASS}", this.CSSSelected); sCSSText = sCSSText.Replace("{MENU_HASCHILD_CLASS}", this.CSSHasChildren); if (!String.IsNullOrEmpty(this.TopBackgroundStyle)) { this.TopBackgroundStyle = this.TopBackgroundStyle.Replace(";", ""); sCSSText = sCSSText.Replace("{TOP_BACKGROUND_STYLE}", "background: " + this.TopBackgroundStyle + ";"); } else { sCSSText = sCSSText.Replace("{TOP_BACKGROUND_STYLE}", ""); } sCSSText = sCSSText.Replace("{MENU_ID}", "#" + this.HtmlClientID + ""); sCSSText = sCSSText.Replace("{MENU_WRAPPER_ID}", "#" + this.HtmlClientID + "-wrapper"); sCSSText = "\r\n\t<style type=\"text/css\">\r\n" + sCSSText + "\r\n\t</style>\r\n"; //sCSSText = "\r\n\t<div type=\"text/css\">\r\n" + sCSSText + "\r\n\t</div>\r\n"; cssText.Text = sCSSText; } } }
private Control GetCtrl(string CtrlFile, Control X) { ControlUtilities cu = new ControlUtilities(this); string sCtrl = cu.GetResourceText("Carrotware.CMS.UI.Controls." + CtrlFile + ".ascx"); sCtrl = ScrubCtrl(sCtrl); Control userControl = cu.CreateControlFromString(sCtrl); return userControl; }
protected SiteNav GetCurrentPage() { SiteNav pageNav = null; ControlUtilities cu = new ControlUtilities(this); ContentPage cp = cu.GetContainerContentPage(this); if (cp != null) { pageNav = new SiteNav(); pageNav.Root_ContentID = cp.Root_ContentID; pageNav.FileName = cp.FileName; pageNav.TemplateFile = cp.TemplateFile; } else { pageNav = navHelper.FindByFilename(SiteData.CurrentSiteID, SiteData.AlternateCurrentScriptName); //assign bogus page name for comp purposes if (pageNav == null) { pageNav = new SiteNav(); pageNav.Root_ContentID = Guid.Empty; pageNav.FileName = "/##/##/"; pageNav.TemplateFile = "/##/##/"; } } pageNav.SiteID = SiteData.CurrentSiteID; return pageNav; }
protected override void CreateChildControls() { string sScript = ControlUtilities.GetManifestResourceStream("Carrotware.CMS.UI.Controls.SearchBoxJS.txt"); if (SearchTemplate != null) { this.Controls.Clear(); } phEntry.Controls.Clear(); phEntry.Controls.Add(new jsHelperLib()); phEntry.Controls.Add(litScript); this.Controls.Add(phEntry); phEntry.Visible = true; if (this.SearchTemplate != null) { this.SearchTemplate.InstantiateIn(phEntry); } FindEntryFormCtrls(phEntry); TextBox txtSearchText = null; if (String.IsNullOrEmpty(OverrideTextboxName)) { txtSearchText = (TextBox)GetEntryFormControl("SearchText"); if (txtSearchText == null) { txtSearchText = (TextBox)GetEntryFormControl(typeof(TextBox)); } } else { txtSearchText = new TextBox(); txtSearchText.ID = "over_" + OverrideTextboxName; } if (txtSearchText != null) { sScript = sScript.Replace("{SEARCH_PARAM}", SiteData.SearchQueryParameter); sScript = sScript.Replace("{SEARCH_FUNC}", JS_SearchName); sScript = sScript.Replace("{SEARCH_ENTERFUNC}", JS_EnterSearch); sScript = sScript.Replace("{SEARCH_ENTERFUNC2}", JS_EnterSearch2); if (String.IsNullOrEmpty(OverrideTextboxName)) { sScript = sScript.Replace("{SEARCH_TEXT}", this.ClientID + "_" + txtSearchText.ID); } else { sScript = sScript.Replace("{SEARCH_TEXT}", OverrideTextboxName); } sScript = sScript.Replace("{SEARCH_URL}", SiteData.CurrentSite.SiteSearchPath); litScript.Text = sScript; } base.CreateChildControls(); }