Ejemplo n.º 1
0
        /// <summary>
        /// Initializes controls
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            base.OnLoad(e);
            PropertyPanel allowedPropertyPanel = new PropertyPanel();
            allowedPropertyPanel.Text = "Allowed Macros";
            allowedPropertyPanel.Controls.Add(_macroList);
            Controls.Add(allowedPropertyPanel);

            PropertyPanel numberPropertyPanel = new PropertyPanel();
            numberPropertyPanel.Text = "Max Number";
            _txtMaxNumber = new TextBox();
            _txtMaxNumber.ID = "maxnumber";
            numberPropertyPanel.Controls.Add(_txtMaxNumber);
            Controls.Add(numberPropertyPanel);

            PropertyPanel widthPropertyPanel = new PropertyPanel();
            widthPropertyPanel.Text = "Prefered width";
            _txtPreferedWidth = new TextBox();
            _txtPreferedWidth.ID = "prefwidth";
            widthPropertyPanel.Controls.Add(_txtPreferedWidth);
            Controls.Add(widthPropertyPanel);

            PropertyPanel heightPropertyPanel = new PropertyPanel();
            heightPropertyPanel.Text = "Prefered height";
            _txtPreferedHeight = new TextBox();
            _txtPreferedHeight.ID = "prefheight";
            heightPropertyPanel.Controls.Add(_txtPreferedHeight);
            Controls.Add(heightPropertyPanel);

        }
Ejemplo n.º 2
0
        public void addProperty(Control ctrl)
        {

            PropertyPanel pp = new PropertyPanel();
            pp.Controls.Add(ctrl);
            this.Controls.Add(pp);
        }
Ejemplo n.º 3
0
        public void addProperty(string Caption, Control C)
        {
            /*
             * tr = new TableRow();
             * td = new TableCell();
             * td.Text = Caption;
             * td.Attributes.Add("width", "15%");
             * td.Attributes.Add("valign", "top");
             * td.Attributes.Add("class", "propertyHeader");
             * tr.Cells.Add(td);
             *
             * td = new TableCell();
             * td.Attributes.Add("class", "propertyContent");
             * td.Controls.Add(C);
             * tr.Cells.Add(td);
             *
             * tbl.Rows.Add(tr);
             * if (!this.Controls.Contains(tbl)) {
             *  this.Controls.Add(tbl);
             * }*/
            PropertyPanel pp = new PropertyPanel();

            pp.Controls.Add(C);
            pp.Text = Caption;

            this.Controls.Add(pp);
        }
Ejemplo n.º 4
0
        public void addProperty(string Caption, Control C) {
            /*
            tr = new TableRow();
            td = new TableCell();
            td.Text = Caption;
            td.Attributes.Add("width", "15%");
            td.Attributes.Add("valign", "top");
            td.Attributes.Add("class", "propertyHeader");
            tr.Cells.Add(td);
                        
            td = new TableCell();
            td.Attributes.Add("class", "propertyContent");
            td.Controls.Add(C);
            tr.Cells.Add(td);

            tbl.Rows.Add(tr);
            if (!this.Controls.Contains(tbl)) {
                this.Controls.Add(tbl);
            }*/
            PropertyPanel pp = new PropertyPanel();
            pp.Controls.Add(C);
            pp.Text = Caption;

            this.Controls.Add(pp);
        }
Ejemplo n.º 5
0
        public void addProperty(Control ctrl)
        {
            PropertyPanel pp = new PropertyPanel();

            pp.Controls.Add(ctrl);
            this.Controls.Add(pp);
        }
Ejemplo n.º 6
0
        public void AddProperty(string caption, Control c)
        {

            PropertyPanel pp = new PropertyPanel();
            pp.Controls.Add(c);
            pp.Text = caption;

            this.Controls.Add(pp);
        }
Ejemplo n.º 7
0
        public void addProperty(string Caption, Control C)
        {

            PropertyPanel pp = new PropertyPanel();
            pp.Controls.Add(C);
            pp.Text = Caption;

            this.Controls.Add(pp);
        }
Ejemplo n.º 8
0
        public void addProperty(string Caption, Control C)
        {
            PropertyPanel pp = new PropertyPanel();

            pp.Controls.Add(C);
            pp.Text = Caption;

            this.Controls.Add(pp);
        }
Ejemplo n.º 9
0
        public void AddProperty(string caption, Control c)
        {
            PropertyPanel pp = new PropertyPanel();

            pp.Controls.Add(c);
            pp.Text = caption;

            this.Controls.Add(pp);
        }
