Skip to content

Commit

Permalink
adding support for the webui-friendly method for getting a list of gr…
Browse files Browse the repository at this point in the history
…oups by a list of group IDs
  • Loading branch information
SignpostMarv committed Jan 2, 2012
1 parent 55ce0b1 commit 0f54c70
Showing 1 changed file with 52 additions and 24 deletions.
76 changes: 52 additions & 24 deletions AuroraService/addon-modules/AuroraWebUI/Modules/WebUIHandler.cs
Expand Up @@ -1472,40 +1472,68 @@ private OSDMap GetGroups(OSDMap map)
OSDArray Groups = new OSDArray();
if (groups != null)
{
Dictionary<string, bool> sort = new Dictionary<string, bool>();
Dictionary<string, bool> boolFields = new Dictionary<string, bool>();

if (map.ContainsKey("Sort") && map["Sort"].Type == OSDType.Map)
if (!map.ContainsKey("GroupIDs"))
{
OSDMap fields = (OSDMap)map["Sort"];
foreach (string field in fields.Keys)
Dictionary<string, bool> sort = new Dictionary<string, bool>();
Dictionary<string, bool> boolFields = new Dictionary<string, bool>();

if (map.ContainsKey("Sort") && map["Sort"].Type == OSDType.Map)
{
sort[field] = int.Parse(fields[field]) != 0;
OSDMap fields = (OSDMap)map["Sort"];
foreach (string field in fields.Keys)
{
sort[field] = int.Parse(fields[field]) != 0;
}
}
}
if (map.ContainsKey("BoolFields") && map["BoolFields"].Type == OSDType.Map)
{
OSDMap fields = (OSDMap)map["BoolFields"];
foreach (string field in fields.Keys)
if (map.ContainsKey("BoolFields") && map["BoolFields"].Type == OSDType.Map)
{
boolFields[field] = int.Parse(fields[field]) != 0;
OSDMap fields = (OSDMap)map["BoolFields"];
foreach (string field in fields.Keys)
{
boolFields[field] = int.Parse(fields[field]) != 0;
}
}
List<GroupRecord> reply = groups.GetGroupRecords(
AdminAgentID,
start,
map.ContainsKey("Count") ? map["Count"].AsUInteger() : 10,
sort,
boolFields
);
if (reply.Count > 0)
{
foreach (GroupRecord groupReply in reply)
{
Groups.Add(GroupRecord2OSDMap(groupReply));
}
}
resp["Total"] = groups.GetNumberOfGroups(AdminAgentID, boolFields);
}
List<GroupRecord> reply = groups.GetGroupRecords(
AdminAgentID,
start,
map.ContainsKey("Count") ? map["Count"].AsUInteger() : 10,
sort,
boolFields
);
if (reply.Count > 0)
else
{
foreach (GroupRecord groupReply in reply)
OSDArray groupIDs = (OSDArray)map["Groups"];
List<UUID> GroupIDs = new List<UUID>();
foreach (string groupID in groupIDs)
{
Groups.Add(GroupRecord2OSDMap(groupReply));
UUID foo;
if (UUID.TryParse(groupID, out foo))
{
GroupIDs.Add(foo);
}
}
if (GroupIDs.Count > 0)
{
List<GroupRecord> reply = groups.GetGroupRecords(AdminAgentID, GroupIDs);
if (reply.Count > 0)
{
foreach (GroupRecord groupReply in reply)
{
Groups.Add(GroupRecord2OSDMap(groupReply));
}
}
resp["Total"] = Groups.Count;
}
}
resp["Total"] = groups.GetNumberOfGroups(AdminAgentID, boolFields);
}

resp["Groups"] = Groups;
Expand Down

0 comments on commit 0f54c70

Please sign in to comment.