Пример #1
0
 public void UpdateEditControl()
 {
     if (Controls.Count == 1)
     {
         var u = Controls[0];
         u.ID                    = ID + "_control";
         _gp                     = (GenericProperty)u;
         _gp.PropertyType        = PropertyType;
         _gp.DataTypeDefinitions = _dtds;
         _gp.Tabs                = _tabs;
         _gp.TabId               = _tabId;
         _gp.FullId              = _fullId;
     }
 }
Пример #2
0
 public void UpdateEditControl()
 {
     if (this.Controls.Count == 1)
     {
         System.Web.UI.Control u = this.Controls[0];
         u.ID                    = this.ID + "_control";
         _gp                     = (GenericProperty)u;
         _gp.PropertyType        = _pt;
         _gp.DataTypeDefinitions = _dtds;
         _gp.Tabs                = _tabs;
         _gp.TabId               = _tabId;
         _gp.FullId              = _fullId;
     }
 }
		public void UpdateEditControl() 
		{
			if (this.Controls.Count == 1) 
			{
				System.Web.UI.Control u = this.Controls[0];
				u.ID = this.ID + "_control";
				_gp = (GenericProperty) u;
				_gp.PropertyType = _pt;
				_gp.DataTypeDefinitions = _dtds;
				_gp.Tabs = _tabs;
				_gp.TabId = _tabId;
				_gp.FullId = _fullId;
			}
		}
 private bool DoesPropertyTypeAliasExist(GenericProperty gpData)
 {
     bool hasAlias = _contentType.getPropertyType(Casing.SafeAliasWithForcingCheck(gpData.Alias.Trim())) != null;
     ContentType ct = _contentType;
     while (ct.MasterContentType > 0)
     {
         ct = new ContentType(ct.MasterContentType);
         hasAlias = ct.getPropertyType(Casing.SafeAliasWithForcingCheck(gpData.Alias.Trim())) != null;
     }
     return !hasAlias;
 }
Пример #5
0
        private void saveProperties(ref SaveClickEventArgs e)
        {
            this.CreateChildControls();

            GenericProperties.GenericProperty gpData = gp.GenricPropertyControl;
            if (gpData.Name.Trim() != "" && gpData.Alias.Trim() != "")
            {
                if (doesPropertyTypeAliasExist(gpData))
                {
                    string[] info = { gpData.Name, gpData.Type.ToString() };
                    cms.businesslogic.propertytype.PropertyType pt = cType.AddPropertyType(cms.businesslogic.datatype.DataTypeDefinition.GetDataTypeDefinition(gpData.Type), Casing.SafeAliasWithForcingCheck(gpData.Alias.Trim()), gpData.Name);
                    pt.Mandatory        = gpData.Mandatory;
                    pt.ValidationRegExp = gpData.Validation;
                    pt.Description      = gpData.Description;

                    if (gpData.Tab != 0)
                    {
                        cType.SetTabOnPropertyType(pt, gpData.Tab);
                    }

                    gpData.Clear();
                }
                else
                {
                    e.Message  = ui.Text("contentTypeDublicatePropertyType");
                    e.IconType = umbraco.BasePages.BasePage.speechBubbleIcon.warning;
                }
            }

            foreach (GenericProperties.GenericPropertyWrapper gpw in _genericProperties)
            {
                cms.businesslogic.propertytype.PropertyType pt = gpw.PropertyType;
                pt.Alias              = gpw.GenricPropertyControl.Alias;
                pt.Name               = gpw.GenricPropertyControl.Name;
                pt.Description        = gpw.GenricPropertyControl.Description;
                pt.ValidationRegExp   = gpw.GenricPropertyControl.Validation;
                pt.Mandatory          = gpw.GenricPropertyControl.Mandatory;
                pt.DataTypeDefinition = cms.businesslogic.datatype.DataTypeDefinition.GetDataTypeDefinition(gpw.GenricPropertyControl.Type);
                if (gpw.GenricPropertyControl.Tab == 0)
                {
                    cType.removePropertyTypeFromTab(pt);
                }
                else
                {
                    cType.SetTabOnPropertyType(pt, gpw.GenricPropertyControl.Tab);
                }

                pt.Save();
            }

            // Sort order
            foreach (HtmlInputHidden propSorter in _sortLists)
            {
                if (propSorter.Value.Trim() != "")
                {
                    string tabId = propSorter.ID;
                    // remove leading "propSort_" and trailing "_Content"
                    tabId = tabId.Substring(9, tabId.Length - 9 - 8);
                    // calc the position of the prop SO i.e. after "t_<tabId>Contents[]="
                    int propSOPosition = "t_".Length + tabId.Length + "Contents[]=".Length + 1;

                    string[] tempSO = propSorter.Value.Split("&".ToCharArray());
                    for (int i = 0; i < tempSO.Length; i++)
                    {
                        string propSO           = tempSO[i].Substring(propSOPosition);
                        int    currentSortOrder = int.Parse(propSO);
                        cms.businesslogic.propertytype.PropertyType.GetPropertyType(currentSortOrder).SortOrder = i;
                    }
                }
            }
        }