Ejemplo n.º 10
0
        public void addProperty(string Caption, Control C, params BaseValidator[] validators)
        {
            PropertyPanel pp = new PropertyPanel();

            pp.Controls.Add(C);

            foreach (var validator in validators)
            {
                validator.Display = ValidatorDisplay.Dynamic;
                pp.Controls.Add(validator);
            }
            pp.Text = Caption;

            this.Controls.Add(pp);
        }
        private void AddFieldsetTextbox(Control rootContainer, string uid, bool isNew, string defaultValue)
        {
            var pane = Utility.FindControl<Pane>((Pane c) => c.GetType() == typeof(Pane), rootContainer);
            var container = new PropertyPanel { ID = "pane" + uid, CssClass = "propertyItem", Text = "Fieldset" };

            var nameBox = Utility.FindControl<TextBox>((TextBox c) => c.ClientID.EndsWith("tbAlias"), rootContainer);

            var textbox = new TextBox { ID = uid, CssClass = "propertyFormInput" };
            if (string.IsNullOrEmpty(textbox.Text))
                textbox.Text = defaultValue;
            if (isNew)
                textbox.Attributes["relatedTextbox"] = "ctl00$" + nameBox.ClientID.Replace("_", "$").Replace("GenericPropertyNew$control", "GenericPropertyNew_control"); // HACK
            else
                textbox.Attributes["relatedTextbox"] = "ctl00$" + nameBox.ClientID.Replace("_", "$").Replace("$gpw$", "$gpw_").Replace("$control$", "_control$"); // HACK
            // I don't think we're using this anymore :: textbox.TextChanged += textbox_TextChanged;
            container.Controls.Add(textbox);
            pane.Controls.Add(container);
        }
Ejemplo n.º 12
0
        public void addProperty(Control ctrl) {
            /*
            tr = new TableRow();
            td = new TableHeaderCell();
            td.ColumnSpan = 2;
            td.Attributes.Add("width", "100%");
            td.Attributes.Add("valign", "top");
            td.Attributes.Add("class", "propertyContent");
            td.Controls.Add(ctrl);
            tr.Cells.Add(td);
            tbl.Rows.Add(tr);
            if (!this.Controls.Contains(tbl)) {
                this.Controls.Add(tbl);
            }
             */

            PropertyPanel pp = new PropertyPanel();
            pp.Controls.Add(ctrl);
            this.Controls.Add(pp);
       }
Ejemplo n.º 13
0
        public void addProperty(Control ctrl)
        {
            /*
             * tr = new TableRow();
             * td = new TableHeaderCell();
             * td.ColumnSpan = 2;
             * td.Attributes.Add("width", "100%");
             * td.Attributes.Add("valign", "top");
             * td.Attributes.Add("class", "propertyContent");
             * td.Controls.Add(ctrl);
             * tr.Cells.Add(td);
             * tbl.Rows.Add(tr);
             * if (!this.Controls.Contains(tbl)) {
             *  this.Controls.Add(tbl);
             * }
             */

            PropertyPanel pp = new PropertyPanel();

            pp.Controls.Add(ctrl);
            this.Controls.Add(pp);
        }
        /// <summary>
        /// Instantiates the PrevalueEditor components.
        /// </summary>
        /// <param name="datatype">The datatype to use with this editor</param>
        public PrevalueEditor(BaseDataType datatype)
        {
            //instantiate the local m_datatype field with the given datatype
            _datatype = datatype;

            //The enclosing Umbraco panel to hold all other elements for this data type
            var ppEditPanel = new PropertyPanel { Text = "Content controls" };

            //Instantiate the property list, the add box, the add link, the JS custom scripts and the hidden value
            InstantiateHiddenValue(ppEditPanel);
            InstantiateHelpText(ppEditPanel);
            InstantiatePropertyList(ppEditPanel);
            InstantiateAddBox(ppEditPanel);
            InstantiateAddLink(ppEditPanel);
            InstantiateCustomScripts();
            Controls.Add(ppEditPanel);

            var ppShowLabelPanel = new PropertyPanel { Text = "Show label" };
            _showLabel = new CheckBox
                              {
                                  ID = "showLabel",
                                  Text = "",
                                  Checked = true
                              };
            ppShowLabelPanel.Controls.Add(_showLabel);
            Controls.Add(ppShowLabelPanel);

            var ppMaxCountPanel = new PropertyPanel { Text = "Max number of items (0 = no limit)" };
            _maxCount = new TextBox
            {
                ID = "maxCount",
                Text = ""
            };
            ppMaxCountPanel.Controls.Add(_maxCount);
            Controls.Add(ppMaxCountPanel);
        }
 private static void InstantiateHelpText(PropertyPanel ppEditPanel)
 {
     var sb = new StringBuilder();
     sb.Append("<div class=\"ECtop\">");
     sb.Append("<a href=\"#\" id=\"helpLink\" class=\"EChelplink\" title=\"show or hide help text\" onclick=\"TheFarm.Umbraco.EmbeddedContent.ToggleHelp();\"><div class=\"backgroundSpritePrevalue off\"></div></a>");
     sb.Append("<a href=\"#\" id=\"showValidation\" class=\"ECshowValidation\" title=\"hide or show validation in the list below\" onclick=\"TheFarm.Umbraco.EmbeddedContent.ToggleValidation();\"><div class=\"backgroundSpritePrevalue off\"></div></a>");
     sb.Append("<a href=\"#\" id=\"showRequired\" class=\"ECshowRequired\" title=\"hide or show required information in the list below\" onclick=\"TheFarm.Umbraco.EmbeddedContent.ToggleRequired();\"><div class=\"backgroundSpritePrevalue off\"></div></a>");
     sb.Append("<a href=\"#\" id=\"showTitle\" class=\"ECshowTitle\" title=\"hide or show 'show in title' information in the list below\" onclick=\"TheFarm.Umbraco.EmbeddedContent.ToggleTitle();\"><div class=\"backgroundSpritePrevalue off\"></div></a>");
     sb.Append("<a href=\"#\" id=\"showDescription\" class=\"ECshowDescription\" title=\"hide or show description in the list below\" onclick=\"TheFarm.Umbraco.EmbeddedContent.ToggleDescription();\"><div class=\"backgroundSpritePrevalue off\"></div></a>");
     sb.Append("<a href=\"#\" id=\"showType\" class=\"ECshowType\" title=\"hide or show type information in the list below\" onclick=\"TheFarm.Umbraco.EmbeddedContent.ToggleType();\"><div class=\"backgroundSpritePrevalue off\"></div></a>");
     sb.Append("</div>");
     sb.Append("<div id=\"helpText\"><div class=\"helpTextInner\">");
     sb.Append("This is a quick reference like overview of the control, you can find more information on how it works ");
     sb.Append("at various blog posts on <a href=\"http://farmcode.org\" target=\"_blank\">farmcode.org</a>. <br /><br />");
     sb.Append("You can think of the Embedded Content control as a complex data type. It produces pretty much the same ");
     sb.Append("XML as if you were creating a new document type (= create a new Embedded Content data type), add ");
     sb.Append("a range of properties to it of certain types (= add a new field to the Embedded Content data type list) and ");
     sb.Append("then allow the doc type to be placed under nother doc type. <br /><br />");
     sb.Append("Start by clicking on the 'add' below to open the add property box. Here is an explanation of the individual entries:");
     sb.Append("<br /><br />");
     sb.Append("<table>");
     sb.Append("<tr>");
     sb.Append("<td>Name</td><td>the name of the property, just for the editor</td>");
     sb.Append("</tr>");
     sb.Append("<tr>");
     sb.Append("<td>Alias</td><td>this is the name of the Xml node when data for this schema gets saved (see below for an example)</td>");
     sb.Append("</tr>");
     sb.Append("<tr>");
     sb.Append("<td>Type</td><td>the type of this property</td>");
     sb.Append("</tr>");
     sb.Append("<tr>");
     sb.Append("<td>Description</td><td>a short description for the purposes of the editor</td>");
     sb.Append("</tr>");
     sb.Append("<tr>");
     sb.Append("<td>Show in title?</td><td>if ticked then this property will be displayed in the content list which the content editor sees</td>");
     sb.Append("</tr>");
     sb.Append("<tr>");
     sb.Append("<td>Required?</td><td>tick if this field will be mandatory</td>");
     sb.Append("</tr>");
     sb.Append("<tr>");
     sb.Append("<td>Validation</td><td>enter a regular expression for validation on the content node</td>");
     sb.Append("</tr>");
     sb.Append("</table>");
     sb.Append("<br />");
     sb.Append("After you click on Add in the box the property will be added to your list. Once you have more than one property ");
     sb.Append("in the list you will be able to sort them by clicking on the darker drag handle to the left of each item ");
     sb.Append("and putting the item where you want it to be.");
     sb.Append("<br /><br />");
     sb.Append("EXAMPLE:");
     sb.Append("<br />");
     sb.Append("The following content definition");
     sb.Append("<br />");
     sb.Append("Property 1: Name:The first property; Alias: first; Type: Textstring; Required: true; Validation: ");
     sb.Append("<br />");
     sb.Append("Property 2: Name:The second property; Alias: second; Type: True/false; Required: false; Validation: ^[a-z]*$");
     sb.Append("<br /><br />");
     sb.Append("will be saved to the database as");
     sb.Append("<br />");
     sb.Append("&lt;data&gt;");
     sb.Append("<br />");
     sb.Append("&nbsp;&nbsp;&lt;item id=\"1\"&gt;");
     sb.Append("<br />");
     sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&lt;first&gt;{some value}&lt;/first&gt;");
     sb.Append("<br />");
     sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&lt;second&gt;{some value}&lt;/second&gt;");
     sb.Append("<br />");
     sb.Append("&nbsp;&nbsp;&lt;/item&gt;");
     sb.Append("<br />");
     sb.Append("&nbsp;&nbsp;&lt;item id=\"2\"&gt;");
     sb.Append("<br />");
     sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&lt;first&gt;{some value}&lt;/first&gt;");
     sb.Append("<br />");
     sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&lt;second&gt;{some value}&lt;/second&gt;");
     sb.Append("<br />");
     sb.Append("&nbsp;&nbsp;&lt;/item&gt;");
     sb.Append("<br />");
     sb.Append("&lt;/data&gt;");
     sb.Append("<br /><br />");
     sb.Append("</div></div>");
     var helpText = new Literal
                        {
                            Text = sb.ToString()
                        };
     ppEditPanel.Controls.Add(helpText);
 }
 /// <summary>
 /// Instantiates the add form box.
 /// </summary>
 /// <param name="ppEditPanel">The Panel to add the control to</param>
 private void InstantiateAddBox(PropertyPanel ppEditPanel)
 {
     _addBox = new Literal
     {
         ID = "addBox"
     };
     // ReSharper disable LocalizableElement
     _addBox.Text = "<div id=\"addBox\" class=\"ECaddBoxPrevalues\">" +
                    "<input type=\"hidden\" id=\"hiddenEditId\" />" +
                    "<table cellpadding=\"0\" cellspacing=\"0\">" +
                    "<tr>" +
                    "<td clase=\"vt\">" +
                    "Name:" +
                    "</td>" +
                    "<td class=\"pl10\">" +
                    "<input type=\"textbox\" id=\"name\" size=\"77\" />" +
                    "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td class=\"vt pt10\">" +
                    "Alias:" +
                    "</td>" +
                    "<td class=\"pl10 pt10\">" +
                    "<input type=\"textbox\" id=\"alias\" size=\"77\" />" +
                    "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td class=\"vt pt10\">" +
                    "Type:" +
                    "</td>" +
                    "<td class=\"pl10 pt10\">" +
                    "<select id=\"type\">" +
                    "<option value=\"Textstring\">Textstring</option>" +
                    "<option value=\"Textbox multiple\">Textbox multiple</option>" +
                    "<option value=\"True/false\">True/false</option>" +
                    "<option value=\"Content picker\">Content picker</option>" +
                    "<option value=\"Media picker\">Media picker</option>" +
                    "<option value=\"Simple editor\">Simple editor</option>" +
                    "<option value=\"Date picker\">Date picker</option>" +
                    "<option value=\"Richttext editor\">Richtext editor</option>";
     //foreach (var dataTypeDefinition in DataTypeDefinition.GetAll())
     //{
     //    _addBox.Text += "<option value=\"" + dataTypeDefinition.Id + "\">" + dataTypeDefinition.DataType.Id + ", " + dataTypeDefinition.Text + "</option>";
     //}
     _addBox.Text += "</select>" +
                    "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td class=\"vt pt10\">" +
                    "Description:<br /><small>please do not use '|' or '||'</small>" +
                    "</td>" +
                    "<td class=\"pl10 pt10\">" +
                    "<textarea id=\"description\" cols=\"47\" rows=\"5\"></textarea>" +
                    "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td class=\"vt pt10\">" +
                    "Show in title?" +
                    "</td>" +
                    "<td class=\"pl10 pt10\">" +
                    "<input type=\"checkbox\" id=\"showInTitle\" />" +
                    "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td class=\"vt pt10\">" +
                    "Required?" +
                    "<br /><small>If selected this will be a mandatory field</small>" +
                    "</td>" +
                    "<td class=\"pl10 pt10 vt\">" +
                    "<input type=\"checkbox\" id=\"required\" />" +
                    "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td class=\"vt pt10\">" +
                    "Validation:" +
                    "<br /><small>You can provide a regular expression that will be checked upon submission</small>" +
                    "</td>" +
                    "<td class=\"pl10 pt10 vt\">" +
                    "<input type=\"textbox\" id=\"validation\" size=\"77\" />" +
                    "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td>" +
                    "</td>" +
                    "<td class=\"pl10 pt10\">" +
                    "<a href=\"#\" id=\"addPropertyLink\" title=\"add new property\"><div class=\"ECbigButton\"></div></a>" +
                    "</td>" +
                    "</tr>" +
                    "</table>" +
                    "<a href=\"#\" id=\"closeLink\" title=\"close\"><div class=\"ECbigButton\"></div></a>" +
                    "</div>";
     // ReSharper restore LocalizableElement
     ppEditPanel.Controls.Add(_addBox);
 }
