Openbiz 2.3 Overview
Openbiz 2.3 Installation
- Download and install
- Run demo application
- Upgrade from 2.2.2
Openbiz 2.3 New Features
- New source tree structure
- Data layer refactor
- Presentation layer refactor
- Other code enhancement
- List-Detail views
- Multi-selection support
- Dynamic value set on record update/creation
- Ajax file upload
- Display a BizForm in a Modal or Window
- DHTML Tabs
- Improved Excel Export Features
This document introduces the new enhanced features of Openbiz 2.3 upon version 2.2. Openbiz 2.2 manual still apply on version 2.3.
Openbiz 2.3 Installation
Download and Install Openbiz 2.3
Openbiz 2.3 source is available at sourceforge openbiz project site. Optional downloads. Third party libraries are included under openbiz/bin/others. User are free to download latest releases of Zend Framework, Smarty engine.
Run demo applications
User Openbiz web installer to install demo application and trac application.
To install demo application, launch http://server_path/openbiz_install_path/baseapp/index.php. Follow the install wizard.
To install trac application, launch http://server_path/openbiz_install_path/baseapp/index_trac.php. Follow the install wizard.
Upgrade from 2.2.2
Openbiz 2.3 can work with 2.2.2 metadata files. If you have customer classes on BizForm or BizDataObj, you need to make code change on BizDataObj query. Please refer to the Openbiz 2.3 sample code section.
Openbiz 2.3 New Features
New source tree structure
In openbiz bin directory, 3 new directories are created to store data, presentation and utility classes.
Openbiz demoapp is renamed to baseapp to indicate it is not a separate application out of openbiz package. 2 new directories are added - files and modules. Files directory is to store runtime generated files. Modules is a logic location to store source, metadata and templates files of modules.
Where to create a new module? In Openbiz 2.2 and earlier release, users need to put metadata, php, templates souces under app/metadata/my_module/, app/bin/my_module/ and app/templates directories. In 2.3, users can put all files under the app/module/my_module/. Openbiz 2.3 still works with 2.2 structure to make upgrading easy.
Comparison of module in 2.2 and 2.3 openbiz applications:
| Openbiz 2.2 application |
Openbiz 2.3 application |
app/
---bin/
------my_module/ (php files)
---medata/
------my_module/ (metadata files)
---templates (tempalte files) |
app/
---modules
------my_module/ (php and metadata files)
----------templates/ (template files) |
Openbiz 2.3 core and baseapp structure:
| Openbiz core library |
openbiz_root/
---bin/ (openbiz core php source)
------data/ (data layer classes)
----------private/ (data layer non-public classes)
------service/ (openbiz core service classes)
------ui/ (presentation layer classes)
----------private/ (presentation layer non-public classes)
------util/ (utility helper classes)
---languages/ (languages files)
---medata/ (openbiz metadata files)
------service/ (service package)
---others/ (third party libraries)
------phpmailer/ (phpmailer lib)
------Smarty/ (smarty package)
------zendfrwk/ (Zend Framework) |
| Openbiz base application |
baseapp/ (baseapp web pages)
---bin/ (baseapp php source)
------shared/ (baseapp shared library)
------service/ (baseapp service library)
---css/ (baseapp style sheets)
---files/ (baseapp files)
------cache/ (cache files)
----------data/ (data cache files)
----------metadata/ (metadata compiled files)
------sec_upload/ (secured uploaded files)
------tmpfiles/ (temporary files)
------upload/ (public accessed uploaded files)
---js/ (baseapp javascript files)
---pages/ (baseapp HTML files)
---images/ (baseapp images)
---log/ (baseapp logs)
---medata/ (baseapp metadata files)
------shared/ (baseapp shared package)
------service/ (baseapp service package)
---modules (baseapp modules files)
------demo/ (demo module)
----------templates/ (template files of demo module)
------trac/ (trac module)
----------tempaltes/ (template files of trac module)
---session (baseapp session files)
---templates (baseapp smarty templates files)
------cpl (baseapp smarty compiled templates)
------cfg (baseapp smarty configuration files) |
Data layer refactor
BizDataObj becomes 3 classes:
- BizDataObj_Abstract handles metadata related and general functions
- BizDataObj_Lite handles readonly functions such as search. This can improve the performance of many readonly pages.
- BizDataObj is a fully functional object that can handle search, new, update, delete. join, add/remove through object reference ...
Data object query API changes:
| Openbiz 2.2 DataObj |
Openbiz 2.3 DataObj |
| RunSearch(&$resultRecords) |
$resultRecords = Fetch() |
| FetchRecords($searchRule, &$resultRecord, $recNum=-1, $pageNum=-1, $clearSearchRule=true, $noAssociation=false) |
Recommend using DirectFetch($searchRule="", $count=-1, $offset=0); to replace FetchRecords
Still has the same FetchRecords
|
| $pdo_statement = Query() |
$pdo_statement = Find() |
| $num_pages = GetTotalPageCount() |
$num_records = Count() |
Openbiz 2.3 sample code of query
|
/* Fetches SQL result rows as a sequential array according the query rules set before.
* sample code:
*/
$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:
*/
// fetch all record with firstname starting with Mike
$do->DirectFetch("[FirstName] LIKE 'Mike%'");
// fetch first 10 records with firstname starting with Mike
$do->DirectFetch("[FirstName] LIKE 'Mike%'", 10);
// fetch 20th-30th records with firstname starting with Mike
$do->DirectFetch("[FirstName] LIKE 'Mike%'", 10, 20);
/* Do the search query and return results set as PDOStatement
* sample code:
*/
$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);
$resultSet = $do->Find();
$do->GetDBConnection()->setFetchMode(PDO::FETCH_ASSOC);
while ($record = $resultSet->fetch())
{
print_r($record);
}
|
Presentation layer refactor
BizForm becomes 3 classes
- BizForm_Abstract handles metadata related and general functions
- BizForm_Lite handles readonl functions like paging, sorting, search. No subform is supported. This can improve the performance of many readonly pages. The examples of using BizForm_Lite class are baseapp/modules/trac/FM_Ticket.xml and baseapp/modules/trac/FM_TicketChange.xml.
- BizForm can handle readonly and functions like new, update, delete, pick, subForm, popup...
Paging logic is moved from BizDataObj to BizForm.
Other code enhancement
- Make singleton API to get BizSystem instance by calling BizSystem::instance();
- Separating error handling logic to openbiz/bin/ErrorHandler.php. Also add exception handling logic there.
List-Detail views
In many data centric applications, List/Detail views are commonly used as an UI pattern to present data.
- List view is read only list of records
- It usually provide a search box to search records on certain fields
- No child form is shown in the list view
- It has a link (on name, id column) to drill down to detail view
- Detail view shows the details of a record
- It also allows user to edit, delete the record
- Children forms are shown under the detail form
- It has some links back to list view
Openbiz trac application Ticket tab is the type of List/Detail views pattern.

