private void SetEditorToolbar()
    {
        EditorToolGroup foundgroup = null;

        foreach (EditorToolGroup tg in RadEditor1.Tools)
        {
            if (tg.Attributes["id"] == "placeholders")
            {
                foundgroup = tg;
            }
        }
        if (foundgroup != null)
        {
            RadEditor1.Tools.Remove(foundgroup);
        }

        EditorToolGroup main = new EditorToolGroup();

        main.Attributes["id"] = "placeholders";
        RadEditor1.Tools.Add(main);

        //add a custom dropdown and set its items and dimension attributes
        EditorDropDown ddn = new EditorDropDown("PlaceHolders");

        ddn.Text = "Place holders";

        //Set the popup width and height
        ddn.Attributes["width"]       = "110px";
        ddn.Attributes["popupwidth"]  = "240px";
        ddn.Attributes["popupheight"] = "200px";

        if (CurrentTemplateNameViewState != "")
        {
            TypedMailTemplate tmpl = TypedMailTemplate.FromName(CurrentTemplateNameViewState);

            foreach (string key in tmpl.Placeholders.Keys)
            {
                if (tmpl.Placeholders[key].TagOrId == TypedMailTemplate.PlaceholderType.Tag)
                {
                    ddn.Items.Add(tmpl.Placeholders[key].Label, " <span class='placeholder2' >%" + tmpl.Placeholders[key].Name + "%</span> ");
                }
                else if (tmpl.Placeholders[key].TagOrId == TypedMailTemplate.PlaceholderType.Id)
                {
                    ddn.Items.Add(tmpl.Placeholders[key].Label, " <div id=\"" + tmpl.Placeholders[key].Name + "\" class='placeholder1' > " + tmpl.Placeholders[key].Label + " </div> ");
                }
                else
                {
                    ddn.Items.Add(tmpl.Placeholders[key].Label, " <span id=\"" + tmpl.Placeholders[key].Name + "\" class='placeholder1' > <span class='placeholder2' >%" + tmpl.Placeholders[key].Name + "%</span> </span> ");
                }
            }
        }

        //Add tool to toolbar
        main.Tools.Add(ddn);
    }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Operations
            EditorToolGroup main = new EditorToolGroup();

            reExpression.Tools.Add(main);
            EditorTool opAdd = new EditorTool();

            opAdd.Name     = "Add";
            opAdd.ShowIcon = false;
            opAdd.ShowText = true;
            opAdd.Text     = "&nbsp;+&nbsp;";
            main.Tools.Add(opAdd);
            EditorTool opSub = new EditorTool();

            opSub.Name     = "Sub";
            opSub.ShowIcon = false;
            opSub.ShowText = true;
            opSub.Text     = "&nbsp;-&nbsp;";
            main.Tools.Add(opSub);
            EditorTool opMult = new EditorTool();

            opMult.Name     = "Multiple";
            opMult.ShowIcon = false;
            opMult.ShowText = true;
            opMult.Text     = "&nbsp;*&nbsp;";
            main.Tools.Add(opMult);
            EditorTool opDiv = new EditorTool();

            opDiv.Name     = "Divide";
            opDiv.ShowIcon = false;
            opDiv.ShowText = true;
            opDiv.Text     = "&nbsp;/&nbsp;";
            main.Tools.Add(opDiv);
            // ()
            EditorToolGroup scopes = new EditorToolGroup();

            reExpression.Tools.Add(scopes);
            EditorTool scOpen = new EditorTool();

            scOpen.Name     = "scOpen";
            scOpen.ShowIcon = false;
            scOpen.ShowText = true;
            scOpen.Text     = "&nbsp;(&nbsp;";
            scopes.Tools.Add(scOpen);
            EditorTool scClose = new EditorTool();

            scClose.Name     = "scClose";
            scClose.ShowIcon = false;
            scClose.ShowText = true;
            scClose.Text     = "&nbsp;)&nbsp;";
            scopes.Tools.Add(scClose);
            EditorTool scDot = new EditorTool();

            scDot.Name     = "scDot";
            scDot.ShowIcon = false;
            scDot.ShowText = true;
            scDot.Text     = "&nbsp;.&nbsp;";
            scopes.Tools.Add(scDot);
            //Metrics
            EditorToolGroup dynamicToolbar = new EditorToolGroup();

            reExpression.Tools.Add(dynamicToolbar);
            EditorDropDown ddn = new EditorDropDown("MetricDropdown");

            ddn.Text = "Available Metrics";
            ddn.Attributes["width"]       = "500px";
            ddn.Attributes["popupwidth"]  = "500px";
            ddn.Attributes["popupheight"] = "250px";
            List <Bll.Metric.Extend> _Metrics = Bll.Metric.GetBaseMetrics(MetricCategoryID, FrequencyID);

            foreach (Bll.Metric.Extend m in _Metrics)
            {
                ddn.Items.Add(m.Name, m.FormulaCode);
            }
            dynamicToolbar.Tools.Add(ddn);


            ddn      = new EditorDropDown("OrgLocationDropdown");
            ddn.Text = "Org Location Mode";
            ddn.Attributes["width"]       = "450px";
            ddn.Attributes["popupwidth"]  = "450px";
            ddn.Attributes["popupheight"] = "250px";
            ddn.Items.Add("Sum", "Sum(");
            ddn.Items.Add("Quantity", "Quantity(");
            ddn.Items.Add("Average", "Average(");
            ddn.Items.Add("RMS sum", "RMS_Sum(");
            ddn.Items.Add("RMS average", "RMS_average(");
            ddn.Items.Add("Org Location", "");
            dynamicToolbar.Tools.Add(ddn);
        }
 public EditorDropDownHtmlBuilder(EditorDropDown dropDown)
 {
     this.dropDown = dropDown;
 }
    private void SetEditorToolbar ()
    {
        EditorToolGroup foundgroup = null;
        foreach (EditorToolGroup tg in RadEditor1.Tools)
        {
            if (tg.Attributes["id"] == "placeholders")
                foundgroup = tg;
        }
        if (foundgroup != null)
            RadEditor1.Tools.Remove(foundgroup);

        EditorToolGroup main = new EditorToolGroup();

        main.Attributes["id"] = "placeholders";
        RadEditor1.Tools.Add(main);

        //add a custom dropdown and set its items and dimension attributes
        EditorDropDown ddn = new EditorDropDown("PlaceHolders");
        ddn.Text = "Place holders";

        //Set the popup width and height
        ddn.Attributes["width"] = "110px";
        ddn.Attributes["popupwidth"] = "240px";
        ddn.Attributes["popupheight"] = "200px";

        if (CurrentTemplateNameViewState != "")
        {
            TypedMailTemplate tmpl = TypedMailTemplate.FromName(CurrentTemplateNameViewState);

            foreach (string key in tmpl.Placeholders.Keys)
            {
                if (tmpl.Placeholders[key].TagOrId == TypedMailTemplate.PlaceholderType.Tag)
                {
                    ddn.Items.Add(tmpl.Placeholders[key].Label, " <span class='placeholder2' >%" + tmpl.Placeholders[key].Name + "%</span> ");
                }
                else if (tmpl.Placeholders[key].TagOrId == TypedMailTemplate.PlaceholderType.Id)
                {
                    ddn.Items.Add(tmpl.Placeholders[key].Label, " <div id=\"" + tmpl.Placeholders[key].Name + "\" class='placeholder1' > " + tmpl.Placeholders[key].Label + " </div> ");
                }
                else
                {
                    ddn.Items.Add(tmpl.Placeholders[key].Label, " <span id=\"" + tmpl.Placeholders[key].Name + "\" class='placeholder1' > <span class='placeholder2' >%" + tmpl.Placeholders[key].Name + "%</span> </span> ");
                }
            }
        }

        //Add tool to toolbar
        main.Tools.Add(ddn);
    }
 public EditorDropDownHtmlBuilder(EditorDropDown dropDown)
 {
     this.dropDown = dropDown;
 }