home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************\
- * *
- * GbUpdate.jfm -- Guest Book Update Form *
- * *
- * GbUpdate.jfm is part of the Guest Book solution application. It is used *
- * to update the guest book entries. The bulk of the form was created by the *
- * expert, but a couple interesting things were added. Note the header script *
- * right below this comment. It creates the login form and opens the login *
- * form instead of this update form. Only a successful login will cause the *
- * update form itself to open. *
- * *
- * Dependencies: gestbk31.gif *
- * homepg31.gif *
- * expinavh.gif *
- * expirowh.gif *
- * apps/shared/controls.cc *
- * *
- * Links to: ibapps/index.htm *
- * *
- * Updated 8/27/96 by IntraBuilder Samples Group *
- * $Revision: 1.4 $ *
- * *
- * Copyright (c) 1996, Borland International, Inc. All rights reserved. *
- * *
- \****************************************************************************/
- #include "intra.h"
- #include "security.h"
- //
- // The code loads the security login form instead of the update form.
- // An object reference to the update form is stored as a property of
- // the login form. If the login is successful, the login form opens
- // this update form.
- //
- // First create the update form, but don't open it.
- var f = new gbupdateForm();
- // then create a security object
- _sys.scripts.load(SM_CLASS_LOCATION + "security.js");
- f.security = new SecurityManager();
- // then create the login form
- _sys.scripts.load("gblogin.jfm");
- var login = new gbloginForm();
- // the login form requires two custom properties be set
- login.security = f.security;
- login.nextForm = f;
- // finally, open the login form
- login.open();
- return;
- // {End Header} Do not remove this comment//
- // Generated on 08/27/1996
- //
- var f = new gbupdateForm();
- f.open();
- class gbupdateForm extends Form {
- _sys.scripts.load(_sys.env.home() + "APPS\\SHARED\\CONTROLS.CC");
- with (this) {
- color = "a4d5ff";
- height = 27;
- left = 1.1667;
- top = 0.4706;
- width = 78;
- title = "Guest Book Update";
- preRender = class::Form_preRender;
- }
-
-
- with (this.ibapps1 = new Database()){
- left = 53;
- top = 3;
- databaseName = "IBAPPS";
- active = true;
- }
-
-
- with (this.guest1 = new Query()){
- left = 47;
- top = 3;
- database = parent.ibapps1;
- sql = "SELECT * FROM guest";
- active = true;
- }
-
-
- with (this.guest1.rowset) {
-
- autoEdit = false;
- filterOptions = 3;
- locateOptions = 3;
- }
-
-
- with (this.rule1 = new Rule(this)){
- left = 1;
- top = 6;
- size = 2;
- right = 72;
- pageno = 0;
- }
-
-
- with (this.rule2 = new Rule(this)){
- left = 1;
- top = 20;
- size = 2;
- right = 72;
- pageno = 0;
- }
-
-
- with (this.rule3 = new Rule(this)){
- left = 1;
- top = 28;
- size = 2;
- right = 72;
- pageno = 0;
- }
-
-
- with (this.guestBookLogo = new Image(this)){
- height = 4.8235;
- left = 1;
- top = 0.4706;
- width = 13.6667;
- dataSource = "filename GESTBK31.GIF";
- alignment = 4;
- pageno = 0;
- }
-
-
- with (this.titleHTML = new HTML(this)){
- height = 2;
- left = 23;
- top = 0.4706;
- width = 49;
- color = "steelblue";
- 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>';
- pageno = 0;
- }
-
-
- with (this.navImage = new Image(this)){
- height = 1.3529;
- left = 1;
- top = 7;
- width = 17.3333;
- dataSource = "filename EXPINAVH.GIF";
- alignment = 4;
- 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()}};
- }
-
-
- with (this.editImage = new Image(this)){
- height = 1.3529;
- left = 23;
- top = 7;
- width = 29;
- dataSource = "filename EXPIROWH.GIF";
- alignment = 4;
- 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();}}}};
- }
-
-
- with (this.visitHTML = new HTML(this)){
- height = 1;
- left = 1;
- top = 9;
- width = 15;
- color = "black";
- fontBold = false;
- text = "Visittime";
- }
-
-
- with (this.visitText = new Text(this)){
- left = 23;
- top = 9;
- width = 22;
- dataLink = parent.guest1.rowset.fields["VisitTime"];
- }
-
-
- with (this.nameHTML = new HTML(this)){
- height = 1;
- left = 1;
- top = 10;
- width = 15;
- color = "black";
- fontBold = false;
- text = "Fullname";
- }
-
-
- with (this.nameText = new Text(this)){
- left = 23;
- top = 10;
- width = 33;
- dataLink = parent.guest1.rowset.fields["FullName"];
- }
-
-
- with (this.emailHTML = new HTML(this)){
- height = 1;
- left = 1;
- top = 11;
- width = 15;
- color = "black";
- fontBold = false;
- text = "Email";
- }
-
-
- with (this.emailText = new Text(this)){
- left = 23;
- top = 11;
- width = 33;
- dataLink = parent.guest1.rowset.fields["Email"];
- }
-
-
- with (this.whereHTML = new HTML(this)){
- height = 1;
- left = 1;
- top = 12;
- width = 15;
- color = "black";
- fontBold = false;
- text = "Wherefrom";
- }
-
-
- with (this.whereText = new Text(this)){
- left = 23;
- top = 12;
- width = 33;
- dataLink = parent.guest1.rowset.fields["WhereFrom"];
- }
-
-
- with (this.firstVisitCheck = new CheckBox(this)){
- height = 1;
- left = 23;
- top = 13;
- width = 17;
- text = "Firstvisit";
- dataLink = parent.guest1.rowset.fields["FirstVisit"];
- fontBold = false;
- }
-
-
- with (this.commentHTML = new HTML(this)){
- height = 1;
- left = 1;
- top = 14;
- width = 15;
- color = "black";
- fontBold = false;
- text = "Comment";
- }
-
-
- with (this.commitTextArea = new TextArea(this)){
- height = 5;
- left = 23;
- top = 14;
- width = 49;
- dataLink = parent.guest1.rowset.fields["Comment"];
- readOnly = false;
- }
-
-
- with (this.homePageLinkImage = new Image(this)){
- height = 4.8235;
- left = 1;
- top = 21;
- width = 13.6667;
- dataSource = "filename HOMEPG31.GIF";
- alignment = 4;
- pageno = 0;
- onImageClick = class::link_to_home_page;
- }
-
-
- with (this.homePageLinkHTML = new HTML(this)){
- height = 1;
- left = 23;
- top = 21;
- width = 28;
- color = "black";
- fontBold = false;
- text = "<A HREF='/ibapps/index.htm'>Return to Home Page</A>";
- pageno = 0;
- }
-
-
- with (this.generatedHTML1 = new GeneratedHTML(this)){
- height = 1;
- left = 1;
- top = 29;
- width = 58;
- pageno = 0;
- }
-
-
- with (this.errorHTML = new HTML(this)){
- height = 4;
- left = 2;
- top = 5;
- width = 60;
- color = "black";
- text = "error";
- pageno = 2;
- }
-
-
- this.rowset = this.guest1.rowset
-
- function link_to_home_page()
- {
- location.href="/ibapps/index.htm";
- }
-
- function Form_preRender()
- {
- // see if the logged in user has access to the guest book update form
- try {
- if (!this.security.hasAccessTo("guestbook")) {
- this.errorHTML.text = "Error: Insufficient rights to update Guest Book data.";
- this.pageno = 2;
- }
- }
- catch (Exception e) {
- this.errorHTML.text = "An error occured loading the update form. " +
- e.message() + " (" + e.code + ")";
- this.pageno = 2;
- }
- }
-
- }
-