Exemplo n.º 1
0
 protected void dgEditExtras_itemdatabound(object sender, DataGridItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         cms.businesslogic.propertytype.PropertyType pt = cms.businesslogic.propertytype.PropertyType.GetPropertyType(int.Parse(((DataRowView)e.Item.DataItem).Row["id"].ToString()));
         ((CheckBox)e.Item.FindControl("ckbMemberCanEdit")).Checked = dt.MemberCanEdit(pt);
         ((CheckBox)e.Item.FindControl("ckbMemberCanView")).Checked = dt.ViewOnProfile(pt);
     }
 }
Exemplo n.º 2
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);
     }
 }
Exemplo n.º 3
0
 protected void saveExtras()
 {
     foreach (DataGridItem dgi in dgEditExtras.Items)
     {
         if (dgi.ItemType == ListItemType.Item || dgi.ItemType == ListItemType.AlternatingItem)
         {
             cms.businesslogic.propertytype.PropertyType pt = cms.businesslogic.propertytype.PropertyType.GetPropertyType(int.Parse(dgi.Cells[0].Text));
             dt.setMemberCanEdit(pt, ((CheckBox)dgi.FindControl("ckbMemberCanEdit")).Checked);
             dt.setMemberViewOnProfile(pt, ((CheckBox)dgi.FindControl("ckbMemberCanView")).Checked);
             dt.Save();
         }
     }
 }
        //PPH Handle doctype copies..
        private void HandleDocumentTypeCopy()
        {
            cms.businesslogic.web.DocumentType eDt = new umbraco.cms.businesslogic.web.DocumentType(int.Parse(helper.Request("id")));

            //Documentype exists.. create new doc type...
            if (eDt != null)
            {
                string Alias = rename.Text;
                cms.businesslogic.web.DocumentType dt = cms.businesslogic.web.DocumentType.MakeNew(base.getUser(), Alias.Replace("'", "''"));

                dt.IconUrl                    = eDt.IconUrl;
                dt.Thumbnail                  = eDt.Thumbnail;
                dt.Description                = eDt.Description;
                dt.allowedTemplates           = eDt.allowedTemplates;
                dt.DefaultTemplate            = eDt.DefaultTemplate;
                dt.AllowedChildContentTypeIDs = eDt.AllowedChildContentTypeIDs;

                dt.MasterContentType = int.Parse(masterType.SelectedValue);

                Hashtable oldNewTabIds = new Hashtable();
                foreach (cms.businesslogic.web.DocumentType.TabI tab in eDt.getVirtualTabs.ToList())
                {
                    if (tab.ContentType == eDt.Id)
                    {
                        int tId = dt.AddVirtualTab(tab.Caption);
                        oldNewTabIds.Add(tab.Id, tId);
                    }
                }

                foreach (cms.businesslogic.propertytype.PropertyType pt in eDt.PropertyTypes)
                {
                    if (pt.ContentTypeId == eDt.Id)
                    {
                        cms.businesslogic.propertytype.PropertyType nPt = umbraco.cms.businesslogic.propertytype.PropertyType.MakeNew(pt.DataTypeDefinition, dt, pt.Name, pt.Alias);
                        nPt.ValidationRegExp = pt.ValidationRegExp;
                        nPt.SortOrder        = pt.SortOrder;
                        nPt.Mandatory        = pt.Mandatory;
                        nPt.Description      = pt.Description;

                        if (pt.TabId > 0 && oldNewTabIds[pt.TabId] != null)
                        {
                            int newTabId = (int)oldNewTabIds[pt.TabId];
                            nPt.TabId = newTabId;
                        }
                    }
                }

                string returnUrl = SystemDirectories.Umbraco + "/settings/EditNodeTypeNew.aspx?id=" + dt.Id.ToString();

                dt.Save();


                pane_settings.Visible = false;
                panel_buttons.Visible = false;

                feedback.Text = "Document type copied";
                feedback.type = umbraco.uicontrols.Feedback.feedbacktype.success;

                ClientTools.ChangeContentFrameUrl(returnUrl);
            }
        }
Exemplo n.º 5
0
				public editor(cms.businesslogic.propertytype.PropertyType pt,ContentTypeControl parent) 
				{
					this.pt = pt;	
					ent = parent;
				}
Exemplo n.º 6
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;
                    }
                }
            }
        }
Exemplo n.º 7
0
 public editor(cms.businesslogic.propertytype.PropertyType pt, ContentTypeControl parent)
 {
     this.pt = pt;
     ent     = parent;
 }