Multi-selection (multi-delete) support
Selecting multiple records on a data grid is a common function in many applications. Openbiz 2.3 starts to support it. To add a checkbox in the first column of a grid, the following line needs to be added.
<BizCtrl DisplayName="" FieldName="Id" Name="row_selections" Class="RowSelector" DisplayMode="READ"/>
The example is baseapp/modules/demo/FMEvent.xml

Dynamic value set on record update/creation
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
<BizField Column="time" Name="time" Type="Datetime" ValueOnCreate="{date('Y-m-d H:i:s')}" Format="%m/%d/%Y"/>
<BizField Column="changetime" Name="changetime" Type="Datetime" ValueOnCreate="{date('Y-m-d H:i:s')}" ValueOnUpdate="{date('Y-m-d H:i:s')}"/>
Ajax file upload
Openbiz add Ajax file upload support to give better user experience on uploading files. Example can be found at baseapp/modules/trac/FM_Attachment.xml and baseapp/modules/trac/FM_Attachement.php. Uploaded file is stored into sec_upload directory (in 2.2.2, only support upload file to a blob column in a table).
Display a BizForm in a Modal or Resizable Window
Beta support for modals and resizeable windows has been introduced in the latest SVN (Rev. 306) version of of 2.3. Using either of these elements requires no custom coding and can be configured entirely within the Eclipse Plugin. Edit an existing Toolbar button to display in a Modal/Window by specifyingFunctionType="Modal or "FunctionType="Window" . This will also change the way Context Menus are rendered. Likewise, double clicking on a record will trigger the new display element.
Here is a simple example of having the QUERY form show up in a Modal dialog instead of within the main page. For a window, replace the word Modal with Window.
<Control Caption="Search" DisplayMode="READ" Enabled="" Function="SearchRecord()" FunctionType="Modal" HTMLAttr="" Height="" Image="search.gif" Name="btn_search" Style="" Type="Button" Width=""/>
Using the new Event Handler style of buttons, the same can be written as
<Control Caption="Edit" DisplayMode="READ" Enabled="" Function="EditRecord()" FunctionType="Modal" HTMLAttr="" Height="" Image="edit.gif" Name="btn_edit" Style="" Type="Button" Width="">
<EventHandler Event="onclick" Function="EditRecord()" FunctionType="Modal" Name="edit_attendee" ShortcutKey="Ctrl+E"/>
</Control>
A Modal's size and title can also be customized from by adding an "OnMouseOver" even hanlder.
<Control Caption="New" DisplayMode="READ" Enabled="" Function="NewRecord()" FunctionType="Modal" HTMLAttr="" Height="" Image="new.gif" Name="btn_new" Style="" Type="Button" Width="">
<EventHandler Event="onmouseover" Function="js:formatModal('height=600&width=750&title=New Attendee')" FunctionType="" Name="format_new_modal"/>
<EventHandler Event="onclick" Function="NewRecord()" FunctionType="Modal" Name="new_attendee" ShortcutKey="Ctrl+N"/>
</Control>
DHTML Tabs
Coming Soon.... In the mean time, check out the demo and flip between Attendees and Registration tabs. Look ma, no page reloads!
http://localhost/latest_openbiz/baseapp/bin/controller.php?view=demo.Eve...
Improved Excel Export Features
Now you can customize the way OB's Excel service behaves.
New features include:
- Export the contents of a different BizForm than the BizForm that holds the Export Button.
- Export field data from different displaymodes (READ, EDIT or even EXCEL)
- Choose from three output formats, HTML, CSV and TAB
Consider the following example:
<Control Caption="Excel Export" DisplayMode="READ" Image="excel.gif" Name="btn_excel" Type="button">
<EventHandler ContextMenu="Export to Excel" Event="onclick" Function="CallService(service.excelService,renderCSV,demo.FMAttendee,READ)" FunctionType="Popup" Name="onclick"/>
</Control>
Notice the additional paramters that drive each new feature. First call the excel service, pick your format (renderCSV, renderTAB and renderHTML), choose the BizForm whose data you wish to export and finally, choose the display mode from which to draw fields.
Check it out in action here: http://phpopenbiz.org/demo/23/baseapp/bin/controller.php?view=demo.Atten...