groupDescription(request.group);
write("Choose a Folder from the " + request.group +" Phase
")
function Cursor_User()
{
// select a list of folders based on the sales phase which was chosen. Different logic exists for
// users versus a system administrator. The user only gets to see folders in the their interest group, or which
// belong to interest group = all
GroupList = database.cursor('SELECT folderid, foldername, interestgroup, folder.description FROM folder, interestgroup WHERE group = "'+ request.group +'" AND interestgroup.interestgroupid = folder.interestgroupid AND (folder.interestgroupid = "'+ client.interestgroupid +'" OR folder.interestgroupid = "1") ORDER BY foldername, interestgroup');
}
function Cursor_Admin()
{
GroupList = database.cursor('SELECT folderid, foldername, interestgroup, folder.description FROM folder, interestgroup WHERE group = "'+ request.group +'" AND interestgroup.interestgroupid = folder.interestgroupid ORDER BY foldername, interestgroup');
}
function Make_FolderTableHeader()
{
write("");
write("");
write("Folder | ");
write("Interest Group | ");
write("Description |
");
}
function Make_FolderTable () // this is the table that will contain the folders for the given sales phase.
{
var printhead = "false";
var name = "";
while (GroupList.next())
{
if(printhead == "false") // keeps table heading from printing if no rows found.
{Make_FolderTableHeader();
printhead="true"}
foldername = escape(GroupList.foldername);
write("" + GroupList.foldername + " | ");
write("" + GroupList.interestgroup + " | ");
write("" + GroupList.description + " |
");
} //end of while loop
//the following logic prints the "no data found" message if the query result returns nothing.
if(printhead == "true")
{write("
");
write("
");}
else
{ Print_No_Found();}
}
if(client.accesslevel == "A") // a system admin user
{Cursor_Admin();}
else
{Cursor_User();}
Make_FolderTable();
// to submit knowledge, the group name is passed
");