protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext)
        {
            var excludeSubTree = this.Request.QueryString["superOf"];

            var exceptOrg = this.Request.QueryString["exceptOrg"];

            var exceptID = excludeSubTree ?? exceptOrg;

            bool godBehavior = callBackContext == "godMode";

            if (excludeSubTree != parentNode.Value)
            {
                PC.SCObjectAndRelationCollection relations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(PC.SchemaInfo.FilterByCategory("Organizations").ToSchemaNames(), new string[] { parentNode.Value }, false, true, false, DateTime.MinValue);

                var pmLimitString = this.Request.QueryString.Get("permission");

                var requiredPermissions = pmLimitString != null?pmLimitString.Split(',') : null;

                PC.Permissions.SCContainerAndPermissionCollection permissions = null;

                if (requiredPermissions != null)
                {
                    permissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, relations.ToIDArray());
                }

                BindObjectsToTreeNodes(relations, result, godBehavior, requiredPermissions, permissions, excludeSubTree, exceptID);
            }
        }
		private void InitTreeNodes(WfApplicationCollection applications)
		{
			DeluxeTreeNode rootNode = new DeluxeTreeNode(TreeRootText, TreeRootText)
			{
				NodeOpenImg = "../images/computer.gif",
				NodeCloseImg = "../images/computer.gif",
				Expanded = true
			};

			AddDefaultTreeNode(rootNode);

			foreach (WfApplication app in applications)
			{
				DeluxeTreeNode node = new DeluxeTreeNode(app.Name, app.CodeName)
				{
					ToolTip = app.CodeName,
					NodeOpenImg = "../images/accomplished.gif",
					NodeCloseImg = "../images/accomplished.gif",
					ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading
				};

				rootNode.Nodes.Add(node);
			}

			tree.Nodes.Add(rootNode);
		}
        protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext)
        {
            switch ((string)parentNode.ExtendedData)
            {
            case "Category":
            {
                var subCates = AUClient.ServiceBroker.AUCenterQueryService.Instance.GetSubCategories(parentNode.Value, true);
                foreach (var item in subCates)
                {
                    result.Add(CreateNode(item));
                }

                var subSchemas = AUClient.ServiceBroker.AUCenterQueryService.Instance.GetAUSchemaByCategory(parentNode.Value, true);
                foreach (var item in subSchemas)
                {
                    result.Add(CreateNode(item));
                }
            }
            break;

            case "AUSchema":
            {
                var schemaRoles = AUClient.ServiceBroker.AUCenterQueryService.Instance.GetMembers(parentNode.Value, new string[] { "AUSchemaRoles" }, true);
                foreach (AUClient.ClientAUSchemaRole item in schemaRoles)
                {
                    result.Add(CreateNode(item));
                }
            }
            break;

            default:
                break;
            }
        }
Beispiel #4
0
        /// <summary>
        /// unindent the node
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _unindentButton_Click(object sender, EventArgs e)
        {
            TreeNode       node  = this._treeView.SelectedNode;
            DeluxeTreeNode oItem = (DeluxeTreeNode)_treeView.SelectedNode.Tag;

            if (node != null)
            {
                TreeNode       node2  = node.Parent;
                DeluxeTreeNode oItem2 = oItem.Parent;
                if (node2 != null)
                {
                    TreeNodeCollection       collection1     = this._treeView.Nodes;
                    DeluxeTreeNodeCollection oItemCollection = _navBar.Nodes;
                    if (node2.Parent != null)
                    {
                        collection1     = node2.Parent.Nodes;
                        oItemCollection = oItem2.Parent.Nodes;
                    }
                    if (node2 != null)
                    {
                        node.Remove();
                        RemoveTreeItem(oItem);
                        collection1.Insert(node2.Index + 1, node);
                        oItemCollection.AddAt(oItemCollection.IndexOf(oItem2) + 1, oItem);
                        this._treeView.SelectedNode = node;
                    }
                }
            }
        }
Beispiel #5
0
        private string GetDesignTimeNodeImage(DeluxeTreeNode node, bool expanded)
        {
            string result = string.Empty;

            if (expanded)
            {
                result = node.NodeOpenImg;

                if (result == string.Empty)
                {
                    result = this.NodeOpenImg;
                }
            }
            else
            {
                result = node.NodeCloseImg;

                if (result == string.Empty)
                {
                    result = this.NodeCloseImg;
                }
            }

            return(result);
        }
        /// <summary>
        /// 设置TreeNode的属性
        /// </summary>
        /// <param name="node">TreeNode</param>
        /// <param name="materialNode">MaterialTreeNode</param>
        private void InitNode(DeluxeTreeNode node, MaterialTreeNode materialNode)
        {
            node.ToolTip          = "点击打开文件";
            node.Expanded         = true;
            node.SelectedCssClass = " ";
            node.Html             = string.Format("[{0}]<a href=\"{1}?requestType=download&rootPathName={2}&controlID={3}&fileName={4}&pathType={5}&filePath={6}&fileReadonly=true&userID={7}\" target=\"_blank\" >{8}</a>",
                                                  (materialNode.Material.Department != null) ? materialNode.Material.Department.DisplayName : string.Empty,
                                                  this.CurrentPageUrl,
                                                  WebUtility.GetRequestQueryValue("rootPathName", string.Empty),
                                                  WebUtility.GetRequestQueryValue("controlID", string.Empty),
                                                  materialNode.Material.OriginalName,
                                                  Convert.ToInt16(PathType.relative),
                                                  HttpUtility.UrlEncode(materialNode.Material.RelativeFilePath),
                                                  this.userID,
                                                  HttpUtility.HtmlEncode(materialNode.Material.Title));

            if (!string.IsNullOrEmpty(materialNode.Material.RelativeFilePath))
            {
                string fileName = Path.GetFileName(materialNode.Material.RelativeFilePath);

                string fileIconPath = FileConfigHelper.GetFileIconPath(fileName);

                if (fileIconPath != string.Empty)
                {
                    node.NodeCloseImg = fileIconPath;
                    node.NodeOpenImg  = fileIconPath;
                }
            }
        }
