Professional Documents
Culture Documents
4 Manual
OpenBiz is a PHP application framework for professional IT developers and
consultants to build web-based enterprise applications.
Release 1.0
Index
Index .......................................................................................................................... 1
Openbiz 2.4 Overview................................................................................................ 6
Installation........................................................................................................... 6
Download and Install Openbiz 2.4 ............................................................... 6
Install demo applications ............................................................................. 7
Set the database.......................................................................................... 7
Access latest source code with SVN ........................................................... 7
What is new in Openbiz 2.4 ................................................................................ 8
Presentation Layer Changes ....................................................................... 8
EasyForm Metadata ...................................................................................11
EasyForm and EasyView Configuration Guide .......................................... 18
Metadata Generation Wizard ..................................................................... 18
Screenshots............................................................................................... 18
Openbiz 2.4 EastView and EasyForm metadata............................................... 22
EasyView metadata DTD file. .................................................................... 22
EasyForm metadata DTD file..................................................................... 22
Openbiz Architecture Overview................................................................................ 25
Metadata-driver framework ............................................................................... 25
Multi-layer Object Oriented Design ................................................................... 25
Openbiz's implementation of MVC.................................................................... 26
Openbiz's implementation of persistent object and ORM ................................. 27
Openbiz security model .................................................................................... 28
Openbiz Architecture Stacks ............................................................................. 30
Openbiz Source Code Structure ....................................................................... 30
Openbiz Class Structure ................................................................................... 32
Openbiz Configuration Guide................................................................................... 34
Manage metadata ............................................................................................. 34
Introduction of metadata ............................................................................ 34
Sample metadatas..................................................................................... 35
1
Openbiz 2.4 Manual
2
Openbiz 2.4 Manual
................................................................................................................... 79
Multi-selection (multi-delete) support ......................................................... 79
Application tabs and sub tabs support ....................................................... 80
Other Navigation widgets........................................................................... 81
Use Theme ....................................................................................................... 82
Use theme in openbiz application .............................................................. 82
Theme settings .......................................................................................... 83
Upgrade old version application with theme .............................................. 84
Theme and template file ............................................................................ 84
Openbiz Development Guide ................................................................................... 85
View access url ................................................................................................. 85
Manage your code ............................................................................................ 87
3
Openbiz 2.4 Manual
4
Openbiz 2.4 Manual
5
Openbiz 2.4 Manual
Openbiz 2.4 removes the display modes concepts used in previous releases. The
benefits:
Without confusing display mode in a form, the definition of the metadata is
clear and easy to manage.
Each view/form has single display which is browser backward/forward
button friendly, bookmark friendly as well as search engine friendly
The single display is used by most consumer facing web
applications.Openbiz are good for both enterprise and consumer web
development
Openbiz 2.4 redesigns the UI element with 20+ new element classes. The benefits:
This makes writing custom element class much easier than in previous
release which has big base UI element class HTMLControl.
Another advantage of using different element class is that different class has
its own attributes defined in metadata - this brings flexibility with no
confusion.
Openbiz 2.4 uses EasyView/EasyForm to implement common data management UI
patterns which are "list, detail, edit (LDE)"
Installation
Openbiz 2.4 source is available at sourceforge openbiz project site. Third party
libraries are included under openbiz/bin/others. User are free to download latest
releases of Zend Framework, Smarty engine from their own websites.
6
Openbiz 2.4 Manual
Developer can pull Openbiz 2.4 latest code from 2.4 SVN repository. Third party
libraries are NOT included in the SVN. Please download latest releases of Zend
Framework, Smarty engine from their own websites.
Use Openbiz web installer to install new easy application, demo application and trac
application.
Name
Driver
Server (hostname, or IP address)
Port. Database host port number
Charset. Databsae charset. E.g. utf8
User. Username to access database
Password. Password to access the database
User can pull the latest 2.4 source from SVN repository
7
Openbiz 2.4 Manual
https://bigchef.svn.sourceforge.net/svnroot/bigchef/branches/2.4/
The latest SVN snapshot can be downloaded here
http://bigchef.svn.sourceforge.net/viewvc/bigchef/branches/2.4.tar.gz?view=tar.
If you want to contribute (add features or fix bugs) to SVN repository, you need to have a
sourceforge account. To apply for sourceforge account, go to
http://sourceforge.net/account/newuser_emailverify.php. Then email your account to
support@phpopenbiz.org, your account will be added to openbiz project. After that you
should be able to check in/out openbiz SVN repository.
No matter in enterprise or consumer web applications, the most commonly adopted data
management flow is shown below. The new Openbiz 2.4 demo application (built on
EasyView and EasyForm) is a sample implementation of the pattern.
8
Openbiz 2.4 Manual
New Features
Openbiz 2.4 is a redesign on its presentation layer. It supports (or will support) basic and
advanced UI functionality in previous release.
9
Openbiz 2.4 Manual
easy
Data Layer
Throw Exception on BizDataObj query error.
Add log on each query call in BizDataObj
Service
Add csv import in ExcelService as it is a popular feature
Drop IOService as ExcelService does the same job
Replace PhpMailer with Zend_Mail in MailService
Baseapp
Use header and footer templates in the default view template
Naming convention of view, form, data metadata files
"v_" for view metadata file
"f_" for form metadata file
"d_" for data metadata file
The UI code in /bin/easy directory is rewritten with the following class structure.
View Class Description
EasyView Base view class
DynaView Dynamic view class, dynamic view can be given any
form to display
ViewRenderer Render view with Smarty or PHP template
Form Class Description
EasyForm Base form class
PickerForm Special form class for record picker
FormRenderer Render form with Smarty or PHP template
Element Class Description
Element Base UI element class. It won't be used in metadata.
InputElement Base input element class. It won't be used in metadata.
InputText Input box element
Textarea Text area element
Password Password element
File File element for upload
10
Openbiz 2.4 Manual
EasyForm Metadata
The details of the EasyForm metadata is given below. (A) stands for attribute, (E) stands
for element.
EasyForm Element
Name (A) -
Name of the form object. It must be same as the metadata file name.
Description (A) -
Form description.
Class (A) -
Form implementation Class. By default it is EasyForm. Developers can put custom
form class here.
FormType (A) -
The type of the form. It can be LIST, NEW, EDIT. Default value is empty string. It
11
Openbiz 2.4 Manual
12
Openbiz 2.4 Manual
put predefined Element class (in above table) here or custom class
drived from Element class.
Description (A) -
Element description.
FieldName (A) -
Data object's BizField name
Label (A) -
Label of the element
Text (A) -
Text value of the element
Image (A) -
Image file name. This is used in Button class.
Link (A) -
URL string. This is used in ColumnText class
Hidden (A) -
The visibility flag of the element. It should be either 'Y' or 'N'
Enabled (A) -
The flag indicating if the element is enabled or not. It should be either 'Y'
or 'N'
Sortable (A) -
The flag indicating if the element can be sorted or not. It should be
either 'Y' or 'N'
Required (A) -
The flag indicating if the element is a required input field or not. It should
be either 'Y' or 'N'
DefaultValue (A) -
The default value when creating a new record.
ValuePicker (A) -
The name of the picker form that is used to pick a record from a popup
window to base page.
SelectFrom (A) -
It defines the list of the values that are shown on the Listbox.
Width (A) -
13
Openbiz 2.4 Manual
14
Openbiz 2.4 Manual
Element
InputText Textarea Password File Button HTMLButton
Class
Name x x x x x x
Description x x x x x x
FieldName x x x x
Label x x x
Text x x x x
Image x
Link
Hidden x x x x x x
Enabled x x x x x x
Sortable
Required x x x x
DefaultValue x x
ValuePicker
SelectFrom
Width x x x x x x
Height x x x x x x
CssClass x x x x x x
Style x x x x x x
HTMLAttr x x x x x x
Element
ResetButton SubmitButton RichText AutoSuggest InputDate
Class
Name x x x x x
Description x x x x x
FieldName x x x
Label x x x
Text x x x x
Image
15
Openbiz 2.4 Manual
Link
Hidden x x x x x
Enabled x x x x x
Sortable
Required x x x
DefaultValue x x x
ValuePicker
SelectFrom
Width x x x x x
Height x x x x x
CssClass x x x x x
Style x x x x x
HTMLAttr x x x x x
Element
InputDatetime InputPicker RowCheckbox Hidden Listbox
Class
Name x x x x x
Description x x x x x
FieldName x x x x x
Label x x x
Text x
Image
Link
Hidden x x x x x
Enabled x x x x
Sortable
Required x x x
DefaultValue x x x
ValuePicker x
SelectFrom x
16
Openbiz 2.4 Manual
Width x x x x x
Height x x x x x
CssClass x x x x x
Style x x x x x
HTMLAttr x x x x x
Element
Checkbox Radio LabelText ColumnText HTMLBlock
Class
Name x x x x x
Description x x x x x
FieldName x x x
Label x x x x
Text x x x
Image
Link x
Hidden x x x x
Enabled x x
Sortable x
Required x x
DefaultValue x x
ValuePicker
SelectFrom x x
Width x x x x
Height x x x x
CssClass x x x x x
Style x x x x
HTMLAttr x x x x
17
Openbiz 2.4 Manual
To help quick Openbiz 2.4 metadata file creation, a xtweb tool is developed in Openbiz 2.4
alpha build 0715. This wizard will ask user to
1. Select a database instances which are declared in /metadata/Config.xml
2. Select a table from the database
3. Select columns of the table
4. Give a component name and generate metadata files
5. After the metadata files are generated, a link is presented to user to test the view
The following metadata files will be generated in the user defined path.
Data object file
View object files
Form object files - List form, Detail form, Edit form and New form
To run the tool, enter url http://host/baseapp/bin/tool.php
(e.g. http://localhost/ob/ob24/baseapp/bin/tool.php)
Screenshots
18
Openbiz 2.4 Manual
19
Openbiz 2.4 Manual
4. Edit page
5. New Page
20
Openbiz 2.4 Manual
21
Openbiz 2.4 Manual
22
Openbiz 2.4 Manual
23
Openbiz 2.4 Manual
24
Openbiz 2.4 Manual
The goal of Openbiz framework is to make design, development and maintenance of web
applications easy. Openbiz is XML metadata-driven framework, which means openbiz
objects are constructed based on description in their metadata files. Building an
application means design and development of metadata files in most time. Due to the
self-explanation nature of XML language, the application is easy to maintain. Meanwhile
Openbiz is an extensible framework due to the extensible nature of XML.
OpenBiz provides a PHP framework that assists you to build complicated web application
in an easy way.
25
Openbiz 2.4 Manual
Usually a business application can be modulated to 3 layers - Data layer, Business Logic
layer and Presentation layer. In OpenBiz architecture, these 3 layers map to 3 packages,
Presentation layer is refined to logic which is implemented by BizView package and GUI
layers which is implemented by jbForm javascript package. Business Logic layer is
implemented by BizDataObj package. 3rd party package ADODB handles Database layer.
Plugin services provide functional service components that can be invoked by both
presentation and data layer objects.
One of the key advantages of Openbiz is that it is a framework that follows the
Model-View-Controller (MVC) design pattern. This makes Openbiz applications much
more manageable because the presentation code (View) is cleanly separated from the
application data and logic (Model). All user interactions with the application are handled by
a front-end controller.
26
Openbiz 2.4 Manual
Comparing Openbiz MVC with existing MVC frameworks in market such as JSF and
Struts, Openbiz is more close to JSF because both are component based architecture.
Openbiz's View layer comprises components of View, Form and Element. These
components are accessible during request processing.
Similar with popular Hibernate approach, Openbiz uses session to maintain the
persistency of objects. Unlike J2EE web container who has objects pool in memory, PHP
objects are be constructed and released for each request (this is called shared-nothing
architecture). To keep the persistency of objects, openbiz persistent objects (Data,
Form ...) save a set of states in session, then reconstruct the object with these states. Also
to avoid multiple object instances of same class in the same session, Openbiz use
ObjectFactory to ensure object singleton.
27
Openbiz 2.4 Manual
Openbiz supports web security in three ways - user authentication, view access control
and data access control. Openbiz mainly uses plugin services to control security. This
implementation allows customers to plugin their own logic to the services. The details will
discussed in the developer guide - Implement authentication, view and data access
control.
28
Openbiz 2.4 Manual
Security
Openbiz implementation with plugin services
concept
User Openbiz uses authentication service (bin/service/authService.php) to
authentication authenticate username and password
Role-based view Openbiz uses profile service (bin/service/profileService.php) to get
access control user profile that includes "role". Then match this role to access
service (bin/service/accessService.php) to determine the users'
accessibility to the view
Attribute-based Openbiz uses profile service (bin/service/profileService.php) to get
data access user profile that includes attributes. Then based on these attributes
29
Openbiz 2.4 Manual
Openbiz source code includes two main folders - openbiz and baseapp.
30
Openbiz 2.4 Manual
31
Openbiz 2.4 Manual
The UI code in /bin/easy directory is rewritten with the following class structure in 2.4
32
Openbiz 2.4 Manual
33
Openbiz 2.4 Manual
Manage metadata
Introduction of metadata
The core concept of the Openbiz is metadata-driven mechanism. What is metadata? From
the dictionary, metadata is a component of data which describes the data. It is "data about
data". Metadata files in Openbiz are actually the configuration files of Openbiz classes. All
Openbiz classes are general classes. They represent different things with association to
different metadata. For example, when d_Student.xml links to BizDataObj class, this
BizDataObj instance is a student object. While when d_school.xml links to BizDataObj
class, then this BizDataObj instance becomes a school object.
Because Openbiz classes are described with metadata, authoring metadata files is same
as implementing a class. Thus, application development means authoring metadata files
in most time, instead of traditional programming. Applicaiton described with the metadata
files should have more clear logic and design.
34
Openbiz 2.4 Manual
Sample metadatas
Let's show two simple metadata samples - d_Event.xml represents an event data object
and f_EventEdit.xml represents an editing event form. The the meaning the xml should be
self-explained.
d_Event.xml
<BizFieldList>
</BizFieldList>
</BizDataObj>
f_EventEdit.xml
35
Openbiz 2.4 Manual
<DataPanel>
</DataPanel>
<ActionPanel>
RedirectPage="..."/>
</Element>
</Element>
</ActionPanel>
</EasyForm>
A good designed applications are usually built upon modules. Openbiz recommends
36
Openbiz 2.4 Manual
developers to create their metadata under app/modules/ directory. Openbiz metadata files
can be organized by module name and sub direcotry names. It is like the package concept
used in Java. For example,
PackageX.PackageY.metaA.xml refers to the metaA.xml under
modules/PackageA/PackageB directory.
4. separate files by functions and data, form, view (good for big module)
Example:
/modules/trac/ticket/ includes only ticket view metadata files
/modules/trac/ticket/data/ includes only ticket data metadata files
/modules/trac/ticket/form/ includes only ticket form metadata files
37
Openbiz 2.4 Manual
returns a value. If users need more complicated logic which can't be put in a simple
expression, they can associate an object with user-defined class where they put special
code.
Using Expressions
Simple expression is to support dynamic value binding of metadata attributes. Users can
use simple expression in the following place in metadata files.
BizDataObj
SearchRule, SortRule, OtherSQLRule, AccessRule, UpdateCondition, DeleteCondition.
These attributes are query related attributes of BizDataObj element, [field_name] is not
evaluated to field value. [field_name] is the syntax of query lanaguage, it will be replaced
by table column name. Please see Query Language in BizDataObj for details.
BizField
Required, Validator, Value, DefaultValue
Element
Link, Style, Hidden, Enabled, SelectFrom
EventHandler
Function, RedirectPage
Literals
Operators
38
Openbiz 2.4 Manual
Variables
@object_name:property_name
@BOEvent:Name
@FMEvent:Title
@object_name:*[child_name].property_name
@BOEvent:Field[Id].Value
@FMEvent:Control[evt_id].Value
@:property_name or @this:property_name
get the given property of this object ("this" object is the object defined in the metadata file)
@:*[child_name].property_name or @this:*[child_name].property_name
39
Openbiz 2.4 Manual
[field_name]
@profile:property_name
@profile:ROLEID
invoke the registered plugin service method and get the returned value.
Currently registered plugin services are
@validation - validation service
@query - query service
In a LabelText Element,
text="{@query:FetchField(easy.d_Event,
[Id]=@:Element[fld_evtid].Value, Name)}"
As implied from the implementation, developers can add more property support by
modifying/overriding GetProperty() method. The input of GetProperty() can be
either "property_name" or "*[child_name]" or something new that supported by
customer code.
40
Openbiz 2.4 Manual
Simple expression language also allow developers to use any global variables
supported by PHP. Please read http://us2.php.net/manual/en/reserved.variables.php
for details
Functions
Developers can invoke any PHP functions in simple expression. A user defined functions
can be invoked if the file that contains such function is included. For example, if the
metadata object A is based on a customer class, the class file is A.php that includes
another A_help.inc. In this case, you can invoke functions defined in A_help.inc in simple
expression.
Examples
<BizDataObj SearchRule="[Start]>'date(\"Y-m-d\")'">
<BizDataObj AccessRule="[OwnerId]='{@profile:USERID}'">
<BizDataObj UpdateCondition="[OrgId]=={@profile:ORGID}">
<BizDataObj DeleteCondition="'admin'=={@profile:ROLEID}">
41
Openbiz 2.4 Manual
Openbiz maps database tables to object with BizDataObj. This chapter introduces the
concept of mapping tables with BizDataObj, the next chapter "ORM" has full details of the
mapping configuration. A BizDataObj must have table name and mapping between table
columns to BizDataObj fields.
Specify the databsae which is defined in metadata/Config.xml.
One of BizFields must have name as "Id". This is required. This Id field usually
map to the primary key column of a table.
42
Openbiz 2.4 Manual
The syntax is
Use DefaultValue attribute to give default value to the BizField when dataobject
creates a new record.
Openbiz users won't worry about the composing complicated SQL statements.
BizDataObj support more intuitive query language at the object level. The basic syntax is
"[FieldName] opr 'Value' AND/OR [fieldName] opr 'Value'..." Here "opr" is SQL operator. At
runtime, openbiz convert [FieldName] to column name and generate SQL statement.
Openbiz also put table relationship in generated query statements.
Specify the default query in SearchRule
43
Openbiz 2.4 Manual
BizField supports following data types and formats in its Type and Format attributes.
Text
None
Number
Date
44
Openbiz 2.4 Manual
In default read-only mode, a date can be formatted according to the Date format.
Datetime
In default read-only mode, a date can be formatted according to the Date format.
Currency
Phone
1234567890 is formatted as
mask=(###) ###-####, phone=(123) 456-7890
mask=###-###-####, phone=123-456-7890
If a phone number starting with "*", it represents international phone number, it won't be
formatted
45
Openbiz 2.4 Manual
Blob
None
Data validations
Required
Validator
Uniqueness
46
Openbiz 2.4 Manual
Sometimes we want to set value to certain fields on record creation and update. For
example, when a record is create, we want to set the current time in "create_time" column.
And when this record is updated, we want to set the current time in "update_time" column.
Openbiz introduces 2 new attributes in BizDataObj to take are of such work.
ValueOnCreate can set the value on record creation
ValueOnUpdate can set the value on record update.
You can find example in baseapp/modules/trac/DO_Ticket.xml
Openbiz (default)
Id is generated using "ob_sysids" table which stores SYSID information for all tables who
have SYSID column
Apply to all database types
Identity
47
Openbiz 2.4 Manual
Sequence:seqname
GUID
UUID
Other
BizDataObj supports composite key as well. This feature would be useful when working
with legacy database tables who does not have single primary key column. The syntax of
BizDataObj whose Id field maps >2 primary key columns is:
48
Openbiz 2.4 Manual
<!-- make sure you place the Id field after PK1, PK2 fields.
-->
...
BizDataObj works with Openbiz audit trail Service to audit data change of specified fields.
To enable auditing on field, you can simply set OnAudit="Y" in the BizField. For example,
BizDataObj metadata
The details of the EasyForm metadata is given below. (A) stands for attribute, (E) stands
for element.
BizDataObj Element
Name (A) -
Name of the dataobject. It must be same as the metadata file name.
Description (A)
DBName (A)
Table (A)
IDGeneration (A)
SearchRule (A)
SortRule (A)
OtherSQLRule (A)
49
Openbiz 2.4 Manual
AccessRule (A)
UpdateCondition (A)
DeleteCondition (A)
Uniqueness (A)
BizFieldList (E)
BizField (E)
Name (A)
Join (A)
Column (A)
SQLExpr (A)
Type (A)
Format (A)
Value (A)
DefaultValue (A)
Required (A)
Validator (A)
ValueOnCreate (A)
ValueOnUpdate (A)
OnAudit (A)
TableJoins (E)
Join (E)
Name (A)
Description (A)
Table (A)
Column (A)
JoinRef (A)
ColumnRef (A)
JoinType (A)
ObjReferences (E)
Object (E)
Name (A)
Description (A)
Relationship (A)
50
Openbiz 2.4 Manual
Table (A)
Column (A)
FieldRef (A)
CascadeDelete (A)
XTable (A)
XColumn1 (A)
XColumn2 (A)
XDataObj (A)
Object/Relationship Mapping
To support more advanced O/R mapping, TableJoin and ObjectReference are introduced
to BizDataObj metadata file.
To understand the O/R mapping, a sample is listed below:
To map a table to a BizDataObj, you only need to configure the BizFieldList part in the
metadata.
51
Openbiz 2.4 Manual
<BizFieldList>
</BizFieldList>
</BizDataObj>
You can map multiple tables to a BizDataObj through Join. Joined table is referred by a
foreign key column in the base table of the BizDataObj, that says the base table has a
foreign key points to joined table's column. If Join is not given, the column is from the main
table of BizDataObj.
<BizFieldList>
</BizFieldList>
<TableJoins>
</TableJoins>
52
Openbiz 2.4 Manual
ON BaseTable.ColumnRef=JoinedTable.JoinedColumn …
FROM regist as T0
ON T0.ATTENDEE_ID = T1.SYSID
<TableJoins>
53
Openbiz 2.4 Manual
</TableJoins>
Many to one relationship between two tables means that table 1 has a column that
contains the foreign key pointing to a key/unique column in table 2. To map such
relationship between two BizDataObjs, use an Object in ObjectReference section.
<BizFieldList>
</BizFieldList>
<TableJoins>
</TableJoins>
<ObjReferences>
</ObjReferences>
</BizObj>
54
Openbiz 2.4 Manual
One to many relationship between two tables means table 2 has a column that contains
the foreign key pointing to a key/unique column in table 1. To map such relationship
between two BizDataObjs, use an Object in ObjectReference section.
<BizFieldList>
</BizFieldList>
<ObjReferences>
</ObjReferences>
</BizDataObj>
55
Openbiz 2.4 Manual
Description
Relationship Relationship between this dataobj and the referred dataobj
Table The table of the referred dataobj
Column The column of the referred dataobj's table. This column contains
the foreign key to the base table
FieldRef The field mapping to the column in base table
CascadeDelete Indicate whether deleting a record in base table will cause the
deletion of all related record in referred table.
Many to many relationship between two tables means an intersection table (also called
cross reference table, or correlation table) contains the foreign key columns pointing to a
key/unique column in table 1 and table 2. To map such relationship between two
BizDataObjs, use an Object in ObjectReference section.
<BizFieldList>
</BizFieldList>
<ObjReferences>
</ObjReferences>
</BizDataObj>
56
Openbiz 2.4 Manual
Description
Relationship Relationship between this dataobj and the referred dataobj
Table The table of the referred dataobj
Column The column of the referred dataobj's table. This column contains
the foreign key to the base table
FieldRef The field mapping to the column in base table
CascadeDelete Indicate whether deleting a record in base table will cause the
deletion of all related record in intersection table.
XTable The intersection table name
XColumn1 The intersection table column that has the foreign key of the base
table
XColumn2 The intersection table column that has the foreign key of the
referred table
XDataObj BizDataObject whose base table is the intersection table that is
XTable. When user associates one record from referred
DataObject to the base DataObject, a new record is created from
the XDataObj and added in the intersection table.
View is the container of presentation elements. For browser, view is a web page. Form is a
logic presentation unit. Form can be a typical HTML form or combincation of multiple
elements that present a logic dataset. An Openbiz form is more list the Form concept used
in Visual Basic. Forms are contained in a view which can defined the relationship between
forms. The layout of view and form are defined in template files (smarty or php template).
If more than one Forms are placed in a View and they can be linked by specifying
Parent-Child relationship in the View. The Forms need to have the relationship of their
underline BizDataObj. Here is a sample.
57
Openbiz 2.4 Manual
<FormReferences>
</FormReferences>
</EasyView>
Openbiz Form is composed with four parts - data panel, action panel, navigation panel
and search panel
Data panel is the area showing the data. It can be shown as list, table, form, tree and
so on.
Action panel is a list of controls where users can invoke command on the form.
Navigation panel is a set of controls that controls data navigation such as paging,
scrolling.
Search panel usually includes the search entries and search button.
Form is to present data defined in BizDataObj. Form defines the mapping between
elements in the BizForm and the fields in BizDataObj. Here's an example.
58
Openbiz 2.4 Manual
<DataPanel>
</DataPanel>
</EasyForm >
In Openbiz 2.4, in default display patterm follows the navigations between views. This
means users
see list of data in a "list" view
create a new record in a "new" view
edit a record in a "edit" view
see record details in "detail" view
For heavy data crowded screen, the above display pattern requires many page reloads.
To resolve the problem and archieve the same user interactivity supported by 2.3 BizForm,
the practice below can be used. Assume the default form of a view is a list form.
1. Popup. Use popup dialog or window to display the edit/new/details form - same as 2.3
BizForm Modal/Window.
2. Toggle. Render edit/new/details form in the same area of the list form - same as 2.3
BizForm display modes toggling.
The sampel implementation of above 2 approaches can be found in baseapp Attendee tab.
New attendee form is a Toggel form with list form. Edit Attendee form is a Popup form.
59
Openbiz 2.4 Manual
60
Openbiz 2.4 Manual
Element of a form can be linked to different Element class to present different type of UI
unit. Openbiz core provides 20+ basic and advanced element classes. Developers would
be able to bind an element with the following types:
Element type Class Special tricks beyond comment configuration
Single line text input InputText Using HTMLAttr="maxlength=N" sets the limit the
maximum number of characters that the user can
enter.
Multiple line text Textarea
input
List box or Combo Listbox By default show comboBox. If
box HTMLAttr="size=N", show N-row listbox
Checkbox SelectFrom="Value" means this checkbox returns
the Value when user check the checkbox
Radio Button By default the radion buttons are arranged
horiztionally. If Width="1", you can force them
arranged vertically
Label and field LabelText
Grid cell ColumnText
Image Button Button
Standard Button HTMLBUtton
Reset Button ResetButton
Submit Button SubmitButton
Password input box Password
File upload input File
Hidden Hidden
Date input InputDate DHTML calendar 1.0 (LGPL license) provided by
dynarch.com. The DHTML calendar is well
documented at
http://www.dynarch.com/demos/jscalendar/doc/ht
ml/reference.html. Many thanks to Nik Chankov
61
Openbiz 2.4 Manual
Not all attributes in Element is used by all classes. Element class will optionally use the
attributes. Please see the classs and attributes mapping matrix below.
Element Class InputText Textarea Password File Button HTMLButton
Name x x x x x x
Description x x x x x x
FieldName x x x x
Label x x x
Text x x x x
Image x
Link
Hidden x x x x x x
Enabled x x x x x x
62
Openbiz 2.4 Manual
Sortable
Required x x x x
DefaultValue x x
ValuePicker
SelectFrom
Width x x x x x x
Height x x x x x x
CssClass x x x x x x
Style x x x x x x
HTMLAttr x x x x x x
63
Openbiz 2.4 Manual
64
Openbiz 2.4 Manual
Sortable
Required x x x
DefaultValue x x x
ValuePicker
SelectFrom x x x
Width x x x x x
Height x x x x x
CssClass x x x x x
Style x x x x x
HTMLAttr x x x x x
65
Openbiz 2.4 Manual
Openbiz allows setting event handling functions to element. Event handling is defined in
following syntax.
</Element>
- Function gives a BizForm method name and arguments. Server side should have a
corresponding BizForm method. When the request hits BizController, it is routed to the
BizForm method. If the method doesn't exist, an error is returned. Function with syntax of
The objectName can be empty, this means it calls method of current BizForm. For
example
User can only invoke method of objects whose have metadata files. These objects include
BizForm, BizDataObj, BizView and PluginService. BizForm methods and PluginService
methods are recommended to be callable from client side.
RPC
the function with type RPC is invoked on server side by HTTPRequest (AJAX). RPC is
66
Openbiz 2.4 Manual
Page
the function with type Page is invoked on server side with page reload, form data is not
passed to server
example
Export button to bring up a file save dialog in the page
Form
the function with type Form is invoked on server side by form submission
example
Save button when there's file to upload in the form:
Popup
the function with type Popup is invoked on server side targeting to a new popup window
example
Excel output button to show excel format in a popup:
67
Openbiz 2.4 Manual
Prop_Window
the function with type Prop_Window is invoked on server side targeting to a new prototype
window (DHTML in-page window)
example
Add record button to show the picker form in a in-page window:
Prop_Dialog
the function with type Prop_Dialog is invoked on server side targeting to a new
prototype dialog (DHTML in-page modal window)
example
Edit record button to show the edit form in modal dialog:
Openbiz allows binding static or dynamic data to Listbox element as well as other
elements that use SelectFrom attribute.
68
Openbiz 2.4 Manual
In your form, you can assign SelectFrom="Selection(Fee)" for an Element, which means
this field element is a Listbox whose data is from the "Fee" elements in Selection.xml file.
What's in the Selection.xml?
<Fee Value=""/>
<Fee Value="15"/>
<Fee Value="20"/>
Also, you can give both value and text. If only give value, openbiz uses the value as the
display text.
You can make up your own xml file that has list of values for selection.
Format
SelectFrom="BizDataObjName[BizFieldName4Text:BizFieldName4Value]"
is supported so that users can show BizFieldName4Text field in Listbox and set
BizFieldName4Value for value.
69
Openbiz 2.4 Manual
In a complex form, there's usually some elements depending the values of other elements.
When the driving element changes, its children controls change accordingly. This is so
called form controls dependency.
With the help of expression language, elements' relationship can be specified in BizForm
metadata file. With the help of event handlers, events on driving control will cause the
dynamical changes on its children controls. Here is a sample.
<DataPanel>
</Element>
</Element>
</Element>
</Element>
70
Openbiz 2.4 Manual
with js function">
</Element>
</DataPanel>
Openbiz supports wizard by easy metadata configuration. Openbiz wizard has following
features:
Each form has "Next", "Back", "Cancel" and "Finish" navigation buttons.
If user clicks cancel button, user input data is not saved to database.
71
Openbiz 2.4 Manual
User input data won't to commit to database until user clicks finish button.
To see sample of wizards, go to Miscellaneous tab, click on "Wizard tests +" submenus.
Or copy the url as http://host/baseapp/bin/controller.php?view=easy.v_EventWizard
Openbiz wizard is a regular view that contains several wizard forms. So configuring a
wizard in openbiz is no harder than configuring a View. The difference between a wizard
view and regular view is wizard view show the wizard forms one by one based on the their
sequence in view metadata file, but regular view show all forms in one page. Below is an
example of a wizard view metadata file.
<FormReferences>
</FormReferences>
</EasyView>
A wizard form is a regular form with class as EasyFormWizard. The form usually needs to
configure next, back, cancel and finish buttons. For cancel and finish button, redirect page
can be given to route the user navigation.
72
Openbiz 2.4 Manual
<DataPanel>
</DataPanel>
<ActionPanel>
</Element>
73
Openbiz 2.4 Manual
</Element>
</Element>
</ActionPanel>
...
</EasyForm>
If application has speical logic, Openbiz suggests developers to write their own wizard
form class drived from core classes. By overriding GoPrev(), GoNext(), DoCancel() and
DoFinish() methods, developers can do different handling on navigation buttons events.
Users can pick record from a different form on the following cases:
Add/change the child record (parent-child is M-1) by picking another child record.
Add a child record in the child form (parent-child is M-M) by picking an existing child
record
Add/change the joined fields by picking a record from joined dataobj.
Note: Openbiz keeps only one instance of a metadata object (of DataObj, Form, View) in
a user session, so always configure a different object when two instances of same entity
needed in one view. For example, on an Event form (FMEvent / BOEvent), we usually
configure an event popup as (FMEventPopup / BOEventX). There're two ways to
configure a record-selecting popup BizForm.
Configure Element to show popup
To configure element to show popup form, users can set "LoadPicker(viewName,
FormName)" in the EventHandler Function attribute and set
FunctionTarget="Popup" or "Prop_Window". This configuration can be used in
74
Openbiz 2.4 Manual
On the popup form, add a button to call AddToParent() to add the current selected
record to the parent form (the form trigger the popup).
Configure InputPicker to show popup
In order to pick values from a popup window and populate them to base form
elements, you can use InputPicker element that has the pick button at the right side of
an input box. To configure the InputPicker element, ValuePicker and PickerMap need
to be specified correctly.
ValuePicker attribute. ValuePicker gives the view and form to be shown in
the popup.
It has syntax as ValuePicker="viewName,formName,elementName".
PickerMap attribute. PickerMap is used to map the picked record from a
popup form to the base record that initiates the popup. Openbiz will pick
values from popup form according to the mapping.
The syntax of PickerMap is
PickerMap="thisform_control_1:popup_control_1,
thisform_control_2:popup_control_2, ..."
Sample:
On the popup form, add a button to call JoinToParent() to join the current selected
record to the parent form (the form trigger the popup).
75
Openbiz 2.4 Manual
Shortcut keys are defined in Form metadata files. EventHandler of controls can have a
ShortcutKey attribute to associate the shortcut key to a function. The syntax is
</Element>
Form only recognizes shortcut keys defined in controls of its Toolbar and Navbar.
0,1,...9 0,1,...9
76
Openbiz 2.4 Manual
F1,F2,...F12 F1,F2,...F12
Developers can configure combination of Ctrl and/or Shift and/or Alt with other key, just
use "+" to link them together. Be aware of not conflicting with default shortcut keys of
browsers. Openbiz shortcut keys can usually override the browser default keys.
See shortcut key sample in demoapp/modules/easy/f_EventList.xml.
Openbiz Form allows user to override browser right click behavior by defining
ContextMenu attribute for EventHandler of Toolbar/Navbar controls. User can see context
menu by right-clicking mouse on grid.
77
Openbiz 2.4 Manual
Tree structure is commonly used to describe objects with hierarchy. For example,
company internal organization, product catalog ... Openbiz provides supports for tree
structure in 2.4 beta based on popular jstree 0.9.8 . The steps of configurating a tree form
are:
1. Design an table to capture tree relationship. Normally such table has schema like
(id, parent_id, name, object_id). We can call this table as tree index table.
o id is the PK of the record. Of course, the table may have different name
other than "id" as its PK column.
o parent_id is the FK pointing to parent record "id" column. Again "parent_id"
is just a pseudo name
o name is the name of the tree node. Again "name" is just a pseudo name
o object_id is the FK pointing to another table who has the real object data.
Again "object_id" is just a pseudo name
2. Design another table to capture the real object data. We can call this table as tree
object
table.file:///D:/Apache2/htdocs/ob/ob24/baseapp/modules/easy/f_tree_structure_li
st.xml
o The "id" of this table is same as "object_id" in the tree index table.
3. Define a dataobj xml that needs to have
o "Table" as tree index table
o "Id" field mapping to "id" column
o "PId" field mapping to "parent_id" column
o "Name" field mapping to "name" column
o "ObjectId" field mapping to "object_id" column
4. Define a form with Class = "EasyFormTree". EasyFormTree is an Openbiz core
form class. 2 more attributes for such class.
78
Openbiz 2.4 Manual
o RootSearchRule. It tells the root node search rule. E.g. "[PId] is null"
o TreeDepth. It tells how many levels of the initial tree.
5. Set form template engine as "PHP", and use tree_php.tpl
o PHP template allow more control of the rendering logic. Rendering tree
needs to use recursive function call which is hard in smarty (needs custom
plugin)
o tree_php.tpl prepare the jstree and other necessary functions
http://host/baseapp/bin/controller.php?view=easy.v_tree_structure.
79
Openbiz 2.4 Manual
Tabs are very popularly used in both business web applications and consumer web sites.
In many business applications, subtabs are common widgets to organize the
parent-children relationship between UI components in a page. Openbiz supports tabs
and subtabs with combination of enhanced HTMLTab class.
demo/Tabs.xml
<TabViews>
</TabViews>
</Tabs>
80
Openbiz 2.4 Manual
demo/EventTabs.xml
<TabViews>
</TabViews>
</Tabs>
Menu configuration in Openbiz. Please see the sample below. The xml should be
self-explained.
</Node>
</Node>
</Tree>
Tree configuration in Openbiz. Please see the sample below. The xml should be
81
Openbiz 2.4 Manual
self-explained.
</MenuItem>
</MenuItem>
</Menu>
Use Theme
From Openbiz 2.4 beta, theme is added to provide more flexibility of managing application
style.
82
Openbiz 2.4 Manual
Theme settings
2. Add /themes/your_theme/templates/cfg/tpl.conf.
This file is smarty config file that defines the images and css url (absolute or relative to
83
Openbiz 2.4 Manual
your_app/bin).
# global variables
images = "../themes/default/images"
css = "../themes/default/css"
1. Ignore theme
For application built on older version, it can keep the existing source structure where css,
images, templates folders are under your_app/. In your app.inc, set
define('USE_THEME', 0);
2. Use theme
Please follow the steps mentioned in "Theme settings" section.
move only view templates under theme/templates. Theme contains the overall
application style and page layout that is defined in view template file.
keep form templates under its own module directories. Form template is special
layout in the form block. It won't change in different theme.
84
Openbiz 2.4 Manual
http://host/app_path/bin/controller.php?view=viewname
Sample
http://localhost/ob24/baseapp/bin/controller.php?view=easy.v_EventList
85
Openbiz 2.4 Manual
http://host/app_path/bin/controller.php?view=viewname&fld:fldname=fldvalue
fldname and fldvalue are used as the search rule of the first form in the view.
Sample
http://localhost/ob24/baseapp/bin/controller.php?view=easy.v_EventDetail&fld:Id=EVT_4
http://host/app_path/bin/controller.php?view=viewname&form=formname
Sample
http://localhost/ob24/baseapp/bin/controller.php?view=easy.v_Regist&form=easy.f_Regist
List
With view name, form name and field name/value (Dynamic view)
http://host/app_path/bin/controller.php?view=viewname&form=formname&fld:fldname=fld
value
fldname and fldvalue are used as the search rule of the form in the view.
Sample
http://localhost/ob24/baseapp/bin/controller.php?view=easy.v_Regist&form=easy.f_Regist
Detail&fld:Id=REG_103
With view name, form name and child form name (Dynamic view)
http://host/app_path/bin/controller.php?view=viewname&form=formname&cform=child_fo
rmname
Sample
http://localhost/ob24/baseapp/bin/controller.php?view=easy.v_Attendee&form=easy.f_Att
endeeList&cform=common.f_AttachList
With view name, form name and child form name and field name/value
(Dynamic view)
http://host/app_path/bin/controller.php?view=viewname&form=formname&cform=child_fo
86
Openbiz 2.4 Manual
rmname&fld:fldname=fldvalue
fldname and fldvalue are used as the search rule of the parent form in the view.
Sample
http://localhost/ob24/baseapp/bin/controller.php?view=easy.v_Attendee&form=easy.f_Att
endeeDetail&cform=common.f_AttachList&fld:Id=ATD_1
Developers are recommended to write their module and put source files under
app/modules/your_module/ directory.
The following source files are normally considered in the module development.
Metadata files
87
Openbiz 2.4 Manual
PHP custom class file should be in the sample directory of the metadata
Template files
Template files can be stored in the /templates directory of the metadata file.
For general template, it can be stored in yourapp/modules/common/templates/ or
yourapp/templates/ directory.
Image files
Image files are in yourapp/images/. You can set sub directory in image/
css files css files are in yourapp/css/. You can set sub directory in css/
javascript files
Javascript files are in yourapp/js/. You can set sub directory in js/
Language files
Only basic usage of BizDataObj is listed below. Please refer to the API doc for details.
/* Fetches SQL result rows as a sequential array according the query rules set
before.
* sample code:
88
Openbiz 2.4 Manual
*/
$do->ResetRules();
$do->SetSearchRule($search_rule1);
$do->SetSearchRule($search_rule2);
$do->SetSortRule($sort_rule);
$do->SetOtherRule($groupby);
$total = $do->Count();
$do->SetLimit($count, $offset=0);
$recordSet = $do->Fetch();
/* Fetches SQL result rows as a sequential array without using query rules set
before.
* sample code:
*/
* sample code:
*/
$do->ResetRules();
89
Openbiz 2.4 Manual
$do->SetSearchRule($search_rule1);
$do->SetSearchRule($search_rule2);
$do->SetSortRule($sort_rule);
$do->SetOtherRule($groupby);
$total = $do->Count();
$do->SetLimit($count, $offset=0);
$resultSet = $do->Find();
$do->GetDBConnection()->setFetchMode(PDO::FETCH_ASSOC);
print_r($record);
/* Insert a record
* sample code:
*/
$dataRec->first_name = 'Steve';
$dataRec->last_name = 'Jobs';
$dataRec->save( );
$dataRec['first_name'] = 'Steve';
$dataRec['last_name'] = 'Jobs';
$dataRec->save( );
90
Openbiz 2.4 Manual
/* Update a record
*/
$dataRec->first_name = 'Steve';
$dataRec->last_name = 'Jobs';
$dataRec->save( );
$dataRec['first_name'] = 'Steve';
$dataRec['last_name'] = 'Jobs';
$dataRec->save( );
/* Delete a record
*/
$dataRec->delete( );
User can configure function in BizForm metadata file to invoke appropriate action on
server side. The commonly used BizForm methods are listed below. Please refer to the
API doc for details.
91
Openbiz 2.4 Manual
Update a record
EditRecord - show the edit record page on current focus record
SaveRecord - save current edited record with user input
Delete a record
DeleteRecord - delete the current focus record
Sort records
SortRecord - sort record list on given column and rerender the form
Page Navigation
GotoPage - render the given page
92
Openbiz 2.4 Manual
the Element. The event handler will invoke yav validation rules and display validation error
message at proper location.
This is to validate location input must not be empty and must have more than 2 characters.
The error message will be displayed at the "span" element with id = "errorsDiv_fld_loc".
The error message is displayed as:
Openbiz supports validation on BizDataObj and Form. In BizField, Required and Validator
attributes are used for such purpose.
93
Openbiz 2.4 Manual
Validation rules can be set in metadata files. This will invoke corresponding method call in
validation service.
<BizField Name="Email" Column="EMAIL" Validator="{@validate:email('[Email]')}"/>
<BizField Name="Phone" Column="PHONE"
Validator="{@validate:phone('[Phone]')}"/>
Openbiz uses validation service containing several standard validations along with the
ability to extend the service for your own purposes. The validation service is accessed
via the "Validator" attribute of a BizField or Element metadata. Call the validate service in
a manner similar to other services...
In the form template, 2 elements are needed to display error messages. (Sample at
baseapp/modules/easy/templates/details.tpl)
<div id='errorsDiv' class='innerError'> on top of the form
and <span id="errorsDiv_elementName"></span> at the right hand of each element.
94
Openbiz 2.4 Manual
OpenBiz provides many functionality to build complicated web applications. But different
application has different requirement, so you may extend OpenBiz packages to implement
custom logic.
Because OpenBiz packages are based on object-oriented design, you can easily build up
your own object by extending these packages and inherit all useful functions provided by
them.
Extended classes are automatically loaded on demand. Extended class must be included
in a file with format as ClassName.php.
Use can specify class name for BizDataObj, BizField, EasyView, EasyForm, Element and
PluginService by filling the "Class" attribute of in metadata file
/**
*/
95
Openbiz 2.4 Manual
/**
*/
EasyForm is the main server side presentation class, it has its counterpart class on client
browser side. In the EasyForm metadata, users can specify client side class in jsClass
attribute. For example.
Openbiz provides two client side classes AjaxForm and jbForm that is a subclass of
AjaxForm.
AjaxForm methods:
CallFunction(method, params_array) - convert function to request and send it to
server. A server side BizForm method is invoked by this method if there's no specific
method implemented in the client class. For example, a BizForm, whose
96
Openbiz 2.4 Manual
jbForm methods:
CollectFormData() - overriding AjaxForm CollectFromData(), add additional "selected
row" in the form data
SelectRecord(params_array) - special logic on select record call
SortRecord(params_array) - special logic on sort record call
DeleteRecord(params_array) - special logic on delete record call
To implement UI logic on client side, developers need to create their own client side class
like jbForm and give the class name to jsClass attribute of BizForm element. If you need
special logic in some methods, add these methods in the client class, which can be
subclass of either AjaxForm or jbForm. These methods can be pure client code or it can
this.CallFunction(...) to send the request to server.
An example:
Form metadata file is like:
...
...
97
Openbiz 2.4 Manual
</EasyForm>
function MyjbForm(name) {}
...
...
this.CallFunction("server_MyButtonClick", params_array);
Openbiz customer can write their special logic by implementing Plug-in Service. Plugin
services are also metadata-driven objects. Service code is under bin/service and
98
Openbiz 2.4 Manual
metadata is under /metadata/service. The plugin service metadata only gives the service
name and implementing class. Any xml elements can be child of the root PluginService
element. This is because different services may have different metadata configuration.
Please refer to the Appendix to see the DTD of plugin service metadata xml file.
Openbiz core library includes services under openbiz/bin/service/ and their metadata files
under openbiz/metadata/service/.
excelService.php - excel serivce can output to CSV files from a form and import from
CSV file to a form.
authService.php - authentication service, please refer to next chapter for usage
accessService.php - view access control service, please refer to next chapter for
usage
profileService.php - user profile service, please refer to next chapter for usage
logService.php - log service that write log mesage to file or other storage
emailService.php - integrated with Zend_Mail to send emails through smtp mail
server.
doTriggerService - BizDataObj trigger service that can trigger other actions on
database operations
auditService - audit trail service to trace data change
genIdService - table primary key column (Id) generation service.
Configure a service
In the application, you can specify your own plugin service implementation with following
methods.
1. Change the service metadata content under your_app/metadata/service/, still use the
core service. For example, you can write different accessService.xml to control the
view access rule, but the implementing class is accessService.php in core library. The
accessService.xml is like
99
Openbiz 2.4 Manual
</PluginService>
2. Specify the service implementing class. For example, different applications have
different profile service. The profileService.xml is like
</PluginService>
Write a service
Implement the class and method in the ClassName.php and store the file under
/bin/service/. Its metadata file should be under /metadata/service/. The input arguments of
the method are the caller's object name (a BizForm name) and the input data string (a
collection of form values from client browser). The method implements the user-specific
business logic and returns void. See the following code snippet.
class pdfService
function pdfService() {}
function renderView($viewName)
// get the view object and render the view to a html string
$viewobj = BizSystem::ObjectFactory()->GetObject($viewName);
$sHTML = $viewobj->Render();
100
Openbiz 2.4 Manual
Call service in form. Define the caller function in BizForm metadata file <...
Function="CallService(ClassName,MethodName)"...> is to call a method
"MethodName" of the service "ClassName".
Call service with url. Use url like
bin/BizController.php?F=Invoke&P0=[servicename]&P1=[methodname]&P2=[param
eter1]...
An example is
bin/controller.php?F=Invoke&P0=[pdfService]&P1=[renderView]&P2=[demo.ReportVi
ew]
Call service in code.
global $g_BizSystem;
$svcobj = $g_BizSystem->GetService($class);
$svcobj->$method($this->m_Name);
User authentication
101
Openbiz 2.4 Manual
View access control depended on the AccessControl attribute in view metadata file in
Openbiz implements role-based view access control in its new security architecture.
Openbiz uses profile service (usrlib/profileService.php) to get user profile that includes
"role". Then match this role to access service (usrlib/accessService.php) to determine the
users' accessibility to the view.
ProfileService GetProfile ($userid) method is called to get user profile array which is an
associated array with profile key and profile value pairs. Please note that customer must
replace the default GetProfile method in openbiz package, because the default GetProfile
method returns some randomly made array.
AccessService has a configuration file (accessService.xml) that defines the view access
permission. Please see an example below.
<access-constraint>
<view-collection>
<view name="shared.CalendarView">
<role name="admin"/>
<role name="member"/>
</view>
<view name="demo*"> <!-- can use regular expression in the view name -->
<role name="admin"/>
<role name="member"/>
</view>
102
Openbiz 2.4 Manual
</view-collection>
</access-constraint>
</PluginService>
The xml configuration file is easy to understand. Customer needs to put their own logic in
the accessService.xml.
Openbiz uses profile service (usrlib/profileService.php) to get user profile that includes
attributes. Then based on these attributes to determine browse/update/delete permission
of data record. The data access permissions are controlled in BizDataObj.
Configuration
103
Openbiz 2.4 Manual
Event can be accessed by all invited attendees (if the login user is one of the
attendees, he can access the event)
Configuration
Upon dataobjects update/delete operations, openbiz allows triggering different alerts and
action requests based on boolean results from search criteria for specific object. Briefly it
is called DO Trigger which executes in a response to a change in the values stored in the
database. DO trigger has two parts - trigger events and trigger actions. These information
are defined in DOTrigger plugin service metadata files. At runtime when user
update/delete a BizDataObj record, openbiz searches for this dataobj's trigger by looking
for its trigger metadata file with name DataObjName_trigger.xml under the same directory.
For example, demo/BOEvent's dataobj trigger metadata file is demo/BOEvent_trigger.xml.
104
Openbiz 2.4 Manual
<DOTrigger TriggerType="UPDATE|DELETE"> *
<TriggerActions>
</TriggerAction>
</TriggerActions>
</DOTrigger>
</PluginService>
Trigger conditions
trigger type
Expression
105
Openbiz 2.4 Manual
ExecuteSQL
Name="DBName" Value="Default"
ExecuteShell
Name="Script" Value="dir"
SendEmail
Name="EmailService" Value="service.emailService"
Name="Account" Value="MyPhpopenbiz"
Name="CCs" Value=""
Name="BCCs" Value=""
Name="Body" Value="This is an alert message. \nPlease notice that the record with
{[Id]} was updated."
Name="Attachments" Value=""
106
Openbiz 2.4 Manual
AuditTrail
Name="AuditService" Value="service.auditService"
Name="DataObjectName" Value="{@:Name}"
Messages widely appear in metadata file (especially in Form xml files). For example,
Error message
107
Openbiz 2.4 Manual
Define messages
For messages in metadata, no special definition is needed. You just need to use English
words or other default language in the string.
You can override the openbiz system messages by define a message in a message file
and specify the message file in metadata MessageFile attribute. For example,
In easy/d_event.xml, we have
In /messages/event.msg, we have
To use message in source code, you need to set "MessageFile" attribute in Form or
Dataobj metadata file. The sample code of using message:
$errMsg = $this->GetMessage("DATA_FIELD_REQUIRED",array($fld));
$errMsg =
$this->GetMessage("DATA_FIELD_INVALID_INPUT",array($fld,$value,$bizFld->m_Valid
ator));
108
Openbiz 2.4 Manual
Use Cache
To enable cache on openbiz objects, you need to add "CacheLifeTime" attribute for the
metadata element. CachLifeTime has unit as "second".
<View Name="Misc" CacheLifeTime="60"> tells that the content of view "Misc" is cached
by the system for 60 seconds.
Openbiz counts on cache service to cache content. Zend_Cache is used by cache service.
Thanks for Zend_Cache, the cache service can support all cache backend including:
File cache
SqlLite cache
MemCache
109
Openbiz 2.4 Manual
APC
...
For file cache, openbiz saves the cache data under baseapp/files/cache/data/...
More security
More security is added in openbiz 2.4 beta. Security service is used to check the potential
attack from outside world. Security service allows user to set
The openbiz look and feel is controlled by stylesheet css files. The main css file is
110
Openbiz 2.4 Manual
/css/openbiz.css
In case of using Format="block" in the BizForm's displayMode, users can modify the
following section in css/openbiz.css file.
.tbl {...}
In order to give user specific tab styles, users can modify the following section in
css/openbiz.css file.
.tabmenu {...}
.tabmenu li {...}
111
Openbiz 2.4 Manual
In order to give user specific tab styles, users can modify the following section in
css/menu.css file.
In order to give user specific tree styles, users can modify the following section in
css/openbiz.css file.
UL.expanded {...}
UL.collapsed {...}
LI.tree {...}
In order to give user specific RTE styles, users can modify the following section in
pages/rte/rte.css file.
Debug strategies
Logging
112
Openbiz 2.4 Manual
Debugging
113
Openbiz 2.4 Manual
Openbiz Design Tool is to help writing Openbiz metadata files. With the new web design
tool, users can
Manage Openbiz application source in your browser
Generate Openbiz metadata files with Metadata Wizard
Edit Openbiz metadata file with Metadata Editor
Manage user working directory and permissions. This function is available for
administrator.
Openbiz Tool is built on top of Extplorer- a great open source file management application.
The version of Extplorer used by Openbiz Tool is 2.0.1.
Installation
Download the Openbiz Tool from Openbiz sourcegorge site. Unzip the file in a folder that
is the same level of other Openbiz applications. For example, you may have directories
like
- baseapp. The openbiz baseapp.
- obtool. The openbiz tool
- openbiz. The openbiz library
114
Openbiz 2.4 Manual
After unzip the files, load http://host/tool_path/ in your browser. You will be asked to login.
Enter admin/admin as username and password to login as admin. On Unix/Linux box, you
need to change the permission of the application directory. Please refer to Extplorer site
for details.
After install the tool source, please edit the obtool/metadata/Config.xml to list all your
working database info. These database list will be used in Metadata Wizard and Editor.
With the help of Extplorer, users can manage the file system on browser. The Extplorer
has similar functionality and user interface as client file explorer.
When login as "admin", you can find a "Admin" button on the main toolbar. Click the button
to manage users.
115
Openbiz 2.4 Manual
Metadata Wizard
Developers can use Metadata Wizard to quickly create Openbiz 2.4 metadata files. This
wizard will ask user to
1. Select a database instances which are declared in /metadata/Config.xml
2. Select a table from the database
3. Select columns of the table
4. Give a component name and generate metadata files
5. After the metadata files are generated, a link is presented to user to test the view
The following metadata files will be generated in the user defined path.
Data object file
View object files
Form object files - List form, Detail form, Edit form and New form
Step 1 screen: Metadata wizard can be triggered by clicking the "Metadata Wizard" button.
116
Openbiz 2.4 Manual
Step 2 screen:
117
Openbiz 2.4 Manual
Step 3 screen:
118
Openbiz 2.4 Manual
Metadata Editor
119
Openbiz 2.4 Manual
Dropdown list for table selection. This list depends on the database
selection
Dropdown list for column selection. This list depends on the database
and table selection
Dropdown list for join selection.
Dropdown list for BizField selection of a form element. This list depends
on the BizDataObj seleciton in the form.
Dropdown list for data and form object selection
Under certain cases, you may want to edit the metadata source code directly. You can
always use normal "edit" button to edit the metadata xml source.
120
Openbiz 2.4 Manual
121