Ejemplo n.º 17
0
        private Control AddPanel(XmlNode node, Control c)
        {
            LiteralControl hide = AddShowOnceLink(node);
            if (node.Attributes.GetNamedItem("addPanel") != null &&
                node.Attributes.GetNamedItem("addPanel").Value == "true")
            {
                Pane p = new Pane();
                PropertyPanel pp = new PropertyPanel();
                if (node.Attributes.GetNamedItem("panelCaption") != null &&
                    !String.IsNullOrEmpty(node.Attributes.GetNamedItem("panelCaption").Value))
                {
                    string panelCaption = node.Attributes.GetNamedItem("panelCaption").Value;
                    if (panelCaption.StartsWith("#"))
                    {
                        panelCaption = ui.Text(panelCaption.Substring(1));
                    }
                    pp.Text = panelCaption;
                }
                // check for hide in the future link
                if (!String.IsNullOrEmpty(hide.Text))
                {
                    pp.Controls.Add(hide);
                }
                pp.Controls.Add(c);
                p.Controls.Add(pp);
                return p;
            }

            if (!String.IsNullOrEmpty(hide.Text))
            {
                PlaceHolder ph = new PlaceHolder();
                ph.Controls.Add(hide);
                ph.Controls.Add(c);
                return ph;
            }
            else
            {
                return c;
            }
        }
 /// <summary>
 /// Instantiates the hidden value control. It will be populated with data in the On_Load event
 /// </summary>
 /// <param name="ppEditPanel">The Panel to add the control to</param>
 private void InstantiateHiddenValue(PropertyPanel ppEditPanel)
 {
     _hiddenValue = new HtmlInputHidden
     {
         ID = "EChiddenValue",
         EnableViewState = false
     };
     ppEditPanel.Controls.Add(_hiddenValue);
     _hiddenSettings = new HtmlInputHidden
     {
         ID = "EChiddenSettings",
         EnableViewState = false
     };
     ppEditPanel.Controls.Add(_hiddenSettings);
 }
        private void setupChildControls()
        {
            HyperLink _logoImageLink = new HyperLink();

            _logoImageLink.ImageUrl = "/Umbraco/Api/Resource/GetEmbededPng?filename=settings-logo.png";
            _logoImageLink.NavigateUrl = "http://dejanstojanovic.net/umbraco-googlemap-editor";
            _logoImageLink.Target = "_blank";
            _logoImageLink.ID = "logoImage";
            PropertyPanel propertyPanel = new PropertyPanel();
            propertyPanel.Text = string.Empty;
            propertyPanel.Controls.Add(_logoImageLink);
            Controls.Add(propertyPanel);

            _txtWidth = new TextBox();
            _txtWidth.ID = "txtWidth";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Width & Height";
            propertyPanel.Controls.Add(_txtWidth);
            AddRequiredValidator(_txtWidth);

            propertyPanel.Controls.Add(new Literal() { Text = " x " });

            _txtHeight = new TextBox();
            _txtHeight.ID = "txtHeight";
            propertyPanel.Controls.Add(_txtHeight);
            AddRequiredValidator(_txtHeight);
            Controls.Add(propertyPanel);

            _txtZoom = new TextBox();
            _txtZoom.ID = "txtZoom";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Zoom";
            propertyPanel.Controls.Add(_txtZoom);
            AddRequiredValidator(_txtZoom);
            Controls.Add(propertyPanel);

            _cbSingleLocation = new CheckBox();
            _cbSingleLocation.ID = "cbSingleLocation";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Single location";
            propertyPanel.Controls.Add(_cbSingleLocation);
            Controls.Add(propertyPanel);

            _cbSearchBox = new CheckBox();
            _cbSearchBox.ID = "cbSearchBox";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Search box";
            propertyPanel.Controls.Add(_cbSearchBox);
            Controls.Add(propertyPanel);

            _cbRichText = new CheckBox();
            _cbRichText.ID = "cbRichText";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Rich text editor";
            propertyPanel.Controls.Add(_cbRichText);
            Controls.Add(propertyPanel);

            _txtCenterLatitude = new TextBox();
            _txtCenterLatitude.ID = "txtCenterLatitude";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Center latitude & longitude";
            propertyPanel.Controls.Add(_txtCenterLatitude);
            AddRequiredValidator(_txtCenterLatitude);

            propertyPanel.Controls.Add(new Literal() { Text = " : " });
            _txtCenterLongitude = new TextBox();
            _txtCenterLongitude.ID = "txtCenterLongitude";
            propertyPanel.Controls.Add(_txtCenterLongitude);
            AddRequiredValidator(_txtCenterLongitude);

            Controls.Add(propertyPanel);

            HtmlButton _htmlLocationButton = new HtmlButton();
            _htmlLocationButton.InnerText = "use my current location";
            _htmlLocationButton.ID = "btnGetLocation";
            _htmlLocationButton.Attributes.Add("class", "current-location");
            _htmlLocationButton.Attributes.Add("type", "button");
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "&nbsp;";
            propertyPanel.Controls.Add(_htmlLocationButton);
            Controls.Add(propertyPanel);

            _cblDrawingTools = new CheckBoxList();
            _cblDrawingTools.ID = "cblDRawingTools";

            _cblDrawingTools.Items.Add(new ListItem("Marker", "marker"));
            _cblDrawingTools.Items.Add(new ListItem("Polyline", "polyline"));
            _cblDrawingTools.Items.Add(new ListItem("Polygon", "polygon"));
            _cblDrawingTools.Items.Add(new ListItem("Circle", "circle"));
            _cblDrawingTools.Items.Add(new ListItem("Rectangle", "rectangle"));

            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Drawing tools";
            propertyPanel.Controls.Add(_cblDrawingTools);
            Controls.Add(propertyPanel);

            _cbZoomControl = new CheckBox();
            _cbZoomControl.ID = "cbZoomControl";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Zoom control";
            propertyPanel.Controls.Add(_cbZoomControl);
            Controls.Add(propertyPanel);

            _cbPanControl = new CheckBox();
            _cbPanControl.ID = "cbPanControl";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Pan control";
            propertyPanel.Controls.Add(_cbPanControl);
            Controls.Add(propertyPanel);

            _cbStreetViewControl = new CheckBox();
            _cbStreetViewControl.ID = "cbStreetViewControl";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "StreetView control";
            propertyPanel.Controls.Add(_cbStreetViewControl);
            Controls.Add(propertyPanel);

            _cbScaleControl = new CheckBox();
            _cbScaleControl.ID = "cbScaleControl";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Scale control";
            propertyPanel.Controls.Add(_cbScaleControl);
            Controls.Add(propertyPanel);

            _ddlLanguages = new DropDownList();
            _ddlLanguages.ID = "ddlLanguages";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Language in map editor";
            foreach (string supportedLanguage in Extensions.CultureInfoExtensions.GoogleMapsSupportedLanguageCodes)
            {
                CultureInfo culture;
                try
                {
                    culture = new CultureInfo(supportedLanguage);
                    _ddlLanguages.Items.Add(new ListItem(culture.EnglishName, supportedLanguage));
                }
                catch
                {
                    _ddlLanguages.Items.Add(new ListItem(supportedLanguage, supportedLanguage));
                }
            }
            propertyPanel.Controls.Add(_ddlLanguages);
            Controls.Add(propertyPanel);
        }
