Ignore:
Timestamp:
03/29/10 14:46:01 (14 years ago)
Author:
pedroerp
Message:

Ticket #609 - Merged 2197:2356 /sandbox/workflow/branches/609/ em /sandbox/workflow/trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/workflow/trunk/inc/class.run_activity.inc.php

    r2072 r2372  
    1010        \**************************************************************************/ 
    1111 
     12        require_once(dirname(__FILE__) . SEP . 'common.inc.php');                                /* including common deifinitions */ 
    1213        require_once(dirname(__FILE__) . SEP . 'class.WorkflowUtils.inc.php'  ); /* superclass source code       */ 
    1314        require_once(dirname(__FILE__) . SEP . 'class.basecontroller.inc.php' ); /* module controller            */ 
    1415        require_once(dirname(__FILE__) . SEP . 'class.basemodel.inc.php'      ); /* module logic                 */ 
    15         require_once(dirname(__FILE__) . SEP . 'class.process_factory.inc.php'); /* module process factory class */ 
    16         require_once(dirname(__FILE__) . SEP . 'class.utils.security.php'     ); /* sanitizes input data         */ 
    1716 
    1817        /** 
     
    206205                { 
    207206                        parent::WorkflowUtils(); 
    208                         $this->runtime          = CreateObject('workflow.workflow_wfruntime'); 
     207 
     208                        /** 
     209                         * We should always use newInstance to instantiate 
     210                         * 'workflow_wfruntime' 
     211                         */ 
     212                        $this->runtime                  = &Factory::newInstance('workflow_wfruntime'); 
    209213                        $this->runtime->setDebug(_DEBUG); 
    210                         //$this->base_activity  = CreateObject('workflow.workflow_baseactivity'); 
    211                         //$this->process                = CreateObject('workflow.workflow_process'); 
    212                         $this->GUI              = CreateObject('workflow.workflow_gui'); 
    213                         $this->categories       = CreateObject('phpgwapi.categories'); 
    214  
    215                         $this->workflowSmarty = CreateObject('workflow.workflow_smarty', false); 
     214                        //$this->base_activity  = Factory::getInstance('workflow_baseactivity'); 
     215                        //$this->process                = Factory::getInstance('workflow_process'); 
     216                        $this->GUI                              = &Factory::getInstance('workflow_gui'); 
     217                        $this->categories               = &Factory::getInstance('categories'); 
     218 
     219                        $this->workflowSmarty   = &Factory::getInstance('workflow_smarty', false); 
    216220                        // TODO: open a new connection to the database under a different username to allow privilege handling on tables 
    217221                        /* CELEPAR */ 
     
    301305                        $this->process_version  = $this->process->getVersion(); 
    302306                        $this->activity_name    = $activity->getName(); 
    303                         $this->user_name        = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']); 
     307                        $this->user_name                = $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']); 
    304308                        $this->view_activity    = $this->GUI->gui_get_process_view_activity($this->process_id); 
    305309 
     
    318322                        $GLOBALS['workflow']['wf_workflow_path']                        = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 
    319323                        $GLOBALS['workflow']['wf_resources_path']                       = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file='; 
    320                         $GLOBALS['workflow']['wf_default_resources_path']       = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink('processes'); 
    321                         $GLOBALS['workflow']['wf_workflow_resources_path']      = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink(''); 
     324                        $GLOBALS['workflow']['wf_default_resources_path']       = Factory::getInstance('TemplateServer')->generateLink('processes'); 
     325                        $GLOBALS['workflow']['wf_workflow_resources_path']      = Factory::getInstance('TemplateServer')->generateLink(''); 
    322326                        $GLOBALS['workflow']['wf_activity_url']                         = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id; 
    323                         $GLOBALS['workflow']['wf_user_cnname']                          = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
     327                        $GLOBALS['workflow']['wf_user_cnname']                          = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
    324328                        $GLOBALS['workflow']['wf_back_link']                            = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 
    325329                        $GLOBALS['workflow']['wf_js_path']                                      = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; 
     
    376380 
    377381                                /* check some permissions */ 
    378                                 if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || ($GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($newUser) === false)) 
     382                                if (($newUser == '*') || (!$this->runtime->checkUserRun($newUser)) || (Factory::getInstance('WorkflowLDAP')->getName($newUser) === false)) 
    379383                                { 
    380384                                        $_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups; 
     
    386390                                        return false; 
    387391                                } 
    388                                 $smarty = CreateObject('workflow.process_smarty'); 
     392                                $smarty = Factory::getInstance('process_smarty'); 
    389393                        } 
    390394 
     
    399403                                /* #celepar# smarty code*/ 
    400404 
    401                                 $smarty = CreateObject('workflow.process_smarty'); 
     405                                $smarty = Factory::getInstance('process_smarty'); 
    402406 
    403407                                $smarty->template_dir  = GALAXIA_PROCESSES.SEP.$this->process->getNormalizedName().SEP.'code'.SEP.'templates'; 
     
    438442                        $env['instance']      =& $instance;                        //process manager instance 
    439443                        $env['activity']      =& $activity;                        //activity manager instance 
    440                         $security             =& new SecurityUtils();              //input sanitizer class 
     444                        $security             =& Factory::newInstance('SecurityUtils');              //input sanitizer class 
    441445                        $env['request']       =& $security->process($_REQUEST);    //sanitizes input data from client 
    442                         $env['factory']       =& new ProcessFactory();             //instantiation controller class 
     446                        //$env['factory']       =& new ProcessFactory();             //instantiation controller class 
     447                        $env['factory']       =& Factory::getInstance('ProcessWrapperFactory');  //instantiation controller class 
    443448                        $env['natural']           =& wf_create_object('wf_natural');   //data access object instance for mainframe 
    444449                        /* END WORKFLOW MVC SETTINGS */ 
     
    472477 
    473478                        /* activate the security policy */ 
    474                         $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     479                        Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     480 
     481                        /** 
     482                         * XXX 
     483                         * here we are going to use our new Security static class. 
     484                         * From now, the factory frontend (static) will forward 
     485                         * the messages for the process factory instead of Workflow 
     486                         * factory. 
     487                         * XXX 
     488                        */ 
     489                        Security::enable(); 
    475490 
    476491                        /* include the files */ 
     
    661676                        $GLOBALS['workflow']['wf_workflow_path']                        = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'; 
    662677                        $GLOBALS['workflow']['wf_resources_path']                       = $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file='; 
    663                         $GLOBALS['workflow']['wf_default_resources_path']       = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink('processes'); 
    664                         $GLOBALS['workflow']['wf_workflow_resources_path']      = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateLink(''); 
     678                        $GLOBALS['workflow']['wf_default_resources_path']       = Factory::getInstance('TemplateServer')->generateLink('processes'); 
     679                        $GLOBALS['workflow']['wf_workflow_resources_path']      = Factory::getInstance('TemplateServer')->generateLink(''); 
    665680                        $GLOBALS['workflow']['wf_activity_url']                         = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id; 
    666                         $GLOBALS['workflow']['wf_user_cnname']                          = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
     681                        $GLOBALS['workflow']['wf_user_cnname']                          = Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']); 
    667682                        $GLOBALS['workflow']['wf_back_link']                            = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1'; 
    668683                        $GLOBALS['workflow']['wf_js_path']                                      = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode'; 
     
    699714                        $env['instance']      =& $instance;                        //process manager instance 
    700715                        $env['activity']      =& $activity;                        //activity manager instance 
    701                         $security             =& new SecurityUtils();              //input sanitizer class 
     716                        $security             =& Factory::newInstance('SecurityUtils'); //input sanitizer class 
    702717                        $env['request']       =& $security->process($_REQUEST); //sanitizes input data from client 
    703                         $env['factory']       =& new ProcessFactory();                     //instantiation controller class 
     718                        //$env['factory']       =& new ProcessFactory();                           //instantiation controller class 
     719                        $env['factory']       =& Factory::newInstance('ProcessWrapperFactory');  //instantiation controller class 
    704720                        $env['natural']           =& wf_create_object('wf_natural');   //data access object instance for mainframe 
    705721                        /* END WORKFLOW MVC SETTINGS */ 
     
    712728 
    713729                        /* activate the security policy */ 
    714                         $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     730                        Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy(); 
     731 
     732                        /** 
     733                         * XXX 
     734                         * here we are going to use our new Security static class. 
     735                         * From now, the factory frontend (static) will forward 
     736                         * the messages for the process factory instead of Workflow 
     737                         * factory. Note that this is the same comment as the previous 
     738                         * function... boooring.. =} 
     739                         * XXX 
     740                        */ 
     741                        Security::enable(); 
    715742 
    716743                        $GLOBALS['workflow_env'] = &$env; 
    717                         $nc = new NanoController(); 
     744                        $nc = &Factory::newInstance('NanoController'); 
    718745                        $nc->setClassPath(GALAXIA_PROCESSES . SEP . $this->process->getNormalizedName(). SEP . 'code'); 
    719746                        $nc->iterateOverVirtualRequests(); 
Note: See TracChangeset for help on using the changeset viewer.