Exemple #1
0
        public override Control DataEditorControls(XmlNode xml, Dictionary <string, object> properties)
        {
            //properties should be multiType properties ie. Name, Description, Mandatory, Validation
            Panel pnlDataEditor = new Panel();

            Label lblDataEditor = new Label()
            {
                Text = properties["Name"].ToString()
            };
            Literal litDescription = new Literal()
            {
                Text = properties["Description"].ToString()
            };

            mpDataEditor = new SimpleMediaPicker();

            pnlDataEditor.Controls.Add(lblDataEditor);
            pnlDataEditor.Controls.Add(litDescription);
            pnlDataEditor.Controls.Add(mpDataEditor);

            if (xml != null)
            {
                //Anything special about the xml? no - just do innertext
                mpDataEditor.Value = xml.InnerText;
            }

            return(pnlDataEditor);
        }
        /// <summary>
        /// Creates child controls for this control
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();


            TreeTypeDropDown = new DropDownList {
                ID = "TreeTypeList"
            };
            TreeTypeDropDown.Items.Add(new ListItem("Content", "content"));
            TreeTypeDropDown.Items.Add(new ListItem("Media", "media"));
            TreeTypeDropDown.AutoPostBack = true;
            AddPreValueRow(MNTPResources.Lbl_SelectTreeType, "", TreeTypeDropDown);


            StartNodeSelectionTypeRadioButtons = new RadioButtonList {
                ID = "NodeSelectionTypeRadioButtons"
            };
            StartNodeSelectionTypeRadioButtons.Items.Add(MNTPResources.Item_NodeSelectionType_Picker);
            StartNodeSelectionTypeRadioButtons.Items.Add(new ListItem(MNTPResources.Item_NodeSelectionType_XPath, MNTPResources.Item_NodeSelectionType_XPath.Replace(" ", "")));
            StartNodeSelectionTypeRadioButtons.RepeatDirection = RepeatDirection.Horizontal;
            StartNodeSelectionTypeRadioButtons.AutoPostBack    = true;
            AddPreValueRow(MNTPResources.Lbl_NodeSelectionType, MNTPResources.Desc_NodeSelectionType, StartNodeSelectionTypeRadioButtons);


            StartContentNodeIdPicker = new SimpleContentPicker {
                ID = "StartNodeIdTextBox"
            };
            AddPreValueRow(MNTPResources.Lbl_StartNodeId, MNTPResources.Desc_StartNodeId, StartContentNodeIdPicker);

            StartMediaNodeIdPicker = new SimpleMediaPicker {
                ID = "StartMediaNodeIdPicker"
            };
            AddPreValueRow(MNTPResources.Lbl_StartNodeId, MNTPResources.Desc_StartNodeId, StartMediaNodeIdPicker);


            ShowThumbnailsForMediaCheckBox = new CheckBox {
                ID = "ShowThumbnailsForMedia"
            };
            AddPreValueRow(MNTPResources.Lbl_ShowThumbnails, MNTPResources.Desc_ShowThumbnails, ShowThumbnailsForMediaCheckBox);

            StartNodeXPathExpressionTypeRadioButtons = new RadioButtonList {
                ID = "XPathExpressionTypeRadioButtons"
            };
            StartNodeXPathExpressionTypeRadioButtons.Items.Add(MNTPResources.Item_XPathExpressionType_Global);
            StartNodeXPathExpressionTypeRadioButtons.Items.Add(new ListItem(MNTPResources.Item_XPathExpressionType_CurrentNode, MNTPResources.Item_XPathExpressionType_CurrentNode.Replace(" ", "")));
            StartNodeXPathExpressionTypeRadioButtons.RepeatDirection = RepeatDirection.Horizontal;
            AddPreValueRow(MNTPResources.Lbl_XPathExpressionType, MNTPResources.Desc_XPathExpressionType, StartNodeXPathExpressionTypeRadioButtons);

            StartNodeXPathExpressionTextBox = new TextBox {
                ID = "XPathExpressionTextBox", Width = Unit.Pixel(400)
            };
            RelativeXpathValidator = new CustomValidator()
            {
                ID = "RelativeXpathValidator",
                ControlToValidate = "XPathExpressionTextBox",
                ErrorMessage      = MNTPResources.Val_RelativeXpath,
                CssClass          = "validator"
            };
            RelativeXpathValidator.ServerValidate += new ServerValidateEventHandler(RelativeXpathValidator_ServerValidate);
            AddPreValueRow(MNTPResources.Lbl_XPathExpression, MNTPResources.Desc_XPathExpression, StartNodeXPathExpressionTextBox, RelativeXpathValidator);

            XPathFilterTypeRadioButtons = new RadioButtonList {
                ID = "XPathMatchTypeRadioButtons"
            };
            XPathFilterTypeRadioButtons.Items.Add(MNTPResources.Item_XPathMatchType_Disable);
            XPathFilterTypeRadioButtons.Items.Add(MNTPResources.Item_XPathMatchType_Enable);
            XPathFilterTypeRadioButtons.RepeatDirection = RepeatDirection.Horizontal;
            AddPreValueRow(MNTPResources.Lbl_XPathFilterType, MNTPResources.Desc_XPathFilterType, XPathFilterTypeRadioButtons);

            XPathFilterTextBox = new TextBox {
                ID = "XPathFilter", Width = Unit.Pixel(400)
            };
            AddPreValueRow(MNTPResources.Lbl_XPathFilter, MNTPResources.Desc_XPathFilter, XPathFilterTextBox);

            MaxItemsTextBox = new TextBox {
                ID = "MaxItemsCount", Width = Unit.Pixel(50)
            };
            NumbersMaxItemsValidator = new RegularExpressionValidator
            {
                ID = "NumbersMaxItemsValidator",
                ControlToValidate    = "MaxItemsCount",
                CssClass             = "validator",
                ErrorMessage         = MNTPResources.Val_MaxItemsMsg,
                ValidationExpression = @"^-{0,1}\d*\.{0,1}\d+$"
            };
            AddPreValueRow(MNTPResources.Lbl_MaxItemsAllowed, MNTPResources.Desc_MaxItemsAllowed, MaxItemsTextBox, NumbersMaxItemsValidator);

            MinItemsTextBox = new TextBox {
                ID = "MinItemsCount", Width = Unit.Pixel(50)
            };
            NumbersMinItemsValidator = new RegularExpressionValidator
            {
                ID = "NumbersMinItemsValidator",
                ControlToValidate    = "MinItemsCount",
                CssClass             = "validator",
                ErrorMessage         = MNTPResources.Val_MinItemsMsg,
                ValidationExpression = @"^\d{1,3}$"
            };
            AddPreValueRow(MNTPResources.Lbl_MinItemsAllowed, MNTPResources.Desc_MinItemsAllowed, MinItemsTextBox, NumbersMinItemsValidator);

            ShowItemInfoTooltipCheckBox = new CheckBox {
                ID = "ShowItemInfoTooltipCheckBox"
            };
            AddPreValueRow(MNTPResources.Lbl_ShowItemInfoTooltipCheckBox, MNTPResources.Desc_ShowTooltips, ShowItemInfoTooltipCheckBox);

            StoreAsCommaDelimitedRadioButtons = new RadioButtonList {
                ID = "StoreAsCommaDelimitedRadioButtons"
            };
            StoreAsCommaDelimitedRadioButtons.Items.Add("XML");
            StoreAsCommaDelimitedRadioButtons.Items.Add("CSV");
            StoreAsCommaDelimitedRadioButtons.RepeatDirection = RepeatDirection.Horizontal;
            AddPreValueRow(MNTPResources.Lbl_StoreAsComma, MNTPResources.Desc_StoreAsComma, StoreAsCommaDelimitedRadioButtons);

            ControlHeightTextBox = new TextBox()
            {
                ID = "ControlHeightTextBox", Width = Unit.Pixel(50)
            };
            ControlHeightValidatator = new RegularExpressionValidator
            {
                ID = "ControlHeightValidator",
                ControlToValidate    = "ControlHeightTextBox",
                CssClass             = "validator",
                ErrorMessage         = MNTPResources.Val_ControlHeightMsg,
                ValidationExpression = @"^\d{1,3}$"
            };
            AddPreValueRow(MNTPResources.Lbl_ControlHeight, "", ControlHeightTextBox, ControlHeightValidatator);
        }