Welcome to SunGard SCT Banner Web Programming

www.sungardsct.com

Introduction

Welcome ƒ Peter Tingate – Technical Consultant

www.sungardsct.com

2

Introduction

Prerequisites ƒ Have a printed copy of the BT110 workbook ƒ Experience navigating in Banner ƒ Understanding of HTML tags, structure and syntax ƒ Understanding of PL/SQL block structures, procedures and functions ƒ Access to Self Service Banner as a Web Tailor user ƒ Access to training database

www.sungardsct.com

3

SunGard SCT Web Programming 1

Introduction

Prerequisites ƒ Training accounts in the training database ƒ Under each account grant: create public synonym, and execute any procedure ƒ Under each account run the CT.sql script (provided by instructor) to create the training tables

www.sungardsct.com

4

Introduction

Goals ƒ Utilize HTML and PL/SQL programming languages in web programming for Self Service Banner. ƒ Define Oracle 9iAS architecture, security settings, advanced features and development and standards in web programming for Self Service Banner.

www.sungardsct.com

5

Introduction

Expectations ƒ What do you expect to get out of this training?

www.sungardsct.com

6

SunGard SCT Web Programming 2

Introduction

Agenda ƒ Day 1 ƒ Introduction ƒ Oracle 9iAS Architecture ƒ HTML Review ƒ PL/SQL Review ƒ PL/SQL Web Toolkit

ƒ Day 2 ƒ Security ƒ Development and Standards ƒ Style Sheets

www.sungardsct.com

7

Introduction

What is Banner Self Service? ƒ Add-on to Banner baseline products ƒ Advantages of Banner Web Design ƒ reduced network processing of data servers ƒ move from fat client to thin client on desktop ƒ no middle tier forms, logic maintained on database server

ƒ Uses Oracle PL/SQL Packages on Banner database ƒ static HTML pages, CSS and image files on Web Server

www.sungardsct.com

8

Introduction

Banner Web Documentation ƒ Sources ƒ Banner Bookshelf ƒ Action Line ƒ CD distribution

ƒ Self Service Implementation Guide ƒ Web Tailor User Guide ƒ Self Service Methodology Handbook ƒ Web for General User Guide

www.sungardsct.com

9

SunGard SCT Web Programming 3

Oracle 9iAS Architecture ƒ After completing this section, you will be able to: ƒ Identify self service banner architecture tiers ƒ Describe configuration files and configuration file paths ƒ Define web listener, data access descriptor and browser requests

www.sungardsct.com

10

Oracle 9iAS Architecture - Tiers

Self Service Banner Architecture Tiers

Top Tier: User interfaces with browser

www.sungardsct.com

11

Oracle 9iAS Architecture - Tiers

Self Service Banner Architecture Tiers

Top Tier: User interfaces with browser Middle Tier: Browser communicates with Oracle9i application server (web server)

www.sungardsct.com

12

SunGard SCT Web Programming 4

Oracle 9iAS Architecture - Tiers

Self Service Banner Architecture Tiers

Top Tier: User interfaces with browser Middle Tier: Browser communicates with Oracle9i application server (web server) Database Tier: Web requests are processed by stored procedures

www.sungardsct.com

13

Oracle 9iAS Architecture - Tiers

Oracle Application Server ƒ Oracle Application Server puts into place an architecture which will allows you to build applications that tap into the Oracle database, all the while using the deployable and versatile medium of the World Wide Web. ƒ Transaction management ƒ Multithreaded processing of requests ƒ Thin client, server-side processing ƒ Platform and browser independent ƒ Pre-disposed to growth factors

www.sungardsct.com

14

Oracle 9iAS Architecture - Tiers

Oracle 9i Application Server

http HTML

Apache Listener

Oracle9i Application Server

www.sungardsct.com

15

SunGard SCT Web Programming 5

Oracle 9iAS Architecture - Tiers

Oracle 9i Application Server

Oracle9i Application Server

http HTML

Apache Listener

Apache API's

Secure Socket Layer

Mod PLSQL Include

www.sungardsct.com

16

Oracle 9iAS Architecture - Tiers

Oracle 9i Application Server

Oracle9i Application Server

http HTML

Apache Listener

Apache API's

DAD

Secure Socket Layer

Mod PLSQL Include

PL/SQL gateway

SQL*net HTML

www.sungardsct.com

17

Oracle 9iAS Architecture - Details

Configuration Files PATH

DESCRIPTION

$ORACLE_HOME/Apache/Apa Master Apache che/conf/httpd.conf Listener file $ORACLE_HOME/Apache/Apa Oracle specific Information che/conf/oracle_apache.conf $ORACLE_HOME/Apache/mo dplsql/cfg/plsql.conf

PLSQL gateway configuration file

$ORACLE_HOME/Apache/mo dplsql/cfg/wdbsvr.app

DAD configuration file

www.sungardsct.com

18

SunGard SCT Web Programming 6

Oracle 9iAS Architecture - Details

Web Listener ƒ Responsible for opening a port on the web server to receive, secure, and interpret HTTP requests ƒ Software daemon ƒ listens for requests on pre-defined ports (use any higher than 1000)

