示例#1
0
 protected void ObjDs1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
 {
     var filter = new PigeonCms.AttributeFilter();
     e.InputParameters["filter"] = filter;
     e.Arguments.SortExpression = "Ordering";
 }
示例#2
0
    private void hideAttributes(int setId, bool isQuick = false)
    {
        if(setId > 0) {
            // QUI nascondere le dropdown in più
            var set = sman.GetByKey(setId);

            attributes.Clear();
            foreach (var attributeId in set.AttributesList)
            {
                var afilter = new AttributeFilter();
                attributes.Add(aman.GetByKey(attributeId));
            }
        }

        string quick = (isQuick) ? "Quick" : "";
        DropDownList d1 = new DropDownList();
        TextBox t1 = new TextBox();
        Literal l1 = new Literal();

        var allAttributes = aman.GetByFilter(new AttributeFilter(), "");
        var present = attributes;
        var exclude = attributes = allAttributes.Except(attributes).ToList();

        foreach (var attribute in exclude)
        {
            if (!attribute.AllowCustomValue)
            {
                if (!isQuick)
                {
                    d1 = (DropDownList)PanelAttributes.FindControl("DropAttributeValues" + attribute.Name);
                    l1 = (Literal)PanelAttributes.FindControl("LitAttributeName" + attribute.Name);
                }
                else
                {
                    d1 = (DropDownList)QuickAttributes.FindControl("DropAttributeValues" + quick + attribute.Name);
                    l1 = (Literal)PanelAttributes.FindControl("LitAttributeName" + quick + attribute.Name);
                }
                d1.Visible = false;
                l1.Visible = false;
            }
            else
            {
                if (!isQuick)
                {
                    t1 = (TextBox)PanelAttributes.FindControl("TxtCustomField" + attribute.Name);
                    l1 = (Literal)PanelAttributes.FindControl("LitAttributeName" + attribute.Name);
                }
                else
                {
                    t1 = (TextBox)QuickAttributes.FindControl("TxtCustomField" + quick + attribute.Name);
                    l1 = (Literal)PanelAttributes.FindControl("LitAttributeName" + quick + attribute.Name);
                }
                t1.Visible = false;
                l1.Visible = false;
            }
        }
        foreach (var attribute in present)
        {
            if (!attribute.AllowCustomValue)
            {
                if (!isQuick)
                {
                    d1 = (DropDownList)PanelAttributes.FindControl("DropAttributeValues" + attribute.Name);
                    l1 = (Literal)PanelAttributes.FindControl("LitAttributeName" + attribute.Name);
                }
                else
                {
                    d1 = (DropDownList)QuickAttributes.FindControl("DropAttributeValues" + quick + attribute.Name);
                    l1 = (Literal)PanelAttributes.FindControl("LitAttributeName" + quick + attribute.Name);
                }
                d1.Visible = true;
                l1.Visible = true;
            }
            else
            {
                if (!isQuick)
                {
                    t1 = (TextBox)PanelAttributes.FindControl("TxtCustomField" + attribute.Name);
                    l1 = (Literal)PanelAttributes.FindControl("LitAttributeName" + attribute.Name);
                }
                else
                {
                    t1 = (TextBox)QuickAttributes.FindControl("TxtCustomField" + quick + attribute.Name);
                    l1 = (Literal)PanelAttributes.FindControl("LitAttributeName" + quick + attribute.Name);
                }
                t1.Visible = true;
                l1.Visible = true;
            }
        }
    }