Ejemplo n.º 20
0
 private void BuildEditorForm(CaseInvariantNameValueCollection attributes = null)
 {
     plhEditor.Controls.Clear();
     if (string.IsNullOrEmpty(MacroAlias))
         return;
     var macro = Macro.GetByAlias(MacroAlias);
     foreach (var property in macro.Properties)
     {
         try
         {
             var type = Type.GetType(property.Type.Assembly + "." + property.Type.Type + "," + property.Type.Assembly);
             var control = Activator.CreateInstance(type) as Control;
             if (control != null && control is IMacroGuiRendering)
             {
                 control.ID = property.Alias;
                 if (attributes != null)
                 {
                     var propertyValue = attributes["umb_" + property.Alias];
                     if (propertyValue != null)
                     {
                         propertyValue = HttpUtility.UrlDecode(propertyValue.Replace(@"\r", "\r").Replace(@"\n", "\n").Replace("\\\"", "\""));
                         if (propertyValue != "")
                             type.GetProperty("Value").SetValue(control, Convert.ChangeType(propertyValue, type.GetProperty("Value").PropertyType), null);
                     }
                 }
                 var panel = new PropertyPanel { Text = property.Name };
                 panel.Controls.Add(control);
                 //this._scriptOnLoad = this._scriptOnLoad + "\t\tregisterAlias('" + control.ID + "');\n";
                 plhEditor.Controls.Add(panel);
                 _dataFields.Add(control);
             }
             else
             {
                 Trace.Warn("umbEditContent", "Type doesn't exist or is not umbraco.interfaces.DataFieldI ('" + property.Type.Assembly + "." + property.Type.Type + "')");
             }
         }
         catch (Exception exception)
         {
             Trace.Warn("umbEditContent", "Error creating type '" + property.Type.Assembly + "." + property.Type.Type + "'", exception);
         }
     }
 }
            public void InstantiateIn( Control container )
            {
                HiddenField hdfLanguageId = new HiddenField();
                hdfLanguageId.ID = "HdfLanguageId";
                container.Controls.Add( hdfLanguageId );

                PropertyPanel ppnlSettingHeader = new PropertyPanel();
                ppnlSettingHeader.ID = "PPNLSettingHeader";
                ppnlSettingHeader.Text = PaymentProviderTerms.Key;
                container.Controls.Add( ppnlSettingHeader );

                Label lblValueHeader = new Label();
                lblValueHeader.ID = "LblValueHeader";
                lblValueHeader.Text = PaymentProviderTerms.Value;
                lblValueHeader.Font.Bold = true;
                ppnlSettingHeader.Controls.Add( lblValueHeader );

                PlaceHolder itemPlaceHolder = new PlaceHolder() { ID = "itemPlaceHolder" };
                container.Controls.Add( itemPlaceHolder );
            }
 /// <summary>
 /// Instantiates the add link control.
 /// </summary>
 /// <param name="ppEditPanel">The Panel to add the control to</param>
 private void InstantiateAddLink(PropertyPanel ppEditPanel)
 {
     _addLink = new Literal
     {
         ID = "link",
     // ReSharper disable LocalizableElement
         Text = "<div class=\"ECaddLinkContainer\"><a href=\"#\" id=\"addLink\" title=\"add a new property\"><div class=\"ECbigButton\"></div></a></div>"
     // ReSharper restore LocalizableElement
     };
     ppEditPanel.Controls.Add(_addLink);
 }
        private Pane AddLanguagePane( int? languageId )
        {
            string strLanguageId = languageId != null ? languageId.Value.ToString() : string.Empty;

              Pane pane = new Pane();

              PropertyPanel ppnlSubject = new PropertyPanel();
              ppnlSubject.Text = CommonTerms.Subject;
              pane.Controls.Add( ppnlSubject );

              TextBox txtSubject = new TextBox();
              txtSubject.ID = "TxtSubject" + strLanguageId;
              txtSubject.CssClass = "guiInputText guiInputStandardSize";
              ppnlSubject.Controls.Add( txtSubject );

              PropertyPanel ppnlSenderName = new PropertyPanel();
              ppnlSenderName.Text = CommonTerms.SenderName;
              pane.Controls.Add( ppnlSenderName );

              TextBox txtSenderName = new TextBox();
              txtSenderName.ID = "TxtSenderName" + strLanguageId;
              txtSenderName.CssClass = "guiInputText guiInputStandardSize";
              ppnlSenderName.Controls.Add( txtSenderName );

              PropertyPanel ppnlSenderAddress = new PropertyPanel();
              ppnlSenderAddress.Text = CommonTerms.SenderAddress;
              pane.Controls.Add( ppnlSenderAddress );

              TextBox txtSenderAddress = new TextBox();
              txtSenderAddress.ID = "TxtSenderAddress" + strLanguageId;
              txtSenderAddress.CssClass = "guiInputText guiInputStandardSize";
              ppnlSenderAddress.Controls.Add( txtSenderAddress );

              CustomValidator cusValSenderAddress = new CustomValidator();
              cusValSenderAddress.ID = "CusValSenderAddress" + strLanguageId;
              cusValSenderAddress.ControlToValidate = txtSenderAddress.ID;
              cusValSenderAddress.ServerValidate += Email_ServerValidate;
              cusValSenderAddress.ErrorMessage = "*";
              ppnlSenderAddress.Controls.Add( cusValSenderAddress );

              PropertyPanel ppnlToAddresses = new PropertyPanel();
              ppnlToAddresses.Text = CommonTerms.ToAddresses + "<br /><small>" + CommonTerms.SeparateBySemicolon + "</small>";
              pane.Controls.Add( ppnlToAddresses );

              TextBox txtToAddresses = new TextBox();
              txtToAddresses.ID = "TxtToAddresses" + strLanguageId;
              txtToAddresses.CssClass = "guiInputText guiInputStandardSize";
              ppnlToAddresses.Controls.Add( txtToAddresses );

              CustomValidator cusValToAddresses = new CustomValidator();
              cusValToAddresses.ID = "CusValToAddresses" + strLanguageId;
              cusValToAddresses.ControlToValidate = txtToAddresses.ID;
              cusValToAddresses.ServerValidate += Email_ServerValidate;
              cusValToAddresses.ErrorMessage = "*";
              ppnlToAddresses.Controls.Add( cusValToAddresses );

              PropertyPanel ppnlCCAddresses = new PropertyPanel();
              ppnlCCAddresses.Text = CommonTerms.CCAddresses + "<br /><small>" + CommonTerms.SeparateBySemicolon + "</small>";
              pane.Controls.Add( ppnlCCAddresses );

              TextBox txtCCAddresses = new TextBox();
              txtCCAddresses.ID = "TxtCCAddresses" + strLanguageId;
              txtCCAddresses.CssClass = "guiInputText guiInputStandardSize";
              ppnlCCAddresses.Controls.Add( txtCCAddresses );

              CustomValidator cusValCCAddresses = new CustomValidator();
              cusValCCAddresses.ID = "CusValCCAddresses" + strLanguageId;
              cusValCCAddresses.ControlToValidate = txtCCAddresses.ID;
              cusValCCAddresses.ServerValidate += Email_ServerValidate;
              cusValCCAddresses.ErrorMessage = "*";
              ppnlCCAddresses.Controls.Add( cusValCCAddresses );

              PropertyPanel ppnlBCCAddresses = new PropertyPanel();
              ppnlBCCAddresses.Text = CommonTerms.BCCAddresses + "<br /><small>" + CommonTerms.SeparateBySemicolon + "</small>";
              pane.Controls.Add( ppnlBCCAddresses );

              TextBox txtBCCAddresses = new TextBox();
              txtBCCAddresses.ID = "TxtBCCAddresses" + strLanguageId;
              txtBCCAddresses.CssClass = "guiInputText guiInputStandardSize";
              ppnlBCCAddresses.Controls.Add( txtBCCAddresses );

              CustomValidator cusValBCCAddresses = new CustomValidator();
              cusValBCCAddresses.ID = "CusValBCCAddresses" + strLanguageId;
              cusValBCCAddresses.ControlToValidate = txtBCCAddresses.ID;
              cusValBCCAddresses.ServerValidate += Email_ServerValidate;
              cusValBCCAddresses.ErrorMessage = "*";
              ppnlBCCAddresses.Controls.Add( cusValBCCAddresses );

              PropertyPanel ppnlTemplate = new PropertyPanel();
              ppnlTemplate.Text = CommonTerms.TemplateFile;
              pane.Controls.Add( ppnlTemplate );

              TemplateFileSelector templateFileSelectorControl = new TemplateFileSelector();
              templateFileSelectorControl.ID = "TemplateFileSelectorControl" + strLanguageId;
              templateFileSelectorControl.InsertEmptyItem = true;
              ppnlTemplate.Controls.Add( templateFileSelectorControl );

              return pane;
        }
 /// <summary>
 /// Instantiates the property list. It will be populated with data in the On_Load event.
 /// </summary>
 /// <param name="ppEditPanel">The Panel to add the control to</param>
 private void InstantiatePropertyList(PropertyPanel ppEditPanel)
 {
     _propertyList = new Literal
     {
         ID = string.Format("propertyList{0}", _datatype.DataTypeDefinitionId)
     };
     ppEditPanel.Controls.Add(_propertyList);
 }