Update of /cvsroot/owp/owp/inc/startup
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17620/startup
Modified Files:
owp.inc
Log Message:
Made a part of html integration.
Moved some constants.
Created some default handlers.
Index: owp.inc
===================================================================
RCS file: /cvsroot/owp/owp/inc/startup/owp.inc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** owp.inc 19 Apr 2006 02:26:32 -0000 1.2
--- owp.inc 20 Apr 2006 00:45:44 -0000 1.3
***************
*** 22,26 ****
*/
! /**Contains function, called by smarty compiler for owp tags
* @author Artem Sidorenko <sc...@us...>
* @version $Id$
--- 22,26 ----
*/
! /**Contains function, called by smarty for owp tags
* @author Artem Sidorenko <sc...@us...>
* @version $Id$
***************
*** 35,38 ****
--- 35,69 ----
@ define('owp_handlers_get_php','_get_php');
+ /**Name of onshow event, called before collecting HTML code*/
+ @ define('owp_events_onshow','onshow');
+
+ /**Name of input data handler*/
+ @ define('owp_handlers_input','_process_input');
+
+ /**Creates owp page and object if needed
+ * @param string $file_name path to the template or owp file
+ * @param Smarty $smarty Smarty object
+ * @param bool $template shows if $file_name is a path to template file
+ * @return string path to the owp file
+ */
+ function create_owp($file_name,&$smarty,$template=true){
+ //if owp object was not created yet
+ if(!is_object($smarty->owp)){
+ include_once 'towp.class';
+ $smarty->owp = &new towp($_SESSION);
+ //creating main object, todo!
+ }//\\if
+
+ //building path to the owp file
+ if($template)
+ $file_name = $smarty->owp->get_owp_file_path($file_name);
+
+ //creating page
+ $smarty->owp->create_page($file_name);
+
+ return $file_name;
+ }//\\create_owp
+
+
/**This is a handler for carrying about owp tags in Smarty
* @param bool $open is it an open or close tag?
***************
*** 47,58 ****
if($open&&empty($params)){//first init tag
-
- //if owp object was not created yet
- if(!is_object($smarty->parent->owp)){
- include_once 'towp.class';
- $smarty->parent->owp = &new towp($_SESSION);
- //creating main object, todo!
- }//\\if
-
//file name
$params = array('resource_name'=>$smarty->_current_file);
--- 78,81 ----
***************
*** 60,70 ****
$file_name = $params['resource_name'];
! //loading page data
! $page_name = $smarty->parent->owp->create_page_using_template($file_name);
!
//reseting our push array to page name
$push_array = array($page_name);
! return '';//nothing to return for init tag
}//\\if
--- 83,94 ----
$file_name = $params['resource_name'];
! //creating owp page
! $owp_file = create_owp($file_name,$smarty->parent);
! $page_name = $smarty->parent->owp->get_class_name($owp_file);//our page name
!
//reseting our push array to page name
$push_array = array($page_name);
! return '<?php include_once "owp.inc";start_owp("'.$owp_file.'",$this);?>';//returning call of owp start function
}//\\if
***************
*** 78,86 ****
#processing current element
//building access string
! $access_string = implode('->',$push_array);
$rarray = array();//init
//I know, but without it won't work:-/
! eval('$rarray = $smarty->parent->owp->elements->'.$access_string.'->'.$element.'->'.owp_handlers_get_php.'($open,$access_string);');
//checking if we need to push this tag
--- 102,110 ----
#processing current element
//building access string
! $access_string = implode('->',$push_array).'->'.$element;
$rarray = array();//init
//I know, but without it won't work:-/
! eval('$rarray = $smarty->parent->owp->elements->'.$access_string.'->'.owp_handlers_get_php.'($open,$access_string);');
//checking if we need to push this tag
***************
*** 99,104 ****
return $rarray['code'];
-
}//\\process_owp
?>
\ No newline at end of file
--- 123,138 ----
return $rarray['code'];
}//\\process_owp
+ /**Function starts OOP mode
+ * @param string $file_name path to the owp file
+ * @param Smarty $smarty object of smarty
+ */
+ function start_owp($file_name,&$smarty){
+ //creating owp page
+ create_owp($file_name,$smarty,false);
+ //processing input data
+ //onshow events
+ }//\\start_owp
+
?>
\ No newline at end of file
|