ƒ For maintenance, best to have separate web listeners for each database instance ƒ Allows systems to be brought up and down independently ƒ Allows SSL to be used for web

ƒ Defined by one file configuration file on 9iAS $ORACLE_HOME/Apache/Apache/conf/httpd.conf

www.sungardsct.com

19

Oracle 9iAS Architecture - Details

Data Access Descriptor ƒ Locate the remote database ƒ Establish a SQL*Net connection ƒ Login to the remote database as oracle user ƒ Execute requested package.procedure ƒ Define in flat file: ORACLE_HOME/Apache/modplsql/cfg/wdbsvr.app ƒ DADs can be modified, removed and added via web page http://server.domain:port/pls/admin_/gateway.htm (R1) or http://server.domain:1810 (9iAS R2 & 10gAS)

www.sungardsct.com

20

Oracle 9iAS Architecture - Details

Browser Requests •

The Oracle HTTP Server receives a PL/SQL Server Page request from a client browser

www.sungardsct.com

21

SunGard SCT Web Programming 7

Oracle 9iAS Architecture - Details

Browser Requests •

The Oracle HTTP Server receives a PL/SQL Server Page request from a client browser



The Oracle HTTP Server routes the request to the PL/SQL Gateway

www.sungardsct.com

22

Oracle 9iAS Architecture - Details

Browser Requests •

The Oracle HTTP Server receives a PL/SQL Server Page request from a client browser



The Oracle HTTP Server routes the request to the PL/SQL Gateway



The request is forwarded by the PL/SQL Gateway to the Oracle9i Database. By using the configuration information stored in your DAD, the PL/SQL Gateway connects to the database

www.sungardsct.com

23

Oracle 9iAS Architecture - Details

Browser Requests •

The Oracle HTTP Server receives a PL/SQL Server Page request from a client browser



The Oracle HTTP Server routes the request to the PL/SQL Gateway



The request is forwarded by the PL/SQL Gateway to the Oracle9i Database. By using the configuration information stored in your DAD, the PL/SQL Gateway connects to the database



The PL/SQL Gateway prepares the call parameters, and invokes the PL/SQL procedure in the application

www.sungardsct.com

24

SunGard SCT Web Programming 8

Oracle 9iAS Architecture - Details

Browser Requests •

The Oracle HTTP Server receives a PL/SQL Server Page request from a client browser



The Oracle HTTP Server routes the request to the PL/SQL Gateway



The request is forwarded by the PL/SQL Gateway to the Oracle9i Database. By using the configuration information stored in your DAD, the PL/SQL Gateway connects to the database



The PL/SQL Gateway prepares the call parameters, and invokes the PL/SQL procedure in the application



The PL/SQL procedure generates an HTML page using data and the PL/SQL Web Toolkit accessed from the database

www.sungardsct.com

25

Oracle 9iAS Architecture - Details

Browser Requests •

The Oracle HTTP Server receives a PL/SQL Server Page request from a client browser



The Oracle HTTP Server routes the request to the PL/SQL Gateway



The request is forwarded by the PL/SQL Gateway to the Oracle9i Database. By using the configuration information stored in your DAD, the PL/SQL Gateway connects to the database



The PL/SQL Gateway prepares the call parameters, and invokes the PL/SQL procedure in the application



The PL/SQL procedure generates an HTML page using data and the PL/SQL Web Toolkit accessed from the database



The response is returned to the PL/SQL Gateway

www.sungardsct.com

26

Oracle 9iAS Architecture - Details

Browser Requests •

The Oracle HTTP Server receives a PL/SQL Server Page request from a client browser



The Oracle HTTP Server routes the request to the PL/SQL Gateway



The request is forwarded by the PL/SQL Gateway to the Oracle9i Database. By using the configuration information stored in your DAD, the PL/SQL Gateway connects to the database



The PL/SQL Gateway prepares the call parameters, and invokes the PL/SQL procedure in the application



The PL/SQL procedure generates an HTML page using data and the PL/SQL Web Toolkit accessed from the database



The response is returned to the PL/SQL Gateway



The Oracle HTTP Server sends the response to the client browser

www.sungardsct.com

27

SunGard SCT Web Programming 9

Oracle 9iAS Architecture - Details

PL/SQL Execution Browser http://webserver.myschool.edu:port/ pls/DAD/package.procedure?x=1&y=2

Which database & how do I login?

dad What do I do when I get there?

Gateway

Procedure and parameters www.sungardsct.com

28

Oracle 9iAS Architecture - Details

How it all ties together Web client http://admin02.vassar.edu:8010/banweb/dad/package.procedure?name=

9iAS

Host LISTENER SQL*NET

DAD (tnsnames.ora)

TNS listener

Oracle (Banner database)

Gateway

www.sungardsct.com

29

Oracle 9iAS Architecture - Details

How it all ties together

BROWSER

TC P/I P

HTTP

www.sungardsct.com

30

SunGard SCT Web Programming 10

Oracle 9iAS Architecture - Details

How it all ties together HTML

TC P/I P

BROWSER

Oracle Application Server

HTTP

SQ L*

Ne t

PL/SQL Package.Procedure www.sungardsct.com

31

Oracle 9iAS Architecture - Details

How it all ties together HTML

HTML

TC P/I P

BROWSER

Oracle Application Server

HTTP

SQ L*

Stored Procedures

Ne t

PL/SQL Package.Procedure

Database Host www.sungardsct.com

32

Oracle 9iAS Architecture

Self Check ƒ What is in the middle tier in Oracle 9iAS? ƒ What is the DAD configuration file? ƒ What helps establish a SQL * NET connection?

www.sungardsct.com

33

SunGard SCT Web Programming 11

HTML Review ƒ After completing this section, you will be able to create a static HTML page using basic formatting and document tags

www.sungardsct.com

34

HTML Review

Building Blocks ƒ HTML ƒ PL/SQL ƒ Oracle Application Server Toolkit ƒ HTP, HTF & OWA%

www.sungardsct.com

35

HTML Review

Hyper Text Markup Language ƒ Language of the web ƒ Instructs browser what to do ƒ Series of tags in an ASCII/text document ƒ HTML commands are set off by < > ƒ Tags travel in pairs hi with what you want to affect in between tags ƒ is a start, and is a stop ƒ You can always ‘view source’ in browser

www.sungardsct.com

36

SunGard SCT Web Programming 12

HTML Review

HTML Syntax ƒ Most HTML tags have attributes click here

ƒ Many tags need to be closed ƒ Some tags need attributes

www.sungardsct.com

37

HTML Review

HTML Tags ƒ Basic ƒ Advanced ƒ Tables ƒ Forms ƒ List tags

www.sungardsct.com

38

HTML Review

HTML Tables





creates a table of data specifies the table header specifies the table data specifies table row (where does it end)

Example: ID Name 123-45-6789 Elmer Fudd

ID

Name

123-45-6789

Elmer Fudd

www.sungardsct.com

39

SunGard SCT Web Programming 13

HTML Review

Self Check ƒ Create a web page to mirror the contents you see on-screen.

www.sungardsct.com

40

PL/SQL Review ƒ After completing this section, you will be able to: ƒ Define PL/SQL and the PL SQL toolkit ƒ Create a package and procedure in the training database ƒ Modify a package to create lists and display text ƒ Create a form by using a package

www.sungardsct.com

41

PL/SQL Review - Overview

Building Blocks ƒ HTML ƒ PL/SQL ƒ Oracle Application Server Toolkit ƒ HTP, HTF & OWA%

www.sungardsct.com

42

SunGard SCT Web Programming 14

PL/SQL Review - Overview

PL/SQL ƒ Procedural Language/Standard Query Language ƒ Basic ƒ Variables ƒ Control Structures ƒ if-then-else, for-loop, while-loop, exit-when and goto ƒ Cursor and cursor FOR loops

ƒ Modern ƒ Modularity; subprograms and packages ƒ Information Hiding and Data Encapsulation ƒ Overloading ƒ Exception Handling

www.sungardsct.com

43

PL/SQL Review - Overview

PL/SQL, Continued ƒ Block Structured ƒ Logical unit of work (a module) ƒ Basic units; named (procedures, functions and packages) and anonymous blocks ƒ Supports the idea of stepwise refinement

ƒ Three Parts ƒ Declaration (optional); make variables known ƒ Execution ƒ Exception (optional) handler for warnings or errors

ƒ Nest ƒ Sub-blocks allowed in Executable and Exception parts and can define subprograms in Declaration

www.sungardsct.com

44

PL/SQL Review - Overview

PL/SQL Modularity ƒ Break a program down into manageable modules aiding in top-down design ƒ Reusability ƒ Maintainability ƒ Abstraction

www.sungardsct.com

45

SunGard SCT Web Programming 15

PL/SQL Review - Overview

PL/SQL Modularity, Continued ƒ Subprograms ƒ Procedures ƒ takes parameters and performs an action ƒ Functions ƒ takes parameters and returns computed value

ƒ Packages ƒ collection of logically common variables, cursors, procedures and functions ƒ entire package loaded into memory or can 'Pin' into memory ƒ status in Database must be 'VALID' in order to run

www.sungardsct.com

46

PL/SQL Review - Overview

Package Syntax ƒ Two Parts to a Package ƒ Package Specification (interface)

ƒ Also known as package Header ƒ Public declarations that are visible to your application ƒ Package Body

ƒ Implementation details (actual code) and private declarations

www.sungardsct.com

47

PL/SQL Review - Overview

Package Specification CREATE OR REPLACE PACKAGE package_name IS END package_name;

www.sungardsct.com

48

SunGard SCT Web Programming 16

PL/SQL Review - Overview

Package Body CREATE OR REPLACE PACKAGE BODY package_name IS BEGIN ... EXCEPTION ... END package_name;

www.sungardsct.com

49

PL/SQL Review - Overview

Procedure Syntax PROCEDURE name [ (parameter list) ] IS BEGIN EXCEPTION END name;

www.sungardsct.com

50

PL/SQL Review - Overview

Function Syntax FUNCTION name [ (parameter list) ] RETURN return_datatype IS BEGIN EXCEPTION END name;

www.sungardsct.com

51

SunGard SCT Web Programming 17

PL/SQL Review - Overview

Cursors CURSOR name [ (parameter list) ] IS SELECT ;

www.sungardsct.com

52

PL/SQL Review - Overview

Self Check ƒ Review page 16 of the workbook and complete the exercise. ƒ Create a new package and procedure in the training database. ƒ Refer to example package syntax on 19 – “Hello World” Example ƒ Make Package name unique! (Hello_World_Yourname)

www.sungardsct.com

53

PL/SQL Review – PL/SQL Toolkit

PL/SQL Toolkit ƒ A series of packages and procedures delivered by Oracle which create HTML tags ƒ Web displays using HTP & HTF packages ƒ Delivered as part of 9iAS installation and created in the sys schema on database $ORACLE_HOME/Apache/modplsql/owa/owaload.sql

www.sungardsct.com

54

SunGard SCT Web Programming 18

PL/SQL Review – PL/SQL Toolkit

PL/SQL Toolkit, Continued ƒ The purpose of the toolkit is to allow you to more easily generate web content from the information contained in the Banner (Oracle) Database ƒ The packages provide procedures and functions to be used by the Oracle Application Server (OAS) and Self Service Banner

www.sungardsct.com

55

PL/SQL Review – PL/SQL Toolkit

PL/SQL Toolkit, Continued ƒ Oracle tools for creating HTML inside of PL/SQL ƒ Installed into each database and owned by sys schema ƒ Comprised of Packages; ƒ HTP - HyperText Procedures ƒ HTF - HyperText Functions ƒ OWA - Oracle Web Agent Packages ƒ OWA, OWA_SEC, OWA_TEXT, OWA_COOKIE, OWA_UTIL(called internally by the pl/sql cartridge)

ƒ

Uses baseline Oracle packages ƒ DBMS_OUTPUT, UTL_RAW, ...

www.sungardsct.com

56

PL/SQL Review – PL/SQL Toolkit

Building Blocks ƒ HTML ƒ PL/SQL ƒ PL/SQL Toolkit ƒ HTP, HTF & OWA%

www.sungardsct.com

57

SunGard SCT Web Programming 19

PL/SQL Review – PL/SQL Toolkit

HTP & HTF Packages ƒ HTP ƒ Package containing one procedure for every HTML tag available ƒ These generate HTML

ƒ HTF ƒ Package containing one function for every HTML tag available ƒ These parse HTML

ƒ The HTF package turns HTP procedures into functions that return the HTML output as a formatted string

www.sungardsct.com

58

PL/SQL Review – PL/SQL Toolkit

Using HTP and HTF ƒ Opening and closing tags ƒ PL/SQL will not catch your HTML syntax errors ƒ HTML tag attributes will match the parameter list

www.sungardsct.com

59

PL/SQL Review – PL/SQL Toolkit

OWA Packages ƒ OWA_COOKIE: sub-programs which send and retrieve HTTP cookies from browsers ƒ OWA_IMAGE: sub-programs which retrieve coordinates where a user clicks on an image ƒ OWA_SEC: sub-programs which define authentication function, and retrieve password, username and host information for user authentication ƒ OWA_PATTERN, OWA_TEXT: subprograms which manipulate string data ƒ OWA_UTIL: subprograms used to display and retrieve sets of data, handle CGI environment variables, and run dynamic SQL to improve productivity

www.sungardsct.com

60

SunGard SCT Web Programming 20

PL/SQL Review – PL/SQL Toolkit

OWA Packages, Continued ƒ OWA_UTIL - utility procedures • showsource print out the source of a PL/SQL stored object •

showpage dumps the HTML buffer to a SQL*Plus or Server Manager screen



print_cgi_env prints out all of the HTTP environment variables for the session



redirect_url redirects output to another URL



tableprint prints out an Oracle table

www.sungardsct.com

61

PL/SQL Review – PL/SQL Toolkit

PL/SQL Documentation ƒ Oracle 9iAS R1 documentation -- direct your browser to http://download-west.oracle.com/docs/cd/A97335_01/index.htm

ƒ Oracle 10g PL/SQL Reference Guide ƒ HTP: http://download.east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/w_htp.htm #i1058734

ƒ HTF: http://downloadeast.oracle.com/docs/cd/B19306_01/appdev.102/b14258/w_htf.htm#i1011713

ƒ Login, click on on "run web sites and apps", scroll to Oracle PL/SQL and click on the "Using PL/SQL Gateway" link or “Web Toolkit Reference Guide”

www.sungardsct.com

62

PL/SQL Review – PL/SQL Toolkit

HTML attributes in PL/SQL ƒ Passed as parameter values to the HTP or HTF procedure

ƒ If the HTML should look like…

www.sungardsct.com

63

SunGard SCT Web Programming 21

PL/SQL Review – PL/SQL Toolkit