Beispiel #7
0
        protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext)
        {
            if (parentNode.ExtendedData.ToString() == "category")
            {
                var subCates = AU.Adapters.SchemaCategoryAdapter.Instance.LoadSubCategories(parentNode.Value);

                foreach (var item in subCates)
                {
                    DeluxeTreeNode node = CreateTreeNode(item.ID, item.Name, item.Name, item.Name);
                    node.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading;
                    node.ExtendedData          = "category";
                    node.Expanded = false;
                    result.Add(node);
                }
            }

            var subUnits = AU.Adapters.AUSnapshotAdapter.Instance.LoadAUSchemaByCategory(parentNode.Value, true, DateTime.MinValue);

            foreach (AU.AUSchema item in subUnits)
            {
                DeluxeTreeNode node = CreateTreeNode(item.ID, item.Name, item.DisplayName, item.Name);
                node.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal;
                node.NodeOpenImg           = "Images/blocks.png";
                node.NodeCloseImg          = "Images/blocks.png";
                node.ExtendedData          = "schema";
                node.Expanded = false;
                result.Add(node);
            }
        }
        private void tree_GetChildrenData(DeluxeTreeNode parentNode, DeluxeTreeNodeCollection result, string callBackContext)
        {
            ServiceBrokerContext.Current.SaveContextStates();
            try
            {
                InnerTreeContext context = JSONSerializerExecute.Deserialize <InnerTreeContext>(callBackContext);

                if (context.ShowDeletedObjects)
                {
                    ServiceBrokerContext.Current.UseLocalCache       = false;
                    ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.All;
                }
                else
                {
                    ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.Common;
                }

                OguObjectCollection <IOguObject> parents = UserOUControlSettings.GetConfig().UserOUControlQuery.GetObjects(((IOguObject)parentNode.ExtendedData).ID);

                if (parents.Count > 0)
                {
                    BindChildren(result, OnGetChildren(parents[0]), context.MultiSelect, context.ListMask, context.SelectMask);
                }
            }
            finally
            {
                ServiceBrokerContext.Current.RestoreSavedStates();
            }
        }
Beispiel #9
0
        protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext)
        {
            var subUnits = AU.Adapters.AUSnapshotAdapter.Instance.LoadSubUnits(callBackContext, parentNode.Value, true, DateTime.MinValue);

            foreach (AU.AdminUnit item in subUnits)
            {
                AddUnitToTree(item, result);
            }
        }
        private static void FilterObjectToTreeNode(IOguObject obj, DeluxeTreeNode treeNode, UserControlObjectMask listMask, ref bool cancel)
        {
            int mask = (int)obj.ObjectType & (int)listMask;

            if (mask == 0)
            {
                cancel = true;
            }
        }
Beispiel #11
0
        /// <summary>
        /// 删除某个节点
        /// </summary>
        /// <param name="node">节点对象</param>
        public void Remove(DeluxeTreeNode node)
        {
            int index = this.list.IndexOf(node);

            if (index != -1)
            {
                this.RemoveAt(index);
            }
        }
Beispiel #12
0
        public DeluxeTreeNodeCollection GetChildren(DeluxeTreeNode parentNode, string callBackContext)
        {
            DeluxeTreeNodeCollection result = new DeluxeTreeNodeCollection(parentNode);

            if (GetChildrenData != null)
            {
                GetChildrenData(parentNode, result, callBackContext);
            }

            return(result);
        }
Beispiel #13
0
		private static DeluxeTreeNode CreateTreeNode(string id, string name, string displayName, string fullPath)
		{
			DeluxeTreeNode node = new DeluxeTreeNode(string.IsNullOrWhiteSpace(displayName) ? name : displayName, id);

			node.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading;
			node.ToolTip = fullPath;
			node.NodeOpenImg = ControlResources.OULogoUrl;
			node.NodeCloseImg = ControlResources.OULogoUrl;
			node.CssClass = "au-catenode";

			return node;
		}
		private static DeluxeTreeNode CreateTreeNode(string id, string name, string displayName, string fullPath)
		{
			DeluxeTreeNode node = new DeluxeTreeNode(displayName.IsNotEmpty() ? displayName : name, id);

			node.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading;
			node.ToolTip = fullPath;
			node.NodeOpenImg = ControlResources.OULogoUrl;
			node.NodeCloseImg = ControlResources.OULogoUrl;
			node.CssClass = "pc-orgnode";

			return node;
		}
Beispiel #15
0
        protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext)
        {
            var subCates = AU.Adapters.SchemaCategoryAdapter.Instance.LoadSubCategories(parentNode.Value);

            foreach (var item in subCates)
            {
                DeluxeTreeNode node = CreateTreeNode(item.ID, item.Name, item.Name, item.Name);
                node.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal;
                node.Expanded = true;
                result.Add(node);
            }
        }
Beispiel #16
0
        private void LoadNodes(MCS.Web.WebControls.DeluxeTreeNode oItem, TreeNode oTreeNode)
        {
            oTreeNode.Tag = oItem;

            foreach (MCS.Web.WebControls.DeluxeTreeNode oChild in oItem.Nodes)
            {
                TreeNode oChildNode = new TreeNode(oChild.Text);
                LoadNodes(oChild, oChildNode);

                oTreeNode.Nodes.Add(oChildNode);
            }
        }
        protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext)
        {
            string[] schemaTypes = this.Request.QueryString.GetValues("schemaType") ?? DefaultSearchSchemas;

            HashSet <string> union = new HashSet <string>(schemaTypes);

            union.UnionWith(alwaysVisibleSchemaObjects);

            SCObjectAndRelationCollection relations = SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(union.ToArray(), new string[] { parentNode.Value }, false, false, false, Util.GetTime());

            BindObjectsToTreeNodes(relations, result, schemaTypes);
        }
		protected override void OnPreRender(EventArgs e)
		{
			Response.Cache.SetNoStore();
			JSONSerializerExecute.RegisterConverter(typeof(PropertyValueConverter));
			JSONSerializerExecute.RegisterConverter(typeof(UserSettingsConverter));
			JSONSerializerExecute.RegisterConverter(typeof(UserSettingsCategoryConverter));

			txtDataSource.Attributes.Add("style", "display:none;");
			btnSubmit.Attributes.Add("onclick", "updateHiddenText();");

			tree.Nodes.Clear();
			tree.OnNodeSelecting = "nodeClick";

			//根据当前登录的用户取得UserSettings的信息
			UserSettings objUserSettings = UserSettings.LoadSettings(DeluxeIdentity.CurrentUser.ID);

			RegisterEnumTypes(objUserSettings);

			DeluxeTreeNode rootNode = new DeluxeTreeNode(TreeRootText, TreeRootText)
										  {
											  NodeOpenImg = "../images/computer.gif",
											  NodeCloseImg = "../images/computer.gif",
											  Expanded = true
										  };

			DeluxeTreeNode node;
			string fsNodeText = string.Empty;
			string fsNodeValue = string.Empty;
			//循环添加二级结点
			for (int i = 0; i < objUserSettings.Categories.Count; i++)
			{
				fsNodeText = objUserSettings.Categories[i].Description;
				fsNodeValue = objUserSettings.Categories[i].Name;
				node = new DeluxeTreeNode(fsNodeText, fsNodeValue)
						   {
							   NodeOpenImg = "../images/accomplished.gif",
							   NodeCloseImg = "../images/accomplished.gif",
							   ExtendedData = objUserSettings.Categories[i].Description
						   };
				rootNode.Nodes.Add(node);
			}

			tree.Nodes.Add(rootNode);
			if (!IsPostBack)
			{
				if (objUserSettings.Categories.Count != 0)
				{
					txtDataSource.Text = JSONSerializerExecute.Serialize(objUserSettings);
				}
			}

			base.OnPreRender(e);
		}
