Exemple #1
0
 protected void dgGenericPropertiesOfTab_itemcommand(object sender, DataGridCommandEventArgs e)
 {
     // Delete propertytype from contenttype
     if (e.CommandName == "Delete")
     {
         int propertyId = int.Parse(e.Item.Cells[0].Text);
         cms.businesslogic.propertytype.PropertyType pt = cms.businesslogic.propertytype.PropertyType.GetPropertyType(propertyId);
         RaiseBubbleEvent(new object(), new SaveClickEventArgs("Property ´" + pt.GetRawName() + "´ deleted"));
         pt.delete();
         bindDataGenericProperties(false);
     }
 }
Exemple #2
0
        public void UpdateInterface()
        {
            // Name and alias
            if (_pt != null)
            {
                _id = _pt.Id;
                //form.Attributes.Add("style", "display: none;");
                tbName.Text           = _pt.GetRawName();
                tbAlias.Text          = _pt.Alias;
                FullHeader.Text       = _pt.GetRawName() + " (" + _pt.Alias + "), Type: " + _pt.DataTypeDefinition.Text;;
                Header.Text           = _pt.GetRawName();
                DeleteButton.Visible  = true;
                DeleteButton.ImageUrl = SystemDirectories.Umbraco + "/images/delete_button.png";
                DeleteButton.Attributes.Add("style", "float: right; cursor: hand;");
                DeleteButton.Attributes.Add("onclick", "return confirm('" + ui.Text("areyousure", CurrentUser) + "');");
                DeleteButton2.Visible  = true;
                DeleteButton2.ImageUrl = SystemDirectories.Umbraco + "/images/delete_button.png";
                DeleteButton2.Attributes.Add("style", "float: right; cursor: hand;");
                DeleteButton2.Attributes.Add("onclick", "return confirm('" + ui.Text("areyousure", CurrentUser) + "');");
            }
            else
            {
                // Add new header
                FullHeader.Text = "Click here to add a new property";
                Header.Text     = "Create new property";

                // Hide image button
                DeleteButton.Visible  = false;
                DeleteButton2.Visible = false;
            }
            validationLink.NavigateUrl           = "#";
            validationLink.Attributes["onclick"] = ClientTools.Scripts.OpenModalWindow("dialogs/regexWs.aspx?target=" + tbValidation.ClientID, "Search for regular expression", 600, 500) + ";return false;";

            // Data type definitions
            if (_dataTypeDefinitions != null)
            {
                ddlTypes.Items.Clear();
                var itemSelected = false;
                foreach (cms.businesslogic.datatype.DataTypeDefinition dt in _dataTypeDefinitions)
                {
                    var li = new ListItem(dt.Text, dt.Id.ToString());
                    if ((_pt != null && _pt.DataTypeDefinition.Id == dt.Id))
                    {
                        li.Selected  = true;
                        itemSelected = true;
                    }

                    ddlTypes.Items.Add(li);
                }

                // If item not selected from previous edit or load, set to default according to settings
                if (!itemSelected)
                {
                    SetDefaultDocumentTypeProperty();
                }
            }

            // tabs
            if (_tabs != null)
            {
                ddlTab.Items.Clear();
                for (int i = 0; i < _tabs.Length; i++)
                {
                    ListItem li = new ListItem(_tabs[i].Caption, _tabs[i].Id.ToString());
                    if (_tabs[i].Id == _tabId)
                    {
                        li.Selected = true;
                    }
                    ddlTab.Items.Add(li);
                }
            }
            ListItem liGeneral = new ListItem("Generic Properties", "0");

            if (_tabId == 0)
            {
                liGeneral.Selected = true;
            }
            ddlTab.Items.Add(liGeneral);

            // mandatory
            if (_pt != null && _pt.Mandatory)
            {
                checkMandatory.Checked = true;
            }

            // validation
            if (_pt != null && string.IsNullOrEmpty(_pt.ValidationRegExp) == false)
            {
                tbValidation.Text = _pt.ValidationRegExp;
            }

            // description
            if (_pt != null && _pt.Description != "")
            {
                tbDescription.Text = _pt.GetRawDescription();
            }
        }