/*	Web_Page_Creator

		Digita Wizard Script for Wordworth 7
		Copyright 1998, Digita International Ltd.
		
		Created: 19 January 1996
		Author:  Mark Jackson, DP
*/


OPTIONS failat 100
OPTIONS RESULTS

/* Text variables */
TheTitle = ""

Heading = ""
SubHeading = ""
LineAfterHeading = "Y"
CentreHeading = "Y"

PicFileName = ""
PicDescription = ""
LineAfterPicture = "N"
CentrePicture = "N"

Paragraph1 = ""
Paragraph2 = ""
Paragraph3 = ""
Paragraph4 = ""
LineAfterText = "Y"

SiteLocation = ""
SiteDescription = ""

YourName = ""
EmailAddress = ""

WizFileName = ""

/* Example text */
ExTheTitle = "Digita's Home Page"

ExHeading = "Welcome to Digita's Home Page"
ExSubHeading = "Where did you want to be yesterday?"
ExLineAfterHeading = "Y"
ExCentreHeading = "Y"

ExPicFileName = "/ClipArt/DigitaLogo.gif"
ExPicDescription = "The Digita Logo"
ExLineAfterPicture = "Y"
ExCentrePicture = "Y"

ExParagraph1 = "This page is all about Digita International."
ExParagraph2 = "We're a company that produces software for a number of Computer platforms, currently the Amiga and Windows."
ExParagraph3 = "Wordworth is our Word Processing package for the Amiga."
ExParagraph4 = "Check out our forthcoming Web site by pointing your browser at 'http://www.digita.com/'."
ExLineAfterText = "Y"

ExSiteLocation = "http://www.digita.com/"
ExSiteDescription = "Digita International's Home Page"

ExName = "Web Support"
ExEmailAddress = "webmaster@digita.com"

ExWizFileName = "MyWebPage.html"


/* Start of Wizard */
START:
WizardReq TITLE "Web Page Creator Wizard" LABEL "This Wizard will help you create a page for the World Wide Web." LABEL "" LABEL " Click Next or press Enter to continue to the next step" LABEL " click Previous to return to the previous step, if available" LABEL " click Cancel to quit without creating a web page or" LABEL " click Finish to create a web page using the current parameters." BUTTON 1 "_Next" BUTTON 2 "_Finish" BUTTON "-1" "_Cancel"
IF Result = -1 THEN
	EXIT
IF Result = 2 THEN
	SIGNAL MAKEWEBPAGE


STEP1:
WizardReq TITLE "Web Page Creator Wizard" LABEL "Please enter the title for the document, this should" LABEL "be a brief description of what the page is about." LABEL "" TEXTBOX 1 "_Title:" CONTENTS TheTitle BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Example" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
Pressed = Result

If Pressed = -1 THEN
	Exit

If Pressed = 2 THEN
	SIGNAL START

If Pressed = 3 THEN DO
	TheTitle = ExTheTitle
	Pressed = ""
	Signal STEP1
END


Wizard_GetTextBox 1
TheTitle = Result

If TheTitle = "" THEN DO
	RequestNotify Prompt "You must enter a title!"
	Signal STEP1
END

If Pressed = 4 THEN
	SIGNAL MAKEWEBPAGE


STEP2:
WizardReq TITLE "Web Page Creator Wizard" LABEL "Please type a heading for the page, this" LABEL "will appear at the top of the page." LABEL "" TEXTBOX 1 "_Heading:" CONTENTS Heading TEXTBOX 2 "_SubHeading (optional):" CONTENTS SubHeading TEXTBOX 3 "_Line after? (Y/N):" CONTENTS LineAfterHeading TEXTBOX 4 "Cent_red? (Y/N):" CONTENTS CentreHeading BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Example" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
Pressed = Result

If Pressed = -1 THEN
	Exit
If Pressed = 2 THEN DO
	Pressed = ""
	SIGNAL STEP1
END

If Pressed = 3 THEN DO
	Heading = ExHeading
	SubHeading = ExSubHeading
	LineAfterHeading = ExLineAfterHeading
	CentreHeading = ExCentreHeading
	Pressed = ""
	Signal STEP2
END


Wizard_GetTextBox 1
Heading = Result

Wizard_GetTextBox 2
SubHeading = Result

Wizard_GetTextBox 3
LineAfterHeading = UPPER(Result)
If LineAfterHeading = "NO" THEN
	LineAfterHeading = "N"

If LineAfterHeading ~= "N" THEN
	LineAfterHeading = "Y"