Beispiel #19
0
        /// <summary>
        /// 反序列化数节点
        /// </summary>
        /// <param name="dictionary">属性字典</param>
        /// <param name="type">对象类型</param>
        /// <param name="serializer">JS序列化器</param>
        /// <returns>反序列化生成的对象</returns>
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            DeluxeTreeNode node = new DeluxeTreeNode();

            node.Text          = DictionaryHelper.GetValue(dictionary, "text", string.Empty);
            node.Html          = DictionaryHelper.GetValue(dictionary, "html", string.Empty);
            node.Value         = DictionaryHelper.GetValue(dictionary, "value", string.Empty);
            node.ToolTip       = DictionaryHelper.GetValue(dictionary, "toolTip", string.Empty);
            node.EnableToolTip = DictionaryHelper.GetValue(dictionary, "enableToolTip", true);
            node.NodeOpenImg   = DictionaryHelper.GetValue(dictionary, "nodeOpenImg", string.Empty);
            node.NodeCloseImg  = DictionaryHelper.GetValue(dictionary, "nodeCloseImg", string.Empty);
            node.ImgWidth      = Unit.Parse(DictionaryHelper.GetValue(dictionary, "imgWidth", string.Empty));
            node.ImgHeight     = Unit.Parse(DictionaryHelper.GetValue(dictionary, "imgHeight", string.Empty));
            node.ImgMarginLeft = Unit.Parse(DictionaryHelper.GetValue(dictionary, "imgMarginLeft", string.Empty));
            node.ImgMarginTop  = Unit.Parse(DictionaryHelper.GetValue(dictionary, "imgMarginTop", string.Empty));

            if (dictionary.ContainsKey("extendedData"))
            {
                node.ExtendedData = dictionary["extendedData"];
            }

            node.Checked  = DictionaryHelper.GetValue(dictionary, "checked", false);
            node.Selected = DictionaryHelper.GetValue(dictionary, "selected", false);
            node.Expanded = DictionaryHelper.GetValue(dictionary, "expanded", false);

            node.SubNodesLoaded = DictionaryHelper.GetValue(dictionary, "subNodesLoaded", false);

            node.ShowCheckBox          = DictionaryHelper.GetValue(dictionary, "showCheckBox", false);
            node.CssClass              = DictionaryHelper.GetValue(dictionary, "cssClass", string.Empty);
            node.SelectedCssClass      = DictionaryHelper.GetValue(dictionary, "selectedCssClass", string.Empty);
            node.ChildNodesLoadingType = (ChildNodesLoadingTypeDefine)dictionary["childNodesLoadingType"];
            node.LazyLoadingText       = DictionaryHelper.GetValue(dictionary, "lazyLoadingText", string.Empty);
            node.NavigateUrl           = DictionaryHelper.GetValue(dictionary, "navigateUrl", string.Empty);
            node.Target          = DictionaryHelper.GetValue(dictionary, "target", string.Empty);
            node.ExtendedDataKey = DictionaryHelper.GetValue(dictionary, "extendedDataKey", string.Empty);

            node.TextNoWrap        = DictionaryHelper.GetValue(dictionary, "textNoWrap", true);
            node.NodeVerticalAlign = DictionaryHelper.GetValue(dictionary, "nodeVerticalAlign", VerticalAlign.NotSet);

            object objNodes;

            if (dictionary.TryGetValue("nodes", out objNodes))
            {
                ArrayList nodes = (ArrayList)objNodes;
                for (int i = 0; i < nodes.Count; i++)
                {
                    node.Nodes.Add((DeluxeTreeNode)Deserialize((IDictionary <string, object>)nodes[i], type, serializer));
                }
            }

            return(node);
        }
        /// <summary>
        /// 初始化某个节点
        /// </summary>
        /// <param name="node">节点</param>
        /// <param name="childNodes">子节点</param>
        private DeluxeTreeNode GenerateDeluxeTreeNode(MaterialTreeNode materialNode)
        {
            DeluxeTreeNode rootNode = new DeluxeTreeNode(materialNode.Material.Title, materialNode.Material.ID);

            this.InitNode(rootNode, materialNode);

            foreach (MaterialTreeNode node in materialNode.Children)
            {
                rootNode.Nodes.Add(GenerateDeluxeTreeNode(node));
            }

            return(rootNode);
        }
		private void AddDefaultTreeNode(DeluxeTreeNode rootNode)
		{
			DeluxeTreeNode node = new DeluxeTreeNode("全局参数", "Default")
			{
				ToolTip = "Default",
				Selected = true,
				NodeOpenImg = "../images/accomplished.gif",
				NodeCloseImg = "../images/accomplished.gif",
				ExtendedData = "Program"
			};

			rootNode.Nodes.Add(node);
		}
Beispiel #22
0
        protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext)
        {
            string[] excludes = this.Request.QueryString.GetValues("exclude");
            var      subUnits = AU.Adapters.AUSnapshotAdapter.Instance.LoadSubUnits(callBackContext, parentNode.Value, true, DateTime.MinValue);

            foreach (AU.AdminUnit item in subUnits)
            {
                if (IsInExclude(item.ID, excludes) == false)
                {
                    AddUnitToTree(item, result);
                }
            }
        }
Beispiel #23
0
        /// <summary>
        /// new root
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _addRootButton_Click(object sender, EventArgs e)
        {
            MCS.Web.WebControls.DeluxeTreeNode oItem = new MCS.Web.WebControls.DeluxeTreeNode();
            oItem.Text = "New Root";

            Items.Add(oItem);

            TreeNode oNewTreeNode = new TreeNode("New Root");

            oNewTreeNode.Tag = oItem;
            _treeView.Nodes.Add(oNewTreeNode);

            _treeView.SelectedNode = _treeView.Nodes[_treeView.Nodes.Count - 1];
        }
Beispiel #24
0
 private void RemoveTreeItem(DeluxeTreeNode oItem)
 {
     if (oItem.Parent == null)
     {
         // we have a root
         // oItem.Remove(oItem);
         _navBar.Nodes.Remove(oItem);
     }
     else
     {
         // we have a child
         oItem.Parent.Nodes.Remove(oItem);
     }
 }
