Update of /cvsroot/phpwebapp/web_app/parser
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19096/parser
Modified Files:
Tag: phpwebapp-1_0
class.WebPage.php class.Parser.php
Log Message:
Added function WebApp::popup_window($name, $url, $features ='nil')
Index: class.WebPage.php
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/parser/class.WebPage.php,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** class.WebPage.php 25 Aug 2003 13:18:32 -0000 1.8
--- class.WebPage.php 8 Oct 2004 10:12:56 -0000 1.8.2.1
***************
*** 44,53 ****
var $rs_collection;
! /** Keeps a list of messages that are displayed with alert()
! * to the user after the page is loaded. */
var $messages;
! /** Keeps a list of debug messages that are displayed
! * after the page is rendered. */
var $dbg_messages;
--- 44,66 ----
var $rs_collection;
! /**
! * Keeps a list of messages that are displayed with alert()
! * to the user after the page is loaded.
! * @see WebApp::message($msg)
! */
var $messages;
! /**
! * Keeps a list of windows that are poped up after the page is loaded.
! * It is a two dimensional array, indexed by name and with columns for
! * 'url' and 'features'.
! * @see WebApp::window($name, $url, $features)
! */
! var $popup_windows;
!
! /**
! * Keeps a list of debug messages that are displayed
! * after the page is rendered.
! */
var $dbg_messages;
***************
*** 63,66 ****
--- 76,80 ----
$this->messages = array();
+ $this->popup_windows = array();
$this->dbg_messages = array();
***************
*** 86,89 ****
--- 100,105 ----
{
print "Error:WebPage:addTemplate: unidentified template.\n";
+ global $webPage;
+ print $webPage->template_list();
$tpl->toText();
return;
***************
*** 187,191 ****
$msg = str_replace("\n", '\n', $msg); //replace new lines with '\n'
$msg = str_replace("'", "\\'", $msg); //escape single quotes
! $js .= "\talert('$msg');\n";
}
$js .= "</script>\n";
--- 203,207 ----
$msg = str_replace("\n", '\n', $msg); //replace new lines with '\n'
$msg = str_replace("'", "\\'", $msg); //escape single quotes
! $js .= " alert('$msg');\n";
}
$js .= "</script>\n";
***************
*** 193,196 ****
--- 209,230 ----
}
+ /**
+ * Returns JS code that will open a popup window
+ * for each window in the list popup_windows
+ */
+ function popup_windows_to_js()
+ {
+ if (sizeof($this->popup_windows)==0) return '';
+
+ $js = "<script language='javascript'>\n";
+ while ( list($name,$data) = each ($this->popup_windows) )
+ {
+ $url = $data['url'];
+ $features = $data['features'];
+ $js .= " $name = window.open('$url', '$name', '$features');\n";
+ }
+ $js .= "</script>\n";
+ return $js;
+ }
function print_dbg_messages()
Index: class.Parser.php
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/parser/class.Parser.php,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C2 -d -r1.6.2.1 -r1.6.2.2
*** class.Parser.php 4 Oct 2004 09:09:32 -0000 1.6.2.1
--- class.Parser.php 8 Oct 2004 10:12:56 -0000 1.6.2.2
***************
*** 93,101 ****
{
global $webPage;
-
$webPage->tpl_file = $tpl_file;
- $webPage->tpl_collection = array();
- $webPage->rs_collection = array();
- $webPage->wb_collection = array();
$tpl = new MainTpl($tpl_file);
--- 93,97 ----
|