public DataType_PrevalueEditor(umbraco.cms.businesslogic.datatype.BaseDataType DataType)
 {
     //Log.Add(LogTypes.Debug, 0, "Prevalue Constructor");
     _datatype = DataType;
     jsonSerializer = new JavaScriptSerializer();
     savedOptions = Configuration;
     if (savedOptions == null)
         savedOptions = new TextBoxListOptions();
 }
        public TextBoxList_DataEditor(umbraco.interfaces.IData Data, TextBoxListOptions Configuration)
        {
            //load the prevalues
            options = Configuration;

            //ini the savedData object
            savedData = Data;

            //setupChildControls();
        }
Beispiel #3
0
        public void list(HtmlGenericControl widgetElementsDiv, WidgetElement schemaElement, XmlNode widgetNode)
        {
            //deserialize element prevalues
            ListOptions prevalues = jsonSerializer.Deserialize<ListOptions>(schemaElement.prevalues);

            HtmlGenericControl controlWrapper = buildControlWrapper(widgetElementsDiv, prevalues.elementName, prevalues.title, prevalues.description, schemaElement, widgetNode);

            DataInterface dataExtractor = new DataInterface();

            TextBoxListOptions listOptions = new TextBoxListOptions();
            listOptions.indentedLimit = prevalues.maxIndents.ToString();
            TextBoxList_DataEditor list = new TextBoxList_DataEditor(dataExtractor, listOptions);

            //get the value from the XML
            try
            {
                XmlNode element = widgetNode.SelectSingleNode(prevalues.elementName);
                dataExtractor.Value = element.InnerXml;
                list.currentData = element.InnerXml;
            }
            catch (Exception e)
            {
                dataExtractor.Value = "<list><item indent='0'/></list>";
            }

            HtmlGenericControl listWrapper = new HtmlGenericControl();
            listWrapper.Controls.Add(list);
            listWrapper.TagName = "div";
            listWrapper.Attributes["class"] = "widgetList " + prevalues.className;

            controlWrapper.Controls.Add(listWrapper);
        }