Beispiel #25
0
		protected override void OnPreRender(EventArgs e)
		{
			base.OnPreRender(e);

			var settings = LogCategoryConfigSection.GetConfig();

			if (settings == null)
				throw new System.Configuration.ConfigurationErrorsException("未找到日志类别配置");

			var nodeGenerl = new DeluxeTreeNode("用户操作", "G")
			{
				Expanded = true
			};

			var nodeAd = new DeluxeTreeNode("活动目录同步", "AD")
			{
				Expanded = true,
				NodeCloseImg = "../images/ad.png",
				NodeOpenImg = "../images/ad.png"
			};

			var nodeAdReverse = new DeluxeTreeNode("活动目录反向同步", "RAD");

			this.tree.Nodes.Add(nodeGenerl);
			this.tree.Nodes.Add(nodeAd);
			this.tree.Nodes.Add(nodeAdReverse);

			System.Collections.Specialized.HybridDictionary dic = new System.Collections.Specialized.HybridDictionary();

			foreach (LogCategoryConfigurationElement item in settings.Categories)
			{
				var node = new DeluxeTreeNode(item.Title, nodeGenerl.Value + "." + item.Name);
				node.Expanded = false;
				nodeGenerl.Nodes.Add(node);
				dic.Add(item.Name, node);
			}

			var categoris = LogCategoryAdapter.Instance.LoadCategories();

			foreach (var item in categoris)
			{
				if (dic.Contains(item.Category))
				{
					var nodeParent = (DeluxeTreeNode)dic[item.Category];

					var node = new DeluxeTreeNode(item.Description, nodeParent.Value + "." + item.OperationType);
					nodeParent.Nodes.Add(node);
				}
			}
		}
Beispiel #26
0
        private DeluxeTreeNode AddSchemaToTree(AU.AUSchema item, MCS.Web.WebControls.DeluxeTreeNodeCollection treeNodes)
        {
            DeluxeTreeNode node = new MCS.Web.WebControls.DeluxeTreeNode(item.Name, item.ID)
            {
                NodeOpenImg           = ControlResources.OULogoUrl,
                NodeCloseImg          = ControlResources.OULogoUrl,
                CssClass              = "au-catenode",
                ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal,
                ExtendedData          = "Schema",
                Expanded              = true
            };

            treeNodes.Add(node);

            return(node);
        }
Beispiel #27
0
		private static DeluxeTreeNode CreateTreeNode(SchemaObjectBase obj)
		{
			string name = obj.Properties.GetValue("DisplayName", string.Empty);

			if (string.IsNullOrEmpty(name))
				name = obj.Properties.GetValue("Name", string.Empty);

			DeluxeTreeNode node = new DeluxeTreeNode(name, obj.ID);

			node.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading;
			node.ToolTip = obj.Properties.GetValue("description", string.Empty);
			node.NodeOpenImg = ControlResources.OULogoUrl;
			node.NodeCloseImg = ControlResources.OULogoUrl;

			return node;
		}
		protected void tree_GetChildrenData(DeluxeTreeNode parentNode, DeluxeTreeNodeCollection result, string callBackContext)
		{
			WfProgramInApplicationCollection programs = WfApplicationAdapter.Instance.LoadProgramsByApplication(parentNode.Value);

			foreach (WfProgram program in programs)
			{
				DeluxeTreeNode node = new DeluxeTreeNode(program.Name, program.ApplicationCodeName + "~" + program.CodeName)
				{
					ToolTip = program.CodeName,
					NodeOpenImg = "../images/edit.gif",
					NodeCloseImg = "../images/edit.gif",
					ExtendedData = "Program"
				};

				result.Add(node);
			}
		}
Beispiel #29
0
        /// <summary>
        /// 将树节点进行JSON序列化
        /// </summary>
        /// <param name="obj">树节点对象</param>
        /// <param name="serializer">序列化器</param>
        /// <returns>属性集合</returns>
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();

            DeluxeTreeNode node = (DeluxeTreeNode)obj;

            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "text", node.Text);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "html", node.Html);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "value", node.Value);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "toolTip", node.ToolTip);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "enableToolTip", node.EnableToolTip, true);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "nodeOpenImg", node.NodeOpenImg);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "nodeCloseImg", node.NodeCloseImg);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "imgWidth", node.ImgWidth.ToString());
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "imgHeight", node.ImgHeight.ToString());
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "imgMarginLeft", node.ImgMarginLeft.ToString());
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "imgMarginTop", node.ImgMarginTop.ToString());
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "extendedData", node.ExtendedData);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "expanded", node.Expanded);

            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "subNodesLoaded", node.SubNodesLoaded);

            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "textNoWrap", node.TextNoWrap, true);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "nodeVerticalAlign", node.NodeVerticalAlign, VerticalAlign.NotSet);

            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "showCheckBox", node.ShowCheckBox);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "checked", node.Checked);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "selected", node.Selected);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "childNodesLoadingType", node.ChildNodesLoadingType);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "lazyLoadingText", node.LazyLoadingText);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "cssClass", node.CssClass);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "selectedCssClass", node.SelectedCssClass);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "navigateUrl", node.NavigateUrl);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "target", node.Target);
            DictionaryHelper.AddNonDefaultValue <string, object>(dict, "extendedDataKey", node.ExtendedDataKey);

            DeluxeTreeNode[] nodes = new DeluxeTreeNode[node.Nodes.Count];
            for (int i = 0; i < nodes.Length; i++)
            {
                nodes[i] = node.Nodes[i];
            }

            dict.Add("nodes", nodes);

            return(dict);
        }
