protected void Page_Load(object sender, System.EventArgs e) { pp_name.Text = ui.Text("name"); pp_renderControl.Text = ui.Text("renderControl"); pane_settings.Text = ui.Text("settings"); pp_guid.Text = ui.Text("guid"); _id = int.Parse(Request.QueryString["id"]); dt = cms.businesslogic.datatype.DataTypeDefinition.GetDataTypeDefinition(_id); f = new cms.businesslogic.datatype.controls.Factory(); if (!IsPostBack) { txtName.Text = dt.Text; SortedList datatypes = new SortedList(); foreach (interfaces.IDataType df in f.GetAll()) { datatypes.Add(df.DataTypeName + "|" + Guid.NewGuid().ToString(), df.Id); } IDictionaryEnumerator ide = datatypes.GetEnumerator(); string datatTypeId = dt.DataType != null?dt.DataType.Id.ToString() : String.Empty; while (ide.MoveNext()) { ListItem li = new ListItem(); li.Text = ide.Key.ToString().Substring(0, ide.Key.ToString().IndexOf("|")); li.Value = ide.Value.ToString(); if (!String.IsNullOrEmpty(datatTypeId) && li.Value.ToString() == datatTypeId) { li.Selected = true; } ddlRenderControl.Items.Add(li); } ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadDataTypes>().Tree.Alias) .SyncTree(_id.ToString(), false); } if (dt.DataType != null) { litGuid.Text = dt.DataType.Id.ToString(); } Panel1.Text = umbraco.ui.Text("edit") + " datatype: " + dt.Text; insertPrevalueEditor(); }
protected void Page_Load(object sender, System.EventArgs e) { pp_name.Text = ui.Text("name"); pp_renderControl.Text = ui.Text("renderControl"); pane_settings.Text = ui.Text("settings"); pp_guid.Text = ui.Text("guid"); _id = int.Parse(Request.QueryString["id"]); dt = cms.businesslogic.datatype.DataTypeDefinition.GetDataTypeDefinition(_id); f = new cms.businesslogic.datatype.controls.Factory(); if (!IsPostBack) { txtName.Text = dt.Text; SortedList datatypes = new SortedList(); foreach (interfaces.IDataType df in f.GetAll()) datatypes.Add(df.DataTypeName + "|" + Guid.NewGuid().ToString(), df.Id); IDictionaryEnumerator ide = datatypes.GetEnumerator(); string datatTypeId = dt.DataType != null ? dt.DataType.Id.ToString() : String.Empty; while (ide.MoveNext()) { ListItem li = new ListItem(); li.Text = ide.Key.ToString().Substring(0, ide.Key.ToString().IndexOf("|")); li.Value = ide.Value.ToString(); //SJ Fixes U4-2488 Edit datatype: Media Picker appears incorrectly //Apparently in some installs the media picker rendercontrol is installed twice with //the exact same ID so we need to check for duplicates if (ddlRenderControl.Items.Contains(li)) continue; if (!String.IsNullOrEmpty(datatTypeId) && li.Value.ToString() == datatTypeId) li.Selected = true; ddlRenderControl.Items.Add(li); } ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadDataTypes>().Tree.Alias) .SyncTree("-1,init," + _id.ToString(), false); } if (dt.DataType != null) litGuid.Text = dt.DataType.Id.ToString(); Panel1.Text = umbraco.ui.Text("edit") + " datatype: " + dt.Text; insertPrevalueEditor(); }
/// <summary> /// Creates a new datatypedefinition given its name and the user which creates it. /// </summary> /// <param name="u">The user who creates the datatypedefinition</param> /// <param name="Text">The name of the DataTypeDefinition</param> /// <param name="UniqueId">Overrides the CMSnodes uniqueID</param> /// <returns></returns> public static DataTypeDefinition MakeNew(BusinessLogic.User u, string Text, Guid UniqueId) { int newId = CMSNode.MakeNew(-1, _objectType, u.Id, 1, Text, UniqueId).Id; cms.businesslogic.datatype.controls.Factory f = new cms.businesslogic.datatype.controls.Factory(); // initial control id changed to empty to ensure that it'll always work no matter if 3rd party configurators fail // ref: http://umbraco.codeplex.com/workitem/29788 Guid FirstcontrolId = Guid.Empty; SqlHelper.ExecuteNonQuery("Insert into cmsDataType (nodeId, controlId, dbType) values (" + newId.ToString() + ",@controlId,'Ntext')", SqlHelper.CreateParameter("@controlId", FirstcontrolId)); DataTypeDefinition dtd = new DataTypeDefinition(newId); dtd.OnNew(EventArgs.Empty); return(dtd); }
/// <summary> /// Creates a new datatypedefinition given its name and the user which creates it. /// </summary> /// <param name="u">The user who creates the datatypedefinition</param> /// <param name="Text">The name of the DataTypeDefinition</param> /// <param name="UniqueId">Overrides the CMSnodes uniqueID</param> /// <returns></returns> public static DataTypeDefinition MakeNew(BusinessLogic.User u, string Text, Guid UniqueId) { int newId = CMSNode.MakeNew(-1, _objectType, u.Id, 1, Text, UniqueId).Id; cms.businesslogic.datatype.controls.Factory f = new cms.businesslogic.datatype.controls.Factory(); // initial control id changed to empty to ensure that it'll always work no matter if 3rd party configurators fail // ref: http://umbraco.codeplex.com/workitem/29788 Guid FirstcontrolId = Guid.Empty; SqlHelper.ExecuteNonQuery("Insert into cmsDataType (nodeId, controlId, dbType) values (" + newId.ToString() + ",@controlId,'Ntext')", SqlHelper.CreateParameter("@controlId", FirstcontrolId)); DataTypeDefinition dtd = new DataTypeDefinition(newId); dtd.OnNew(EventArgs.Empty); return dtd; }