protected void Page_Load(object sender, EventArgs e) { this.theme = GetTheme(); if (!Page.IsPostBack) { } }
protected override void OnPageLoad(object sender, EventArgs e) { this.theme = ThemeManager.Instance.GetByGuid(Data.Guid.New(Request.QueryString["tid"])); if (!Page.IsPostBack) { this.ThemeName.Text = theme.Name; LoadAvailableTemplates(theme); } }
/// <summary> /// Gets the templates which still need to be added to this theme /// </summary> /// <param name="theme"></param> /// <returns></returns> public IList<String> GetAvailableGlobalTemplateTypeNames(CmsTheme theme) { IList<CmsTemplate> associated = GetTemplates(theme); CmsTemplateDao dao = new CmsTemplateDao(); IList<CmsGlobalTemplateType> globals = dao.FindGlobalTemplateTypes(); IList<String> temp1 = new List<String>(); IList<String> temp2 = new List<String>(); foreach (CmsTemplate item in associated) temp1.Add(item.Name); foreach (CmsGlobalTemplateType global in globals) temp2.Add(global.Name); IEnumerable<String> available = temp2.Except<String>(temp1); return new List<String>(available); }
/// <summary> /// Gets the templates which are currently associated with the specified theme. /// </summary> /// <param name="theme"></param> /// <returns></returns> public IList<CmsTemplate> GetTemplates(CmsTheme theme) { CmsTemplateDao dao = new CmsTemplateDao(); return dao.FindByThemeId(theme.Id); }
private void LoadAvailableTemplates(CmsTheme theme) { this.TemplateType.Items.Clear(); IList<String> names = TemplateManager.Instance.GetAvailableGlobalTemplateTypeNames(theme); foreach (String name in names) { ListItem item = new ListItem(name, name); this.TemplateType.Items.Add(item); } IList<CmsTemplate> existings = TemplateManager.Instance.GetTemplates(this.theme); this.LstExistingTemplates.Items.Clear(); foreach (CmsTemplate template in existings) { ListItem item = new ListItem(template.Name, TextEncryption.Encode(template.Id.ToString())); this.LstExistingTemplates.Items.Add(item); } }