Beispiel #30
0
        /// <summary>
        /// 序列化节点集合
        /// </summary>
        /// <param name="obj">树节点对象</param>
        /// <param name="serializer">JS序列化器</param>
        /// <returns>属性集合</returns>
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();

            IList list = (IList)obj;

            DeluxeTreeNode[] nodes = new DeluxeTreeNode[list.Count];

            for (int i = 0; i < list.Count; i++)
            {
                nodes[i] = (DeluxeTreeNode)((IList)obj)[i];
            }

            dict.Add("treeNodes", nodes);

            return(dict);
        }
        private void BindOguObjToTreeNode(IOguObject obj, DeluxeTreeNode treeNode, bool multiSelect, UserControlObjectMask selectMask)
        {
            treeNode.Text = obj.DisplayName;

            if (obj.ObjectType == SchemaType.Organizations)
            {
                treeNode.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading;
            }

            string nodeImg = GetImageUrlByObjectType(obj);

            treeNode.NodeOpenImg  = nodeImg;
            treeNode.NodeCloseImg = nodeImg;

            treeNode.ShowCheckBox    = multiSelect && (((int)obj.ObjectType & (int)selectMask) != 0);
            treeNode.ExtendedData    = obj;
            treeNode.ExtendedDataKey = TreeExtendedDataKey;
        }
        private void InitRootTreeNode()
        {
            IOrganization innerRoot = this.Root;

            ServiceBrokerContext.Current.SaveContextStates();

            try
            {
                if (ShowDeletedObjects)
                {
                    ServiceBrokerContext.Current.UseLocalCache       = false;
                    ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.All;
                }

                if (innerRoot == null)
                {
                    var tmpRootPath = this.RootPath;

                    if (string.IsNullOrEmpty(tmpRootPath))
                    {
                        tmpRootPath = OguPermissionSettings.GetConfig().RootOUPath;
                    }

                    innerRoot = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(tmpRootPath); // OguMechanismFactory.GetMechanism().GetRoot();
                }

                DeluxeTreeNode rootNode = new DeluxeTreeNode();

                BindOguObjToTreeNode((IOrganization)OguBase.CreateWrapperObject(innerRoot), rootNode, MultiSelect, SelectMask);

                rootNodesData.Add(rootNode);

                if (RootExpanded)
                {
                    rootNode.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal;
                    rootNode.Expanded = true;
                    BindChildren(rootNode.Nodes, OnGetChildren(innerRoot), MultiSelect, ListMask, SelectMask);
                }
            }
            finally
            {
                ServiceBrokerContext.Current.RestoreSavedStates();
            }
        }
Beispiel #33
0
        /// <summary>
        /// indent the node
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _indentButton_Click(object sender, EventArgs e)
        {
            TreeNode node = this._treeView.SelectedNode;

            if (node != null)
            {
                TreeNode       node2  = node.PrevNode;
                DeluxeTreeNode oItem  = (DeluxeTreeNode)node.Tag;
                DeluxeTreeNode oItem2 = (DeluxeTreeNode)node.PrevNode.Tag;
                if (node2 != null)
                {
                    node.Remove();
                    RemoveTreeItem(oItem);
                    node2.Nodes.Add(node);
                    oItem2.Nodes.Add(oItem);
                    this._treeView.SelectedNode = node;
                }
            }
        }
Beispiel #34
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                string schemaID = Request.QueryString["schemaId"];
                if (string.IsNullOrEmpty(schemaID))
                {
                    throw new HttpException("必须提供schemaId");
                }
                this.hfSchemaID.Value = schemaID;
                this.hfParentID.Value = Request.QueryString["parentID"];

                var auSchema = DbUtil.GetEffectiveObject <AU.AUSchema>(schemaID);
                var subUnits = AU.Adapters.AUSnapshotAdapter.Instance.LoadSubUnits(schemaID, schemaID, true, DateTime.MinValue);

                this.schemaLabel.InnerText = auSchema.GetQualifiedName();

                string[] excludes = this.Request.QueryString.GetValues("exclude");

                this.tree.CallBackContext = schemaID;

                var rootNode = new MCS.Web.WebControls.DeluxeTreeNode(string.IsNullOrEmpty(auSchema.DisplayName) ? auSchema.Name : auSchema.DisplayName, auSchema.ID)
                {
                    NodeOpenImg           = ControlResources.OULogoUrl,
                    NodeCloseImg          = ControlResources.OULogoUrl,
                    CssClass              = "au-catenode",
                    ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal,
                    ExtendedData          = "AUSchema",
                    Expanded              = true
                };

                tree.Nodes.Add(rootNode);

                foreach (AU.AdminUnit item in subUnits)
                {
                    if (IsInExclude(item.ID, excludes) == false)
                    {
                        AddUnitToTree(item, rootNode.Nodes);
                    }
                }
            }
        }
Beispiel #35
0
        /// <summary>
        /// new child
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _addChildButton_Click(object sender, EventArgs e)
        {
            if (_treeView.SelectedNode == null)
            {
                return;
            }

            MCS.Web.WebControls.DeluxeTreeNode oItem = (MCS.Web.WebControls.DeluxeTreeNode)_treeView.SelectedNode.Tag;

            MCS.Web.WebControls.DeluxeTreeNode oNewItem = new MCS.Web.WebControls.DeluxeTreeNode();
            oNewItem.Text = "New Item";

            oItem.Nodes.Add(oNewItem);

            TreeNode oNewTreeNode = new TreeNode("New Item");

            oNewTreeNode.Tag = oNewItem;
            _treeView.SelectedNode.Nodes.Add(oNewTreeNode);
            _treeView.SelectedNode.Expand();
        }
        private void BindChildren(DeluxeTreeNodeCollection nodes, IEnumerable <IOguObject> objects, bool multiSelect, UserControlObjectMask listMask, UserControlObjectMask selectMask)
        {
            OguDataCollection <IOguObject> wrappedObjects = CreateWrappedObjects(objects);

            foreach (IOguObject obj in wrappedObjects)
            {
                DeluxeTreeNode treeNode = new DeluxeTreeNode();
                bool           cancel   = false;

                BindOguObjToTreeNode(obj, treeNode, multiSelect, selectMask);

                FilterObjectToTreeNode(obj, treeNode, listMask, ref cancel);

                if (cancel == false)
                {
                    if (LoadingObjectToTreeNode != null)
                    {
                        LoadingObjectToTreeNode(this, obj, treeNode, ref cancel);
                    }
                }

                if (obj.FullPath.IsNotEmpty())
                {
                    treeNode.Checked = this.selectedOuUserData.FindSingleObjectByFullPath(obj.FullPath) != null;
                }
                else
                {
                    treeNode.Checked = this.selectedOuUserData.FindSingleObjectByID(obj.ID) != null;
                }

                if (cancel == false)
                {
                    nodes.Add(treeNode);
                }
            }

            if (ObjectsLoaded != null)
            {
                ObjectsLoaded(this, wrappedObjects);
            }
        }
