home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 8 / CDACTUAL8.iso / progs / ite / ite10d1.exe / DATA.Z / GBUPDATE.JFM < prev    next >
Encoding:
Text File  |  1996-09-07  |  9.5 KB  |  338 lines

  1. /****************************************************************************\
  2. *                                                                            *
  3. * GbUpdate.jfm  --  Guest Book Update Form                                   *
  4. *                                                                            *
  5. * GbUpdate.jfm is part of the Guest Book solution application. It is used    *
  6. * to update the guest book entries. The bulk of the form was created by the  *
  7. * expert, but a couple interesting things were added. Note the header script *
  8. * right below this comment. It creates the login form and opens the login    *
  9. * form instead of this update form. Only a successful login will cause the   *
  10. * update form itself to open.                                                *
  11. *                                                                            *
  12. * Dependencies:  gestbk31.gif                                                *
  13. *                homepg31.gif                                                *
  14. *                expinavh.gif                                                *
  15. *                expirowh.gif                                                *
  16. *                apps/shared/controls.cc                                     *
  17. *                                                                            *
  18. * Links to:      ibapps/index.htm                                            *
  19. *                                                                            *
  20. * Updated 8/27/96 by IntraBuilder Samples Group                              *
  21. * $Revision:   1.4  $                                                        *
  22. *                                                                            *
  23. * Copyright (c) 1996, Borland International, Inc. All rights reserved.       *
  24. *                                                                            *
  25. \****************************************************************************/
  26. #include "intra.h"
  27. #include "security.h"
  28. //
  29. // The code loads the security login form instead of the update form.
  30. // An object reference to the update form is stored as a property of
  31. // the login form. If the login is successful, the login form opens
  32. // this update form.
  33. // 
  34. // First create the update form, but don't open it.
  35. var f = new gbupdateForm();
  36. // then create a security object
  37. _sys.scripts.load(SM_CLASS_LOCATION + "security.js");
  38. f.security = new SecurityManager();
  39. // then create the login form
  40. _sys.scripts.load("gblogin.jfm");
  41. var login = new gbloginForm();
  42. // the login form requires two custom properties be set
  43. login.security = f.security;
  44. login.nextForm = f;
  45. // finally, open the login form
  46. login.open();
  47. return;
  48. // {End Header} Do not remove this comment//
  49. // Generated on 08/27/1996
  50. //
  51. var f = new gbupdateForm();
  52. f.open();
  53. class gbupdateForm extends Form {
  54.    _sys.scripts.load(_sys.env.home() + "APPS\\SHARED\\CONTROLS.CC");
  55.    with (this) {
  56.       color = "a4d5ff";
  57.       height = 27;
  58.       left = 1.1667;
  59.       top = 0.4706;
  60.       width = 78;
  61.       title = "Guest Book Update";
  62.       preRender = class::Form_preRender;
  63.    }
  64.  
  65.  
  66.    with (this.ibapps1 = new Database()){
  67.       left = 53;
  68.       top = 3;
  69.       databaseName = "IBAPPS";
  70.       active = true;
  71.    }
  72.  
  73.  
  74.    with (this.guest1 = new Query()){
  75.       left = 47;
  76.       top = 3;
  77.       database = parent.ibapps1;
  78.       sql = "SELECT * FROM guest";
  79.       active = true;
  80.    }
  81.  
  82.  
  83.    with (this.guest1.rowset) {
  84.  
  85.       autoEdit = false;
  86.       filterOptions = 3;
  87.       locateOptions = 3;
  88.    }
  89.  
  90.  
  91.    with (this.rule1 = new Rule(this)){
  92.       left = 1;
  93.       top = 6;
  94.       size = 2;
  95.       right = 72;
  96.       pageno = 0;
  97.    }
  98.  
  99.  
  100.    with (this.rule2 = new Rule(this)){
  101.       left = 1;
  102.       top = 20;
  103.       size = 2;
  104.       right = 72;
  105.       pageno = 0;
  106.    }
  107.  
  108.  
  109.    with (this.rule3 = new Rule(this)){
  110.       left = 1;
  111.       top = 28;
  112.       size = 2;
  113.       right = 72;
  114.       pageno = 0;
  115.    }
  116.  
  117.  
  118.    with (this.guestBookLogo = new Image(this)){
  119.       height = 4.8235;
  120.       left = 1;
  121.       top = 0.4706;
  122.       width = 13.6667;
  123.       dataSource = "filename GESTBK31.GIF";
  124.       alignment = 4;
  125.       pageno = 0;
  126.    }
  127.  
  128.  
  129.    with (this.titleHTML = new HTML(this)){
  130.       height = 2;
  131.       left = 23;
  132.       top = 0.4706;
  133.       width = 49;
  134.       color = "steelblue";
  135.       text = '<H1><FONT SIZE="+4"><FONT COLOR="mediumvioletred">G</FONT></FONT>uest <FONT SIZE="+4"><FONT COLOR="mediumvioletred">B</FONT></FONT>ook <FONT SIZE="+4"><FONT COLOR="mediumvioletred">U</FONT></FONT>pdate</H1>';
  136.       pageno = 0;
  137.    }
  138.  
  139.  
  140.    with (this.navImage = new Image(this)){
  141.       height = 1.3529;
  142.       left = 1;
  143.       top = 7;
  144.       width = 17.3333;
  145.       dataSource = "filename EXPINAVH.GIF";
  146.       alignment = 4;
  147.       onImageServerClick = {|nLeft, nTop|;if (nLeft >= 26*0 && nLeft < 26*1){form.rowset.first()}else if (nLeft >= 26*1 && nLeft < 26*2){if (!form.rowset.next(-1)) form.rowset.next();}else if (nLeft >= 26*2 && nLeft < 26*3){if (!form.rowset.next()) form.rowset.next(-1);}else{form.rowset.last()}};
  148.    }
  149.  
  150.  
  151.    with (this.editImage = new Image(this)){
  152.       height = 1.3529;
  153.       left = 23;
  154.       top = 7;
  155.       width = 29;
  156.       dataSource = "filename EXPIROWH.GIF";
  157.       alignment = 4;
  158.       onImageServerClick = {|nLeft, nTop|;if (nLeft >= 26*0 && nLeft < 26*1){form.rowset.beginAppend()}else if (nLeft >= 26*1 && nLeft < 26*2){form.rowset.delete()}else if (nLeft >= 26*2 && nLeft < 26*3){form.rowset.save()}else if (nLeft >= 26*3 && nLeft < 26*4){form.rowset.abandon()}else if (nLeft >= 26*4 && nLeft < 26*5){form.rowset.beginEdit()}else if (nLeft >= 26*5 && nLeft < 26*6){with(this) {if (form.rowset.state==5) {text="New Query";form.rowset.applyLocate();} else {text="Run Query";form.rowset.beginLocate();}}}else{with(this) {if (form.rowset.state==4) {text="New Filter";form.rowset.applyFilter();} else {text="Run Filter";form.rowset.beginFilter();}}}};
  159.    }
  160.  
  161.  
  162.    with (this.visitHTML = new HTML(this)){
  163.       height = 1;
  164.       left = 1;
  165.       top = 9;
  166.       width = 15;
  167.       color = "black";
  168.       fontBold = false;
  169.       text = "Visittime";
  170.    }
  171.  
  172.  
  173.    with (this.visitText = new Text(this)){
  174.       left = 23;
  175.       top = 9;
  176.       width = 22;
  177.       dataLink = parent.guest1.rowset.fields["VisitTime"];
  178.    }
  179.  
  180.  
  181.    with (this.nameHTML = new HTML(this)){
  182.       height = 1;
  183.       left = 1;
  184.       top = 10;
  185.       width = 15;
  186.       color = "black";
  187.       fontBold = false;
  188.       text = "Fullname";
  189.    }
  190.  
  191.  
  192.    with (this.nameText = new Text(this)){
  193.       left = 23;
  194.       top = 10;
  195.       width = 33;
  196.       dataLink = parent.guest1.rowset.fields["FullName"];
  197.    }
  198.  
  199.  
  200.    with (this.emailHTML = new HTML(this)){
  201.       height = 1;
  202.       left = 1;
  203.       top = 11;
  204.       width = 15;
  205.       color = "black";
  206.       fontBold = false;
  207.       text = "Email";
  208.    }
  209.  
  210.  
  211.    with (this.emailText = new Text(this)){
  212.       left = 23;
  213.       top = 11;
  214.       width = 33;
  215.       dataLink = parent.guest1.rowset.fields["Email"];
  216.    }
  217.  
  218.  
  219.    with (this.whereHTML = new HTML(this)){
  220.       height = 1;
  221.       left = 1;
  222.       top = 12;
  223.       width = 15;
  224.       color = "black";
  225.       fontBold = false;
  226.       text = "Wherefrom";
  227.    }
  228.  
  229.  
  230.    with (this.whereText = new Text(this)){
  231.       left = 23;
  232.       top = 12;
  233.       width = 33;
  234.       dataLink = parent.guest1.rowset.fields["WhereFrom"];
  235.    }
  236.  
  237.  
  238.    with (this.firstVisitCheck = new CheckBox(this)){
  239.       height = 1;
  240.       left = 23;
  241.       top = 13;
  242.       width = 17;
  243.       text = "Firstvisit";
  244.       dataLink = parent.guest1.rowset.fields["FirstVisit"];
  245.       fontBold = false;
  246.    }
  247.  
  248.  
  249.    with (this.commentHTML = new HTML(this)){
  250.       height = 1;
  251.       left = 1;
  252.       top = 14;
  253.       width = 15;
  254.       color = "black";
  255.       fontBold = false;
  256.       text = "Comment";
  257.    }
  258.  
  259.  
  260.    with (this.commitTextArea = new TextArea(this)){
  261.       height = 5;
  262.       left = 23;
  263.       top = 14;
  264.       width = 49;
  265.       dataLink = parent.guest1.rowset.fields["Comment"];
  266.       readOnly = false;
  267.    }
  268.  
  269.  
  270.    with (this.homePageLinkImage = new Image(this)){
  271.       height = 4.8235;
  272.       left = 1;
  273.       top = 21;
  274.       width = 13.6667;
  275.       dataSource = "filename HOMEPG31.GIF";
  276.       alignment = 4;
  277.       pageno = 0;
  278.       onImageClick = class::link_to_home_page;
  279.    }
  280.  
  281.  
  282.    with (this.homePageLinkHTML = new HTML(this)){
  283.       height = 1;
  284.       left = 23;
  285.       top = 21;
  286.       width = 28;
  287.       color = "black";
  288.       fontBold = false;
  289.       text = "<A HREF='/ibapps/index.htm'>Return to Home Page</A>";
  290.       pageno = 0;
  291.    }
  292.  
  293.  
  294.    with (this.generatedHTML1 = new GeneratedHTML(this)){
  295.       height = 1;
  296.       left = 1;
  297.       top = 29;
  298.       width = 58;
  299.       pageno = 0;
  300.    }
  301.  
  302.  
  303.    with (this.errorHTML = new HTML(this)){
  304.       height = 4;
  305.       left = 2;
  306.       top = 5;
  307.       width = 60;
  308.       color = "black";
  309.       text = "error";
  310.       pageno = 2;
  311.    }
  312.  
  313.  
  314.    this.rowset = this.guest1.rowset
  315.  
  316.    function link_to_home_page()
  317.    {
  318.       location.href="/ibapps/index.htm";
  319.    }
  320.  
  321.    function Form_preRender() 
  322.    {
  323.       // see if the logged in user has access to the guest book update form
  324.       try {
  325.          if (!this.security.hasAccessTo("guestbook")) {
  326.             this.errorHTML.text = "Error: Insufficient rights to update Guest Book data.";
  327.             this.pageno = 2;
  328.          }
  329.       }
  330.       catch (Exception e) {
  331.          this.errorHTML.text = "An error occured loading the update form. " +
  332.                                e.message() + " (" + e.code + ")";
  333.          this.pageno = 2;
  334.       }
  335.    }
  336.  
  337. }
  338.