HTML attributes in PL/SQL, Continued ƒ Passed as parameter values to the HTP or HTF procedure

ƒ If the HTML should look like…

ƒ Then the PL/SQL will look like: HTP.IMG('/images/logo.gif','CENTER','LOGO');

www.sungardsct.com

64

PL/SQL Review – PL/SQL Toolkit

Start with a Template ƒ Structure Tags ƒ HTP.htmlOpen

creates

ƒ HTP.headOpen

creates

ƒ HTP.headClose

creates

ƒ HTP.BodyOpen('background', 'attributes') creates ƒ HTP.BodyClose

creates

ƒ HTP.htmlClose

creates

www.sungardsct.com

65

PL/SQL Review – PL/SQL Toolkit

Start with a Template, Continued CREATE OR REPLACE PACKAGE dummy IS Procedure END ; / CREATE OR REPLACE PACKAGE BODY IS Procedure do_something

IS

BEGIN

END END

;

;

/

www.sungardsct.com

66

SunGard SCT Web Programming 22

PL/SQL Review – PL/SQL Toolkit

Create the Main Document Tags BEGIN

HTP.htmlOpen; HTP.headOpen; /* header options */ HTP.headClose; HTP.bodyOpen('mybackground','BASEFONT=');

/*most other work done here */

HTP.bodyClose; HTP.htmlClose;

END

;

www.sungardsct.com

67

PL/SQL Review – PL/SQL Toolkit

Use PL/SQL Toolkit to Create HTML BEGIN

case insensitive

HTP.htmlOpen; htp.headOpen; htp.title('Hello World title'); htp.comment('This is my html heading section.'); HTP.headClose; HTP.bodyOpen(null,'text="blue"'); htp.p('Yeah, you guessed it... Hello World.'); HTP.bodyClose; HTP.htmlClose;

END

;

Question: Why did I put NULL in BodyOpen?

www.sungardsct.com

68

PL/SQL Review – PL/SQL Toolkit

Use PL/SQL Toolkit to Create HTML, Continued Would look like this; Hello World title Yeah, you guessed it... Hello World.

Question: Where are the blank lines from the previous slide?

www.sungardsct.com

69

SunGard SCT Web Programming 23

PL/SQL Review – Tags

Common Tags ƒ Head tags ƒ Body tags ƒ Formatting tags ƒ List tags

www.sungardsct.com

70

PL/SQL Review – Tags

List Example HTML Output .... ... Registration Checklist Biology 101 English Refresher Physical Education ......

www.sungardsct.com

71

PL/SQL Review – Tables

Tables ƒ These toolkit package.procedure calls are used to create and populate an HTML Table: HTML

HTP



HTP.tableOpen()



HTP.tableClose()



HTP.tableRowOpen()



HTP.tableRowClose()



HTP.tableheader()



Htp.tableData()

www.sungardsct.com

72

SunGard SCT Web Programming 24

PL/SQL Review – Tables

Table Example 1: HTML Output Student ID Grade in Class 382482771 B+ 983278820 C-

www.sungardsct.com

73

PL/SQL Review – Tables

Table Example 2: HTML Output ... Account Balance 302076 8,204.78 ... www.sungardsct.com

74

PL/SQL Review

Self Check ƒ Follow the instructions on pages 24 and 25. ƒ The “Hello_world_your_name” package will be used to display “Hello World Name” to a browser. ƒ Your existing package will be used to produce a list of street addresses. ƒ The instructor will demonstrate how to register a page in Web Tailor after you complete Step 7 of the exercise.

www.sungardsct.com

75

SunGard SCT Web Programming 25

PL/SQL Review – Forms

Forms ƒ Variables and values ƒ Form tags ƒ Form procedures

www.sungardsct.com

76

PL/SQL Review – Forms

Life cycle of a variable/value pair ƒ Variable instantiated at HTML ƒ Value assigned at POST ƒ URL of the ACTION receives the pair, manipulates and/or forwards to the next cycle

www.sungardsct.com

77

PL/SQL Review – Forms

Life cycle of a variable/value pair, Continued HTML

PL/SQL

FORM ACTION=“url” METHOD=“POST



If a student can register for Fall 2005, then display registration and maintain the value Fall 2005 throughout the student’s session

” However, only display courses which are offered for Fall 2005. url?term=fall 2005

SUBMIT

All of this info is lost after the HTML response is generated.

www.sungardsct.com

78

SunGard SCT Web Programming 26

PL/SQL Review – Forms

Display Form ƒ HTML output looks like... ...

Select a term: ...

www.sungardsct.com

79

PL/SQL Review – Forms

Variables and Values ƒ ACTION URL now becomes a procedure ƒ package.procedure notation

ƒ Declarations at HTML are posted to the procedure, so the procedure has to be prepared to receive them ƒ Variables declared at HTML establish the name of the variable in PL/SQL parameter list ƒ PL/SQL establishes the datatype

www.sungardsct.com

80

PL/SQL Review – Forms

Variables and Values ƒ Constant feedback between HTML and PL/SQL ƒ HTML has no ‘memory’ area ƒ Value pairs that are essential to processing have to be ‘hidden’ on each subsequent page