Beispiel #37
0
        /// <summary>
        /// 在指定位置增加一个节点
        /// </summary>
        /// <param name="index">位置</param>
        /// <param name="node">节点对象</param>
        public void AddAt(int index, DeluxeTreeNode node)
        {
            node.Parent = this.owner;
            this.list.Insert(index, node);
            if (index == 0)
            {
                node.PreviousSibling = null;
                if (this.list.Count > 1)
                {
                    node.NextSibling        = this[1];
                    this[1].PreviousSibling = node;
                }
                else
                {
                    node.NextSibling = null;
                }
            }
            else if (index == (this.list.Count - 1))
            {
                node.NextSibling = null;
                if (this.list.Count > 1)
                {
                    node.PreviousSibling        = this[index - 1];
                    this[index - 1].NextSibling = node;
                }
                else
                {
                    node.PreviousSibling = null;
                }
            }
            else if (index > 0 && index < this.list.Count)
            {
                node.PreviousSibling        = this[index - 1];
                this[index - 1].NextSibling = node;

                node.NextSibling = this[index + 1];
                this[index + 1].PreviousSibling = node;
            }
        }
        private void InitTree()
        {
            string materialID = HttpUtility.UrlEncode(WebUtility.GetRequestQueryValue <string>("materialID", string.Empty));

            if (materialID != string.Empty)
            {
                MaterialTreeNode rootNode = MaterialAdapter.Instance.LoadMaterialVersionsByMaterialID(materialID);

                if (rootNode == null)
                {
                    return;
                }

                DeluxeTreeNode deluxeTreeNode = this.GenerateDeluxeTreeNode(rootNode);

                if (deluxeTreeNode != null)
                {
                    this.treeControl.Visible = true;
                    this.treeControl.Nodes.Add(deluxeTreeNode);
                }
            }
        }
		private DeluxeTreeNode AddSchemaToTree(AU.AUSchema item, MCS.Web.WebControls.DeluxeTreeNodeCollection treeNodes)
		{
			DeluxeTreeNode node = new MCS.Web.WebControls.DeluxeTreeNode(item.Name, item.ID)
			{
				NodeOpenImg = ControlResources.OULogoUrl,
				NodeCloseImg = ControlResources.OULogoUrl,
				CssClass = "au-catenode",
				ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal,
				ExtendedData = "Schema",
				Expanded = true
			};

			treeNodes.Add(node);

			return node;
		}
Beispiel #40
0
 protected void LoadObectjToTreeNode(UserOUGraphControl treeControl, IOguObject oguObj, DeluxeTreeNode newTreeNode, ref bool cancel)
 {
     if (oguObj.ObjectType == SchemaType.Groups)
         cancel = true;
 }
        /// <summary>
        /// 在指定位置增加一个节点
        /// </summary>
        /// <param name="index">位置</param>
        /// <param name="node">节点对象</param>
        public void AddAt(int index, DeluxeTreeNode node)
        {
            node.Parent = this.owner;
            this.list.Insert(index, node);
            if (index == 0)
            {
                node.PreviousSibling = null;
                if (this.list.Count > 1)
                {
                    node.NextSibling = this[1];
                    this[1].PreviousSibling = node;
                }
                else
                    node.NextSibling = null;
            }
            else if (index == (this.list.Count - 1))
            {
                node.NextSibling = null;
                if (this.list.Count > 1)
                {
                    node.PreviousSibling = this[index - 1];
                    this[index - 1].NextSibling = node;
                }
                else
                    node.PreviousSibling = null;
            }
            else if (index > 0 && index < this.list.Count)
            {
                node.PreviousSibling = this[index - 1];
                this[index - 1].NextSibling = node;

                node.NextSibling = this[index + 1];
                this[index + 1].PreviousSibling = node;
            }
        }
 /// <summary>
 /// 是否包含某个节点
 /// </summary>
 /// <param name="node">节点对象</param>
 /// <returns>是否包含</returns>
 public bool Contains(DeluxeTreeNode node)
 {
     return this.list.Contains(node);
 }
Beispiel #43
0
        public DeluxeTreeNodeCollection GetChildren(DeluxeTreeNode parentNode, string callBackContext)
        {
            DeluxeTreeNodeCollection result = new DeluxeTreeNodeCollection(parentNode);

            if (GetChildrenData != null)
                GetChildrenData(parentNode, result, callBackContext);

            return result;
        }
		private void groupControl_LoadingObjectToTreeNode(UserOUGraphControl treeControl, IOguObject oguObj, DeluxeTreeNode newTreeNode, ref bool cancel)
		{
			if ((oguObj is IUser) == false)
			{
				newTreeNode.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading;

				if (oguObj is IGroup)
				{
					IGroup group = (IGroup)oguObj;

					int count = GroupMemberSelectedCount(group, treeControl.SelectedOuUserData);

					if (count > 0 && group.Members.Count == count)
					{
						newTreeNode.Checked = true;
						treeControl.SelectedOuUserData.Add(group);
					}
				}
			}
			else
			{
				OguUser user = (OguUser)oguObj;

				StringBuilder strB = new StringBuilder();

				foreach (IGroup group in user.MemberOf)
				{
					if (strB.Length > 0)
						strB.Append(",");

					strB.Append(group.ID);
				}

				user.Tag = strB.ToString();
			}

			newTreeNode.ShowCheckBox = true;
		}
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="owner">父节点</param>
 public DeluxeTreeNodeCollection(DeluxeTreeNode owner)
 {
     this.owner = owner;
 }
		private static DeluxeTreeNode CreateTreeNode(string id, string name, string displayName, string fullPath, string schemaType)
		{
			DeluxeTreeNode node = new DeluxeTreeNode(displayName.IsNotEmpty() ? displayName : name, id);

			var profile = profiles[schemaType];
			node.ChildNodesLoadingType = profile.Terminal ? ChildNodesLoadingTypeDefine.Normal : ChildNodesLoadingTypeDefine.LazyLoading;
			node.ToolTip = fullPath;
			node.NodeOpenImg = profile.OpenImageUrl;
			node.NodeCloseImg = profile.CloseImageUrl;
			node.CssClass = profile.CssClass ?? "pc-orgnode";
			node.ShowCheckBox = true;

			return node;
		}