示例#3
0
    protected new void Page_Init(object sender, EventArgs e)
    {
        base.Page_Init(sender, e);
        ContentEditorProvider.InitEditor(this, Upd1, base.ContentEditorConfig);

        string titleId = "";
        foreach (KeyValuePair<string, string> item in Config.CultureList)
        {
            //title
            Panel pan1 = new Panel();
            pan1.CssClass = "form-group input-group";

            TextBox txt1 = new TextBox();
            txt1.ID = "TxtTitle" + item.Value;
            txt1.MaxLength = 200;
            txt1.CssClass = "form-control";
            txt1.ToolTip = item.Key;
            txt1.ClientIDMode = System.Web.UI.ClientIDMode.Static;
            LabelsProvider.SetLocalizedControlVisibility(this.ShowOnlyDefaultCulture, item.Key, txt1);
            pan1.Controls.Add(txt1);
            Literal lit1 = new Literal();
            if (!this.ShowOnlyDefaultCulture)
                lit1.Text = "<span class='input-group-addon'>" + item.Value + "</span>";
            pan1.Controls.Add(lit1);
            if (item.Key == Config.CultureDefault)
                titleId = txt1.ClientID;
            PanelTitle.Controls.Add(pan1);

            //description
            var txt2 = (Controls_ContentEditorControl)LoadControl("~/Controls/ContentEditorControl.ascx");
            txt2.ID = "TxtDescription" + item.Value;
            //txt2.CssClass = "adminMediumText";
            txt2.Configuration = base.ContentEditorConfig;
            LabelsProvider.SetLocalizedControlVisibility(this.ShowOnlyDefaultCulture, item.Key, txt2);
            PanelDescription.Controls.Add(txt2);

            Literal lit2 = new Literal();
            if (!this.ShowOnlyDefaultCulture)
                lit2.Text = "&nbsp;[<i>" + item.Value + "</i>]<br /><br />";
            PanelDescription.Controls.Add(lit2);
        }

        if (IsPostBack)
        {
            int setId = 0;
            int.TryParse(DropSets.SelectedValue, out setId);
            var afilter = new AttributeFilter();
            if (setId > 0)
            {
                var set = sman.GetByKey(setId);
                foreach (var attributeId in set.AttributesList)
                {
                    attributes.Add(aman.GetByKey(attributeId));
                }
            }
            else
            {
                attributes = aman.GetByFilter(afilter, "");
            }
            PanelAttributes.Controls.Add(generateAttributesDropDown());
            PanelAttributes.Controls.Add(generateAttributesTextBox());
            QuickAttributes.Controls.Add(generateAttributesDropDown(true));
            QuickAttributes.Controls.Add(generateAttributesTextBox(true));
        }

        if (this.BaseModule.DirectEditMode)
        {
        }

        TxtAlias.Attributes.Add("onfocus", "preloadAlias('" + titleId + "', this)");

        //restrictions
        Grid1.AllowSorting = false;
        Grid1.Columns[COL_ORDER_ARROWS_INDEX].Visible = this.AllowOrdering;
        Grid1.Columns[COL_UPLOADFILES_INDEX].Visible = this.TargetFilesUpload > 0;
        Grid1.Columns[COL_UPLOADIMAGES_INDEX].Visible = this.TargetImagesUpload > 0;
        Grid1.Columns[COL_DELETE_INDEX].Visible = base.AllowDelete;

        Grid1.Columns[COL_ALIAS_INDEX].Visible = this.ShowAlias;
        TxtAlias.Visible = this.ShowAlias;

        Grid1.Columns[COL_ACCESSTYPE_INDEX].Visible = this.ShowSecurity;
        PermissionsControl1.Visible = this.ShowSecurity;

        TxtItemDate.Visible = this.ShowDates;
        TxtValidFrom.Visible = this.ShowDates;
        TxtValidTo.Visible = this.ShowDates;

        DropEnabledFilter.Visible = this.ShowEnabledFilter;
        ItemFields1.Visible = this.ShowFieldsPanel;
        ItemParams1.Visible = this.ShowParamsPanel;

        ItemFields1.Title = base.GetLabel("LblFields", "Fields", null, true);
        ItemParams1.Title = base.GetLabel("LblParameters", "Parameters", null, true);
    }
示例#4
0
 protected void ObjDs2_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
 {
     var filter = new PigeonCms.AttributeFilter();
     e.InputParameters["filter"] = filter;
 }