System Administration

Choose a Bulletin to Modify


//Main Global variable definition. These constants and literals are //used throughout the application var scrolltable = "bulletin"; var highdate = "12/31/9999"; var blankalpha = ""; var nodate = "mm/dd/yyyy"; var zeronum = 0; var prevlabel = "Page Up"; var nextlabel = "Page Dn"; var backvalue = "Back"; var result = 0; var begindate = ""; var search = "Search"; var toplabel = "Top of List"; // end globals //The following code checks the date field entered, if the user came from the Search button on SA09 if((request.search == search)||(request.back == backvalue)) {if((request.startdate == blankalpha)||(request.startdate==nodate)||(request.startdate==null)) {begindate = highdate} else {begindate = request.startdate}} //The following code determins if the user has pressed page up or page down // and sets bullpagenum, which scrolls accordingly if (request.prevbutt == prevlabel) {client.bullpagenum = request.prevpagenum} if (request.prevbutt == toplabel) {client.bullpagenum = 1} if(request.nextbutt==nextlabel) {client.bullpagenum = request.nextpagenum} function CursorMaster_SA09S() //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.bullpagenum, 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 complexity of this query is due to the fact that rows on the previous page cannot be viewed // when the user presses page up or page down. Thus, the values stored on scrollkey dictate the rows //shown to the user. For this display, there are three keys, activation date, expiration date and bulletin id // Three keys makes the selection process involved. BulletinList = database.cursor('SELECT activationdate, expirationdate, bulletinid, title, MONTH(activationdate) AS ac_mon, DAY(activationdate) AS ac_day, YEAR(activationdate) AS ac_year, MONTH(expirationdate) AS ex_mon, DAY(expirationdate) AS ex_day, YEAR(expirationdate) AS ex_year, bulletin.interestgroupid, interestgroup.interestgroup FROM bulletin, interestgroup WHERE (((activationdate = date("' + temppage3.alphakey1 + '")) AND (expirationdate = date("' + temppage3.alphakey2 + '")) AND (bulletinid >= "' + temppage3.numkey1 + '")) OR ((activationdate = date("' + temppage3.alphakey1 + '")) AND (expirationdate < date("' + temppage3.alphakey2 + '"))) OR ((activationdate < date("' + temppage3.alphakey1 + '")))) AND bulletin.interestgroupid = interestgroup.interestgroupid ORDER BY activationdate DESC, expirationdate DESC, bulletinid '); } function CursorUser_SA09S() //this is the cursor SELECT statement executed by a user who does NOT have System Administration // authority. { // This first SELECT gets the scroll keys from the scroll key table temppage4 = new TopPage(client.userid, scrolltable, client.bullpagenum, blankalpha, blankalpha, zeronum, zeronum); temppage4.sel_scroll(); //Once the starting point on the page has been determined, // the cursor for the application specific data can be selected BulletinList = database.cursor('SELECT activationdate, expirationdate, bulletinid, title, MONTH(activationdate) AS ac_mon, DAY(activationdate) AS ac_day, YEAR(activationdate) AS ac_year, MONTH(expirationdate) AS ex_mon, DAY(expirationdate) AS ex_day, YEAR(expirationdate) AS ex_year, bulletin.interestgroupid, interestgroup.interestgroup FROM bulletin, interestgroup WHERE (((activationdate = date("' + temppage4.alphakey1 + '")) AND (expirationdate = date("' + temppage4.alphakey2 + '")) AND (bulletinid >= "' + temppage4.numkey1 + '")) OR ((activationdate = date("' + temppage4.alphakey1 + '")) AND (expirationdate < date("' + temppage4.alphakey2 + '"))) OR ((activationdate < date("' + temppage4.alphakey1 + '")))) AND bulletin.interestgroupid = interestgroup.interestgroupid AND ( bulletin.ownerid = "' + client.userid +'") ORDER BY activationdate DESC, expirationdate DESC, bulletinid '); } function BuildTableHeader_SA09S() // Building the column headers for the table { write("

"); write(""); write(""); write(""); write(""); write(""); write(""); write(""); write(""); } function BuildTableData_SA09S() // Building the selected data and inserting it into the table. Buttons // Are added for modify/delete functionality { var activationdate; var expirationdate; var keepfetching = "true"; var printhead = "false"; var indx=1; while(keepfetching == "true") { if(BulletinList.next()) {if(printhead =="false") {BuildTableHeader_SA09S(); printhead="true";} if(indx<11) {// format the dates first activationdate = BulletinList.ac_mon + "/" + BulletinList.ac_day + "/" + BulletinList.ac_year; expirationdate = BulletinList.ex_mon + "/" + BulletinList.ex_day + "/" + BulletinList.ex_year ; write(""); write(""); write(""); write(""); write(""); write(""); indx++; } else {keepfetching = "false"; activationdate = BulletinList.ac_mon + "/" + BulletinList.ac_day + "/" + BulletinList.ac_year; expirationdate = BulletinList.ex_mon + "/" + BulletinList.ex_day + "/" + BulletinList.ex_year ; } } 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.bullpagenum==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.bullpagenum) + 1; var actdate = activationdate; var expdate = expirationdate; var bullnum = BulletinList.bulletinid; BulletinList.close() temppage1 = new TopPage(client.userid, scrolltable, nextpage, actdate, expdate, bullnum, 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();}; }; write("
You Have Authority to Modify the Following Bulletins, Page "+ client.bullpagenum + "
ModDelActivation DateExpiration DateInterest GroupTitle
" + activationdate + "" + expirationdate + "" + BulletinList. interestgroup + "" + BulletinList.title + "

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

"); write(""); // The Top button is displayed if the user in on page > 2 if (client.bullpagenum >2) {CreateTopButton_SA09S()}; // The previous button is not displayed if the user in on page 1 if (client.bullpagenum != 1) {CreatePrevButton_SA09S()}; // The next button is not displayed if there is no more data to display if(indx == 11) {CreateNextButton_SA09S()}; } function CreateTopButton_SA09S() { // the page number is set to 1 on reentry write(""); } function CreatePrevButton_SA09S() { // the page number is set back one value when the user presses "Page Up" var prevpage = parseInt(client.bullpagenum) - 1; write(""); } function CreateNextButton_SA09S() { // the page number is set forward one value when the user presses "Page Dn" var newpage = parseInt(client.bullpagenum) + 1; write(""); } if((client.bullpagenum == "null")||(client.bullpagenum == null)||(request.search == search)) { // Creating the initial Scrollkey value for the first page client.bullpagenum = 1 temppage2 = new TopPage(client.userid, scrolltable, 1, begindate, highdate, zeronum, zeronum); pageoneresult = temppage2.ins_scroll(); if(pageoneresult !=0) {temppage2.upd_scroll();} } if(client.accesslevel == "A") {CursorMaster_SA09S();} else {CursorUser_SA09S();} indx = BuildTableData_SA09S(); DeterminePaging_SA09S();
"); write("
"); write(""); write("
"); write(""); write(""); write("
"); write(""); write(""); write("