Пример #1
0
        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();
            }
        }
Пример #2
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;
                    }
                }
            }
        }
Пример #3
0
        private void PreloadTreeNodesImages(DeluxeTreeNodeCollection treeNodes)
        {
            foreach (DeluxeTreeNode node in treeNodes)
            {
                this.PreloadImage(node.NodeOpenImg, node.NodeOpenImg);
                this.PreloadImage(node.NodeCloseImg, node.NodeCloseImg);

                this.PreloadTreeNodesImages(node.Nodes);
            }
        }
Пример #4
0
        public DeluxeTreeNodeCollection GetChildren(DeluxeTreeNode parentNode, string callBackContext)
        {
            DeluxeTreeNodeCollection result = new DeluxeTreeNodeCollection(parentNode);

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

            return(result);
        }
Пример #5
0
 private void AddUnitToTree(AU.AdminUnit item, MCS.Web.WebControls.DeluxeTreeNodeCollection treeNodes)
 {
     treeNodes.Add(new MCS.Web.WebControls.DeluxeTreeNode(item.Name, item.ID)
     {
         NodeOpenImg           = ControlResources.OULogoUrl,
         NodeCloseImg          = ControlResources.OULogoUrl,
         CssClass              = "au-catenode",
         ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading,
         ExtendedData          = "AU"
     });
 }
Пример #6
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);
        }
		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);
			}
		}
Пример #8
0
        public DeluxeTreeItemsEditorForm(DeluxeTree oMenu)
        {
            InitializeComponent();

            this._firstActivate = true;
            _navBar             = oMenu;
            Items            = oMenu.Nodes;
            _serviceProvider = oMenu.Site;
            // add pre-existing nodes
            foreach (MCS.Web.WebControls.DeluxeTreeNode oRoot in Items)
            {
                TreeNode oRootNode = new TreeNode(oRoot.Text);
                LoadNodes(oRoot, oRootNode);
                _treeView.Nodes.Add(oRootNode);
            }
            this.propertyGrid1.Site = new FormPropertyGridSite(_serviceProvider, this.propertyGrid1);
            _treeView.HideSelection = false;
        }
Пример #9
0
        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);
            }
        }
		private static void BindObjectsToTreeNodes(SCObjectAndRelationCollection relations, DeluxeTreeNodeCollection nodes, string[] schemaTypes)
		{
			HashSet<string> filter = new HashSet<string>(schemaTypes);
			relations.Sort((m, n) => m.InnerSort.CompareTo(n.InnerSort));
			foreach (SCObjectAndRelation r in relations)
			{
				DeluxeTreeNode newTreeNode = CreateTreeNode(r.ID, r.Name, r.DisplayName, r.FullPath, r.SchemaType);
				if (filter.Contains(r.SchemaType) == false)
				{
					newTreeNode.ShowCheckBox = false;
					newTreeNode.Checked = false;
				}
				nodes.Add(newTreeNode);
			}
		}
Пример #11
0
        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;
            }
        }
Пример #12
0
        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);
            }
        }
Пример #13
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);
            }
        }
Пример #14
0
		protected void tree_GetChildrenData(DeluxeTreeNode parentNode, DeluxeTreeNodeCollection result, string callBackContext)
		{
			SCObjectAndRelationCollection relations = SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(PC.SchemaInfo.FilterByCategory("Organizations").ToSchemaNames(), new string[] { parentNode.Value }, false, true, false, Util.GetTime());
			BindObjectsToTreeNodes(relations, result);
		}
Пример #15
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 BindObjectsToTreeNodes(PC.SCObjectAndRelationCollection relations, DeluxeTreeNodeCollection nodes, bool godMode, string[] requiredPermissions, PC.Permissions.SCContainerAndPermissionCollection permissions, string excludeID, string exceptID)
		{
			relations.Sort((m, n) => m.InnerSort.CompareTo(n.InnerSort));
			foreach (PC.SCObjectAndRelation r in relations)
			{
				if (r.ID != excludeID && Util.IsOrganization(r.SchemaType))
				{
					bool showCheckBoxes;
					bool selectable;

					if (r.ID == exceptID)
					{
						selectable = false;
					}
					else if (godMode)
					{
						selectable = true;
					}
					else
					{
						selectable = true;
						if (requiredPermissions != null && permissions != null)
						{
							foreach (string p in requiredPermissions)
							{
								selectable &= Util.ContainsPermission(permissions, r.ID, p);
							}
						}
					}

					if (HttpContext.Current.Request.QueryString["mode"] == "single")
					{
						showCheckBoxes = false;
					}
					else
					{
						showCheckBoxes = selectable;
					}

					DeluxeTreeNode newTreeNode = CreateTreeNode(r.ID, r.Name, r.DisplayName, r.FullPath, selectable, showCheckBoxes);

					nodes.Add(newTreeNode);
				}
			}
		}
Пример #17
0
        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);
        }
Пример #18
0
		private static void BindObjectsToTreeNodes(SCObjectAndRelationCollection relations, DeluxeTreeNodeCollection nodes)
		{
			relations.Sort((m, n) => m.InnerSort.CompareTo(n.InnerSort));
			foreach (SCObjectAndRelation r in relations)
			{
				if (Util.IsOrganization(r.SchemaType))
				{
					DeluxeTreeNode newTreeNode = CreateTreeNode(r.ID, r.Name, r.DisplayName, r.FullPath);
					nodes.Add(newTreeNode);
				}
			}
		}
 public DeluxeTreeItemsEditorForm(DeluxeTree oMenu)
 {
     InitializeComponent();
   
     this._firstActivate = true;
     _navBar = oMenu;
     Items = oMenu.Nodes;
     _serviceProvider = oMenu.Site;
     // add pre-existing nodes
     foreach (MCS.Web.WebControls.DeluxeTreeNode oRoot in Items)
     {
         TreeNode oRootNode = new TreeNode(oRoot.Text);
         LoadNodes(oRoot, oRootNode);
         _treeView.Nodes.Add(oRootNode);
     }
     this.propertyGrid1.Site = new FormPropertyGridSite(_serviceProvider, this.propertyGrid1);
     _treeView.HideSelection = false;
 }
Пример #20
0
        public DeluxeTreeNodeCollection GetChildren(DeluxeTreeNode parentNode, string callBackContext)
        {
            DeluxeTreeNodeCollection result = new DeluxeTreeNodeCollection(parentNode);

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

            return result;
        }
Пример #21
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);
                }
            }
        }
Пример #22
0
        private void PreloadTreeNodesImages(DeluxeTreeNodeCollection treeNodes)
        {
            foreach (DeluxeTreeNode node in treeNodes)
            {
                this.PreloadImage(node.NodeOpenImg, node.NodeOpenImg);
                this.PreloadImage(node.NodeCloseImg, node.NodeCloseImg);

                this.PreloadTreeNodesImages(node.Nodes);
            }
        }
Пример #23
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);
            }
        }