home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
ib
/
setups
/
intrabld
/
data.z
/
GBUPDATE.JFM
< prev
next >
Wrap
Text File
|
1996-12-11
|
9KB
|
316 lines
/****************************************************************************\
* *
* 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 11/12/96 by IntraBuilder Samples Group *
* $Revision: 1.7 $ *
* *
* 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 11/12/96
//
var f = new gbupdateForm();
f.open();
class gbupdateForm extends Form {
_sys.scripts.load(_sys.env.home() + "APPS\\SHARED\\CONTROLS.CC")
with (this) {
preRender = class::Form_preRender;
color = "a4d5ff";
height = 13.6667;
left = 0;
top = 0;
width = 76;
title = "Guest Book Update";
}
with (this.ibapps1 = new Database()){
left = 68;
top = 2;
databaseName = "IBAPPS";
active = true;
}
with (this.guest1 = new Query()){
left = 62;
top = 2;
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)){
top = 4;
size = 2;
right = 70;
pageno = 0;
}
with (this.rule2 = new Rule(this)){
top = 15.5;
size = 2;
right = 70;
pageno = 0;
}
with (this.rule3 = new Rule(this)){
top = 20;
size = 2;
right = 70;
pageno = 0;
}
with (this.guestBookLogo = new Image(this)){
height = 3.4167;
width = 10.25;
dataSource = "filename GESTBK31.GIF";
alignment = 4;
pageno = 0;
}
with (this.titleHTML = new HTML(this)){
height = 2;
left = 12;
width = 58;
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)){
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()}};
height = 0.9583;
left = 12;
top = 2;
width = 13;
dataSource = "filename EXPINAVH.GIF";
alignment = 4;
}
with (this.editImage = new Image(this)){
onImageServerClick = {|nLeft, nTop|;if (nLeft >= 26*0 && nLeft < 26*1){form.rowset.beginAppend()}else if (nLeft >= 26*1 && nLeft < 26*2){if (!form.rowset.endOfSet) form.rowset.delete(); if (form.rowset.endOfSet) form.rowset.next(-1);}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();}}}};
height = 0.9583;
left = 30;
top = 2;
width = 22.75;
dataSource = "filename EXPIROWH.GIF";
alignment = 4;
}
with (this.visitHTML = new HTML(this)){
height = 1;
top = 5;
width = 14;
color = "black";
text = "Visit time";
}
with (this.visitText = new Text(this)){
left = 14;
top = 5;
width = 16;
dataLink = parent.guest1.rowset.fields["VisitTime"];
}
with (this.nameHTML = new HTML(this)){
height = 1;
top = 6;
width = 14;
color = "black";
text = "Full name";
}
with (this.nameText = new Text(this)){
left = 14;
top = 6;
width = 33;
dataLink = parent.guest1.rowset.fields["FullName"];
}
with (this.emailHTML = new HTML(this)){
height = 1;
top = 7;
width = 14;
color = "black";
text = "Email address";
}
with (this.emailText = new Text(this)){
left = 14;
top = 7;
width = 33;
dataLink = parent.guest1.rowset.fields["Email"];
}
with (this.whereHTML = new HTML(this)){
height = 1;
top = 8;
width = 14;
color = "black";
text = "Where from";
}
with (this.whereText = new Text(this)){
left = 14;
top = 8;
width = 33;
dataLink = parent.guest1.rowset.fields["WhereFrom"];
}
with (this.firstVisitCheck = new CheckBox(this)){
height = 1;
left = 14;
top = 9;
width = 17;
text = "First visit";
dataLink = parent.guest1.rowset.fields["FirstVisit"];
}
with (this.commentHTML = new HTML(this)){
height = 1;
top = 10;
width = 14;
color = "black";
text = "Comment";
}
with (this.commitTextArea = new TextArea(this)){
height = 5;
left = 14;
top = 10;
width = 52;
dataLink = parent.guest1.rowset.fields["Comment"];
}
with (this.homePageLinkImage = new Image(this)){
onImageClick = class::link_to_home_page;
height = 3.4167;
top = 16;
width = 10.25;
dataSource = "filename HOMEPG31.GIF";
alignment = 4;
pageno = 0;
}
with (this.homePageLinkHTML = new HTML(this)){
height = 1;
left = 12;
top = 16;
width = 58;
color = "black";
text = "<A HREF='/ibapps/index.htm'>Return to Home Page</A>";
pageno = 0;
}
with (this.generatedHTML1 = new GeneratedHTML(this)){
height = 1;
top = 20.5;
width = 70;
pageno = 0;
}
with (this.errorHTML = new HTML(this)){
height = 4;
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;
}
}
}