Beispiel #47
0
        private string GetDesignTimeNodeImage(DeluxeTreeNode node, bool expanded)
        {
            string result = string.Empty;

            if (expanded)
            {
                result = node.NodeOpenImg;

                if (result == string.Empty)
                    result = this.NodeOpenImg;
            }
            else
            {
                result = node.NodeCloseImg;

                if (result == string.Empty)
                    result = this.NodeCloseImg;
            }

            return result;
        }
        /// <summary>
        /// 反序列化数节点
        /// </summary>
        /// <param name="dictionary">属性字典</param>
        /// <param name="type">对象类型</param>
        /// <param name="serializer">JS序列化器</param>
        /// <returns>反序列化生成的对象</returns>
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            DeluxeTreeNode node = new DeluxeTreeNode();

            node.Text = DictionaryHelper.GetValue(dictionary, "text", string.Empty);
            node.Html = DictionaryHelper.GetValue(dictionary, "html", string.Empty);
            node.Value = DictionaryHelper.GetValue(dictionary, "value", string.Empty);
            node.ToolTip = DictionaryHelper.GetValue(dictionary, "toolTip", string.Empty);
            node.EnableToolTip = DictionaryHelper.GetValue(dictionary, "enableToolTip", true);
            node.NodeOpenImg = DictionaryHelper.GetValue(dictionary, "nodeOpenImg", string.Empty);
            node.NodeCloseImg = DictionaryHelper.GetValue(dictionary, "nodeCloseImg", string.Empty);
            node.ImgWidth = Unit.Parse(DictionaryHelper.GetValue(dictionary, "imgWidth", string.Empty));
            node.ImgHeight = Unit.Parse(DictionaryHelper.GetValue(dictionary, "imgHeight", string.Empty));
            node.ImgMarginLeft = Unit.Parse(DictionaryHelper.GetValue(dictionary, "imgMarginLeft", string.Empty));
            node.ImgMarginTop = Unit.Parse(DictionaryHelper.GetValue(dictionary, "imgMarginTop", string.Empty));

            if (dictionary.ContainsKey("extendedData"))
                node.ExtendedData = dictionary["extendedData"];

            node.Checked = DictionaryHelper.GetValue(dictionary, "checked", false);
            node.Selected = DictionaryHelper.GetValue(dictionary, "selected", false);
            node.Expanded = DictionaryHelper.GetValue(dictionary, "expanded", false);

            node.SubNodesLoaded = DictionaryHelper.GetValue(dictionary, "subNodesLoaded", false);

            node.ShowCheckBox = DictionaryHelper.GetValue(dictionary, "showCheckBox", false);
            node.CssClass = DictionaryHelper.GetValue(dictionary, "cssClass", string.Empty);
            node.SelectedCssClass = DictionaryHelper.GetValue(dictionary, "selectedCssClass", string.Empty);
            node.ChildNodesLoadingType = (ChildNodesLoadingTypeDefine)dictionary["childNodesLoadingType"];
            node.LazyLoadingText = DictionaryHelper.GetValue(dictionary, "lazyLoadingText", string.Empty);
            node.NavigateUrl = DictionaryHelper.GetValue(dictionary, "navigateUrl", string.Empty);
            node.Target = DictionaryHelper.GetValue(dictionary, "target", string.Empty);
            node.ExtendedDataKey = DictionaryHelper.GetValue(dictionary, "extendedDataKey", string.Empty);

            node.TextNoWrap = DictionaryHelper.GetValue(dictionary, "textNoWrap", true);
            node.NodeVerticalAlign = DictionaryHelper.GetValue(dictionary, "nodeVerticalAlign", VerticalAlign.NotSet);

            object objNodes;

            if (dictionary.TryGetValue("nodes", out objNodes))
            {
                ArrayList nodes = (ArrayList)objNodes;
                for (int i = 0; i < nodes.Count; i++)
                    node.Nodes.Add((DeluxeTreeNode)Deserialize((IDictionary<string, object>)nodes[i], type, serializer));
            }

            return node;
        }
        /// <summary>
        /// 将树节点进行JSON序列化
        /// </summary>
        /// <param name="obj">树节点对象</param>
        /// <param name="serializer">序列化器</param>
        /// <returns>属性集合</returns>
        public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            Dictionary<string, object> dict = new Dictionary<string, object>();

            DeluxeTreeNode node = (DeluxeTreeNode)obj;

            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "text", node.Text);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "html", node.Html);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "value", node.Value);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "toolTip", node.ToolTip);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "enableToolTip", node.EnableToolTip, true);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "nodeOpenImg", node.NodeOpenImg);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "nodeCloseImg", node.NodeCloseImg);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "imgWidth", node.ImgWidth.ToString());
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "imgHeight", node.ImgHeight.ToString());
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "imgMarginLeft", node.ImgMarginLeft.ToString());
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "imgMarginTop", node.ImgMarginTop.ToString());
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "extendedData", node.ExtendedData);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "expanded", node.Expanded);

            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "subNodesLoaded", node.SubNodesLoaded);

            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "textNoWrap", node.TextNoWrap, true);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "nodeVerticalAlign", node.NodeVerticalAlign, VerticalAlign.NotSet);

            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "showCheckBox", node.ShowCheckBox);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "checked", node.Checked);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "selected", node.Selected);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "childNodesLoadingType", node.ChildNodesLoadingType);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "lazyLoadingText", node.LazyLoadingText);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "cssClass", node.CssClass);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "selectedCssClass", node.SelectedCssClass);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "navigateUrl", node.NavigateUrl);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "target", node.Target);
            DictionaryHelper.AddNonDefaultValue<string, object>(dict, "extendedDataKey", node.ExtendedDataKey);

            DeluxeTreeNode[] nodes = new DeluxeTreeNode[node.Nodes.Count];
            for (int i = 0; i < nodes.Length; i++)
                nodes[i] = node.Nodes[i];

            dict.Add("nodes", nodes);

            return dict;
        }
		private static DeluxeTreeNode CreateTreeNode(string id, string name, string displayName, string fullPath, bool selectable, bool showCheckBox)
		{
			DeluxeTreeNode node = new DeluxeTreeNode(displayName.IsNotEmpty() ? displayName : name, id);

			node.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading;
			node.ToolTip = fullPath;
			node.NodeOpenImg = selectable ? ControlResources.OULogoUrl : ControlResources.OULogoUrl;
			node.NodeCloseImg = selectable ? ControlResources.OULogoUrl : ControlResources.OULogoUrl;

			node.ShowCheckBox = showCheckBox;

			if (selectable == false)
			{
				node.CssClass = "pc-node-exclude";
				node.SelectedCssClass = "pc-node-exclude";
				node.ExtendedData = "noselect";
			}

			return node;
		}
		private static void PrepareTreeNodeRecursively(PC.SCSimpleObject parentOrg, DeluxeTreeNode parentTreeNode, Dictionary<string, PC.SCSimpleObject> parentsList, bool godMode, DateTime timePoint, string[] requiredPermissions, string excludeId, string exceptID)
		{
			if (excludeId != parentOrg.ID)
			{
				PC.SCObjectAndRelationCollection relations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(PC.SchemaInfo.FilterByCategory("Organizations").ToSchemaNames(), new string[] { parentOrg.ID }, false, true, false, timePoint);

				PC.Permissions.SCContainerAndPermissionCollection permissions = null;

				if (requiredPermissions != null)
				{
					permissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, relations.ToIDArray());
				}

				BindObjectsToTreeNodes(relations, parentTreeNode.Nodes, godMode, requiredPermissions, permissions, excludeId, exceptID);

				foreach (DeluxeTreeNode childNode in parentTreeNode.Nodes)
				{
					PC.SCSimpleObject obj = null;

					if (parentsList.TryGetValue(childNode.Value, out obj))
					{
						childNode.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal;
						childNode.Expanded = true;

						PrepareTreeNodeRecursively(obj, childNode, parentsList, godMode, timePoint, requiredPermissions, excludeId, exceptID);
					}
				}
			}
		}
        /// <summary>
        /// 序列化节点集合
        /// </summary>
        /// <param name="obj">树节点对象</param>
        /// <param name="serializer">JS序列化器</param>
        /// <returns>属性集合</returns>
        public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            Dictionary<string, object> dict = new Dictionary<string, object>();

            IList list = (IList)obj;
            DeluxeTreeNode[] nodes = new DeluxeTreeNode[list.Count];

            for (int i = 0; i < list.Count; i++)
                nodes[i] = (DeluxeTreeNode)((IList)obj)[i];

            dict.Add("treeNodes", nodes);

            return dict;
        }
 /// <summary>
 /// 增加一个节点
 /// </summary>
 /// <param name="node">节点对象</param>
 public void Add(DeluxeTreeNode node)
 {
     this.AddAt(this.list.Count, node);
 }
 protected void userSelector_LoadingObjectToTreeNode(UserOUGraphControl treeControl, IOguObject oguObj, DeluxeTreeNode newTreeNode, ref bool cancel)
 {
     newTreeNode.ShowCheckBox = true;
     newTreeNode.Checked = true;
 }
        /// <summary>
        /// new child
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _addChildButton_Click(object sender, EventArgs e)
        {
            if (_treeView.SelectedNode == null)
            {
                return;
            }

            MCS.Web.WebControls.DeluxeTreeNode oItem = (MCS.Web.WebControls.DeluxeTreeNode)_treeView.SelectedNode.Tag;

            MCS.Web.WebControls.DeluxeTreeNode oNewItem = new MCS.Web.WebControls.DeluxeTreeNode();
            oNewItem.Text = "New Item";

            oItem.Nodes.Add(oNewItem);

            TreeNode oNewTreeNode = new TreeNode("New Item");
            oNewTreeNode.Tag = oNewItem;
            _treeView.SelectedNode.Nodes.Add(oNewTreeNode);
            _treeView.SelectedNode.Expand();
        }
 /// <summary>
 /// 删除某个节点
 /// </summary>
 /// <param name="node">节点对象</param>
 public void Remove(DeluxeTreeNode node)
 {
     int index = this.list.IndexOf(node);
     if (index != -1)
         this.RemoveAt(index);
 }
        private void RemoveTreeItem(DeluxeTreeNode oItem)
        {
            if (oItem.Parent == null)
            {
                // we have a root
                // oItem.Remove(oItem);
                _navBar.Nodes.Remove(oItem);

            }
            else
            {
                // we have a child
                oItem.Parent.Nodes.Remove(oItem);
            }
        }
