home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
ib
/
setups
/
intrabld
/
data.z
/
GBMAIL.JFM
< prev
next >
Wrap
Text File
|
1996-12-11
|
8KB
|
312 lines
/****************************************************************************\
* *
* GbMail.jfm -- Guest Mail Form *
* *
* GbMail.jfm is part of the Guest Book solution application. It is used *
* to send out mailing over the internet. Much of the form was created by the *
* expert, but a couple interesting things were added. The header script below*
* this comment allows us to call an external function in a dll. Notice how *
* easy it is to add the power of dll functions to your application. *
* *
* *
* Dependencies: mailSock.dll *
* mailto71.gif *
* homepg31.gif *
* apps\shared\controls.cc *
* *
* Updated 11/12/96 by IntraBuilder Samples Group *
* $Revision: 1.4 $ *
* *
* Copyright (c) 1996, Borland International, Inc. All rights reserved. *
* *
\****************************************************************************/
extern boolean sendMail(char* /*address*/, char*/*sender*/, char*/*subject*/,char* /*body*/) "mailSock.dll"
#define MAINPAGE 1
#define SUCCESSPAGE 2
#define ERRORPAGE 3
// {End Header} Do not remove this comment//
// Generated on 11/12/96
//
var f = new mailExampleForm();
f.open();
class mailExampleForm extends Form {
_sys.scripts.load(_sys.env.home() + "APPS\\SHARED\\CONTROLS.CC");
with (this) {
onServerLoad = class::Form_onServerLoad;
color = "a4d5ff";
height = 13.6667;
left = 0;
top = 0;
width = 72;
title = "Guest Book Mail";
}
with (this.ibapps1 = new Database()){
left = 60;
top = 0;
databaseName = "IBAPPS";
active = true;
}
with (this.mail1 = new Query()){
left = 56;
top = 0;
database = parent.ibapps1;
sql = "SELECT EMAIL FROM GUEST";
active = true;
with (rowset) {
}
}
with (this.rule1 = new Rule(this)){
top = 4;
size = 2;
right = 70;
pageno = 0;
}
with (this.rule2 = new Rule(this)){
top = 13.5;
size = 2;
right = 70;
pageno = 0;
}
with (this.rule3 = new Rule(this)){
top = 18;
size = 2;
right = 70;
pageno = 0;
}
with (this.mailServerLogo = new Image(this)){
height = 3.4167;
width = 10.25;
dataSource = "filename MAILTO71.GIF";
alignment = 4;
pageno = 0;
}
with (this.TITLE = new HTML(this)){
height = 2;
left = 12;
width = 44;
color = "steelblue";
fontName = "Times New Roman";
fontItalic = true;
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">M</FONT></FONT>ail</H1>';
pageno = 0;
}
with (this.subjectField = new Text(this)){
left = 12;
top = 6;
width = 46;
value = "";
}
with (this.messageField = new TextArea(this)){
height = 6;
left = 12;
top = 7;
width = 46;
value = "";
}
with (this.button1 = new Button(this)){
onServerClick = class::button1_onServerClick;
left = 12;
top = 2;
width = 16;
text = "Send message";
}
with (this.fromField = new Text(this)){
left = 12;
top = 5;
width = 46;
value = "";
}
with (this.HTML1 = new HTML(this)){
height = 1;
top = 5;
width = 12;
color = "blue";
fontName = "Times New Roman";
text = "From";
}
with (this.errorHTML = new HTML(this)){
height = 5;
top = 5;
width = 70;
color = "red";
text = "Error message";
pageno = 3;
}
with (this.subjectHTML = new HTML(this)){
height = 1;
top = 6;
width = 12;
color = "blue";
fontName = "Times New Roman";
text = "Subject";
}
with (this.Message = new HTML(this)){
height = 1;
top = 7;
width = 12;
color = "blue";
fontName = "Times New Roman";
text = "Message";
}
with (this.homePageLinkImage = new Image(this)){
onImageClick = class::link_to_home_page;
height = 3.4167;
top = 14;
width = 10.25;
dataSource = "filename HOMEPG31.GIF";
alignment = 4;
pageno = 0;
}
with (this.homePageLinkHTML = new HTML(this)){
height = 1;
left = 12;
top = 14;
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 = 18.5;
width = 70;
pageno = 0;
}
with (this.HTML2 = new HTML(this)){
height = 4;
top = 5;
width = 70;
color = "blue";
fontName = "Times New Roman";
fontItalic = true;
text = "The mail has been sent out.";
pageno = 2;
}
with (this.okButtonPage2 = new Button(this)){
onServerClick = class::okButtonPage2_onServerClick;
top = 10;
width = 24;
text = " Back ";
pageno = 2;
}
with (this.okButtonPage3 = new Button(this)){
onServerClick = class::okButtonPage3_onServerClick;
top = 10;
width = 12;
text = " Back ";
pageno = 3;
}
with (this.serverButton = new Button(this)){
onServerClick = class::serverButton_onServerClick;
left = 38;
top = 2;
width = 26;
text = "Configure Mail Server...";
}
this.rowset = this.mail1.rowset;
function Form_onServerLoad()
{
// set to the first page
this.pageno=MAINPAGE;
}// end Form_onServerLoad()
function button1_onServerClick()
{
var address=new String();
var subject=new String();
var body=new String();
var sender=new String();
form.rowset.first();
subject=form.subjectField.value;
body=form.messageField.value;
sender=form.fromField.value;
while(!(form.rowset.endOfSet)){
address+=form.rowset.fields["EMAIL"].value+",";
form.rowset.next();
}
// call the sendmail.dll function to actually send the message
result=sendMail(address,sender,subject,body); //send out each message seperately
if (result==false) { //switch to error page
form.errorHTML.text="Could not transmit message, mail settings may be incorrect on the server";
form.pageno=ERRORPAGE;
}
else { //transmission ok, switch to success page
form.messageField.value=""; //empty the fields
form.subjectField.value="";
form.pageno=SUCCESSPAGE;
}
}
function okButtonPage2_onServerClick()
{
form.pageno = MAINPAGE;
}
function okButtonPage3_onServerClick()
{
form.pageno = MAINPAGE;
}
function link_to_home_page()
{
location.href="/ibapps/index.htm";
}
function serverButton_onServerClick()
{
_sys.forms.run("gbconfig.jfm");
}
}