Changeset 1239


Ignore:
Timestamp:
07/31/09 15:48:07 (15 years ago)
Author:
niltonneto
Message:

Ticket #593 - Verificação de ambiente na entrada do workflow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/workflow/inc/class.ui_userinterface.inc.php

    r795 r1239  
    2727                'printArea' => true 
    2828        ); 
    29          
     29 
    3030        /** 
    3131         * Constructor 
     
    3636 
    3737        } 
    38          
     38 
    3939        /** 
    4040         * Draw the user interface 
    41          * @param int $tabIndex  
     41         * @param int $tabIndex 
    4242         */ 
    4343        function draw($tabIndex = null) 
    4444        { 
    45                 $this->set_wf_session(); 
    46  
    47                 if (is_null($tabIndex)) 
    48                         $tabIndex = 1; 
    49  
    5045                $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['workflow']['title']; 
    5146                $GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'workflow'); 
    5247                $smarty = CreateObject('workflow.workflow_smarty'); 
     48 
     49                // Check if workflow config is ok 
     50                if (count($errors = $this->_checkWorkflowConfig())) 
     51                { 
     52                        $smarty->assign('header', $smarty->expressoHeader); 
     53                        $smarty->assign('footer', $smarty->expressoFooter); 
     54                        $smarty->assign('errors', $errors); 
     55                        $smarty->display('notworking.tpl'); 
     56                        return false; 
     57                } 
     58 
     59                $this->set_wf_session(); 
     60 
     61                if (is_null($tabIndex)) 
     62                        $tabIndex = 1; 
    5363 
    5464                $javaScripts = $this->get_common_js(); 
     
    8999                $smarty->assign('tabs', $tabs); 
    90100                $smarty->assign('startTab', $tabIndex); 
     101 
    91102                $smarty->display('userinterface.tpl'); 
     103        } 
     104 
     105        /** 
     106         * Check if workflow config is ok 
     107         * @param void 
     108         * @access private 
     109         * @return array Errors that were found 
     110         */ 
     111        private function _checkWorkflowConfig() 
     112        { 
     113                $errors = array(); 
     114 
     115                // Get a connection to db workflow and galaxia (module) 
     116                if ($GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Error) 
     117                        $errors[] = 'Unable to connect to database Workflow'; 
     118 
     119                if ($errormsg = $GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Error) 
     120                        $errors[] = 'Unable to connect to database Galaxia'; 
     121 
     122                return $errors; 
    92123        } 
    93124 
Note: See TracChangeset for help on using the changeset viewer.