private static void OccupyUserPresenceAddress(IEnumerable objs) { List <string> userIDs = new List <string>(); foreach (IOguObject obj in objs) { if (obj is IUser) { userIDs.Add(obj.ID); } } UserIMAddressCollection usersExtendedInfo = UserOUControlSettings.GetConfig().UserOUControlQuery.QueryUsersIMAddress(userIDs.ToArray()); foreach (OguBase obj in objs) { if (obj is IUser) { UserIMAddress userIMAddresses = usersExtendedInfo.Find(e => string.Compare(e.UserID, obj.ID, true) == 0); if (userIMAddresses != null && userIMAddresses.IMAddress.IsNotEmpty()) { obj.ClientContext["IMAddress"] = UserPresence.NormalizeIMAddress(userIMAddresses.IMAddress); } } } }
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); //; OguMechanismFactory.GetMechanism().GetObjects<IOguObject>( // SearchOUIDType.Guid, ((IOguObject)parentNode.ExtendedData).ID); BindChildren(result, OnGetChildren(parents[0]), context.MultiSelect, context.ListMask, context.SelectMask); } finally { ServiceBrokerContext.Current.RestoreSavedStates(); } }
protected void InnerGetDataSource(string sPrefix, int iCount, object context, ref IEnumerable result) { ServiceBrokerContext.Current.Timeout = QueryUserTimeout; IOrganization rootOrg = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(this.RootPath); OguDataCollection <IOguObject> users = QueryChildrenBySelectMask(rootOrg, sPrefix); ArrayList arrList = new ArrayList(); if (this.CanSelectRoot) { if (rootOrg.DisplayName.IndexOf(sPrefix) == 0) { arrList.Add(OguBase.CreateWrapperObject(rootOrg)); } } for (int i = 0; i < users.Count; i++) { //资源类型过滤 IOguObject oguObject = OguBase.CreateWrapperObject(users[i]); if (this.SelectMask == UserControlObjectMask.All || (((int)this.SelectMask & (int)oguObject.ObjectType)) != 0) { arrList.Add(oguObject); } } //修饰一下结果 foreach (OguBase obj in arrList) { string path = string.Empty; if (obj.Parent != null) { path = obj.Parent.FullPath; } if (path.IndexOf(rootOrg.FullPath) == 0) { path = path.Substring(rootOrg.FullPath.Length); path = path.Trim('\\'); } if (obj is OguBase) { // v-weirf changed : obj must be a OguBase to use Description if (obj is IUser) { ((OguBase)obj).Description = string.Format("{0} {1}", ((IUser)obj).Occupation, path); } else if (obj is OguOrganization) { ((OguBase)obj).Description = path; } } } result = arrList; }
public static UserOUControlSettings GetConfig() { UserOUControlSettings settings = (UserOUControlSettings)ConfigurationBroker.GetSection("userOUControlSettings"); if (settings == null) settings = new UserOUControlSettings(); return settings; }
private OguDataCollection <IOguObject> QueryChildrenBySelectMask(IOrganization dept, string searchString) { ServiceBrokerContext.Current.SaveContextStates(); try { var queryImpl = UserOUControlSettings.GetConfig().UserOUControlQuery; ServiceBrokerContext.Current.ListObjectCondition = ShowDeletedObjects ? ListObjectMask.All : ListObjectMask.Common; OguDataCollection <IOguObject> result = new OguDataCollection <IOguObject>(); if (SelectMask == UserControlObjectMask.Organization) { OguObjectCollection <IOrganization> orgs = queryImpl.QueryDescendants <IOrganization>(SchemaQueryType.Organizations, dept, searchString, MaxQueryCount); //dept.QueryChildren<IOrganization>(searchString, true, SearchLevel.SubTree, MaxQueryCount); foreach (IOrganization org in orgs) { result.Add(org); } } else if (SelectMask == UserControlObjectMask.Group) { OguObjectCollection <IGroup> groups = queryImpl.QueryDescendants <IGroup>(SchemaQueryType.Groups, dept, searchString, MaxQueryCount); // dept.QueryChildren<IGroup>(searchString, true, SearchLevel.SubTree, MaxQueryCount); foreach (IGroup group in groups) { result.Add(group); } } else if (SelectMask == UserControlObjectMask.User || SelectMask == (UserControlObjectMask.User | UserControlObjectMask.Sideline)) { OguObjectCollection <IUser> users = queryImpl.QueryDescendants <IUser>(SchemaQueryType.Groups, dept, searchString, MaxQueryCount); //dept.QueryChildren<IUser>(searchString, true, SearchLevel.SubTree, MaxQueryCount); foreach (IUser user in users) { result.Add(user); } } else { if ((int)(SelectMask & (UserControlObjectMask.Group | UserControlObjectMask.User | UserControlObjectMask.Organization)) != 0) { OguObjectCollection <IOguObject> objs = queryImpl.QueryDescendants <IOguObject>(SchemaQueryType.Users | SchemaQueryType.Groups | SchemaQueryType.Organizations, dept, searchString, MaxQueryCount); //dept.QueryChildren<IOguObject>(searchString, true, SearchLevel.SubTree, MaxQueryCount); foreach (IOguObject obj in objs) { result.Add(obj); } } } return(result); } finally { ServiceBrokerContext.Current.RestoreSavedStates(); } }
public static UserOUControlSettings GetConfig() { UserOUControlSettings settings = (UserOUControlSettings)ConfigurationBroker.GetSection("userOUControlSettings"); if (settings == null) { settings = new UserOUControlSettings(); } return(settings); }
private IEnumerable <IOguObject> OnGetChildren(IOguObject parent) { IEnumerable <IOguObject> result = null; if (GetChildren != null) { result = GetChildren(this, parent); } else { result = UserOUControlSettings.GetConfig().UserOUControlQuery.GetChildren((IOrganization)parent); } return(result); }
/// <summary> /// 得到用户状态的Html。会从当前的上下文中获取用户的SIP地址 /// </summary> /// <param name="userID"></param> /// <param name="userName"></param> /// <param name="uniqueID"></param> /// <param name="showStatusImage"></param> /// <param name="showUserIcon"></param> /// <param name="showUserName"></param> /// <param name="statusImageType"></param> /// <param name="userIconUrl"></param> /// <returns></returns> public static string GetUsersPresenceHtml(string userID, string userName, string uniqueID, bool showStatusImage, bool showUserIcon, bool showUserName, StatusImageType statusImageType, string userIconUrl) { UserIMAddress uie = UserExtendInfo.Find(u => u.UserID == userID); if (uie == null) { UserExtendInfo.CopyFrom(UserOUControlSettings.GetConfig().UserOUControlQuery.QueryUsersIMAddress(userID)); } else { UserExtendInfo.Add(uie); } return(GetUsersPresenceHtml(userID, userName, uniqueID, true, showUserIcon, showUserName, statusImageType, userIconUrl, UserExtendInfo)); }
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(); } }
/// <summary> /// 将ClenteState中的信息生成ClientState字符串 /// </summary> /// <returns>ClientState字符串</returns> protected override string SaveClientState() { object[] foArray = new object[2]; var tmpRoot = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(this.RootPath); if (tmpRoot != null) { this.foOUCtrl.Root = tmpRoot; } for (int i = 0; i < this.SelectedOuUserData.Count; i++) { this.SelectedOuUserData[i] = (IOguObject)OguBase.CreateWrapperObject(this.SelectedOuUserData[i]); } OccupyUserPresenceAddress(this.SelectedOuUserData); foArray[0] = this.SelectedOuUserData; foArray[1] = this.Text; return(JSONSerializerExecute.Serialize(foArray)); }
private OguDataCollection <IOguObject> InnerCheckInputOuUser(string chkString) { ServiceBrokerContext.Current.Timeout = QueryUserTimeout; IOrganization root = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(this.RootPath); OguDataCollection <IOguObject> users = QueryChildrenBySelectMask(root, chkString); OguDataCollection <IOguObject> forSelected = new OguDataCollection <IOguObject>(); for (int i = 0; i < users.Count; i++) { if (((int)users[i].ObjectType & (int)this.SelectMask) != 0) { forSelected.Add(OguBase.CreateWrapperObject(users[i])); } } if (this.CanSelectRoot) { if (root.DisplayName.IndexOf(chkString) == 0) { forSelected.Add(OguBase.CreateWrapperObject(root)); } } //沈峥添加,修饰一下Description //IOrganization root = OguMechanismFactory.GetMechanism().GetRoot(); foreach (OguBase obj in forSelected) { string path = string.Empty; if (obj.Parent != null) { path = obj.Parent.FullPath; } if (path.IndexOf(root.FullPath) == 0) { path = path.Substring(root.FullPath.Length); path = path.Trim('\\'); } if (obj is OguBase) { //v-weirf changed, for Description setable,obj must be OguBase if (obj is IUser) { ((OguBase)obj).Description = string.Format("{0} {1}", ((IUser)obj).Occupation, path); } else if (obj is IOrganization) { ((OguBase)obj).Description = path; } else { ((OguBase)obj).Description = path; } } } return(forSelected); }