// This file is called from ManageServerGroup.csp. It presents
// the user with the option of adding and removing servers to and from
// the group he or she choose in ChooseServerGroup.csp. It uses
// ManageServerGroupMembers.csp to do this.
<!-- #include file="RetrieveIStore.csp" -->
<!-- #include file=helper_js.csp -->
// This function returns a listbox popuplated with all servers
// connected to the APS and all APSs.
// IStore - The InfoStore object.
//Query for all servers in the APS(s).
("SELECT SI_NAME FROM CI_SYSTEMOBJECTS WHERE SI_PROGID='CrystalEnterprise.Server'");
var HTML="<select name=ServerName>";
for (k=1;k<=Servers.Count;k++)
HTML = HTML + "<option value='"+Servers.Item(k).Title+"'>"+Servers.Item(k).Title;
function GetServersInGroup(IStore, ServerGroupId)
// This prints a drop down box of all the servers that are in a group.
// IStore - The InfoStore object.
// ServerGroupId - The InfoObject ID of the selected ServerGroup object.
// Query for the ServerGroup object for the group you are interested in.
var ServerGroups = IStore.Query
("SELECT SI_GROUP_MEMBERS FROM CI_SYSTEMOBJECTS WHERE SI_ID=" + ServerGroupId);
var ServerGroup = ServerGroups.Item(1).PluginInterface("");
Response.Write(ServerGroupId + "<BR>");
// Iterate through the members in the Servers collection to
var HTML="<select name=MemberName>";
for (k=1;k<=ServerGroup.Servers.Count;k++)
HTML = HTML + "<option value='"+ServerGroup.Servers.Item(k)+"'>"+ServerGroup.Servers.Item(k);
function GetServerGroups(IStore)
// This function returns a listbox popuplated with all the server groups.
// IStore - The InfoStore object.
var ServerGroups = IStore.Query
// Query for the ServerGroup object for the group you are interested in.
("SELECT SI_SERVER_GROUP FROM CI_SYSTEMOBJECTS WHERE SI_PROGID='CrystalEnterprise.ServerGroup'");
var HTML="<select name=GroupID>";
for (k=1;k<=ServerGroups.Count;k++)
HTML = HTML + "<option value='"+ServerGroups.Item(k).ID+"'>"+ServerGroups.Item(k).Title;
function GetGroupAssociatesInGroup(IStore, ServerGroupId)
// Retrieve a list of all ServerGroups on the APS. Return the list
// in an HTML string that will draw a drop down box.
// IStore - The InfoStore object.
// ServerGroupId - The InfoObject ID of the selected ServerGroup object.
// Query for the ServerGroup object for the group you are interested in.
var ServerGroups = IStore.Query
("SELECT SI_SUBGROUPS From CI_SYSTEMOBJECTS WHERE SI_ID=" + ServerGroupId);
// (Long) Holds the ID of the server group associate.
// (String) Holds the Title of the server group associate.
// Retrieve the ServerGroup plugin.
var ServerGroup = ServerGroups.Item(1).PluginInterface("");
var HTMLTable="<select name=SubGroupID>";
// Iterate through all groups and build the drop down box.
for (k=1;k<=ServerGroup.SubGroups.Count;k++)
GroupAssociateID = ServerGroup.SubGroups.Item(k);
("SELECT SI_SERVER_GROUP From CI_SYSTEMOBJECTS WHERE SI_ID=" + GroupAssociateID);
GroupAssociateName = ServerGroups.Item(1).Title;
HTMLTable = HTMLTable + "<option value='"+GroupAssociateID+"'>"+GroupAssociateName;
HTMLTable= HTMLTable + "</select>";
Response.Redirect ("Start.csp");
ServerGroupId = Request.QueryString.Item("ServerGroupId");
Response.Write("ServerGroupID: " + ServerGroupId);
Response.Write ("<H2>Server group member administration</H2>");
Response.Write ("<form action='ManageServerGroupMembers.csp
// Print a drop down box with all servers and an add button.
Response.Write ("Available servers: <BR>");
Response.Write (GetServers(IStore));
Response.Write ("<BR><input type=submit name='AddServer' value='Add a server'><HR>");
// Print a drop down box with the servers in the group and
Response.Write ("Servers in group: <BR>");
Response.Write (GetServersInGroup(IStore, ServerGroupId));
Response.Write ("<BR><input type=submit name='RemoveServer' value='Remove a server'> ");
// Add a button to clear all servers from the group.
Response.Write ("<input type=submit name='ClearServers' value='Clear all servers'><HR>");
// Print a drop down box with all group associates and an add button.
Response.Write ("Available groups: <BR>");
Response.Write (GetServerGroups(IStore));
Response.Write ("<BR><input type=submit name='AddGroup' value='Add a group'><HR>");
// Print a drop down box with the group associates in the group and
Response.Write ("Group associates in a group: <BR>");
Response.Write (GetGroupAssociatesInGroup(IStore, ServerGroupId));
Response.Write ("<BR><input type=submit name='RemoveGroup' value='Remove a group'> ");
// Add a button to clear all group associates.
Response.Write ("<input type=submit name='ClearGroups' value='Clear all groups'><HR>");
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |