// This page is called from ChooseServerGroup.csp. If the user chose
// to add or delete a server group, these actions are managed here.
// If the user decided to manage the servers in a group, then more information
// is required and ManageServerGroupMembers.csp is called.
<!-- #include file="RetrieveIStore.csp" -->
<!-- #include file=helper_js.csp -->
function DeleteServerGroup(IStore, ServerGroupId)
// Delete a server group from the APS.
// IStore - The InfoStore object.
// ServerGroupId - The InfoObject ID of the selected ServerGroup object.
// Query for the selected server group.
var ServerGroups = IStore.Query("SELECT SI_SERVER_GROUP FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerGroupId);
// Concatenate # with the Id and given it to the
// Delete method. If you give it just the ID, it will
// treat it as an array index and remove the wrong server.
ServerGroups.Delete("#" + ServerGroupId);
function AddServerGroup(IStore, Name, Description)
// Add a new server group to the APS.
// IStore - The InfoStore object.
// Name - The name of the new server group.
// Description - The description of the new server group.
var PluginMgr = IStore.PluginManager;
var ServerGroup = PluginMgr.PluginInfo("CrystalEnterprise.ServerGroup");
// Create a new InfoObjects collection. This will be used to store the new object
// that will be commmitted later.
var NewInfoObjects = IStore.NewInfoObjectCollection();
// Add the result of the plugin. This will create a new InfoObject that
var NewServerGroup = NewInfoObjects.Add (ServerGroup);
// Set the group's name and description.
NewServerGroup.Description = Description;
// Commit the collection, in which the new group is stored, to the APS.
IStore.Commit (NewInfoObjects);
Response.Redirect ("Start.csp");
// Depending on the user's request, use the functions in this file
// to add or delete the group. If the user wants to manage
// the members of the group, call ChooseServerGroupMembers.csp instead
// and give it the ID of the group in question as a URL parameter.
ServerGroupId = Request.Form.Item("ServerGroupId");
if (Request.Form.Item("Remove") == "Remove")
DeleteServerGroup(IStore,ServerGroupId);
Response.Redirect ("ChooseServerGroup.csp");
if (Request.Form.Item("Add") == "Add")
Name = Request.Form.Item("NewGroupName");
Description = Request.Form.Item("NewGroupDescription");
AddServerGroup(IStore,Name,Description);
Response.Redirect ("ChooseServerGroup.csp");
if (Request.Form.Item("ManageMembers") == "ManageMembers")
Response.Redirect ("ChooseServerGroupMembers.csp
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |