public WidgetTypeData[] AppendWidgetPath(WidgetTypeData[] widgetTypes) { List<WidgetTypeData> widgetTypeList = new List<WidgetTypeData>(); foreach (Ektron.Cms.Widget.WidgetTypeData widget in widgetTypes) { if (widget.Scope == WidgetSpaceScope.SmartDesktop) { widget.ControlURL = m_refContentApi.RequestInformationRef.ApplicationPath + "widgets/" + widget.ControlURL.Replace("\\", "/"); } else { widget.ControlURL = m_refContentApi.RequestInformationRef.WidgetsPath + widget.ControlURL; } Ektron.Cms.Widget.WidgetTypeData widgettypeData = new Ektron.Cms.Widget.WidgetTypeData(); Ektron.Cms.Widget.IWidget chkIsIWidget; chkIsIWidget = Page.LoadControl(widget.ControlURL) as Ektron.Cms.Widget.IWidget; if (chkIsIWidget != null) { widgettypeData.Active = widget.Active; widgettypeData.ButtonText = widget.ButtonText; widgettypeData.ControlURL = widget.ControlURL; widgettypeData.ID = widget.ID; widgettypeData.Scope = widget.Scope; widgettypeData.Settings = widget.Settings; widgettypeData.Title = widget.Title; widgetTypeList.Add(widgettypeData); } } return widgetTypeList.ToArray(); }
private void saveGlobalWidgetProperties() { List<GlobalWidgetPropertySettings> settingsList = new List<GlobalWidgetPropertySettings>(); PropertyInfo[] globalProperties = this.GetType().GetProperties(); foreach (PropertyInfo pi in globalProperties) { GlobalWidgetPropertySettings setting = new GlobalWidgetPropertySettings(); GlobalWidgetData[] propertyAttributes = (GlobalWidgetData[])pi.GetCustomAttributes(typeof(GlobalWidgetData), true); if (propertyAttributes != null && propertyAttributes.Length > 0) { setting.PropertyName = pi.Name; setting.Type = pi.PropertyType; setting.value = pi.GetValue(this, null); settingsList.Add(setting); } } XmlSerializer serializer = new XmlSerializer(typeof(List<GlobalWidgetPropertySettings>)); StringWriter s = new StringWriter(); serializer.Serialize(s, settingsList); WidgetTypeData widgetData = new WidgetTypeData(); WidgetTypeModel m_refWidgetModel = new WidgetTypeModel(); m_refWidgetModel.FindByID(_host.WidgetInfo.ID, out widgetData); m_refWidgetModel.Update(widgetData.ID, widgetData.Title, widgetData.Title, widgetData.ControlURL, s.GetStringBuilder().ToString(), true); }
protected override void OnPreRender(EventArgs e) { //set widget token image path if (_userWidget != null) { hdnWidgetTokenImagePath.Value = _userWidget.TemplateSourceDirectory + "/" + _widget.ControlURL + ".jpg"; } if (_widget != null) { hdnWidgetTitle.Value = _widget.ControlURL.Substring(0, _widget.ControlURL.Length - 5); WidgetTypeModel wtm = new WidgetTypeModel(); WidgetTypeData wtd = new WidgetTypeData(); wtm.FindByControlURL(_widget.ControlURL, out wtd); if (wtd != null) { hdnwidgetTokenTypeId.Value = wtd.ID.ToString(); } } base.OnPreRender(e); }