www.sungardsct.com

81

SunGard SCT Web Programming 27

PL/SQL Review – Forms

Retain the Values ... Procedure P_DisplaySchedule(term in varchar2) is begin ... htp.formOpen(‘mypackage.P_ProcessSchd’, ‘POST’); /* set up hidden variables */ htp.formHidden(‘term’,term); /* display schedule options */ htp.formSubmit(null,’Submit Schedule Options’); htp.formClose;

...

www.sungardsct.com

82

PL/SQL Review – Forms

Toolkit Procedures ƒ htp.FormOpen ƒ htp.FormClose ƒ htp.FormSubmit ƒ htp.FormImage ƒ htp.FormReset ƒ htp.FormHidden ƒ htp.FormText ƒ htp.FormRadio

www.sungardsct.com

83

PL/SQL Review – Forms

Toolkit Procedures, Continued ƒ htp.FormSelectOpen ƒ twbkwbis.p_FormSelectOption ƒ htp.FormTextArea ƒ htp.FormCheckBox ƒ htp.FormPassword

www.sungardsct.com

84

SunGard SCT Web Programming 28

PL/SQL Review – Forms

Forms Example HTP.formOpen ('bwzkwpay.p_calc_refund');

HTP.formHidden('pidm','482911');

HTP.formSelectOpen('refund_class', 'Pick class to request a refund:'); HTP.formSelectOption('English 410'); HTP.formSelectOption('Biology 305'); HTP.formSelectOption('Physics 400'); HTP.formSelectOption('Mathematics 320'); HTP.formSelectClose;

HTP.formSubmit (NULL, ' Press here '); HTP.formClose;

www.sungardsct.com

85

PL/SQL Review – Forms

Forms Example generates this



Pick class to request a refund: English 410 Biology 305 Physics 400 Mathematics 320

‘link text’);

ƒ The TWGBRUL table is used to find the /pls/dad parameter ƒ The following code allows you to connect to another procedure ƒ twbklibs.twgbwrul_rec.twgbwrul_cgibin_dir twbkfrmt.p_printanchor(twbklibs.twgbwrul_rec.twgbwrul_cgibin _dir||'/hello_world_peter.p_displaycourse', ctext => 'go to my hello world'); ƒ twbkfrmt.P_PrintAnchor(‘Hello_World_Peter.DisplayHello’, ctext => ‘Click to Peter’s hello world page’);

www.sungardsct.com

112

Devt & Stds – Tables, Text and Links

Self Check ƒ Follow the instructions on page 60 in the workbook ƒ Create a procedure to display the content of the course validation table, SVWCRSE in an HTML table ƒ Display the course number, course description, credit hours and activity date ƒ Create a link in your Hello World P_DisplayHello to your SWVCRSE (ssb_yourname.p_displaycourse) procedure

www.sungardsct.com

113

Devt & Stds – Data Entry

Data Entry - Basic Form Structure - - Procedure to paint form.. htp.formOpen(twbkwbis.f_cgibin||'/hello_chris.Process','post'); htp.formtext('param1','25'); htp.formtext('param2','25'); htp.formSubmit; htp.formClose;

- - Procedure to process forms parameters create or replace procedure hello_chris ( param1 IN varchar2, param2 IN varchar2 ) begin ..

www.sungardsct.com

114

SunGard SCT Web Programming 38

Devt & Stds – Data Entry

Banner Form Rules ƒ

Each Banner Form needs two procedures •

Procedure to paint HTML form



Procedure to accept input parameters

ƒ

Use Banner Data Entry Table to display input types

ƒ

Use Oracle htp and htf packages for all form tags except for:

ƒ



Form text fields



Entry required indicator

Match HTML Name to Parameter

www.sungardsct.com

115

Devt & Stds – Data Entry

Table Data Entry, Part 1 ƒ Example: you want to create an application which allows a student to change his/her address ƒ The student should see a drop-down listing of all address types they have records for… ƒ Perhaps a business address (BA) and a personal address (PA)

ƒ By choosing an address type from a drop-down and clicking on "submit," the correct address will display ƒ You can do this with a HTML form and a table

www.sungardsct.com

116

Devt & Stds – Data Entry

Table Data Entry, Part 2 • Create a cursor to select from spraddr table .. CREATE OR REPLACE PACKAGE BODY Hello_Chris IS Procedure P_Address_Types IS pidm number; cursor address_cursor(pidm_v number) is select * from saturn.spraddr where spraddr_pidm

= pidm_v;

BEGIN …

www.sungardsct.com

117

SunGard SCT Web Programming 39

Devt & Stds – Data Entry

Table Data Entry, Part 3 ƒ Draw a basic plan of the columns, rows and input types you want on your form ƒ In this case, you are just displaying a single forms selection box in one table row and one table column ƒ Hint: sometimes it useful to find an existing form that looks like the one you want to create and use the code as a template ƒ Let's see the code...

www.sungardsct.com

118

Devt & Stds – Data Entry

