phpwebapp-commits Mailing List for phpWebApp (Page 33)
Brought to you by:
dashohoxha
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(15) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(2) |
Feb
|
Mar
|
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2003 |
Jan
|
Feb
(43) |
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(194) |
Sep
(60) |
Oct
(6) |
Nov
|
Dec
(16) |
2004 |
Jan
(73) |
Feb
(13) |
Mar
(5) |
Apr
|
May
(5) |
Jun
|
Jul
(183) |
Aug
|
Sep
(5) |
Oct
(30) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
(1) |
Jun
(35) |
Jul
(17) |
Aug
(2) |
Sep
(6) |
Oct
(19) |
Nov
(108) |
Dec
|
2006 |
Jan
(10) |
Feb
(1) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Dashamir H. <das...@us...> - 2003-08-07 15:51:33
|
Update of /cvsroot/phpwebapp/documentation In directory sc8-pr-cvs1:/tmp/cvs-serv4439 Removed Files: init.php global.php Log Message: --- init.php DELETED --- --- global.php DELETED --- |
From: Dashamir H. <das...@us...> - 2003-08-07 15:51:33
|
Update of /cvsroot/phpwebapp/documentation/event_handlers In directory sc8-pr-cvs1:/tmp/cvs-serv4439/event_handlers Removed Files: on.beforePage.php on.afterPage.php Log Message: --- on.beforePage.php DELETED --- --- on.afterPage.php DELETED --- |
From: Dashamir H. <das...@us...> - 2003-08-07 15:47:53
|
Update of /cvsroot/phpwebapp/web_app In directory sc8-pr-cvs1:/tmp/cvs-serv3816 Modified Files: class.WebApp.php Log Message: WebApp::to_url_path() improved Index: class.WebApp.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/class.WebApp.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** class.WebApp.php 16 Jul 2003 12:05:23 -0000 1.5 --- class.WebApp.php 7 Aug 2003 15:47:50 -0000 1.6 *************** *** 445,456 **** /*------ mix functions ------------------------*/ ! /** takes a local path and returns it as an url location */ ! function to_url_path($local_path) { ! //sometimes APP_PATH may be empty '', and str_replace() ! //does not accept an empty argument; this is why the ! //trick of "#" is used ! $url_path = str_replace("#".APP_PATH, APP_URL, "#".$local_path); ! return $url_path; } --- 445,455 ---- /*------ mix functions ------------------------*/ ! ! /** takes a path and returns the corresponding url */ ! function to_url_path($path) { ! $doc_root = $_SERVER["DOCUMENT_ROOT"]; ! $url = str_replace($doc_root, '', $path); ! return $url; } |
From: Dashamir H. <das...@us...> - 2003-06-17 14:31:10
|
Update of /cvsroot/phpwebapp/web_app/doc In directory sc8-pr-cvs1:/tmp/cvs-serv11400/doc Modified Files: bugs.txt Log Message: Index: bugs.txt =================================================================== RCS file: /cvsroot/phpwebapp/web_app/doc/bugs.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** bugs.txt 21 Feb 2003 08:16:39 -0000 1.1.1.1 --- bugs.txt 17 Jun 2003 14:31:05 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + * class.Parser.php:630, add state variables of a webobject to the var stack * The JS session vars cannot contain \' (slash single quote), |
From: Dashamir H. <das...@us...> - 2003-06-17 14:31:10
|
Update of /cvsroot/phpwebapp/web_app In directory sc8-pr-cvs1:/tmp/cvs-serv11400 Modified Files: class.WebApp.php makedoc.sh Log Message: Index: class.WebApp.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/class.WebApp.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** class.WebApp.php 23 Feb 2003 14:20:30 -0000 1.2 --- class.WebApp.php 17 Jun 2003 14:31:05 -0000 1.3 *************** *** 307,311 **** function replaceVars($line) { ! while ( ereg("\{\{([^#][^{}]*[^#])\}\}", $line, $regs) ) { $str2replace = $regs[0]; --- 307,311 ---- function replaceVars($line) { ! while ( ereg("\{\{([^#{][^{}]*[^#}])\}\}", $line, $regs) ) { $str2replace = $regs[0]; Index: makedoc.sh =================================================================== RCS file: /cvsroot/phpwebapp/web_app/makedoc.sh,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** makedoc.sh 21 Feb 2003 08:15:03 -0000 1.1.1.1 --- makedoc.sh 17 Jun 2003 14:31:05 -0000 1.2 *************** *** 1,4 **** #!/bin/bash - # $Id$ #/** --- 1,3 ---- |
From: Dashamir H. <das...@us...> - 2003-02-23 15:15:53
|
Update of /cvsroot/phpwebapp/documentation/templates In directory sc8-pr-cvs1:/tmp/cvs-serv13379 Modified Files: about.html Log Message: Index: about.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/about.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** about.html 23 Feb 2003 14:29:07 -0000 1.2 --- about.html 23 Feb 2003 15:15:50 -0000 1.3 *************** *** 92,97 **** <i>documentation</i>, <i>app1</i>, <i>app2</i> etc. Alternatively, you can download them from here: ! <a href="http://phpwebapp.sourceforge.net/download/web_app.tar.gz">web_app.tar.gz</a> (168 KB) , ! <a href="http://phpwebapp.sourceforge.net/download/documentation.tar.gz">documentation.tar.gz</a> (212 KB) , <a href="http://phpwebapp.sourceforge.net/download/app1.tar.gz">app1.tar.gz</a> (5 KB) , <a href="http://phpwebapp.sourceforge.net/download/app2.tar.gz">app2.tar.gz</a> (7 KB) --- 92,97 ---- <i>documentation</i>, <i>app1</i>, <i>app2</i> etc. Alternatively, you can download them from here: ! <a href="http://phpwebapp.sourceforge.net/download/web_app.tar.gz">web_app.tar.gz</a> (268 KB) , ! <a href="http://phpwebapp.sourceforge.net/download/documentation.tar.gz">documentation.tar.gz</a> (254 KB) , <a href="http://phpwebapp.sourceforge.net/download/app1.tar.gz">app1.tar.gz</a> (5 KB) , <a href="http://phpwebapp.sourceforge.net/download/app2.tar.gz">app2.tar.gz</a> (7 KB) |
From: Dashamir H. <das...@us...> - 2003-02-23 14:53:29
|
Update of /cvsroot/phpwebapp/documentation/templates/tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv31005 Modified Files: tutorial.html Log Message: Index: tutorial.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/tutorial/tutorial.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tutorial.html 21 Feb 2003 08:18:32 -0000 1.1.1.1 --- tutorial.html 23 Feb 2003 14:53:26 -0000 1.2 *************** *** 7,11 **** <tr> <td> ! <Include SRC="{{WOBJ_PATH}}tabs3/tabs3.html" /> <WebObject Class="tabs3" Name="tutorial" /> <Include SRC="{{./}}{{tabs3::tutorial->selected_item}}.html" /> --- 7,11 ---- <tr> <td> ! <Include SRC="{{WEBOBJ_PATH}}tabs/tabs3.html" /> <WebObject Class="tabs3" Name="tutorial" /> <Include SRC="{{./}}{{tabs3::tutorial->selected_item}}.html" /> |
From: Dashamir H. <das...@us...> - 2003-02-23 14:42:44
|
Update of /cvsroot/phpwebapp/documentation/webobjects/tabs2 In directory sc8-pr-cvs1:/tmp/cvs-serv20867/webobjects/tabs2 Removed Files: tabs2.css tabs2.html tabs2.js tabs2.php tabs2.txt tabs2_items.php Log Message: --- tabs2.css DELETED --- --- tabs2.html DELETED --- --- tabs2.js DELETED --- --- tabs2.php DELETED --- --- tabs2.txt DELETED --- --- tabs2_items.php DELETED --- |
From: Dashamir H. <das...@us...> - 2003-02-23 14:42:44
|
Update of /cvsroot/phpwebapp/documentation/webobjects/tabs3 In directory sc8-pr-cvs1:/tmp/cvs-serv20867/webobjects/tabs3 Removed Files: tabs3.css tabs3.html tabs3.js tabs3.php tabs3.txt tabs3_items.php Log Message: --- tabs3.css DELETED --- --- tabs3.html DELETED --- --- tabs3.js DELETED --- --- tabs3.php DELETED --- --- tabs3.txt DELETED --- --- tabs3_items.php DELETED --- |
From: Dashamir H. <das...@us...> - 2003-02-23 14:42:44
|
Update of /cvsroot/phpwebapp/documentation/webobjects/displaytxt In directory sc8-pr-cvs1:/tmp/cvs-serv20867/webobjects/displaytxt Added Files: displaytxt.css displaytxt.html displaytxt.php displaytxt.txt Log Message: --- NEW FILE: displaytxt.css --- .txtlines { background-color: white; color: #000099 } --- NEW FILE: displaytxt.html --- <WebBox ID="displaytxt"> <div class="txtlines"> <pre> <Repeat rs="lines"> {{line}} </Repeat> </pre> </div> </WebBox> --- NEW FILE: displaytxt.php --- <?php class displaytxt extends WebObject { function init() { $this->addSVar("file", UNDEFINED); } function onRender() { $file = $this->getSVar("file"); if (!file_exists($file)) { $msg = "displaytxt: file '$file' does not exist."; print WebApp::error_msg($msg); return; } $lines = file($file); $rs = new EditableRS("lines"); for ($i=0; $i < sizeof($lines); $i++) { $line = chop($lines[$i]); $line = htmlentities($line); $rec = array("line" => $line); $rs->addRec($rec); } global $webPage; $webPage->addRecordset($rs); } } ?> --- NEW FILE: displaytxt.txt --- file: display.txt |
From: Dashamir H. <das...@us...> - 2003-02-23 14:42:44
|
Update of /cvsroot/phpwebapp/documentation/webobjects/tabs1 In directory sc8-pr-cvs1:/tmp/cvs-serv20867/webobjects/tabs1 Removed Files: tabs1.css tabs1.html tabs1.js tabs1.php tabs1.txt tabs1_items.php Log Message: --- tabs1.css DELETED --- --- tabs1.html DELETED --- --- tabs1.js DELETED --- --- tabs1.php DELETED --- --- tabs1.txt DELETED --- --- tabs1_items.php DELETED --- |
From: Dashamir H. <das...@us...> - 2003-02-23 14:42:43
|
Update of /cvsroot/phpwebapp/documentation/templates/webobjects/pages In directory sc8-pr-cvs1:/tmp/cvs-serv20867/templates/webobjects/pages Added Files: browse.txt datebox.txt dbTable.txt folderListing.txt form.txt leftMenu.txt listbox.txt table.txt tabs.txt xlistbox.txt Log Message: --- NEW FILE: browse.txt --- What is it ---------- The 'fileBrowser' tool of WebApp is a WebBox which is used to preview the templates and WebBox-es of a WebApp application. It allows the users to browse the folders of the application and to display the files. The files are displayed according to their types, e.g. a php file is displayed as code, an image file is displayed as an image, an HTML file can be displayed both as HTML code and as rendered HTML, etc. It is usually used by the grafical designer of the application to see how the templates look in the application. He cannot see the templates properly just by opening them in the browser, because the templates contain {{#variables}}, template tags (like <Repeat>, <if>, <Recordset>) etc. It can also be used by the JavaScript programmer and PHP/DB programmer to test the functionality of a WebBox separately from the rest of the application (if the WebBox is well encapsulated). How to enable it for a certain application ------------------------------------------ To use it for a certain application, add a php file (e.g. 'browse.php') in the root folder of the application, which contains these lines: <?php include "webapp.php"; WebApp::addVar("APP_STYLE", APP_URL."templates/styles.css"); WebApp::constructHtmlPage(BROWSER_PATH."fileBrowser.html"); ?> It is not a standalone application, it is like a plug-in tool that can be added to an existing application. The constant BROWSE_PATH is declared by the framework itself. By including the "webapp.php" of the application, it gets the paths, the DB connection and the configuration of the application itself, which are needed in order to preview the templates correctly. How it is used -------------- On the left-side of the page there is a box that allows the user to browse a folder and to select a file. The selected file is displayed on the right side of the page. On the top of the page there is a panel that allows the user to change the way the template is displayed. If you check the "Hide Folder Box" and then click refresh, then the left box that is used to browse the folders is hidden (this may be useful when the template that is being displayed is too large and fills all the width of the browser). The options "Code View" and "Preview" change the viewing mode of the HTML files. When "Code View" is selected, the HTML code of the templates will be displayed. When "Preview" is selected, the templates are displayed in the same way that they will be displayed in the application. The second box on the top allows the user to change any session variables, and the third box allows him to change the root folder of the select box. The configuration file ---------------------- Sometimes the templates may have variables inside it, or may be associated with recordsets that contain variables. If these variables are given values somewhere else in the application (outside the template) then these variables will be uninstantiated and the template will not be displayed properly. In order to correct this situation, a configuration file may be used for each template. The 'fileBrowser' looks for the file 'tplFile.cfg.php', includes it if found, and calls the function 'tplFile_config()'. In this function the user can instantiate these variables so that the template is displayed correctly (similar to how it is displayed in a real situation in the application). --- NEW FILE: datebox.txt --- The webobject datebox can be used to select the date from a calendar. It can be used like this: First include the webclass that defines it: <Include SRC="{{#DATEBOX_PATH}}datebox.html" /> (DATEBOX_PATH is defined by the framework) Then declare as many datebox objects as needed: <WebObject Class="datebox" Name="information_date" value="{{#info_date}}" format="YYYY-MM-DD" onchange="check_selected_date(this)" /> <WebObject Class="datebox" Name="proposal_date" /> <WebObject Class="datebox" Name="contact_date" /> etc. The attribute 'value' is used to initialize the datebox with an initial value. If it is not given, then the default is {{#{{#obj_name}}}} (in the last example above it would be {{#contact_date}}). The attribute 'format' is used to specify the format of the date. The reckognized formats are: YYYY-MM-DD (default) MM/DD/YYYY MM-DD-YYYY DD/MM/YYYY DD-MM-YYYY Actually this is only the format of the display, because the internal format is allways YYYY-MM-DD, the format used by the databases. E.g. if the above datebox webobject is declared inside a form with the name 'editDoc', then "document.editDoc.information_date.value" returns the date in the internal format (in the format YYYY-MM-DD). The attribute 'onchange' (be carefull, all lowercase) is used to call any validation function at the time that the date is changed. If you pass 'this' as a argument to this function, then it refers to the display format. E.g. if 'date' is the parameter to which 'this' is passed, then "d = date.value;" gets the selected date in the display format (which is specified by the attribute 'format'), and "date.value = d;" sets the date of the datebox ('d' should be in the format specified by 'format'). If you want to modify this webobject, you can copy it to a path local to the application, modify it and use the modified copy, e.g. <Include SRC="{{#./}}datebox/datebox.html" /> Bugs: When you change the date, the validation code of the "onchange" is executed and it changes the date like this: "date.value = d;" the internal value is not updated, so the value saved in the DB is the selected one (which is wrong). --- NEW FILE: dbTable.txt --- WebObject 'dbTable' is used to display and edit the content of a database table inside a page. It is used like this: <Include SRC="{{#DBTABLE_PATH}}dbTable.html" /> <WebObject Class="dbTable" Name="offices" table = "offices" fields = "off_id,name" where = "off_id < 10" editable = "true" selectable="true" /> The attribute 'table' is the name of the table that will be displayed. If it is not specified, its default value is {{#obj_name}} (the value of attribute 'Name'). The attribute 'fields' is the list of fields that will be displayed. It is optional and its default value is "*" (all fields). The attribute 'where' is the select condition for selecting the records. It is optional and its default value is "" (all the records). The attributes 'editable' and 'selectable' have default values of "false". In this case the 'dbTable' behaves just like 'table'. When 'editable' has a value "true", then the table is editable, i.e. its records can be added, deleted or modified. When 'selectable' has a value "true", then it is possible to select a record from the displayed ones. The fields of the selected record are declared as global template variables and can be used where they are needed. Since WebObject 'dbTable' behaves like 'table' when 'selectable' and 'editable' are "false", then there is no need to use 'table'. But it is simpler than 'dbTable' and it can be easier to modify and customize to fit the needs of a certain application. --- NEW FILE: folderListing.txt --- This box allows the browsing of a folder. It displays a list of subfolders and files that are contained in the folder. It also allows the user to browse the subfolders, to go to the parent folder, to select a file, etc. The files that are displayed are those that match a certain filter specified by the programmer. The variables ------------- The 'folderListing' box uses some state variables to keep its state. Some of these variables can be changed or can be used by the box (or application) that contains this web box. These variables are: * folderListing->root Contains the root folder. Should be initialized by the application the first time that the web box is rendered, and can be changed by the application at any time. * folderListing->fileFilter Contains an ereg expression that is used to filter the files that are displayed. Should be initialized by the application the first time that the web box is rendered. If it is not initialized by the application, then it has a default value of ".*" (filter nothing). * folderListing->currentPath Contains the path from the root to the current folder. * folderListing->selectedFile Contains the name of the last file that was selected (clicked). The events ---------- The 'folderListing' box raises some events and handles them internally. These events can be used as well by the box or the application that contains the 'folderListing'. These events are: * folderListing.folder(folder_name) Raised when a folder is clicked. The box handles this by displaying the selected folder. * folderListing.up() Raised when the link to the parent folder is clicked. The box displays the parent folder. * folderListing.file(file_name) Raised when a file is clicked. The box doesn't change its view. * folderListing.root() Raised when the link to the root folder is clicked. The box displays the root folder. * folderListing.path(path) Raised when the sensitive path is clicked. The box displays the selected folder. * folderListing.changeRoot(root_folder) Raised from outside the box (from the application that uses it). The box changes the root folder and displays it. How to Use this Box ------------------- Usually it can be used by including this line in the template that contains it: <Include SRC="{{#FOLDERLISTING_PATH}}folderListing.html" /> ({{#FOLDERLISTING_PATH}} is declared by the framework itself) In case that you want to change the layout of the webbox, then you should copy the folder 'web_app/boxes/folderListing' from the framework to some place in your application, then make changes to it and include it like this: <Include SRC="{{#folderListing_path}}folderListing.html" /> ({{#folderListing_path}} must be declared by your application) To change the layout of the webbox you can change the file 'folderListing.html' and the file 'folderListing.css'. --- NEW FILE: form.txt --- formWebObj is a webobject that makes easy the handling of big forms (which have many inputs) and their data connection to the database. It is used like this: when you have a webbox that has a big form, in the PHP code of the webbox you include the class 'formWebObj', and then inherit this class, instead of inheriting 'WebObject' ('formWebObj' itself extends 'WebObject', so this is OK). E.g.: <WebBox ID="editProject"> <form name="bigForm"> . . . . . . . . <!--# many <input>s, <select>s, etc. here #--> . . . . . . . . </form> </WebBox> ---------------------------------------------- <? include_once FORM_PATH."formWebObj.php"; class editProject extends formWebObj { . . . . . . . . . . } ?> ---------------------------------------------- <? class formWebObj extends WebObject { . . . . . . . . . . . } ?> Then, in the JS code of the webbox you can use these JS functions which have been declared and included by the 'formWebObj': getEventArgs(form); /** * Returns all the data in the inputs of the given form * so that they can be sent as event args, e.g. * GoTo("thisPage?event=editProject.save(" + getEventArgs(form) + ")"); */ saveFormData(form); /** * Transmit the data of the form, so that * the changed values are not lost. * Must be called before GoTo(). */ This is useful when the page is refreshed for some reason, but you don't want to lose the values that are inputed in it. There are also these two functions that are used internally by 'formWebObj', but you can use them as well, if you need them: function getFormData(form) //returns all the data filled in the given form function setFormData(form, formData) //fills the form with the given data --- NEW FILE: leftMenu.txt --- WebObject 'leftMenu' displays a menu, usually on the left side of the page. It is used like this: <Include SRC="{{#LEFTMENU_PATH}}leftMenu.html" /> <WebObject Class="leftMenu" Name="su" items="{{#./}}su_menu_items.php" /> The attribute 'items' is a PHP file that contains the items of the menu, like this: <? /** * The $menu_items array contains the items of the leftMenu. */ $menu_items = array( "item1" => " Menu Item 1 ", "item2" => " Menu Item 2 ", "item3" => " Menu Item 3 ", "etc1" => " . . . ", "etc2" => " . . . " ); ?> The item of the menu that is selected can be retrieved like this: $selected = WebApp::getSVar("leftMenu::su->selected_item"); If you need to change the look of the leftMenu, then make a local copy and modify 'leftMenu.css'. --- NEW FILE: listbox.txt --- The WebClass "listbox" is used to display a list of values with the <select> tag of HTML. These values are taken from a recordset (which can be retrieved from DB or can be supplied by PHP code. The recodset associated with the listbox must have two fields: 'id' and 'label'. 'label' is the field displayed, and 'id' is the value that is selected, saved in DB and retrieved from DB. Recordset example: <Recordset ID="listbox::country"> <Query> SELECT country_id AS id, country_name AS label FROM countries </Query> </Recordset> Usage example: <Include SRC="{{#LISTBOX_PATH}}listbox.html" /> <WebObject Class="listbox" Name="country" rs = "rs_id" onchange = "alert(this.options[this.selectedIndex].text)" width = "---------------" /> The attribute "rs" is optional. Its default value (if not specified) is {{#obj_id}} (in the example above, it would be 'listbox::country'). The attribute "onchange" (all lowercase), is optional and is used as the "onchange" attribute of the <select> tag. The attribute "width" is also optional; it is used as the last line of the list, in order to keep the width of the <select> to a certain size, and can also be used as a "nothing selected" (none of the above) value. This WebClass uses a <select> tag like this: <select name="{{#obj_name}}" onchange="{{#onchange}}"> . . . . . </select> So, this should be kept in mind when accessing the selected value and when giving an initial value. If the 'listbox' is used inside a 'formWebObj' webbox, then it takes care of it automatically. --- NEW FILE: table.txt --- WebObject 'table' is used to display the content of a table inside a page. It is used like this: <Include SRC="{{#TABLE_PATH}}table.html" /> <WebObject Class="table" Name="offices" table="offices" fields="off_id,name" where="off_id < 10" /> If attribute 'table' is the name of the table that will be displayed. If it is not specified, its default value is {{#obj_name}} (the value of attribute 'Name'). The attribute 'fields' is the list of fields that will be displayed. It is optional and its default value is "*" (all fields). The attribute 'where' is the select condition for selecting the records. It is optional and its default value is "" (all the records). --- NEW FILE: tabs.txt --- WebObject 'tabs1' displays a horizontal menu. It is used like this: <Include SRC="{{#WEBOBJ_PATH}}tabs/tabs1.html" /> <WebObject Class="tabs1" Name="su" items="{{#./}}su_menu_items.php" /> The attribute 'items' is a PHP file that contains the items of the menu, like this: <? /** * The $menu_items array contains the items of the tabs1. */ $menu_items = array( "item1" => " Menu Item 1 ", "item2" => " Menu Item 2 ", "item3" => " Menu Item 3 ", "etc1" => " . . . ", "etc2" => " . . . " ); ?> The item of the menu that is selected can be retrieved like this: $selected = WebApp::getSVar("tabs1::su->selected_item"); If you need to change the look of the tabs1, then make a local copy and modify 'tabs1.css'. WebObject 'tabs2' is very similar to 'tabs1', but the styles are different. It has a tab-like view. WebObject 'tabs3' is very similar to 'tabs2', but it is vertical instead of horizontal. It usually stays on the left of the page. ToDo: It is better to have just one WebClass: 'tabs', and then add another attribute, 'style', which will determine the style of the tabs (horizontal, vertical, etc.). --- NEW FILE: xlistbox.txt --- 'xlistbox' is a multiple listbox (or extended listbox, or hierarchical list) webclass. It consists of several listboxes that depend on each-other hierarchically, so that when the selection changes in one of them, the content of the list that depends on it is refreshed to reflect the change. It is used like this: <WebObject Class="xlistbox" Name="office" mainlist="true" sublist="department" onchange="alert(this.options[this.slectedIndex].text)" /> <WebObject Class="xlistbox" Name="department" sublist="users" onchange="alert(this.options[this.slectedIndex].text)" /> <WebObject Class="xlistbox" Name="user" onchange="alert(this.options[this.slectedIndex].text)" /> The 'mainlist' attribute, when it is true, tells that this is the first list in the group and it is not dependent of any other list. Its default value is 'false'. The 'sublist' attribute tells which is the list that depends on this one, i.e. the list that is refreshed when the selection of this list is changed. The last list of the group has no 'sublist' attribute. The 'onchange' attribute contains the JS code that should be executed when the content of the list changes. It is optional (can be ommitted). Each xlistbox is connected with a recordset whith ID "xlistbox::obj_name". The fields of these recordsets are (id, label) for the main xlistbox of the group, and (master_id, id, label) for the other lists of the group. E.g.: <Recordset ID="xlistbox::office"> <Query> SELECT off_id AS id, name AS label FROM offices </Query> </Recordset> <Recordset ID="xlistbox::department"> <Query> SELECT off_id AS master_id, dept_id AS id, name AS label FROM departments </Query> </Recordset> <Recordset ID="xlistbox::user"> <Query> SELECT department AS master_id, user_id AS id, username AS label FROM users </Query> </Recordset> 'master_id' must be the same as the 'id' of the list above. When the selection of the list above is changed, then the list is refilled with all the items of the recordset that have master_id equal to the selected id of the list above. There can be any number of lists in a group. It is limited only by performance reasons, e.g. if there are 4 or 5 lists in a group, then the size of the data that is retrived from DB and immbeded in JS code may be too big and it may increase the size of the page. When there is only the main list, it behaves just like a 'listbox', and in this case it would be better to use a 'listbox' object instead of a 'xlistbox' object, since it is more efficient. If you want to init the lists with some values, you can add this JS code after the </form> is closed: <script language="javascript"> var form = document.userdata; xlistbox_select(form.office, '{{#office}}'); fill_sublist(form.department, '{{#office}}', '{{#department}}'); fill_sublist(form.user, '{{#department}}', '{{#user}}'); </script> The mainlist usually doesn't need to be initialized, because it is initialized itself, but if it doesn't then it can be initialized using: xlistbox_select(mainlist, id). The sublists can be initialized using: fill_sublist(sublist, master_id, id). Note: saveFormData() (of a 'formWebObj' webbox) doesn't work very well with 'xlistbox' webobjects. Usually it collects all the data of the form, transmits them and then redistributes them in the form, so that they are not lost, even though they are not saved in DB. For 'xlistbox' webobjects it can save and redisplay only the value of the mainlist. |
From: Dashamir H. <das...@us...> - 2003-02-23 14:42:43
|
Update of /cvsroot/phpwebapp/documentation/templates/tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv20867/templates/tutorial Added Files: documentation.html Log Message: --- NEW FILE: documentation.html --- <h3>8 - How This Web Application is Constructed</h3> This web application (the 'phpWebApp documentation') is built using phpWebApp itself. This tutorial explains how this web application is constructed. <br><br> [<a href="javascript: alert('Sorry! Not implemented yet.')">Test</a>] [<a href="javascript: alert('Sorry! Not implemented yet.')">Browse</a>] <br><br> <hr> <br> <ul> <li> <li> <li> </ul> |
From: Dashamir H. <das...@us...> - 2003-02-23 14:37:07
|
Update of /cvsroot/phpwebapp/documentation/webobjects/displaytxt In directory sc8-pr-cvs1:/tmp/cvs-serv17266/displaytxt Log Message: Directory /cvsroot/phpwebapp/documentation/webobjects/displaytxt added to the repository |
From: Dashamir H. <das...@us...> - 2003-02-23 14:35:01
|
Update of /cvsroot/phpwebapp/documentation/templates/webobjects/pages In directory sc8-pr-cvs1:/tmp/cvs-serv16084/pages Log Message: Directory /cvsroot/phpwebapp/documentation/templates/webobjects/pages added to the repository |
From: Dashamir H. <das...@us...> - 2003-02-23 14:33:12
|
Update of /cvsroot/phpwebapp/documentation/templates/user_manual/manual_pages In directory sc8-pr-cvs1:/tmp/cvs-serv14671 Added Files: misc.txt recordset.txt webclass.txt Removed Files: boxes.txt Log Message: --- NEW FILE: misc.txt --- -------- constructing an HTML page ----------- * - WebApp::getHtmlPage($tpl) Constructs the page given as a parameter and returns it as an HTML string. It saves whatever is constructed in the current page and then resumes it again after constructing the requested page, so it can be called from anywhere in the application, e.g. from an event handler. This function is usefull when you want to construct a page for sending it by e-mail. -------- external link to an application page ----------- * - The function WebApp::external_page() returns a link that can be used to jump to this page of the application from any external page. Also the constant "SHOW_EXTERNAL_LINK", which is defined in 'config/const.Settings.php' makes possible to display the external link to the end of the page. The external links are useful e.g. for generating an index page for search engines, so that they can access and index the content pages of the application. * - The framework defies a constant UNDEFINED (which has the value "UNDEFINED" or something else) and is used in the framework and in the application whenever a variable has no value. E.g. if the function WebApp::getWBox("wb_id") returns UNDEFINED, it means that such a webbox does not exist in the application, or if the function Recordset::Field($fld_name) returns UNDEFINED, it means that such a field does not exist or it has no value, etc. ------------------- WebApp::message() --------------------------- * - The function: WebApp::message("msg") can be used in PHP code to display a message to the user after the page is loaded in browser. This can be used to display an error message, e.g. "Wrong username or password", or an information message, e.g. "Project Data Saved". * - The function: WebApp::debug_msg($msg, $comment); is added to the framework. It makes the framework to display the given message after the page is rendered. The comment is optional. You can also print a debug message like this: print "$comment: $msg<br>\n"; but the output of this statement may be mixed with the HTML code and sometimes it may break the page, so the first method is safer and cleaner. The message $msg can be a large message that contains tags, e.g. WebApp::debug_msg($tpl->toHtmlTable()); WebApp::debug_msg($rs->toHtmlTable(), "The content of recordset"); WebApp::debug_msg($tplVars->toHtmlTable(), "The content of varstack at this point"); WebApp::debug_msg($webPage->template_list(), "All the templates parsed up to this point"); etc. ----------------------------------------------------------------- * $webPage->append_to_head($line); $webPage->append_to_body($line); These functions can be used to add more lines to the content of the <head> and <body> elements of a web page. The first one (that appends to <head>) cannot be used inside onRender(), because the <head> of the page has been already sent to the browser. ----------------------------------------------------------------- -------------------------------------------------------------------- * - define("VAR_NOT_FOUND", "{var_name}"); is added to 'config/const.Settings.php' This constant sets the format of the error message that is displayed when a {{variable}} is not found. 'var_name' is replaced by the actual variable name. Examples: "'var_name' is not defined", "", "undefined", etc. It cannot contain "{{var_name}}" inside. ---------------- NULL values ----------------------------------------- * - For a DB value that was NULL, the framework used to return UNDEFINED and, as a result, in the page was displayed {var_name}. Now, the constant NULL_VALUE is returned, which can be specified in the file 'config/const.Settings.php'. It can be "", "NULL", NULL, etc. -------------------------------------------------------------------- * - config/const.Debug.php: define("SHOW_ERROR_MESSAGES", true); If this constant is 'false' than the framework suppresses all the error and warning messages (that are generated by the framework). Usually it should be 'true' during the development and should be switched to 'false' when the application is deployed, in order not to confuse the users of the application with error messages that have no meaning for them. -------------------------------------------------------------------- * - define("DISPLAY_CGI_VARS", false); (at 'config/const.Options.php') When this constant is true, then the CGI vars are displayed at the URL window of the browser. See also SHOW_EXTERNAL_LINK at const.Debug.php. --- NEW FILE: recordset.txt --- recordset.txt --- NEW FILE: webclass.txt --- webclass.txt --- boxes.txt DELETED --- |
From: Dashamir H. <das...@us...> - 2003-02-23 14:29:13
|
Update of /cvsroot/phpwebapp/documentation In directory sc8-pr-cvs1:/tmp/cvs-serv11335 Modified Files: ToDo.txt browse.php Log Message: Index: ToDo.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/ToDo.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ToDo.txt 21 Feb 2003 08:18:22 -0000 1.1.1.1 --- ToDo.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 7,12 **** edhe nje tools per ta castomizuar. - * Hidh ne CVS-ne lokale documentation dhe sample applications. - * Rregullo formatin e komenteve gjenero dokumentacionin me phpDocumentor. --- 7,10 ---- Index: browse.php =================================================================== RCS file: /cvsroot/phpwebapp/documentation/browse.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** browse.php 21 Feb 2003 08:18:22 -0000 1.1.1.1 --- browse.php 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 1,4 **** <?php ! include "application.php"; WebApp::addVar("APP_STYLE", APP_URL."templates/styles.css"); WebApp::constructHtmlPage(BROWSER_PATH."fileBrowser.html"); --- 1,4 ---- <?php ! include "webapp.php"; WebApp::addVar("APP_STYLE", APP_URL."templates/styles.css"); WebApp::constructHtmlPage(BROWSER_PATH."fileBrowser.html"); |
From: Dashamir H. <das...@us...> - 2003-02-23 14:29:13
|
Update of /cvsroot/phpwebapp/documentation/templates In directory sc8-pr-cvs1:/tmp/cvs-serv11335/templates Modified Files: about.html bismilah.html main.html mainMenu_items.php styles.css Log Message: Index: about.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/about.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** about.html 21 Feb 2003 08:18:24 -0000 1.1.1.1 --- about.html 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 1,11 **** - <HTML> - <HEAD> - <TITLE></TITLE> - </HEAD> - <BODY> <br> <h3>What is phpWebApp</h3> <p> ! <b>phpWebApp</b> <i>(v:2003-01)</i> is an application framework which makes easy and simple the task of building PHP web applications based on relational databases. It separates the task of designing and changing the --- 1,6 ---- <br> <h3>What is phpWebApp</h3> <p> ! <b>phpWebApp</b> is an application framework which makes easy and simple the task of building PHP web applications based on relational databases. It separates the task of designing and changing the *************** *** 104,149 **** <h3>Related Links</h3> <ul> ! <li> <a href="http://sourceforge.net" target="_new"> SourceForge.net ! </a> ! <li> <a href="http://sourceforge.net/projects/phpwebapp/" target="_new"> ! phpWebApp Project</a> at SourceForge ! <li> <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpwebapp/" target="_new"> Browse the CVS</a> at SourceForge ! <li> <a href="/documentation/browse.php" target="_new"> Browse the Documentation templates </a> ! <li> <a href="/app1/" target="_new"> Sample Application 1 </a> ! <li> <a href="/app1/browse.php" target="_new"> Browse the Sample Application templates </a> </ul> ! <h3>License</h3> ! <p> ! The <b>phpWebApp</b> <i>(v:2003-01)</i> framework is ! <a href="http://www.fsf.org/">free software</a>. ! It is distributed under the terms of the ! <a href="http://www.fsf.org/copyleft/">GNU GPL(General Public License)</a>. ! </p> <p> ! Copyright (C) 2003 Dashamir Hoxha, <a href="mailto:das...@us...">das...@us...</a> - </p> <p> ! Why GNU GPL? Explain here. </p> <p> ! Here add a link to the previous release of the framework, which was ! distributed under GNU LGPL(Lesser General Public Licence). Explain why ! the licence was changed (if it is not explained in the above paragraph). </p> - <h3>Changes</h3> <p> ! Some of the main changes and improvments that phpWebApp v:2003-01 has ! over the previous release, are these: ! <ul> ! <li>. . .</li> ! <li>. . .</li> ! <li>. . .</li> ! </ul> </p> - <br> - </BODY> - </HTML> --- 99,138 ---- <h3>Related Links</h3> <ul> ! <li> <a href="http://sourceforge.net/projects/phpwebapp/" target="_blank"> ! phpWebApp Project</a> at ! <a href="http://sourceforge.net" target="_blank">SourceForge.net</a> ! <li> <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpwebapp/" target="_blank"> Browse the CVS</a> at SourceForge ! <li> <a href="{{APP_URL}}browse.php" target="_blank"> Browse the Documentation templates </a> ! <li> <a href="{{APP1_URL}}" target="_blank"> Sample Application 1 </a> ! <li> <a href="{{APP1_URL}}browse.php" target="_blank"> Browse the Sample Application templates </a> + <li> The <a href="http://phpwebapp.sourceforge.net/lgpl/documentation/">LGPL version</a> + of phpWebApp is still available, <br>but it is old and unsupported. </ul> ! <h3>Copying</h3> <p> ! Copyright 2001, 2002, 2003 Dashamir Hoxha, <a href="mailto:das...@us...">das...@us...</a> <p> ! phpWebApp is <a href="http://www.fsf.org/philosophy/" target="_blank">free software</a>; ! you can redistribute it and/or modify it under the terms of the ! <a href="http://www.fsf.org/copyleft/" target="_blank">GNU General Public License</a> ! as published by the ! <a href="http://www.fsf.org/" target="_blank">Free Software Foundation</a>; either ! version 2 of the License, or (at your option) any later version. </p> <p> ! phpWebApp is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! <a href="{{WEBAPP_URL}}COPYING" target="_blank">GNU General Public License</a> ! for more details. </p> <p> ! You should have received ! <a href="{{WEBAPP_URL}}COPYING" target="_blank">a copy of the GNU General Public License</a> ! along with phpWebApp; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA </p> Index: bismilah.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/bismilah.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** bismilah.html 21 Feb 2003 08:18:24 -0000 1.1.1.1 --- bismilah.html 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 1,12 **** <table cellspacing="0" cellpadding="0"> ! <tr><td> ! <a href="http://www.harunyahya.com/A_tr.php" target="_new"> <img src="{{GRAPHICS}}bismilah.gif" border="0" alt="Bismillahir-Rahmanir-Rahim"> </a> </td></tr> ! <tr><td> <font size="1">Bismillahir-Rahmanir-Rahim</font> </td></tr> ! <tr><td nowrap="true"> <font size="1">In the name of God, the Compassionate, the Merciful</font> </td></tr> --- 1,12 ---- <table cellspacing="0" cellpadding="0"> ! <tr><td align="right"> ! <a href="http://www.harunyahya.com/A_tr.php" target="_blank"> <img src="{{GRAPHICS}}bismilah.gif" border="0" alt="Bismillahir-Rahmanir-Rahim"> </a> </td></tr> ! <tr><td align="right"> <font size="1">Bismillahir-Rahmanir-Rahim</font> </td></tr> ! <tr><td align="right" nowrap="true"> <font size="1">In the name of God, the Compassionate, the Merciful</font> </td></tr> Index: main.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/main.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** main.html 21 Feb 2003 08:18:24 -0000 1.1.1.1 --- main.html 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 9,19 **** <table width="100%" align="center" cellspacing="0" cellpadding="0" border="0"> <tr> - <td width="1%" align="left" valign="top" nowrap> - <Include SRC="{{./}}bismilah.html" /> - </td> - <td align="center"><h3>phpWebApp Documentation</h3></td> <td width="1%" align="right" valign="top"> <img src="http://sourceforge.net/sflogo.php?group_id=41147" width="88" height="31" border="0" alt="SourceForge Logo"> </td> </tr> </table> --- 9,19 ---- <table width="100%" align="center" cellspacing="0" cellpadding="0" border="0"> <tr> <td width="1%" align="right" valign="top"> <img src="http://sourceforge.net/sflogo.php?group_id=41147" width="88" height="31" border="0" alt="SourceForge Logo"> </td> + <td align="center"><h3>phpWebApp Documentation</h3></td> + <td width="1%" align="left" valign="top" nowrap> + <Include SRC="{{./}}bismilah.html" /> + </td> </tr> </table> *************** *** 21,25 **** <table width="100%" align="center" cellspacing="0" cellpadding="0" border="0"> <tr><td> ! <Include SRC="{{WOBJ_PATH}}tabs1/tabs1.html"> <WebObject Class="tabs1" Name="mainMenu" items="{{./}}mainMenu_items.php" /> --- 21,25 ---- <table width="100%" align="center" cellspacing="0" cellpadding="0" border="0"> <tr><td> ! <Include SRC="{{WEBOBJ_PATH}}tabs/tabs1.html"> <WebObject Class="tabs1" Name="mainMenu" items="{{./}}mainMenu_items.php" /> Index: mainMenu_items.php =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/mainMenu_items.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** mainMenu_items.php 21 Feb 2003 08:18:24 -0000 1.1.1.1 --- mainMenu_items.php 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 7,12 **** "tutorial" => "Tutorial", "user_manual" => "User Manual", ! "developer_docs"=> "Developer Docs", ! "webobjects" => "Web Objects" ); ?> --- 7,12 ---- "tutorial" => "Tutorial", "user_manual" => "User Manual", ! "webobjects" => "Web Objects", ! "developer_docs"=> "Developer Docs" ); ?> Index: styles.css =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/styles.css,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** styles.css 21 Feb 2003 08:18:23 -0000 1.1.1.1 --- styles.css 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 1,5 **** body { ! background-color:#FFEEFF; margin-top:5px; margin-left:5px; --- 1,5 ---- body { ! background-color:#FFFFFF; margin-top:5px; margin-left:5px; |
From: Dashamir H. <das...@us...> - 2003-02-23 14:29:13
|
Update of /cvsroot/phpwebapp/documentation/templates/tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv11335/templates/tutorial Modified Files: intro.html templates.html transitions.html tutorial_items.php Log Message: Index: intro.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/tutorial/intro.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** intro.html 21 Feb 2003 08:18:36 -0000 1.1.1.1 --- intro.html 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 17,115 **** <br> <table width="100%" align="center" cellspacing="0" cellpadding="20" border="0"> ! <tr> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('transitions')">1 - Transitions</a></b> ! <br> ! A very simple application that has 2 or 3 HTML files ! which have transitions to each-other and have some ! links to external pages. ! Explains the folder structure of a simple application, ! explains what are the transitions and the difference ! between the transitions and the links. Explains how to ! debug transitions. ! </td> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('templates')">2 - Templates</a></b> ! <br> ! The HTML files now become templates. This application ! uses the <Include> tag to insert the same header file ! at the beginning of each template and to break the ! templates into sub templates. It shows how to include ! the javascript code and the stylesheet of each template. ! It also explains the use of the framework comments and ! the difference between them and the HTML comments. ! Explains how to debug the template structure. ! </td> ! </tr> ! <tr> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('weboxes')">3 - Introducing WebBox-es</a></b> ! <br> ! Some of the templates are turned into weboxes. ! Explains the fundamental difference between a template ! and a webox. The PHP code of the weboxes ! declares the function onRender(), where some variables ! are added using WebApp::addVar(), and these {{variables}} ! are used in the corresponding template. ! </td> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('events')">4 - Sending and Handelling Events</a></b> ! <br> ! Some of the transitions send ! events to some of the weboxes. The target weboxes handle ! these events in their eventHandler() functions. Explains also ! the transitions to 'thisPage', sending an event to 'any' webox, ! and sending events to 'none' of the weboxes (independent events). ! </td> ! </tr> ! <tr> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('sess_var')">5 - Session and Variables</a></b> ! <br> ! Explains what are the session variables and how to use them. ! Explains further how the {{template variables}} are evaluated. ! Explains how the session variables are used to keep the state ! of the weboxes and the states of the application (introduces ! the function onLoad() of the weboxes). Explains how the <If> ! elements are used to display templates conditionally. ! Explains how to debug the session variables. ! </td> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('database')">6 - Interacting with a Database</a></b> ! <br> ! Explains how to set a default connection with a database. ! Explains the configuration file of a template (*.tpc) and ! the <Recordset> element. Explains the <Repeat> elements and ! how to use them inside a template. Explains the '.db' file ! of a webox, the <Recordset> and <dbCommand> elements inside it, ! and how to use the functions WebApp::execDBCmd(), WebApp::openRS() ! and WebApp::execQuery() inside the PHP code of the webox. ! Explains how to debug the recordsets of the page and the execution ! times of the queries (and other processes). ! </td> ! </tr> ! <tr> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('advanced')">7 - All the rest of the advanced features</a></b> ! <br> ! A complicated, real and almost finished web application (which ! may evolve from the previous samples or may be independent of ! them), which makes use and explains almost all of the advanced ! features of framework which have not been explained in the ! previous samples. Such features may be: ! <ul> ! <li> Detailed explanation of the <Repeat> element and the page ! recordsets. ! <li> <Var> elements ! <li> An <Include> element that uses a variable. ! <li> Usage of an external webox. ! <li> Etc. ! </ul> ! </td> ! <td width="50%" valign="top"> ! <b>8 - _____</b> ! <br> ! </td> ! </tr> </table> --- 17,118 ---- <br> <table width="100%" align="center" cellspacing="0" cellpadding="20" border="0"> ! <tr> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('transitions')">1 - Transitions</a></b> ! <br> ! A very simple application that has 2 or 3 HTML files ! which have transitions to each-other and have some ! links to external pages. ! Explains the folder structure of a simple application, ! explains what are the transitions and the difference ! between the transitions and the links. Explains how to ! debug transitions. ! </td> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('templates')">2 - Templates</a></b> ! <br> ! The HTML files now become templates. This application ! uses the <Include> tag to insert the same header file ! at the beginning of each template and to break the ! templates into sub templates. It shows how to include ! the javascript code and the stylesheet of each template. ! It also explains the use of the framework comments and ! the difference between them and the HTML comments. ! Explains how to debug the template structure. ! </td> ! </tr> ! <tr> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('weboxes')">3 - Introducing WebBox-es</a></b> ! <br> ! Some of the templates are turned into weboxes. ! Explains the fundamental difference between a template ! and a webox. The PHP code of the weboxes ! declares the function onRender(), where some variables ! are added using WebApp::addVar(), and these {{variables}} ! are used in the corresponding template. ! </td> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('events')">4 - Sending and Handelling Events</a></b> ! <br> ! Some of the transitions send ! events to some of the weboxes. The target weboxes handle ! these events in their eventHandler() functions. Explains also ! the transitions to 'thisPage', sending an event to 'any' webox, ! and sending events to 'none' of the weboxes (independent events). ! </td> ! </tr> ! <tr> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('sess_var')">5 - Session and Variables</a></b> ! <br> ! Explains what are the session variables and how to use them. ! Explains further how the {{template variables}} are evaluated. ! Explains how the session variables are used to keep the state ! of the weboxes and the states of the application (introduces ! the function onLoad() of the weboxes). Explains how the <If> ! elements are used to display templates conditionally. ! Explains how to debug the session variables. ! </td> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('database')">6 - Interacting with a Database</a></b> ! <br> ! Explains how to set a default connection with a database. ! Explains the configuration file of a template (*.tpc) and ! the <Recordset> element. Explains the <Repeat> elements and ! how to use them inside a template. Explains the '.db' file ! of a webox, the <Recordset> and <dbCommand> elements inside it, ! and how to use the functions WebApp::execDBCmd(), WebApp::openRS() ! and WebApp::execQuery() inside the PHP code of the webox. ! Explains how to debug the recordsets of the page and the execution ! times of the queries (and other processes). ! </td> ! </tr> ! <tr> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('advanced')">7 - All the rest of the advanced features</a></b> ! <br> ! A complicated, real and almost finished web application (which ! may evolve from the previous samples or may be independent of ! them), which makes use and explains almost all of the advanced ! features of framework which have not been explained in the ! previous samples. Such features may be: ! <ul> ! <li> Detailed explanation of the <Repeat> element and the page ! recordsets. ! <li> <Var> elements ! <li> An <Include> element that uses a variable. ! <li> Usage of an external webox. ! <li> Etc. ! </ul> ! </td> ! <td width="50%" valign="top"> ! <b><a href="javascript: tutorialTab('documentation')">8 - The documentation application</a></b> ! <br> ! This web application (the 'phpWebApp documentation') is built ! using phpWebApp itself. This tutorial explains how this ! web application is constructed. ! </td> ! </tr> </table> Index: templates.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/tutorial/templates.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** templates.html 21 Feb 2003 08:18:36 -0000 1.1.1.1 --- templates.html 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 10,15 **** Explains how to debug the template structure. <br><br> ! [<a href="/app2/" target="_new">Test</a>] ! [<a href="/app2/browse.php" target="_new">Browse</a>] [<a href="http://phpwebapp.sourceforge.net/download/app2.tar.gz">Download</a>] <br><br> --- 10,15 ---- Explains how to debug the template structure. <br><br> ! [<a href="{{APP2_URL}}" target="_blank">Test</a>] ! [<a href="{{APP2_URL}}browse.php" target="_blank">Browse</a>] [<a href="http://phpwebapp.sourceforge.net/download/app2.tar.gz">Download</a>] <br><br> *************** *** 55,69 **** The templates may contain variables inside them (called "template variables"), which are replaced by the framework with their string values. The variables ! inside a template are denoted by double curly braces: <i>{ {tpl_var} }</i>. </p> <p> See this <a href="javascript: codeReview('{{APP2_PATH}}templates/page3/page3.html','4,8,10,12','')">example</a>. ! The <i>{ {TPL_URL} }</i> variable in line 4 contains the URL of the folder ! 'templates', which in this case is '/app2/templates/'. The <i>{ {TPL_PATH} }</i> variable in lines 8 and 12 contains the path in the server of the folder ! templates, e.g. '/var/www/html/app2/templates/'. Both of them are declared in the file <a href="javascript: codeReview('{{APP2_PATH}}config/const.Paths.php','6,7','')"><i>config/const.Paths.php</i></a>. ! The variable <i>{ {./} }</i> in line 10 is a special framework variable that always contains the path of the current folder, i.e. the folder of the current file. --- 55,69 ---- The templates may contain variables inside them (called "template variables"), which are replaced by the framework with their string values. The variables ! inside a template are denoted by double curly braces: <i>{{#tpl_var}}</i>. </p> <p> See this <a href="javascript: codeReview('{{APP2_PATH}}templates/page3/page3.html','4,8,10,12','')">example</a>. ! The <i>{{#TPL_URL}}</i> variable in line 4 contains the URL of the folder ! 'templates', which in this case is '{{APP2_URL}}templates/'. The <i>{{#TPL_PATH}}</i> variable in lines 8 and 12 contains the path in the server of the folder ! templates, e.g. '/var/www/html{{APP2_URL}}templates/'. Both of them are declared in the file <a href="javascript: codeReview('{{APP2_PATH}}config/const.Paths.php','6,7','')"><i>config/const.Paths.php</i></a>. ! The variable <i>{{#./}}</i> in line 10 is a special framework variable that always contains the path of the current folder, i.e. the folder of the current file. *************** *** 159,165 **** <li> All the images of this application are placed in the folder '/img/'. ! In templates they are linked using the { {IMG_URL} } variable. <a href="javascript: codeReview('{{APP2_PATH}}templates/footer.html','9,10','')">See</a> how it is used. ! The { {IMG_URL} } template variable gets the value from the PHP constant IMG_URL, which is declared in the file <a href="javascript: codeReview('{{APP2_PATH}}config/const.Paths.php','6','')"><i>config/const.Paths.php</i></a>. --- 159,165 ---- <li> All the images of this application are placed in the folder '/img/'. ! In templates they are linked using the {{#IMG_URL}} variable. <a href="javascript: codeReview('{{APP2_PATH}}templates/footer.html','9,10','')">See</a> how it is used. ! The {{#IMG_URL}} template variable gets the value from the PHP constant IMG_URL, which is declared in the file <a href="javascript: codeReview('{{APP2_PATH}}config/const.Paths.php','6','')"><i>config/const.Paths.php</i></a>. *************** *** 183,187 **** <br><br> ! <li> <a href="/app2/browse.php" target="_blank">Browse</a> the files of the application and see the templates 'page1.html', 'header.html', 'footer.html', 'page1_content.html'. --- 183,187 ---- <br><br> ! <li> <a href="{{APP2_URL}}browse.php" target="_blank">Browse</a> the files of the application and see the templates 'page1.html', 'header.html', 'footer.html', 'page1_content.html'. *************** *** 262,266 **** If all the images in the application are linked like this: <pre> ! <img src="{ {IMG_URL} }image_name.gif"/> </pre> there will be no problem. However, if any image is hard linked like this: --- 262,266 ---- If all the images in the application are linked like this: <pre> ! <img src="{{#IMG_URL}}image_name.gif"/> </pre> there will be no problem. However, if any image is hard linked like this: *************** *** 283,287 **** <li> Replace the selected lines with this line: <pre> ! <Include SRC="{ {./} }tpl_vars.html"/> </pre> <li> Copy the --- 283,287 ---- <li> Replace the selected lines with this line: <pre> ! <Include SRC="{{#./}}tpl_vars.html"/> </pre> <li> Copy the *************** *** 290,294 **** them with: <pre> ! <Include SRC="{ {./} }include_tag.html"/> </pre> <li> Copy the --- 290,294 ---- them with: <pre> ! <Include SRC="{{#./}}include_tag.html"/> </pre> <li> Copy the *************** *** 297,301 **** them with: <pre> ! <Include SRC="{ {./} }comments.html"/> </pre> <li> Copy the --- 297,301 ---- them with: <pre> ! <Include SRC="{{#./}}comments.html"/> </pre> <li> Copy the *************** *** 304,308 **** them with: <pre> ! <Include SRC="{ {./} }js_code.html"/> </pre> <li> If you test the application now, page1 will be displayed correctly, --- 304,308 ---- them with: <pre> ! <Include SRC="{{#./}}js_code.html"/> </pre> <li> If you test the application now, page1 will be displayed correctly, *************** *** 336,341 **** stylesheet and the header and footer templates. Open the file <a href="javascript: codeReview('{{APP2_PATH}}templates/page1.html','4,8,10','')">page1/page1.html</a> ! and replace <i>{ {./} }</i> with <i>{ {TPL_URL} }</i> for the ! stylesheet, and with <i>{ {TPL_PATH} }</i> for the templates, in the selected lines. </ol> --- 336,341 ---- stylesheet and the header and footer templates. Open the file <a href="javascript: codeReview('{{APP2_PATH}}templates/page1.html','4,8,10','')">page1/page1.html</a> ! and replace <i>{{#./}}</i> with <i>{{#TPL_URL}}</i> for the ! stylesheet, and with <i>{{#TPL_PATH}}</i> for the templates, in the selected lines. </ol> *************** *** 357,361 **** <li> At the top of the file 'page1_content.html' add this line: <pre> ! <link rel="stylesheet" type="text/css" href="{ {./} }page1_content.css"> </pre> <li> Test the application and notice the changes in page1. --- 357,361 ---- <li> At the top of the file 'page1_content.html' add this line: <pre> ! <link rel="stylesheet" type="text/css" href="{{#./}}page1_content.css"> </pre> <li> Test the application and notice the changes in page1. *************** *** 378,382 **** <a href="javascript: codeReview('{{APP2_PATH}}templates/page3/tmpl.html','11','')">tmpl.html</a> and change the SRC of the included template to ! "{ {./} }tpl_2/tpl_2.html". <li> Test the application and go to page3. It should be displayed correctly. </ol> --- 378,382 ---- <a href="javascript: codeReview('{{APP2_PATH}}templates/page3/tmpl.html','11','')">tmpl.html</a> and change the SRC of the included template to ! "{{#./}}tpl_2/tpl_2.html". <li> Test the application and go to page3. It should be displayed correctly. </ol> Index: transitions.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/tutorial/transitions.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** transitions.html 21 Feb 2003 08:18:36 -0000 1.1.1.1 --- transitions.html 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 9,14 **** debug transitions. <br><br> ! [<a href="/app1/" target="_new">Test</a>] ! [<a href="/app1/browse.php" target="_new">Browse</a>] [<a href="http://phpwebapp.sourceforge.net/download/app1.tar.gz">Download</a>] <br><br> --- 9,14 ---- debug transitions. <br><br> ! [<a href="{{APP1_URL}}" target="_blank">Test</a>] ! [<a href="{{APP1_URL}}browse.php" target="_blank">Browse</a>] [<a href="http://phpwebapp.sourceforge.net/download/app1.tar.gz">Download</a>] <br><br> *************** *** 61,65 **** <br> If you have not tested the application yet, please ! <a href="/app1/" target="_new">test it</a> now and pay attention to how the <b>GoTo()</b> is used. </p> --- 61,65 ---- <br> If you have not tested the application yet, please ! <a href="{{APP1_URL}}" target="_blank">test it</a> now and pay attention to how the <b>GoTo()</b> is used. </p> *************** *** 107,111 **** <p> If you have not yet browsed the application, then ! <a href="/app1/browse.php" target="_new">browse it</a> now. </p> <p> --- 107,111 ---- <p> If you have not yet browsed the application, then ! <a href="{{APP1_URL}}browse.php" target="_blank">browse it</a> now. </p> <p> Index: tutorial_items.php =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/tutorial/tutorial_items.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tutorial_items.php 21 Feb 2003 08:18:36 -0000 1.1.1.1 --- tutorial_items.php 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 5,16 **** */ $menu_items = array( ! "intro" => "Introduction", ! "transitions" => "1-Transitions", ! "templates" => "2-Templates", ! "weboxes" => "3-WebBox-es", ! "events" => "4-Events", ! "sess_var" => "5-Session and Variables", ! "database" => "6-Database", ! "advanced" => "7-Advanced" ); ?> --- 5,17 ---- */ $menu_items = array( ! "intro" => "0 - Introduction", ! "transitions" => "1 - Transitions", ! "templates" => "2 - Templates", ! "weboxes" => "3 - WebBox-es", ! "events" => "4 - Events", ! "sess_var" => "5 - Session and Variables", ! "database" => "6 - Database", ! "advanced" => "7 - Advanced", ! "documentation" => "8 - Documentation" ); ?> |
From: Dashamir H. <das...@us...> - 2003-02-23 14:29:13
|
Update of /cvsroot/phpwebapp/documentation/templates/webobjects In directory sc8-pr-cvs1:/tmp/cvs-serv11335/templates/webobjects Modified Files: webobj_items.php webobjects.html wobj_page.php Log Message: Index: webobj_items.php =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/webobjects/webobj_items.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** webobj_items.php 21 Feb 2003 08:18:36 -0000 1.1.1.1 --- webobj_items.php 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 5,17 **** */ $menu_items = array( - "intro" => "intro", "tabs" => "tabs", ! "leftMenu" => "leftMenu", "form" => "form", "datebox" => "datebox", - "listbox" => "listbox", - "xlistbox" => "xlistbox", "table" => "table", "dbTable" => "dbTable", ); ?> --- 5,17 ---- */ $menu_items = array( "tabs" => "tabs", ! "browse" => "fileBrowser", ! "folderListing" => "folderListing", "form" => "form", "datebox" => "datebox", "table" => "table", "dbTable" => "dbTable", + "listbox" => "listbox", + "xlistbox" => "xlistbox" ); ?> Index: webobjects.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/webobjects/webobjects.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** webobjects.html 21 Feb 2003 08:18:36 -0000 1.1.1.1 --- webobjects.html 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 6,14 **** <tr> <td> ! <Include SRC="{{WOBJ_PATH}}tabs2/tabs2.html" /> <WebObject Class="tabs2" Name="webobj" items="{{./}}webobj_items.php" /> <WebBox ID="wobj_page"> ! <Include SRC="{{CODEVIEWER_PATH}}codeViewer.html" /> </WebBox> </td> --- 6,14 ---- <tr> <td> ! <Include SRC="{{WEBOBJ_PATH}}tabs/tabs2.html" /> <WebObject Class="tabs2" Name="webobj" items="{{./}}webobj_items.php" /> <WebBox ID="wobj_page"> ! <Include SRC="{{WOBJ_PATH}}displaytxt/displaytxt.html" /> </WebBox> </td> Index: wobj_page.php =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/webobjects/wobj_page.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** wobj_page.php 21 Feb 2003 08:18:36 -0000 1.1.1.1 --- wobj_page.php 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 5,10 **** { $webobj = WebApp::getSVar("tabs2::webobj->selected_item"); ! $file = WEBOBJ_PATH.$webobj.'/'.$webobj.'.txt'; ! WebApp::setSVar("codeViewer->codeFile", $file); } } --- 5,10 ---- { $webobj = WebApp::getSVar("tabs2::webobj->selected_item"); ! $file = TPL_PATH."webobjects/pages/".$webobj.".txt"; ! WebApp::setSVar("displaytxt->file", $file); } } |
From: Dashamir H. <das...@us...> - 2003-02-23 14:29:13
|
Update of /cvsroot/phpwebapp/documentation/webobjects/tabs2 In directory sc8-pr-cvs1:/tmp/cvs-serv11335/webobjects/tabs2 Modified Files: tabs2.txt Log Message: Index: tabs2.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/webobjects/tabs2/tabs2.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tabs2.txt 21 Feb 2003 08:20:13 -0000 1.1.1.1 --- tabs2.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 1,7 **** ! WebObject 'tabs2' displays a menu, usually on the left side of the page. It is used like this: ! <Include SRC="{{LEFTMENU_PATH}}tabs2.html" /> <WebObject Class="tabs2" Name="su" --- 1,7 ---- ! WebObject 'tabs2' displays a tabs-like horizontal menu. It is used like this: ! <Include SRC="{{WEBOBJ_PATH}}tabs2.html" /> <WebObject Class="tabs2" Name="su" *************** *** 15,19 **** */ $menu_items = array( ! "item1" => " Menu Item 1 ", "item2" => " Menu Item 2 ", "item3" => " Menu Item 3 ", --- 15,19 ---- */ $menu_items = array( ! "item1" => " Menu Item 1 ", "item2" => " Menu Item 2 ", "item3" => " Menu Item 3 ", |
From: Dashamir H. <das...@us...> - 2003-02-23 14:29:13
|
Update of /cvsroot/phpwebapp/documentation/webobjects/tabs3 In directory sc8-pr-cvs1:/tmp/cvs-serv11335/webobjects/tabs3 Modified Files: tabs3.txt Log Message: Index: tabs3.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/webobjects/tabs3/tabs3.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tabs3.txt 21 Feb 2003 08:20:12 -0000 1.1.1.1 --- tabs3.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 1,7 **** ! WebObject 'tabs3' displays a menu, usually on the left side of the page. ! It is used like this: ! <Include SRC="{{LEFTMENU_PATH}}tabs3.html" /> <WebObject Class="tabs3" Name="su" --- 1,7 ---- ! WebObject 'tabs3' displays a tabs-like vertical menu, usually ! on the left side of the page. It is used like this: ! <Include SRC="{{WEBOBJ_PATH}}tabs3.html" /> <WebObject Class="tabs3" Name="su" *************** *** 15,19 **** */ $menu_items = array( ! "item1" => " Menu Item 1 ", "item2" => " Menu Item 2 ", "item3" => " Menu Item 3 ", --- 15,19 ---- */ $menu_items = array( ! "item1" => " Menu Item 1 ", "item2" => " Menu Item 2 ", "item3" => " Menu Item 3 ", |
From: Dashamir H. <das...@us...> - 2003-02-23 14:29:11
|
Update of /cvsroot/phpwebapp/documentation/webobjects/tabs1 In directory sc8-pr-cvs1:/tmp/cvs-serv11335/webobjects/tabs1 Modified Files: tabs1.txt Log Message: Index: tabs1.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/webobjects/tabs1/tabs1.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tabs1.txt 21 Feb 2003 08:20:12 -0000 1.1.1.1 --- tabs1.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 1,7 **** ! WebObject 'tabs1' displays a menu, usually on the left side of the page. ! It is used like this: ! <Include SRC="{{LEFTMENU_PATH}}tabs1.html" /> <WebObject Class="tabs1" Name="su" --- 1,6 ---- ! WebObject 'tabs1' displays a horizontal menu. It is used like this: ! <Include SRC="{{WEBOBJ_PATH}}tabs1.html" /> <WebObject Class="tabs1" Name="su" *************** *** 15,19 **** */ $menu_items = array( ! "item1" => " Menu Item 1 ", "item2" => " Menu Item 2 ", "item3" => " Menu Item 3 ", --- 14,18 ---- */ $menu_items = array( ! "item1" => " Menu Item 1 ", "item2" => " Menu Item 2 ", "item3" => " Menu Item 3 ", |
From: Dashamir H. <das...@us...> - 2003-02-23 14:29:11
|
Update of /cvsroot/phpwebapp/documentation/templates/user_manual/manual_pages In directory sc8-pr-cvs1:/tmp/cvs-serv11335/templates/user_manual/manual_pages Modified Files: database.txt events.txt intro.txt new_app.txt session.txt templates.txt variables.txt webox.txt Log Message: Index: database.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/manual_pages/database.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** database.txt 21 Feb 2003 08:18:29 -0000 1.1.1.1 --- database.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 177,178 **** --- 177,337 ---- WebApp::execQuery($query_str, $cnn1); + + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + ---------------- Recordsets ------------------------------------ + * - Satic Recordsets: <Recordset rs="rsID" static="true"> + These are recordsets that are opened only once during the + page construction. Usually the recordsets are opened as + many times as they are needed (i.e. their query is executed + and the results retrieved from DB). This has the advantage + that the query can be different each time that the recordset + is opened (depending on the {{variables}} that it contains), + and this provides for more flexibility and dynamicity. + + However, in some cases, the same query is executed all the + times that the recordset is opened, e.g. when this recordset + is used to fill a listbox and this listbox can be 20 times + in the page. In this case it is more efficent that the + recordset is opened only once and it is used in the 20 cases. + + * - The syntax of tag Recordset now is: + <Recordset ID="rsID" type="rsType"> + where 'rsType' can be one of the values: "StaticRS", "DynamicRS", + "EditableRS", "PagedRS", "TableRS". The attibute type can be + omitted; in this case the default value is "StaticRS". + + A 'static' recordset is the recordset described above, a RS that + cannot be opened more than once per page. A 'dynamic' RS is a + recordset that evaluates its query (replaces its {{variables}}), + executes it and refreshes the content each time that its + method Open() is called. Notice that before a recordset was + 'dynamic' by default and 'static' only if specified, but now a + RS is 'static' by default (if no type is given). This is + because 'static' recordsets are more common in web applications + and 'dynamic' recordsets are useful only in special cases, + e.g. when we have two nested recordsets (associated with two + nested <Repeat>s) and the inner RS uses a {{variable}} provided + by the outer RS. + + A 'PagedRS' is a recordset that divides the results of the + query into pages of certain size, and retrives from DB only + one page of them. It requires the attribute 'recs_per_page', + which specifies the size of the page. It is used to display + big recordsets, when they cannot fit in a single HTML page. + + An 'EditableRS' is a RS that can be modified from the PHP code. + The programer can retrive the results of a query from DB and + then modify them, or start with an empty RS and fill it + programatically. It makes possible to use templates for results + that don't come from DB (e.g. when you want to display a folder + listing and you get the files and folders using some PHP functions). + + This feature can be used in the "folderListing" webbox, for + example. Instead of generating all the html code of the + folder listing programatically, a <Repeat> template, associated + with a <Recordset> could be used, and this recordset could be + filled from an array or from php code (instead of being filled + from database). + The benefit of this aproach (vs. generatin all the html code + in php) would be that we are able to change the layout of the + 'folderListing' webbox more easily, because instead of changing + the php code, we change only a template. + + The functions of EditableRS are: + $rs->apply($fun_name) + //applies the function $fun_name on each record + //of the recordset; $fun_name is a global function + //that takes as parameter a reference to an associated + //array (a reference to a record), like this: + // function fun_to_be_applied(&$rec) + $rs->setFld($fld_name, $fld_value) + //sets a new value to the given field (in the current record) + $rs->setFlds($arr_flds) + //changes some fields of the current recordset + $rs->addRecs($arr_recs) + $rs->addRec($rec) + //adds a new record after the current record, + //the new record becomes current + $rs->insRecs($arr_recs) + $rs->insRec($rec) + //insert a new record before the current record, + //the new record becomes the current record + $rs->rmRec() //removes the current record + $rs->rmRecs($nr) + //removes $nr recs from the recordset, + //starting with the current record; + //if $nr is not given or exeeds the EOF, + //then removes all the recs up to the EOF + $rs->slice($offset, $length) + //returns a new recordset that contains a slice of this recordset; + //see the documentation of array_slice of PHP + $rs->match($condition, $pos) + //returns true if the query at the given position + //matches the $condition (usually used by the functions + //find() and filter() above); if no position is given + //matches the current record; + //currently the $condition supports only one field + $rs->filter($condition) + //returns a new recordset with the recs that match the + //given condition, $condition is like the WHERE condition + //of a query, but it matches using regexp-s, e.g. + //(username=/^d.*/ AND (firstname=/[^a]+/ OR NOT lastname='Hoxha')) + //(currently it supports only one field, no AND, OR, (, ) etc.) + $rs->find($condition) + //finds the subset of the recordset that matches the + //condition and positions the pointer to the first + //record found; $condition is like the condition in filter(); + //if called without parameter, if finds the next one, + //and so on up to EOF; + $rs->search($condition) + //used by find(), finds all the records that match + //the condition and stores their indeces in + //the array $this->found_positions + $rs->find_next() + //used by find(), returns the next found record + //or UNDEFINED if there are no more records + $rs->getColumn($fld_name) + //returns an array with the values of the specified field + $rs->getColumns($fld_names) + //$fld_names is a comma separated list of field names; + //returns a new recordset that contains only the specified + //columns + + A "TableRS" is an editable RS which is associated with a table in + a DB. After editing this RS, the programer can save the changes + back to DB. (This is not implemented yet.) + + * - WebApp::execQuery($query) now returns an EditableRS. + + * - Function: WebApp::openTable($table, $condition) added. + //opens the given table and returns the records that + //satisfy the given $condition; returns a TableRS + + ---------------------------------------------------------------- + * - The constant DB_TYPE in 'config/const.Settings.php' specifies + the type of the DB that the application is using, like this: + + define("DB_TYPE", "MySQL"); + //this constant defines the type of DB that the application uses + //it can be: "MySQL", "Oracle", "ODBC", "ProgreSQL", etc. + //(except "MySQL", the others are not implemented yet) + + * WebApp::openRS($rs_id, $params =array()) + WebApp::execDBCmd($cmd_id, $params =array()) + + These functions now take an optional array of parameters, which + are replaced in the query as {{tpl_vars}}. + -------------------------------------------------------------------- + * - PagedRS can also handle the queries which have GROUP BY. + + Along to the state variable 'rs_id->current_page' which keeps + the current page of the PagedRS, there is the state variable + 'rs_id->recount' which is set to true by the application when + the records need to to be recounted (e.g. when a new record is + added in DB, or when a record is deleted). + + Before, the number of the records in a PagedRS was counted only + when current_page was 1, but this is not very convenient. + -------------------------------------------------------------------- Index: events.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/manual_pages/events.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** events.txt 21 Feb 2003 08:18:29 -0000 1.1.1.1 --- events.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 185,186 **** --- 185,246 ---- become obsolete or not supported. + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + ------------------ event handling ------------------------------- + * - The class of a webox can declare an event handler function, + with the name "on_eventName". If such a function exists, + then this function is called to handle the event, otherwise + the function eventHandler($event) is called, as before. This + is useful both for backward compatibility and for flexibility: + the programer chooses how to handle the events, either with a + separate event handler for each event, or with a common event + handler for all the events. + -------- transmitVars() -------------------------- + * - function transmitVar(var_name, var_value) + This function sends the var_name (which has the given var_value) + to the server side as a PHP global variable. It can also be used + in the template as a tpl variable: {{var_name}}, since all PHP + global variables can be used as tpl variables. It should be used + carefully, because any tpl variable with the same name will + override its value. + It must be called before GoTo(). + + - function transmitVars(var_list) + Similar to transmitVar() but can transmit more than one variable. + The format of var_list is: var1=val1&var=val2&var3=val3. + Must be called before GoTo(). + + ---------------- SendEvent() ---------------------------------------- + * - js function: SendEvent(obj_id, event_name, event_args) + + Sends an event to the server-side (PHP) code. + obj_id -- the object to which the event is sent + event_name -- the name of the event + event_args -- the arguments of the event, optional + + It is defined in 'func.GoTo.js' which is included automatically + by the framework in each page. This function uses GoTo() to + send an event to a webobject (or webbox). Its target is always + 'thisPage' (so, it cannot switch to another page of the application, + like GoTo()) and it cannot send global PHP variables (like GoTo()). + So, GoTo() is more general, but SendEvent() should be more common + and more frequently used. + + -------------------------------------------------------------------- + * - The GoTo() function accepts only a string of the form + GoTo("target.html?event=obj_id.event_name(event_args)"); + Before it was possible to send some global PHP vars, by appending + them after the event like this: &var1=val1&var2=val2 etc. + This was deprecated and actually it is almost never used. In the + rare cases when it is needed to send a global variable to PHP, + the functions transmitVar() and transmitVars() can be used. + The values of the event arguments could not contain '&' before, + but now they can. + + They cannot contain ';', because it is used to separate event args + from each-other, however, the JS function encode_arg_value(str), + which is defined by the framework, can be used to replace them + with '#semicolumn#', in cases that they need to contain ';'. + The decoding (replacing '#semicolumn#' by ';') is done by the + framework itself. Index: intro.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/manual_pages/intro.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** intro.txt 21 Feb 2003 08:18:29 -0000 1.1.1.1 --- intro.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 1,18 **** - 0 - Table of contents - ---------------------- - 0 - Table of contents - 1 - What is phpWebApp - 2 - Templates - 3 - Transitions - 4 - WebBox-es - 5 - Events - 6 - Variables - 7 - Session - 8 - Database - 9 - How to create a new application - 10 - Common WebBox-es and Tools - - 1 - What is phpWebApp ---------------------- --- 1,3 ---- *************** *** 156,157 **** --- 141,144 ---- For more details read the file: 'common_weboxes.txt' . + + Index: new_app.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/manual_pages/new_app.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** new_app.txt 21 Feb 2003 08:18:29 -0000 1.1.1.1 --- new_app.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 25,29 **** The file 'application.php' --------------------------- ! <?php $app_path = dirname(__FILE__); $app_path = str_replace("\\", "/", $app_path); //could be a Windows path --- 25,29 ---- The file 'application.php' --------------------------- ! <? $app_path = dirname(__FILE__); $app_path = str_replace("\\", "/", $app_path); //could be a Windows path *************** *** 56,60 **** The file 'index.php' --------------------- ! <?php include "application.php"; --- 56,60 ---- The file 'index.php' --------------------- ! <? include "application.php"; *************** *** 95,99 **** The file 'config/const.Paths.php' ---------------------------------- ! <?php //constants of the paths in the application define("APP_URL", "/phpWebApp/app1/"); --- 95,99 ---- The file 'config/const.Paths.php' ---------------------------------- ! <? //constants of the paths in the application define("APP_URL", "/phpWebApp/app1/"); *************** *** 128,132 **** Below is another example of this file: ! <?php //constants of the paths in the application define("APP_URL", "/vodafone/"); --- 128,132 ---- Below is another example of this file: ! <? //constants of the paths in the application define("APP_URL", "/vodafone/"); *************** *** 159,163 **** The file 'config/const.Settings.php' ------------------------------------- ! <?php //The constants defined here change the behaviour of the framework //and the application. You can change the values of the constants --- 159,163 ---- The file 'config/const.Settings.php' ------------------------------------- ! <? //The constants defined here change the behaviour of the framework //and the application. You can change the values of the constants *************** *** 201,205 **** The file 'event_handlers/on.firstTime.php' ------------------------------------------- ! <?php //this function is called the first time //that the application is opened --- 201,205 ---- The file 'event_handlers/on.firstTime.php' ------------------------------------------- ! <? //this function is called the first time //that the application is opened *************** *** 222,226 **** The file 'event_handlers/on.beforePage.php' ------------------------------------------- ! <?php //this function is called before any page is constructed function on_beforePage() --- 222,226 ---- The file 'event_handlers/on.beforePage.php' ------------------------------------------- ! <? //this function is called before any page is constructed function on_beforePage() *************** *** 238,242 **** The file 'event_handlers/on.afterPage.php' ------------------------------------------- ! <?php //this function is called after any page is constructed function on_afterPage() --- 238,242 ---- The file 'event_handlers/on.afterPage.php' ------------------------------------------- ! <? //this function is called after any page is constructed function on_afterPage() *************** *** 256,257 **** --- 256,265 ---- - 'browser.php', which includes the preview tool + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + -------------------------------------------------------------------- + * - config/const.Settings.php is divided into const.Options.php + (some constants that can have optional values, depending on the + application), and const.Debug.php (constants that enable or + disable several debugging features of the framework). Index: session.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/manual_pages/session.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** session.txt 21 Feb 2003 08:18:29 -0000 1.1.1.1 --- session.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 105,106 **** --- 105,249 ---- functions serialise() and unserialise(), to convert them to and from string format. + + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + + ----- state vars (or session or persistent vars) added to webox ---- + * - Now each webox can have its own state vars (or session vars, or + persistent vars). Inside the class of the webox, its state vars + can be accessed like this: + $this->addSVar ($var_name, $var_value); + $this->addSVars($associated_array); + $this->setSVar ($var_name, $var_value); + $this->setSVars($associated_array); + $var_value = $this->getSVar($var_name); + $assoc_arr = $this->getSVars(); + These variables can be accessed inside the webox in the usual way: + {{var_name}} + and they are valid only in the scope of this webox (and shadow any + other {{variables}} with the same name that are defined in the + enclosing scopes. + + In case that some state variable of a webox needs to be used + from the template of another webox, they can be accessed like this: + {{boxID->var_name}} + + From the JS code as well, they can be accessed like this: + session.setVar("boxID->var_name", var_value); etc. + + Also, when you need to access the state var of another box from + the PHP code of this webox, you can use this function: + $var_value = WebApp::getSVar("otherBoxID->var_name"); + The function $var_value=WebApp::getSVar($var_name) can also + be used to get the session variables (instead of + $var_value=$session->Vars[$var_name]). + Also the function: WebApp::setSVar($var_name, $var_value) + is available (instead of $session->Vars[$var_name] = $var_value;), + and the function: $wb = WebApp::getWBox("wbox_id"); + which returns a reference to the webox with the given id (this + reference can be used to access the variables, state variable or + functions of this webox, e.g. $wb->getQuery(); ). + + If the constant DEBUG_STATEVARS in the 'config/const.Settings.php' + is set to true, then the framework outputs the state variables + for each webox. + + ----------------- Session ------------------------------------- + * - The special variable 'sessChange' is removed as obsolete. The + programer can change the session on client side, before calling + GoTo(), instead of changing session variables using 'sessChange'. + + * - 'init.Session.php' is removed as obsolete. The session (state) + variables can be initialized either in the 'init()' function + of the weboxes or in the 'on.firstTime.php'. + + * - Added session.rmVar(var_name) so that session vars can be + removed from JS code as well. The names of the session functions + in JS have been changed so that they are more consistent with the + other function names in framework. Now they are: + session.addVar("var_name", "var_value"); + session.rmVar("var_name"); + session.setVar("var_name", "var_value"); + session.getVar("var_name"); + + * - The names of the functions of the session object are: + $session->addVar($var_name, $var_value); + $session->rmVar($var_name); //removes a variable from session + $session->setVar($var_name, $var_value); //sets a new value + $session->getVar($var_name); //get the value of the var + + The names of the functions for the state vars of a webox are: + $this->addSVar($var_name, $var_value); + $this->addSVars($arr_vars); + $this->setSVar($var_name, $var_value); + $this->setSVars($arr_vars); + $this->getSVar($var_value); + $this->getSVars(); + + The session and state vars can also be accessed using this functions: + WebApp::addSVar($var_name, $var_value); + WebApp::setSVar($var_name, $var_value); + WebApp::getSVar($var_name); + + + * - DB Session Vars (or DB State Vars) + Some of the state (session) variables now can be optionally stored + in DB instead of storing them in the HTML page itself (using JS code). + This increses the security of an application based on the framework, + because the variables that are stored in the JS code potentially can + be viewed and manipulated by malicious users. So, some of the + session vars can be stored in DB and they are invisible on the client + side, and the others (most of them) can be stored in the page, so that + they can be accessed and used by the JS code of the application. + + To add a DB var, we use the same functions that are used to add a JS + var, but add a third parameter that is not false, like this: + + $session->addVar($var_name, $var_value, true); + $session->addVar($var_name, $var_value, "DB"); + $session->addVar($var_name, $var_value, "secure"); etc. + + $this->addSVar($var_name, $var_value,"DB"); + WebApp::addSVar($var_name, $var_value, "DB"); + + To change or get the value of a DB variable we use the same "set" + and "get" functions that we use for JS vars, without additional + parameters (the framework finds itself whether this is a DB or a + JS state variable). Usually a DB and a JS var have different names, + but in case that they have the same name, DB vars have priority + over JS vars (which means that "get" returns the value of the + DB var and "set" sets the value to the DB var, instead of to the + JS var). + + The array: '$session->dbVars' can be used to access the DB vars + as well, like this: + $session->dbVars[$var_name] = $var_value; + $var_value = $session->dbVars[$var_name]; + but it is not neccessary and it is not recomended to use it + (in fact, it is discouraged to use it). + + The function $this->getSVars() behaves a little bit different + from the others. Without argument it returns a list of all + the state vars of the webox, both DB vars and JS vars. With + an argument "DB" it returns only the DB vars, and with argument + "JS" it returns only the JS vars. + + For DB vars to work properly, there should be a DB connection + with a database and the USES_DB constant in 'config/cont.Settings.php' + must be true. Otherwise the DB vars are converted and stored as + JS vars. Also, in database there must be the table session(id, vars), + but if it does not egzist, it is created automatically by the framework + (if the connection has permition to create tables). + + ---------------- session var values ---------------------------- + * - The session JS vars can contain: ' (single quote), " (double + quote), \n (new line character), \ (slash), \t (tab), etc. + + They cannot contain, however, \' (slash single quote), + \" (slash double quote), \n (slash n). + + -------------------------------------------------------------------- + * - The function: session.isset(var_name) can be used to check + whether a certain variable egzists in the session or not. + Index: templates.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/manual_pages/templates.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** templates.txt 21 Feb 2003 08:18:32 -0000 1.1.1.1 --- templates.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 274,275 **** --- 274,365 ---- For more details see the file: 'webox.txt' . #--> + + + * - Variables can also be used in the 'rs' attribute of a <Repeat> tag, + e.g. <Repeat rs="{{rs_id}}"> . . . </Repeat> . + This allows a repeat block to use different queries in different + cases (according to the logic of the program). These variables + are evaluated at the parse time, at the time that the repeat + element is parsed. So, if you give value to this variable inside + the function onRender(), it will not get it; instead it should be + given value in the function onParse(), or it should be a state + variable or global variable. + + * - The syntax of tag Recordset now is: + <Recordset ID="rsID" type="rsType"> + where 'rsType' can be one of the values: "StaticRS", "DynamicRS", + "EditableRS", "PagedRS", "TableRS". The attibute type can be + omitted; in this case the default value is "StaticRS". + + A 'static' recordset is the recordset described above, a RS that + cannot be opened more than once per page. A 'dynamic' RS is a + recordset that evaluates its query (replaces its {{variables}}), + executes it and refreshes the content each time that its + method Open() is called. Notice that before a recordset was + 'dynamic' by default and 'static' only if specified, but now a + RS is 'static' by default (if no type is given). This is + because 'static' recordsets are more common in web applications + and 'dynamic' recordsets are useful only in special cases, + e.g. when we have two nested recordsets (associated with two + nested <Repeat>s) and the inner RS uses a {{variable}} provided + by the outer RS. + + A 'PagedRS' is a recordset that divides the results of the + query into pages of certain size, and retrives from DB only + one page of them. It requires the attribute 'recs_per_page', + which specifies the size of the page. It is used to display + big recordsets, when they cannot fit in a single HTML page. + + An 'EditableRS' is a RS that can be modified from the PHP code. + The programer can retrive the results of a query from DB and + then modify them, or start with an empty RS and fill it + programatically. It makes possible to use templates for results + that don't come from DB (e.g. when you want to display a folder + listing and you get the files and folders using some PHP functions). + + This feature can be used in the "folderListing" webbox, for + example. Instead of generating all the html code of the + folder listing programatically, a <Repeat> template, associated + with a <Recordset> could be used, and this recordset could be + filled from an array or from php code (instead of being filled + from database). + The benefit of this aproach (vs. generatin all the html code + in php) would be that we are able to change the layout of the + 'folderListing' webbox more easily, because instead of changing + the php code, we change only a template. + + -------------------------------------------------------------- + * - <Repeat rs="{{tpl_var}}"> + The attribute rs of the <Repeat> tag can contain variables + (so that the same repeat can use different recordsets, + according to the logic of the program). These variables + are evaluated now in render time (before they were evaluated + in parse time) because this is more convenient. + + -------------------------------------------------------------------- + * - The tag <WebObject> can be written in several lines (for making it + more readable, in case that it has many attributes) and the parser + can handle it. E.g. + <WebObject Class = "listbox" Name = "country" + rs = "rs_id" + width = "---------------" /> + + -------------------------------------------------------------------- + * - The recordsets declared by the <Recordset> tag were by default + of type "StaticRS". Now the default type is "EditableRS", + because this is more useful (and anyway EditableRS extends StaticRS). + It can be declared explicitly as "StaticRS" only when the programer + has strong reasons to disallow the modification of this recordset + from the PHP code. + + TODO: Add a separate section for Recordsets and the <Repeat> tag. + + * - The expression of the <Var> tag can now be declared in several + lines, like this: + <Var name="class"> + ( + "{{item}}"=="{{{{obj_id}}->selected_item}}" ? + "leftMenu-item-selected" + :"leftMenu-item" + ) + </Var> Index: variables.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/manual_pages/variables.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** variables.txt 21 Feb 2003 08:18:32 -0000 1.1.1.1 --- variables.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 135,136 **** --- 135,148 ---- (e.g. {{#var1}} is replaced by "var1"). + + + * - Variables can be nested, like this: {{checked_{{id}}}} + First the innermost variable is replaced, then the outer variable. + If {{id}} has the value "2" and {{checked_2}} has the value "true", + then the whole variable above will be replaced by "true"; + + If the value of a variable contains another variable inside, + it will be replaced as well. E.g, if the variable {{nr}} has the + value "5" and the variable {{msg}} has the value + "This is message number {{nr}}.", then using {{msg}} inside a + template will produce the string: "This is message number 5." Index: webox.txt =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/manual_pages/webox.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** webox.txt 21 Feb 2003 08:18:32 -0000 1.1.1.1 --- webox.txt 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 135,136 **** --- 135,372 ---- It is better that a WebBox and all the files related to it be placed in a folder with the same name as the boxID. + + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + + -------- the PHP code of a webox ----------------------- + * - The PHP code of a webox: <WebBox ID="boxID" + is placed in the file "boxID.php" which is in the + same folder as the template containing the webox. + + The code of the webox now is organized inside a class: + "class boxID extends IWebBox {...}" + which extends the interface (or the abstract class) IWebBox. + This makes the PHP code of the application more object-oriented + and better organized. + + The class "boxID" can override the functions: + eventHandler($event), onParse() and onRender() + of IWebBox, or can define other functions that can be + used inside these functions. These functions replace + the old functions: boxID_eventHandler($event), boxID_onParse() + and boxID_onRender() + + + ---------- the function init() ---------------------------------- + * - The class of the webox can also define the function init(), + which is like the functions eventHandler(), onParse() and + onRender(), and overrides the abstract function with the same + name of the class IWebBox. This function is called only when + the webox is loaded for the first time (only once in a session + of the application). + + This function is the right place for initializing the state + vars of the webox with default values. Previously, this was + done in the onParse() with a statement like this: + if (!isset($session->Vars["state_var"])) + { + $session->Vars["state_var"] = "initial_value"; + } + Now it should be done in the init() function, like this: + $this->addSVar("state_var", "initial_value"); + + + ----- state vars (or session or persistent vars) added to webox ---- + * - Now each webox can have its own state vars (or session vars, or + persistent vars). Inside the class of the webox, its state vars + can be accessed like this: + $this->addSVar ($var_name, $var_value); + $this->addSVars($associated_array); + $this->setSVar ($var_name, $var_value); + $this->setSVars($associated_array); + $var_value = $this->getSVar($var_name); + $assoc_arr = $this->getSVars(); + These variables can be accessed inside the webox in the usual way: + {{var_name}} + and they are valid only in the scope of this webox (and shadow any + other {{variables}} with the same name that are defined in the + enclosing scopes. + + In case that some state variable of a webox needs to be used + from the template of another webox, they can be accessed like this: + {{boxID->var_name}} + + From the JS code as well, they can be accessed like this: + session.setVar("boxID->var_name", var_value); etc. + + Also, when you need to access the state var of another box from + the PHP code of this webox, you can use this function: + $var_value = WebApp::getSVar("otherBoxID->var_name"); + The function $var_value=WebApp::getSVar($var_name) can also + be used to get the session variables (instead of + $var_value=$session->Vars[$var_name]). + Also the function: WebApp::setSVar($var_name, $var_value) + is available (instead of $session->Vars[$var_name] = $var_value;), + and the function: $wb = WebApp::getWBox("wbox_id"); + which returns a reference to the webox with the given id (this + reference can be used to access the variables, state variable or + functions of this webox, e.g. $wb->getQuery(); ). + + If the constant DEBUG_STATEVARS in the 'config/const.Settings.php' + is set to true, then the framework outputs the state variables + for each webox. + + * - The callback function onLoad() is renamed to onParse(). As before, + it is called just before the webbox is parsed. + + ----------------------------------------------------------------- + * - The framework supports WebClasses and WebObjects. + + <WebClass ID="className" Path="path/to/className.php"> + <Parameter name="param1" default="default value" /> + <Parameter name="param2" /> + <!--# . . . . . . . . . . . . . . . . #--> + <!--# the template of the web class #--> + <!--# . . . . . . . . . . . . . . . . #--> + </WebClass> + + <WebObject Class="className" name="wObj1" param1="value1" param2="value2" /> + <WebObject Class="className" name="wObj2" param2="value2" /> + <WebObject Class="className" name="wObj3" param1="{{nr}}+1" param2="red" /> + + The element <WebClass> defines a web class, but it by itself + does not produce any HTML output in the rendered page. The element + <WebObject> declares an object of the class and the content (the template) + of the <WebClass> is used to render this object. + + The 'Path' attribute of the <WebClass> declares the path of the + file that defines the PHP code of the WebClass. It is optional, + and if it is not given, then the current folder (the folder of the + template that contains the <WebClass> definition) is searched for + the file "className.php". + + The <Parameter> elements declare the names and optionally the default + values of the parameters of the webobjects. (The current implementation + requires that they come immediately after the <WebClass> line and have + no empty lines or other lines between them, otherwise they will not be + parsed correctly.) These parameters can be used inside the template of + the webclass like template variables, e.g. {{param1}}. If a parameter + doesn't get a value in the <WebObject> declaration, then its default + value is used (if it doesn;t have a default value, then it is handled + like an undefined variable). When a <WebObject> is rendered, the value + of the parameters is evaluated as a mixed expression (a PHP expression + that contains {{template vars}}). + + When several objects of the same class are declared, the template of the + webclass is repeated for each of them. The webclass designer should + take this into account when building the webclass. E.g. if there is + such an input in the webclass template: + <input type="text" name="staff"> + There will be several such inputs in the HTML code, and its value + cannot be accessed like this: document.form.staff.value + + ToDo: The framework declares some variables like: {{className}} + {{objName}}, {{objID}} (which usually is {{className}}::{{objName}}), + {{objCount}} (counts the objects of the same class, starting from 1), + etc. These vars can be used inside the template of the webclass, + if the webclass designer needs them, e.g.: + <input type="text" name="staff_{{objCount}}"> + + The PHP code + ------------- + The file "className.php", if it egzists, contains this class definition: + <? + class className extends WebObject + { + . . . . . + } + ?> + Where 'WebObject' is a class defined by the framework that supplies + some useful functionality for all webclasses. + This functionality is: + 1 - The callback functions that are called by the framework at + certain moments during the time that the webobject is processesed. + These callback functions are: + + init() + + on_eventName($event_args) + + eventHandler($event) + + onParse() + + onRender() + + 2 - The ability to keep persistent variables that define the + state of the object. These state variables can be used + inside the "className" like this: + + $this->addSVar($var_name, $var_value); + + $this->addSVar($var_name, $var_value, "DB"); + + $this->setSVar($var_name, $var_value); + + $this->setSVars($var_name, $var_value); + + $var_value = $this->getSVar($var_name); + + $arr_values = $this->getSVars($var_name); + + etc. + Outside the scope of the WebClass, these state variables can + be accessed like this: + + WebApp::setSVar("className::objName->var_name", "var_value") + + $var_value = WebApp::getSVar("className::objName->var_name"); + + {{className::objName->var_name}} (in templates) + + session.setVar("className::objName->var_name", "var_value") + + etc. + + + WebBox-es + --------- + The <WebBox>-es are handled by the framework as a special case of + <WebClass>-es and <WebObject>-s. When the framework parses: + <WebBox ID="boxID"> + . . . . . + </WebBox> + it interprets it as: + <WebClass ID="boxID"> + . . . . . + </WebClass> + <WebObject Class="boxID" /> + and the ID of the created object, instead of being "className::objName" + is just "boxID", so it is handled the same as before + (e.g. $var_value = WebApp::getSVar("boxID->var_name"), etc. ) + Thus, when upgrading an egzisting application, the only change that + needs to be done is to replace: + class boxID extends IWebBox + with + class boxID extends WebObject + + -------- afterParse() ---------------------------- + * - WebObject::afterParse() + is like WebObject::onParse(), only that it is called after + the WebObject is parsed. + + -------- webobject vars -------------------------- + * - The framework declares for each webobject these variables: + {{obj_id}} -- the object id ({{class_name}}::{{obj_name}}) + {{class_name}} -- the name of the class + {{obj_name}} -- the name of the object + {{obj_count}} -- counts the objects of the same class, + starting from 1 + These vars can be used inside the template of the webclass, + if the webclass designer needs them, e.g.: + <input type="text" name="staff_{{obj_count}}"> + + -------------------------------------------------------------------- + * - The tag <WebObject> can be written in several lines (for making it + more readable, in case that it has many attributes) and the parser + can handle it. E.g. + <WebObject Class = "listbox" Name = "country" + rs = "rs_id" + width = "---------------" /> + + -------------------------------------------------------------------- + * - The JS code of a <WebBox> is included automatically by the + framework at the <head> of the page. The framework looks for + the file 'box_id.js' (or 'class_id.js', in case of a <WebClass>) + in the same folder with the <WebBox>. If it exists there, then + the framework includes a line like this in the <head> of the page: + <script language='javascript' src='path/to/box_id.js'></script> + + Similarly, for the CSS code, the framework includes a line like + this: <link type='stylesheet' src='path/to/box_id.css' ....> + in the <head> of the page. + |
From: Dashamir H. <das...@us...> - 2003-02-23 14:29:11
|
Update of /cvsroot/phpwebapp/documentation/templates/user_manual In directory sc8-pr-cvs1:/tmp/cvs-serv11335/templates/user_manual Modified Files: manual_items.php manual_page.php user_manual.html Log Message: Index: manual_items.php =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/manual_items.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** manual_items.php 21 Feb 2003 08:18:24 -0000 1.1.1.1 --- manual_items.php 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 2,11 **** /** * The $menu_items array contains the items ! * of the tabs2::manual web object. */ $menu_items = array( ! "intro" => "Intro", "templates" => "Templates", "transitions" => "Transitions", "webox" => "WebBox-es", "events" => "Events", --- 2,12 ---- /** * The $menu_items array contains the items ! * of the tabs3::manual web object. */ $menu_items = array( ! "intro" => "Introduction", "templates" => "Templates", "transitions" => "Transitions", + "webclass" => "WebClass-es", "webox" => "WebBox-es", "events" => "Events", *************** *** 13,18 **** "session" => "Session", "database" => "Database", ! "new_app" => "New Application", ! "boxes" => "Common Weboxes" ); ?> --- 14,20 ---- "session" => "Session", "database" => "Database", ! "recordset" => "Recordsets", ! "new_app" => "Application Structure", ! "misc" => "Misc" ); ?> Index: manual_page.php =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/manual_page.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** manual_page.php 21 Feb 2003 08:18:24 -0000 1.1.1.1 --- manual_page.php 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 4,10 **** function onRender() { ! $page = WebApp::getSVar("tabs2::manual->selected_item"); $file = TPL_PATH."user_manual/manual_pages/".$page.".txt"; ! WebApp::setSVar("codeViewer->codeFile", $file); } } --- 4,10 ---- function onRender() { ! $page = WebApp::getSVar("tabs3::manual->selected_item"); $file = TPL_PATH."user_manual/manual_pages/".$page.".txt"; ! WebApp::setSVar("displaytxt->file", $file); } } Index: user_manual.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/user_manual/user_manual.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** user_manual.html 21 Feb 2003 08:18:24 -0000 1.1.1.1 --- user_manual.html 23 Feb 2003 14:29:07 -0000 1.2 *************** *** 7,15 **** <tr> <td> ! <Include SRC="{{WOBJ_PATH}}tabs2/tabs2.html" /> ! <WebObject Class="tabs2" Name="manual" items="{{./}}manual_items.php" /> <WebBox ID="manual_page"> ! <Include SRC="{{CODEVIEWER_PATH}}codeViewer.html" /> </WebBox> </td> --- 7,15 ---- <tr> <td> ! <Include SRC="{{WEBOBJ_PATH}}tabs/tabs3.html" /> ! <WebObject Class="tabs3" Name="manual" items="{{./}}manual_items.php" /> <WebBox ID="manual_page"> ! <Include SRC="{{WOBJ_PATH}}displaytxt/displaytxt.html" /> </WebBox> </td> |