Index: /sandbox/workflow/branches/609/templateFile.php
===================================================================
--- /sandbox/workflow/branches/609/templateFile.php	(revision 1468)
+++ /sandbox/workflow/branches/609/templateFile.php	(revision 2223)
@@ -12,4 +12,5 @@
 if (empty($_SESSION))
 	exit(0);
-$GLOBALS['workflow']['factory']->getInstance('TemplateServer')->redirect();
+//$GLOBALS['workflow']['factory']->getInstance('TemplateServer')->redirect();
+Factory::getInstance('TemplateServer')->redirect();
 ?>
Index: /sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php
===================================================================
--- /sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php	(revision 2222)
+++ /sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php	(revision 2223)
@@ -49,6 +49,9 @@
 		/* registering allowed classes */
 		$this->registerFileInfo('WorkflowObjects', 'class.WorkflowObjects.inc.php', 'inc');
+		$this->registerFileInfo('TemplateServer', 'class.TemplateServer.inc.php', 'inc');
+		$this->registerFileInfo('workflow_smarty', 'class.workflow_smarty.inc.php', 'inc');
 
-		$this->registerFileInfo('db', 'x', 'inc', PHPGW_API_INC);
+		/* registering egw class example */
+		//$this->registerFileInfo('db', 'x', 'inc', PHPGW_API_INC);
 
 		/* ok. no more instances of this class.. */
Index: /sandbox/workflow/branches/609/lib/factory/Factory.php
===================================================================
--- /sandbox/workflow/branches/609/lib/factory/Factory.php	(revision 2222)
+++ /sandbox/workflow/branches/609/lib/factory/Factory.php	(revision 2223)
@@ -74,5 +74,5 @@
 
 			$args = func_get_args();
-			call_user_func_array(array(self::$_securedFactory, "getInstance"), $args);
+			return call_user_func_array(array(self::$_securedFactory, "getInstance"), $args);
 
 		}
@@ -85,7 +85,6 @@
 
 			$args = func_get_args();
-			call_user_func_array(array(self::$_unsecuredFactory, "getInstance"), $args);
+			return call_user_func_array(array(self::$_unsecuredFactory, "getInstance"), $args);
 		}
-
 	}
 
Index: /sandbox/workflow/branches/609/inc/class.ui_userinterface.inc.php
===================================================================
--- /sandbox/workflow/branches/609/inc/class.ui_userinterface.inc.php	(revision 2107)
+++ /sandbox/workflow/branches/609/inc/class.ui_userinterface.inc.php	(revision 2223)
@@ -45,5 +45,6 @@
 		$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['workflow']['title'];
 		$GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'workflow');
-		$smarty = CreateObject('workflow.workflow_smarty');
+		//$smarty = CreateObject('workflow.workflow_smarty');
+		$smarty = Factory::getInstance('workflow_smarty');
 
 		// Check if workflow config is ok
Index: /sandbox/workflow/branches/609/inc/common.inc.php
===================================================================
--- /sandbox/workflow/branches/609/inc/common.inc.php	(revision 2222)
+++ /sandbox/workflow/branches/609/inc/common.inc.php	(revision 2223)
@@ -12,11 +12,10 @@
 
 /**
- * Server base path. This constant must be defined by expresso itself.
- * Anyway, there are cases that we access Workflow directly; therefore
- * it must be defined somewhere...
- * @name PHPGW_SERVER_ROOT
+ * Server base path. This constant is somewhat simililar to
+ * 'PHPGW_SERVER_ROOT'. Nevertheless, there are cases that we
+ * access Workflow directly and it must be defined somewhere.
+ * @name EGW_SERVER_ROOT
  */
-if (!defined('PHPGW_SERVER_ROOT'))
-	define('PHPGW_SERVER_ROOT', $HTTP_SERVER_VARS['DOCUMENT_ROOT']);
+define('EGW_SERVER_ROOT', $HTTP_SERVER_VARS['DOCUMENT_ROOT']);
 
 /**
@@ -24,5 +23,5 @@
  * @name WF_SERVER_ROOT
  */
-define('WF_SERVER_ROOT', PHPGW_SERVER_ROOT.'/workflow/');
+define('WF_SERVER_ROOT', EGW_SERVER_ROOT.'/workflow/');
 
 /**
@@ -39,6 +38,6 @@
 
 
-if (file_exists(PHPGW_SERVER_ROOT . '/header.session.inc.php')) {
-	require_once PHPGW_SERVER_ROOT . '/header.session.inc.php';
+if (file_exists(EGW_SERVER_ROOT . '/header.session.inc.php')) {
+	require_once EGW_SERVER_ROOT . '/header.session.inc.php';
 }
 
@@ -54,16 +53,9 @@
 /* including common classes */
 require_once WF_LIB_ROOT . 'security/Security.php';
-//require_once WF_LIB_ROOT . 'factory/Factory.php';
+require_once WF_LIB_ROOT . 'factory/Factory.php';
 require_once WF_LIB_ROOT . 'factory/BaseFactory.php';
 require_once WF_LIB_ROOT . 'factory/WorkflowFactory.php';
 require_once WF_LIB_ROOT . 'factory/ProcessFactory.php';
 
-
-/* TODO - here we will still using that old and ugly factory */
-/* in a near future we should do things right.. */
-require_once WF_INC_ROOT . 'class.factory.inc.php';
-$GLOBALS['workflow']['factory'] = new Factory();
-$GLOBALS['workflow']['workflowObjects'] = $GLOBALS['workflow']['factory']->newInstance('WorkflowObjects');
-
-//$GLOBALS['workflow']['workflowObjects'] = Factory::getInstance('WorkflowObjects', 'asd', 123);
+$GLOBALS['workflow']['workflowObjects'] = Factory::getInstance('WorkflowObjects');
 ?>
