System Administration

Choose a User Profile to Modify

//Main Global variable definition. These constants and literals are //used throughout the application var scrolltable = "user"; var blankalpha = ""; var zeronum = 0; var prevlabel = "Page Up"; var nextlabel = "Page Dn"; var result = 0; var toplabel = "Top of List"; // end globals //The following code determins if the user has pressed page up or page down // and sets userpagenum, which scrolls accordingly if (request.prevbutt == prevlabel) {client.userpagenum = request.prevpagenum } else {if(request.nextbutt==nextlabel) {client.userpagenum = request.nextpagenum} else{if(request.prevbutt==toplabel) {client.userpagenum =1} } } function CursorMaster_SA03() //this is the cursor SELECT statement executed by a user with System Administration // authority. { // This first SELECT gets the scroll keys from the scroll key table temppage3 = new TopPage(client.userid, scrolltable, client.userpagenum, blankalpha, blankalpha, zeronum, zeronum); temppage3.sel_scroll(); //Once the starting point on the page has been determined, // the cursor for the application specific data can be selected // The checking of lastname versus lastname and firstname is for scrolling, and insures that rows from a previous page will not be redisplayed. UserProfile = database.cursor('SELECT lastname, firstname, userid FROM user WHERE (lastname = "' + temppage3.alphakey1 + '" AND firstname >= "' + temppage3.alphakey2 + '") OR (lastname > "' + temppage3.alphakey1 + '" ) ORDER BY lastname, firstname'); } function CursorUser_SA03() //this is the cursor SELECT statement executed by a user with normal User // authority. { // See comments in CursorMaster_SA03 temppage4 = new TopPage(client.userid, scrolltable, client.userpagenum, blankalpha, blankalpha, zeronum, zeronum); temppage4.sel_scroll(); // See comments in CursorMaster_SA03 UserProfile = database.cursor('SELECT lastname, firstname, userid FROM user WHERE userid = "' + temppage4.userid + '"'); } function BuildTableHeader_SA03() // Building the column headers for the table { write("
"); write(""); write(""); write(""); write(""); write(""); write(""); write(""); } function BuildTableData_SA03() // Building the selected data and inserting it into the table. Buttons // Are added for modify/delete functionality { var keepfetching = "true"; var indx=1; var printhead = "false"; while(keepfetching == "true") {if(UserProfile.next()) {if(printhead == "false") {BuildTableHeader_SA03(); printhead = "true"; } if(indx<11) {write(""); write(""); write(""); write(""); write(""); indx++; } else {keepfetching = "false";} } else {keepfetching = "false"; indx=10;} // needed to prevent page down from printing if 10th row is last one. }; // end WHILE loop // If no rows are found, a message is displayed to the user. if((printhead=="false") && (client.userpagenum==1)) { Print_No_Found();} // Since the table on the page contains 10 rows, the 11th row is saved. // The data from this row becomes the next entry in Scrollkey, and will tell // the application where to start when the user presses "Page Dn" if(indx == 11) { var nextpage = 0; nextpage = parseInt(client.userpagenum) + 1; var inslastname = ""+UserProfile.lastname+""; var insfirstname = ""+UserProfile.firstname+""; UserProfile.close(); temppage1 = new TopPage(client.userid, scrolltable, nextpage, inslastname, insfirstname, zeronum, zeronum); newpageresult = temppage1.ins_scroll(); // If this row already exists, alpha or numeric key data is updated in case // a row has been updated since the user last accessed the page. if(newpageresult !=0) {temppage1.upd_scroll();}; } else {UserProfile.close();}; write("
You Have Authority to Modify the Following Entries, Page " + client.userpagenum + "
ModDelLast NameFirst NameUserID
" + UserProfile.lastname + "" + UserProfile.firstname + "" + UserProfile.userid + "

"); return indx; } function DeterminePaging_SA03() { write("

"); write(""); // The Top button is displayed on pages > 2 if (client.userpagenum >2) {CreateTopButton_SA03()}; // The previous button is not displayed if the user in on page 1 if (client.userpagenum != 1) {CreatePrevButton_SA03()}; // The next button is not displayed if there is no more data to display if(indx == 11) {CreateNextButton_SA03()}; } function CreateTopButton_SA03() { // user returns to page 1 write(""); } function CreatePrevButton_SA03() { // the page number is set back one value when the user presses "Page Up" var prevpage = parseInt(client.userpagenum) - 1; write(""); } function CreateNextButton_SA03() { // the page number is set forward one value when the user presses "Page Dn" var newpage = parseInt(client.userpagenum) + 1; write(""); } if((client.userpagenum == "null")||(client.userpagenum == null)) { // Creating the initial Scrollkey value for the first page client.userpagenum = 1 temppage2 = new TopPage(client.userid, scrolltable, 1, blankalpha, blankalpha, zeronum, zeronum); pageoneresult = temppage2.ins_scroll(); if(pageoneresult !=0) {temppage2.upd_scroll();} }; if(client.accesslevel == "A") //DB access is different for standard users versus administrators. {CursorMaster_SA03()} else {CursorUser_SA03()}; indx = BuildTableData_SA03(); DeterminePaging_SA03(); if (client.accesslevel == "A") { }
"); write(""); write("
"); write(""); write(""); write("
"); write(""); write(""); write("