Beispiel #1
0
        private void LoadTemplate(hitbl_WidgetTemplates_WTP template)
        {
            RcbTemplates.SelectedValue = template.WTP_ID.ToString();

            string styleRules = ".widget .top { } .widget .cnt { } .widget .cnt a { } .widget .bottom { }";

            if (!string.IsNullOrEmpty(template.WTP_XMLTemplate))
            {
                _4screen.CSB.DataAccess.Business.StyleSettingsWidget styleSettingsWidget = DataAccess.Business.StyleSettingsWidget.ParseXml(template.WTP_XMLTemplate);

                var           panelItems  = this.Rpb.GetAllItems();
                StyleSettings headerStyle = (StyleSettings)panelItems.ToList().Find(x => x.Value == "Header").FindControl("SP");
                headerStyle.SetStyleSettings(styleSettingsWidget.Header);

                StyleSettings contentStyle = (StyleSettings)panelItems.ToList().Find(x => x.Value == "Content").FindControl("SP");
                contentStyle.SetStyleSettings(styleSettingsWidget.Content);

                StyleSettings footerStyle = (StyleSettings)panelItems.ToList().Find(x => x.Value == "Footer").FindControl("SP");
                footerStyle.SetStyleSettings(styleSettingsWidget.Footer);

                TextBox customStyle = (TextBox)panelItems.ToList().Find(x => x.Value == "CustomStyle").FindControl("TxtStyle");
                customStyle.Text = styleSettingsWidget.CustomStyle;

                styleRules = styleSettingsWidget.CustomStyle;
            }

            this.LitStyles.Text = "<style type=\"text/css\" title=\"styles\">" + styleRules + "</style>";
        }
Beispiel #2
0
        public bool Save()
        {
            _4screen.CSB.DataAccess.Business.StyleSettingsWidget styleSettingsWidget = GetStyleSettings();

            CSBooster_DataContext dataContext = new CSBooster_DataContext(Helper.GetSiemeConnectionString());
            var widgetInstance = (from instances in dataContext.hitbl_WidgetInstance_INs.Where(x => x.INS_ID == InstanceId) select instances).FirstOrDefault();

            if (RcbTemplates.SelectedValue != Constants.DEFAULT_LAYOUTID)
            {
                dataContext.hisp_WidgetTemplates_ReduceCount(widgetInstance.INS_PAG_ID, widgetInstance.WTP_ID);

                var widgetTemplate = (from templates in dataContext.hitbl_WidgetTemplates_WTPs.Where(x => x.WTP_ID == widgetInstance.WTP_ID) select templates).FirstOrDefault();

                if (RcbTemplates.SelectedValue != "Custom")
                {
                    if (widgetTemplate != null && !widgetTemplate.WTP_ExplicitInserted)
                    {
                        dataContext.hitbl_WidgetTemplates_WTPs.DeleteOnSubmit(widgetTemplate);
                    }
                    widgetInstance.WTP_ID = RcbTemplates.SelectedValue.ToGuid();
                }
                else
                {
                    if (widgetTemplate == null || widgetTemplate.WTP_ExplicitInserted)
                    {
                        widgetTemplate                      = new hitbl_WidgetTemplates_WTP();
                        widgetTemplate.WTP_ID               = Guid.NewGuid();
                        widgetTemplate.UserID               = UserProfile.Current.UserId;
                        widgetTemplate.WTP_Name             = GetRandomName();
                        widgetTemplate.WTP_ExplicitInserted = false;
                        widgetTemplate.WTP_Template         = styleSettingsWidget.CustomStyle.Replace("widget", "widget_" + widgetTemplate.WTP_Name);
                        widgetTemplate.WTP_XMLTemplate      = styleSettingsWidget.GetXml();
                        dataContext.hitbl_WidgetTemplates_WTPs.InsertOnSubmit(widgetTemplate);

                        widgetInstance.WTP_ID = widgetTemplate.WTP_ID;
                    }
                    else
                    {
                        widgetTemplate.WTP_Template    = styleSettingsWidget.CustomStyle.Replace("widget", "widget_" + widgetTemplate.WTP_Name);
                        widgetTemplate.WTP_XMLTemplate = styleSettingsWidget.GetXml();
                    }
                }
                dataContext.SubmitChanges();

                dataContext.hisp_WidgetTemplates_IncreaseCount(widgetInstance.INS_PAG_ID, widgetInstance.WTP_ID);
            }
            else
            {
                widgetInstance.WTP_ID = Constants.DEFAULT_LAYOUTID.ToGuid();
                dataContext.SubmitChanges();
            }

            return(true);
        }