Table Data Entry, Part 3 ƒ Procedure to paint form htp.formOpen(twbkwbis.f_cgibin||’/display_address_your_name.P_process‘,'post'); twbkfrmt.P_TableOpen('DATAENTRY'); twbkfrmt.P_TableRowOpen; twbkfrmt.P_TableDataLabel(‘Your Address Types', 'left'); twbkfrmt.P_TableDataOpen; htp.formSelectOpen('atype', 'pick the address type'); for address_rec in address_cursor(pidm)

loop

if address_rec.spraddr_atyp_code = 'PA' then htp.FormSelectOption(address_rec.spraddr_atyp_code, null, 'SELECTED'); else htp.FormSelectOption(address_rec.spraddr_atyp_code);

www.sungardsct.com

119

Devt & Stds – Data Entry

Table Data Entry, Part 4 • Procedure to process form and display data create or replace procedure P_process (atype IN varchar2 ) pidm number; cursor spraddr_cursor(pidm_v number, atyp_v varchar2)

is

select * from saturn.spraddr where spraddr_pidm

= pidm_v

and spraddr_atyp_code = atyp_v; BEGIN

- -

security calls to collect PIDM value

for address_rec in spraddr_cursor(pidm, atype)

loop

twbkfrmt.P_TableOpen('DATADISPLAY‘, ccaption => ‘Your Address’); twbkfrmt.P_TableRowOpen; twbkfrmt.P_TDLabel(‘Address', ‘Left'); twbkfrmt.P_TableDataOpen; twbkfrmt.P_PrintText(address_rec.SPRADDR_STREET_LINE1); twbkfrmt.P_TableDataClose; twbkfrmt.P_TableRowClose; twbkfrmt.P_TableClose; end loop;

END; /

www.sungardsct.com

120

SunGard SCT Web Programming 40

Devt & Stds – Data Entry

Storing Parameters ƒ Use the TWGRWPRM table ƒ Insert a parameter – store the value in the twgrwprm table ƒ Fetch a parameter – return the value for pidm and parameter name

www.sungardsct.com

121

Devt & Stds – Data Entry

Set a Parameter pidm number; last_name_v spriden.spriden_last_name%type; BEGIN if not twgkwbis.F_ValidUser(pidm) then return; end if; -twgkwbis.P_OpenDoc('Hello_Chris.P_DisplayHello');

-- insert a parameter: Select spriden_last into last_name_v where spriden_pidm = pidm and spriden_change_ind is null; Twgkwbis.P_SetParam(pidm, ‘Last_Name’, last_name_v); -- print Last name from TWGBPARM Htp.p(twbkwbis.F_GetParam(pidm, ‘Last_Name’)); ..

www.sungardsct.com

122

Devt & Stds – Data Entry

Self Check ƒ Follow the instructions on page 69 of the workbook. ƒ Create a form to display a student's grades for a term. ƒ After a student selects a valid term from a drop down and clicks submit, a page displays each course number and corresponding GPA for that term.

www.sungardsct.com

123

SunGard SCT Web Programming 41

Advanced Topics ƒ After completing this lesson, you will be able to: ƒ Process form checkbox entries using PL/SQL tables ƒ Manage the appearance of web pages with styles and style sheets

www.sungardsct.com

124

Advanced Topics – PL/SQL Tables

PL/SQL Tables ƒ Some forms’ input types allow multiple choices ƒ PL/SQL tables are used to process more than one choice

California

New York

Indiana

www.sungardsct.com

125

Advanced Topics – PL/SQL Tables

PL/SQL Tables, Continued ƒ PL/SQL tables have two columns, the key and the value ƒ Key: type binary integer ƒ Value: user defined, for SSB varchar2(1000)

ƒ To reference an individual element ƒ tablename(index)

www.sungardsct.com

126

SunGard SCT Web Programming 42

Advanced Topics – PL/SQL Tables

PL/SQL Table syntax DECLARE TYPE varchar2_tabtype IS TABLE OF VARCHAR2 (100) INDEX BY BINARY_INTEGER; v_emails varchar2_tabtype; BEGIN v_emails(1) :=

'[email protected]';

v_emails(2) :=

'[email protected]';

v_emails(-4) := '[email protected]'; END;

www.sungardsct.com

127

Advanced Topics – PL/SQL Tables

Multiple Choices Form Example States you have visited
California York

New

Indiana

www.sungardsct.com

128

Advanced Topics – PL/SQL Tables

Processing Multiple Choices Procedure process_states ( states in twbkslib.nvarchar2_tabtype); I number; begin for I in 0 to 10 loop if states(I) is not null then htp.p(‘You visited ‘); htp.p(states(I)); htp.p(‘
’); end if; end loop; exception when no_data_found then null; end process_states;

www.sungardsct.com

129

SunGard SCT Web Programming 43

Advanced Topics – Styles

Styles ƒ Styles can be defined externally, at the document level, or a tag level. (SSB uses externally defined styles) ƒ You can apply a uniform style to all instances of the one tag in a document. ƒ All (paragraph) tags could be left justified

ƒ (OR) You can apply a style to a subset of tags ƒ Every other (paragraph) could be right justified

www.sungardsct.com

130

Advanced Topics – Styles

Style syntax selector {property: value} body {color: blue} ƒ Selector:

html/element tag you want to control

ƒ Property: attribute for the html tag ƒ Value:

value for the property

h1,h2,h3 {font-family:"sans serif ";color:red} ƒ Use commas to group selectors ƒ Use quotes for multiple word values ƒ Use semi-colons for more than one property/value style

www.sungardsct.com

131

Advanced Topics – Styles

Default Style Sheets ƒ By default, SSB uses four external style sheets to control the look and feel of content: ƒ web_defaultapp: all application pages ƒ web_defaultmenu: all menu pages ƒ web_defaulthome: dynamic homepage displayed before user logins ƒ web_defaulthelp: all help files accessed by link at top right hand corner of each page

ƒ These style sheets have been designed to go together ƒ SCT recommends that your organization use them

www.sungardsct.com

132

SunGard SCT Web Programming 44

Advanced Topics – Styles

SCT-Delivered Style Sheets ƒ web_defer.css ƒ

This CSS contains the settings provided in the previous releases of the SCT Banner Web products

ƒ

You may want to use this CSS if you have Web for Students or another product that has not yet been converted to the new UI to keep the look and feel of your products consistent

ƒ

FAQ# 6012

ƒ

Defect# 78274

ƒ web_color.css ƒ

This CSS demonstrates the flexibility of the CSS technology

ƒ

It is to be used as an example, and is not recommended for normal use on your institution's web site

www.sungardsct.com

133

Advanced Topics – Styles

CSS Levels ƒ Using Web Tailor, you can specify a style sheet file location at the following levels: ƒ

System level – updated via Customize Global User Interface Settings

ƒ

Module level – updated via Customize a Web Module

ƒ

Web page level – updated via Customize a Web Menu or Procedure

ƒ These file locations are expressed as URLs; for example, /css/

www.sungardsct.com

134

Advanced Topics – Styles

Styles in SSB ƒ The external sheet used by a web page is defined by Web Tailor parameter associated with the procedure ƒ You do not need to call a specific style sheet in your code ƒ Default style sheets are called if no style sheet is explicitly associated with a procedure in Web Tailor

www.sungardsct.com

135

SunGard SCT Web Programming 45

Advanced Topics – Styles

Default Style Sheets ƒ A class may differ based on the state of the HTML object. For example, the submenulinktext2 class is used for links ( tags) ƒ If a user has clicked on the link then the color changes: A.submenulinktext2 { color:

#1E2B83;

text-decoration: none;} A.submenulinktext2:visited { color: #800080; text-decoration: none;}

www.sungardsct.com

136

Advanced Topics – Styles

Calling Classes in Code ƒ The following TWBKFRMT procedures have a "class_in" parameter which allow you to specify a new style class for a tag: ƒ P_PrintStrong, P_PrintMenu, P_PrintText ƒ P_PrintText prints text with global font setting (default size = 3)

ƒ The rest of the formatting procedures call a style sheet internally. Therefore, you can only change the style properties by modifying the existing style ƒ If browser is Netscape or Internet Explorer, the css_enable indicator is set to TRUE ƒ Enable Indicator determines whether to use the style tag for formatting

www.sungardsct.com

137

Advanced Topics – Styles

Package Initialization for Twbkfrmt begin /* Try to determine client browser type.

If it looks to be a 4.x or 5.x

version of MSIE or Netscape Navigator, set css_enabled to TRUE. */ begin http_user_agent := owa_util.get_cgi_env('HTTP_USER_AGENT'); exception when others then http_user_agent := 'SQLPLUS'; end; IF http_user_agent IS NOT NULL THEN IF (instr(upper(http_user_agent),'MSIE') > 0) THEN IF (instr(http_user_agent,'MSIE 4.') > 0) OR (instr(http_user_agent,'MSIE 5.') > 0) THEN

css_enabled := TRUE;

END IF; ..

www.sungardsct.com

138

SunGard SCT Web Programming 46

Advanced Topics – Styles

Style Sheet Demonstration ƒ The instructor will demonstrate opening a style sheet in WordPad

www.sungardsct.com

139

Conclusion ƒ Could you explain the 9iAS Architecture? ƒ What is the PL/SQL Toolkit? ƒ Can you integrate your custom code into Web Tailor? ƒ What are some advanced features you would find useful? ƒ Where can I find documentation?

www.sungardsct.com

140

Questions and Answers

www.sungardsct.com

SunGard SCT Web Programming 47

Thank you for your participation

www.sungardsct.com

Session Break

www.sungardsct.com

SunGard, the SunGard logo, SCT, the SCT logo, and Banner, Campus Pipeline, Luminis, PowerCAMPUS, SCT Matrix, SCT Plus, and SCT PocketRecruiter are trademarks or registered trademarks of SunGard Data Systems Inc. or its subsidiaries in the U.S. and other countries. All other trade names are trademarks or registered trademarks of their respective holders. © 2003-2004 SunGard

www.sungardsct.com

SunGard SCT Web Programming 48