Beispiel #58
0
        private void CreateDesignTimeTreeNode(DeluxeTreeNode node, Control parent)
        {
            HtmlGenericControl container = new HtmlGenericControl("div");
            parent.Controls.Add(container);

            HtmlTable nodeTable = new HtmlTable();
            nodeTable.CellPadding = 0;
            nodeTable.CellSpacing = 0;

            container.Controls.Add(nodeTable);

            HtmlTableRow row = new HtmlTableRow();
            nodeTable.Controls.Add(row);

            HtmlTableCell cellExpandImg = new HtmlTableCell();
            cellExpandImg.Style["vertical-align"] = "middle";
            cellExpandImg.Style["text-align"] = "center";

            row.Controls.Add(cellExpandImg);

            HtmlImage imgExpand = new HtmlImage();

            imgExpand.Src = this.DefaultExpandImage;

            cellExpandImg.Controls.Add(imgExpand);

            HtmlTableCell cellImg = new HtmlTableCell();
            cellImg.Style["vertical-align"] = "middle";
            cellImg.Style["text-align"] = "center";

            row.Controls.Add(cellImg);

            HtmlImage img = new HtmlImage();

            HtmlTableCell cellText = new HtmlTableCell();
            cellText.Style["text-align"] = "left";

            if (string.IsNullOrEmpty(node.Html))
                cellText.InnerText = node.Text;
            else
                cellText.InnerHtml = node.Html;

            cellText.Attributes["class"] = node.CssClass;

            row.Controls.Add(cellText);

            img.Src = this.GetDesignTimeNodeImage(node, false);

            if (node.Expanded)
            {
                if (node.HasChildren)
                {
                    imgExpand.Src = this.DefaultCollapseImage;

                    HtmlGenericControl div = new HtmlGenericControl("div");
                    div.Style["margin-left"] = this.NodeIndent.ToString() + "px";

                    foreach (DeluxeTreeNode subNode in node.Nodes)
                        this.CreateDesignTimeTreeNode(subNode, div);

                    container.Controls.Add(div);

                    img.Src = this.GetDesignTimeNodeImage(node, true);
                }
                else
                    imgExpand.Style["visibility"] = "visible";
            }

            if (img.Src != string.Empty)
            {
                HtmlGenericControl imgSpan = new HtmlGenericControl("span");
                imgSpan.Style["display"] = "inline-block";

                if (node.ImgWidth != Unit.Empty)
                    imgSpan.Style["width"] = node.ImgWidth.ToString();

                if (node.ImgHeight != Unit.Empty)
                    imgSpan.Style["height"] = node.ImgHeight.ToString();

                if (node.ImgMarginLeft != Unit.Empty)
                    img.Style["margin-left"] = node.ImgMarginLeft.ToString();

                if (node.ImgMarginTop != Unit.Empty)
                    img.Style["margin-top"] = node.ImgMarginTop.ToString();

                imgSpan.Controls.Add(img);
                cellImg.Controls.Add(imgSpan);
            }
        }
        /// <summary>
        /// new root
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _addRootButton_Click(object sender, EventArgs e)
        {
            MCS.Web.WebControls.DeluxeTreeNode oItem = new MCS.Web.WebControls.DeluxeTreeNode();
            oItem.Text = "New Root";

            Items.Add(oItem);

            TreeNode oNewTreeNode = new TreeNode("New Root");
            oNewTreeNode.Tag = oItem;
            _treeView.Nodes.Add(oNewTreeNode);

            _treeView.SelectedNode = _treeView.Nodes[_treeView.Nodes.Count - 1];
        }
 /// <summary>
 /// 得到某个节点的位置
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public int IndexOf(DeluxeTreeNode node)
 {
     return this.list.IndexOf(node);
 }