Title: Advanced Zen
1Advanced Zen
- Pat McGibbon, Maxim Vershinin
2Agenda
- Templates and Menus
- Layout and Style
- Adding Child Records to Parent Objects
- Zen Security
- Desktop (Drag Drop)
- Localization
3Templates and MenusCreating a Template Page
- Define an abstract page class from which all your
other pages will inherit. - Inheritance even for XData blocks
- Style
- Contents
- Modularize your pages by using pane components
that can be substituted in the child page classes.
4Templates and MenusZen Menus
ltmenu id"menu2" layout"vertical"gt ltmenuItem
caption"Menu A" link"javascript alert('A')"
/gt ltmenuItem caption"Menu B" link"javascript
alert('B')" /gt ltmenu id"menu2B"
caption"Submenu" layout"vertical"
onactivate"zenPage.activateMenu2B()"gt
ltmenuItem caption"Menu A" link"javascript
alert('A')" id"menu2B_A" /gt ltmenuItem
caption"Menu B" link"javascript alert('B')"
/gt ltmenu id"menu2BB" caption"Sub Submenu"
layout"vertical"gt ltmenuItem caption"Menu A"
link"javascript alert('A')" /gt ltmenuItem
caption"Menu B" link"javascript alert('B')"
/gt ltmenuSeparator /gt ltmenuItem caption"Help
Desk" link"ZENApp.HelpDesk.cls"
/gt lt/menugt lt/menugt ltmenuSeparator /gt ltmenuItem
caption"Test Suite" link"ZENTest.HomePage.cls"
/gt ltmenuItem caption"Home link"ZENDemo.Home.cls
" /gt lt/menugt
5Exercise 1 Creating a Template Page
- In this exercise we will review an existing Zen
Template, modify it and demonstrate template
panes and menu capabilities that can be used to
control the look and feel consistently across Zen
pages. Refer to the Exercise Guide for notes on
Exercise 1.
6Layout and StyleZen Style
- Each component can define a default style using
standard CSS style definitions. - The style can be overridden on an application,
component, or page level. - Cascading action the styles that are defined
last take precedence. - The Style is defined within an XData block called
Style using a ltstyle typetext/cssgt and a
closing lt/stylegt tag.
7Layout and StyleZen Layout
- XML block describes the layout of the page
- Zen will automatically generate the HTML
necessary to display the page in a browser. - Components can be grouped together as child
components of a container component . - Create a template page to provide a consistent
look and feel throughout your application.
8Exercise 2 Layout and Style
- In this exercise we will learn how to apply CSS
styles to Zen elements. Refer to the Exercise
Guide for notes on Exercise 2.
9Adding Child RecordsParent Child Relationships -
background
- Parent Child Relationships are very common in
application models - They can be implemented in Caché using the
Relationship property type in a class - Two main types that behave differently with
respect to cascade delete - One to Many
- Parent Child
10Adding Child RecordsParent Child Relationships
Visualizing in Zen
- Common display mode is to display the appropriate
child records as the user changes selection of
parent - Second tablePane for child record
- onselectrow event on parent tablePane triggers
appropriate code to show child records - Also we often need components and supporting code
to manage create/update/delete of child records
11Exercise 3 Adding Child Records to Parent Page
- In this exercise we will add a Comments section
to the PrivateHome page. Comments must always
stay attached to the specific blog entry theyre
entered into. Refer to the Exercise Guide for
notes on Exercise 3.
12Behind the ScenesZen Security
- Application-level security using a combination of
Zen forms and system configuration settings - Special Zen username and password controls
- CacheUserName
- CachePassword
- Modify Home Security Mangement CSP
Applications in the System Management Portal
13Behind the ScenesZen Security
- Control access to pages using RESOURCE class
parameter - Control access to components using the resource
server-only property - Current user must hold USE privileges on this
resource or the component will not be displayed
on the page.
14Exercise 4 Zen Security
- In this exercise we will build a login page that
uses Zens built in username and password
controls. Refer to the Exercise Guide for notes
on Exercise 4.
15DesktopZen Drag Drop Functionality
- Data Drag Drop
- Components provide dragEnabled and dropEnabled
attributes - Window Drag Drop
- Client-side Layout Manager enables ltdragGroupgt
component - Styles for drag-able windows are all customizable
16Exercise 5 Desktop (Drag Drop)
- We will now demo some of the upcoming Desktop
features for you! (This wont work in the
version of Caché which is installed on the
laptops.)
17Behind the ScenesZen Localization
- Create an inventory of text strings in one
language, and a convention for translating them
to other languages - DOMAIN class-level parameter determines
localization dictionary - Developers use XML format for creating files of
original language text and translations - At runtime, the application chooses what language
to use based on browsers native language
18Behind the ScenesZen Localization
- Message dictionary is a database of text strings
organized by Domain Name, Language Name, Message
ID - Text macros automatically create message at
compile time, generates code that retrieves
messages at runtime - ZENLOCALIZE provides automatic translation,
otherwise you must call Text yourself. - All CSP localization practices apply to Zen
applications
19Behind the ScenesZen Localization Message
Dictionary
20Behind the ScenesZen Localization - Text macro
- At compile time creates entries in CacheMsg
global - At run-time retrieves values from CacheMsg based
on - DOMAIN parameter value
- Language setting
- Default for browser
- session.Language
- response.Language
- ID
- All ZEN components invoke this macro by default
- Based on value of ZENLOCALIZE
- Optional id can be supplied for each entry
otherwise automatic
21Exercise 6 Localization
- In this exercise we will localize a web page so
it is automatically rendered in different
languages. Refer to the Exercise Guide for notes
on Exercise 6.
22Any Questions?
- Feel free to contact us!
- Pat McGibbon
- pat.mcgibbon_at_intersystems.com
- Maxim Vershinin
- max.vershinin_at_intersystems.com
23Advanced Zen
- Pat McGibbon, Maxim Vershinin