Wizard_GetTextBox 4
CentreHeading = UPPER(Result)
If CentreHeading = "NO" THEN
	CentreHeading = "N"

If CentreHeading ~= "N" THEN
	CentreHeading = "Y"

If Pressed = 4 THEN
	SIGNAL MAKEWEBPAGE


STEP3:
WizardReq TITLE "Web Page Creator Wizard" LABEL "If you want a picture on your page then" LABEL "enter the details below:" LABEL "" TEXTBOX 1 "F_ile Name (the full path):" CONTENTS PicFileName TEXTBOX 2 "_Description:" CONTENTS PicDescription TEXTBOX 3 "_Line after? (Y/N):" CONTENTS LineAfterPicture TEXTBOX 4 "Cent_red? (Y/N):" CONTENTS CentrePicture BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 4 "_Example" BUTTON 5 "_Finish" BUTTON "-1" "_Cancel"
Pressed = Result

If Pressed = -1 THEN
	Exit
If Pressed = 2 THEN DO
	Pressed = ""
	SIGNAL STEP2
END



If Pressed = 4 THEN DO
	PicFileName = ExPicFileName
	PicDescription = ExPicDescription
	LineAfterPicture = ExLineAfterPicture
	CentrePicture = ExCentrePicture
	Signal STEP3
END
	

Wizard_GetTextBox 1
PicFileName = Result

Wizard_GetTextBox 2
PicDescription = Result

Wizard_GetTextBox 3
LineAfterPicture = UPPER(Result)
If LineAfterPicture = "NO" THEN
	LineAfterPicture = "N"

If LineAfterPicture ~= "N" THEN
	LineAfterPicture = "Y"

Wizard_GetTextBox 4
CentrePicture = UPPER(Result)
If CentrePicture = "NO" THEN
	CentrePicture = "N"

If CentrePicture ~= "N" THEN
	CentrePicture = "Y"

If Pressed = 4 THEN
	Signal MAKEWEBPAGE


STEP4:
WizardReq TITLE "Web Page Creator Wizard" LABEL "Now type some paragraphs of text for the page." LABEL "Type each paragraph in a seperate text gadget:" LABEL "" TEXTBOX 1 "Paragraph _1:" CONTENTS Paragraph1 TEXTBOX 2 "Paragraph _2:" CONTENTS Paragraph2 TEXTBOX 3 "Paragraph _3:" CONTENTS Paragraph3 TEXTBOX 4 "Paragraph _4:" CONTENTS Paragraph4 TEXTBOX 5 "_Line After? (Y/N):" CONTENTS LineAfterText BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Example" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
Pressed = Result

If Pressed = -1 THEN
	Exit
If Pressed = 2 THEN
	Signal STEP3
If Pressed = 3 THEN DO
	Paragraph1 = ExParagraph1
	Paragraph2 = ExParagraph2
	Paragraph3 = ExParagraph3
	Paragraph4 = ExParagraph4
	LineAfterText = ExLineAfterText
	Pressed = ""
	SIGNAL STEP4
END

Wizard_GetTextBox 1
Paragraph1 = Result

Wizard_GetTextBox 2
Paragraph2 = Result

Wizard_GetTextBox 3
Paragraph3 = Result

Wizard_GetTextBox 4
Paragraph4 = Result

Wizard_GetTextBox 5
LineAfterText = UPPER(Result)
If LineAfterText = "NO" THEN
	LineAfterText = "N"

If LineAfterText ~= "N" THEN
	LineAfterText = "Y"

If Pressed = 4 THEN
	Signal MAKEWEBPAGE


STEP5:
WizardReq TITLE "Web Page Creator Wizard" LABEL "If you would like to add a link to one of your" LABEL "favourite Web Sites then type the details below:" LABEL "(The description is the text that is shown on the page.)" LABEL "" TEXTBOX 1 "Site _Location (URL):" CONTENTS SiteLocation TEXTBOX 2 "Site _Description:" CONTENTS SiteDescription BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Example" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
Pressed = Result

If Pressed = -1 THEN
	Exit
if Pressed = 2 THEN
	SIGNAL STEP4

If Pressed = 3 THEN DO
	SiteLocation = ExSiteLocation
	SiteDescription = ExSiteDescription
	Pressed = ""
	Signal STEP5
END

Wizard_GetTextBox 1
SiteLocation = Result

Wizard_GetTextBox 2
SiteDescription = Result

If Pressed = 4 THEN
	SIGNAL MAKEWEBPAGE