Beispiel #3
0
        protected void OnTemplateSaveClick(object sender, EventArgs e)
        {
            string templateName = RcbTemplates2.Text;

            _4screen.CSB.DataAccess.Business.StyleSettingsWidget styleSettingsWidget = GetStyleSettings();

            CSBooster_DataContext dataContext = new CSBooster_DataContext(Helper.GetSiemeConnectionString());
            var widgetTemplate = (from templates in dataContext.hitbl_WidgetTemplates_WTPs.Where(x => x.WTP_Name.ToLower() == templateName.ToLower()) select templates).FirstOrDefault();

            if (widgetTemplate == null)
            {
                widgetTemplate        = new hitbl_WidgetTemplates_WTP();
                widgetTemplate.WTP_ID = Guid.NewGuid();
                if (ParentDataObject.ObjectType == Helper.GetObjectTypeNumericID("Page") || ParentDataObject.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
                {
                    widgetTemplate.UserID = UserProfile.Current.UserId;
                }
                else if (ParentDataObject.ObjectType == Helper.GetObjectTypeNumericID("Community"))
                {
                    widgetTemplate.UserID = ParentDataObject.ObjectID;
                }
                widgetTemplate.WTP_Name             = templateName;
                widgetTemplate.WTP_ExplicitInserted = true;
                widgetTemplate.WTP_Template         = styleSettingsWidget.CustomStyle.Replace("widget", "widget_" + widgetTemplate.WTP_Name);
                widgetTemplate.WTP_XMLTemplate      = styleSettingsWidget.GetXml();
                dataContext.hitbl_WidgetTemplates_WTPs.InsertOnSubmit(widgetTemplate);
                dataContext.SubmitChanges();
                //this.LitStatus.Text = string.Format("<div class=\"CSB_wiz_msg\">{0}</div>", GuiLanguage.GetGuiLanguage("UserControls.WebUI.Base").GetString("MessageStyleSaved"));
                LoadTemplates();
                LoadTemplate(widgetTemplate);
            }
            else
            {
                if (((ParentDataObject.ObjectType == Helper.GetObjectTypeNumericID("Page") || ParentDataObject.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity")) && widgetTemplate.UserID == UserProfile.Current.UserId) ||
                    (ParentDataObject.ObjectType == Helper.GetObjectTypeNumericID("Community")) && widgetTemplate.UserID == ParentDataObject.ObjectID ||
                    UserDataContext.GetUserDataContext().IsAdmin)
                {
                    widgetTemplate.WTP_Template    = styleSettingsWidget.CustomStyle.Replace("widget", "widget_" + widgetTemplate.WTP_Name);
                    widgetTemplate.WTP_XMLTemplate = styleSettingsWidget.GetXml();
                    dataContext.SubmitChanges();
                    //this.LitStatus.Text = string.Format("<div class=\"CSB_wiz_msg\">{0}</div>", GuiLanguage.GetGuiLanguage("UserControls.WebUI.Base").GetString("MessageStyleSaved"));
                    LoadTemplates();
                    LoadTemplate(widgetTemplate);
                }
                else
                {
                    //this.LitStatus.Text = string.Format("<div class=\"CSB_wiz_msg\">{0}</div>", GuiLanguage.GetGuiLanguage("UserControls.WebUI.Base").GetString("ErrorMessageStyleNotSaved"));
                }
            }
        }