STEP6:
WizardReq TITLE "Web Page Creator Wizard" LABEL "If you would like to include contact information" LABEL "for yourself then fill in the details below:" LABEL "" TEXTBOX 1 "_Your Name:" CONTENTS YourName TEXTBOX 2 "E-mail _Address:" CONTENTS EmailAddress BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Example" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
Pressed = Result

If Pressed = "-1" THEN
	Exit
If Pressed = 2 THEN
	Signal STEP5
If Pressed = 3 THEN DO
	YourName = ExName
	EmailAddress = ExEmailAddress
	Pressed = ""
	Signal STEP6
END

Wizard_GetTextBox 1
YourName = Result

Wizard_GetTextBox 2
EmailAddress = Result

If Pressed = 4 THEN
	Signal STEP5


/* Now we've got the information, let's create the HTML file! */
MAKEWEBPAGE:
New
Address Value Result

Document A4 "0.5in" "0.5in" "0.6in" "1.0in"
Zoom 100
Paragraph 0 0 0 LEFT AUTO SINGLE NONE NONE

Font NAME "Shannon Book" SIZE 12

Text '<HTML>'
NewParagraph
Text '<HEAD>'
NewParagraph
Text '<TITLE>'
Bold
if TheTitle = "" THEN
	TheTitle = "<Unnamed>"
Text TheTitle
Plain
Text '</TITLE>'
NewParagraph
Text '</HEAD>'
NewParagraph
NewParagraph
Text '<BODY>'
NewParagraph

If CentreHeading ~= "N" THEN DO
	Text '<CENTER>'
	NewParagraph
END

If Heading ~= "" THEN DO
	Text '<H1>'
	Font Size 28
	Text Heading
	Font SIZE 12
	Text '</H1>'
	NewParagraph
END

If SubHeading ~= "" THEN DO
	Text '<H2>'
	Font Size 18
	Text SubHeading
	Font SIZE 12
	Text '</H2>'
	NewParagraph
END

If LineAfterHeading ~= "N" THEN DO
	Text '<HR>'
	NewParagraph
END

If CentrePicture ~= "N" THEN DO
	If CentreHeading = "N" THEN DO
		Text '<CENTER>'
		NewParagraph
	END
END

If PicFileName ~= "" THEN DO
	Text '<IMG SRC = "'
	Text PicFileName
	Text '"'
	If PicDescription ~= "" THEN DO
		Text ' ALT = "'
		Text PicDescription
		Text '"'
	END
	Text '>'
	NewParagraph
END

If LineAfterPicture ~= "N" THEN DO
	Text '<HR>'
	NewParagraph
END

If CentreHeading ~= "N" | CentrePicture ~= "N" THEN DO
	Text '</CENTER>'
	NewParagraph
END

If Paragraph1 ~= "" THEN DO
	Text Paragraph1
	NewParagraph
	Text '<P>'
	NewParagraph
END

If Paragraph2 ~= "" THEN DO
	Text Paragraph2
	NewParagraph
	Text '<P>'
	NewParagraph
END

If Paragraph3 ~= "" THEN DO
	Text Paragraph3
	NewParagraph
	Text '<P>'
	NewParagraph
END

If Paragraph4 ~= "" THEN DO
	Text Paragraph4
	NewParagraph
	Text '<P>'
	NewParagraph
END

If LineAfterText ~= "N" THEN DO
	Text '<HR>'
	NewParagraph
END

If SiteLocation ~= "" THEN DO
	Text '<A HREF="'
	Text SiteLocation
	Text '">'
	Text SiteDescription
	Text '</A>'
	NewParagraph
	If YourName ~= "" THEN DO
		Text '<P>'
		NewParagraph
	END
END

If YourName ~= "" THEN DO
	Text '<A HREF="mailto:'
	Text EmailAddress
	Text '">E-mail '
	Text YourName
	Text '</A>'
	NewParagraph
END


Text '</BODY>'
NewParagraph
Text '</HTML>'
NewParagraph

WizardReq TITLE "Web Page Creator Wizard" LABEL "Now the page has been created, we need to save" LABEL "the file in ASCII format." LABEL "" LABEL "The filename should end with the extension '.html'" LABEL "" BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN DO
	Close FORCE
	Exit
END

RequestFile TITLE "Select Filename for File" PATTERN "#?.html"
WizFileName = Result

If (RC > 0) THEN
	Exit

if WizFileName = "" THEN
	WizFileName = ExWizFileName

SaveAs ASCII NAME WizFileName

RequestNotify PROMPT "The Web Page Creator Wizard has finished."
End
