Changeset 9951
- Timestamp:
- 11/17/08 08:56:20 (2 months ago)
- Files:
-
- branches/0.8/jaws/html/include/Jaws.php (modified) (1 diff)
- branches/0.8/jaws/html/include/Jaws/EventShouter.php (modified) (2 diffs)
- branches/0.8/jaws/html/include/Jaws/Gadget.php (modified) (2 diffs)
- branches/0.8/jaws/html/include/Jaws/Layout.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/0.8/jaws/html/include/Jaws.php
r9932 r9951 97 97 $this->Registry->Init(); 98 98 $this->InstanceSession(); 99 $this->InstanceCache();100 99 101 100 $this->loadDefaults(); branches/0.8/jaws/html/include/Jaws/EventShouter.php
r9907 r9951 22 22 * @return boolean True if shouter was added, otherwise returns Jaws_Error 23 23 */ 24 function NewShouter($gadget, $call , $time)24 function NewShouter($gadget, $call) 25 25 { 26 26 $params = array(); 27 27 $params['gadget'] = $gadget; 28 28 $params['call'] = $call; 29 $params['time'] = $time;30 29 31 30 $sql = ' 32 31 INSERT INTO [[shouters]] 33 ([gadget], [event] , [event_time])32 ([gadget], [event]) 34 33 VALUES 35 ({gadget}, {call} , {time})';34 ({gadget}, {call})'; 36 35 37 36 $rs = $GLOBALS['db']->query($sql, $params); … … 81 80 * @return boolean True if shouter didn't returned a Jaws_Error, otherwise returns Jaws_Error 82 81 */ 83 function Shout($call, $param , $time = null)82 function Shout($call, $param) 84 83 { 85 if (is_null($time) || $time <= time()) { 86 $GLOBALS['app']->loadClass('Listener', 'Jaws_EventListener'); 87 $res = $GLOBALS['app']->Listener->Listen($call, $param); 88 } else { 89 $res = $this->NewShouter($param, $call, $time); 90 } 91 84 $GLOBALS['app']->loadClass('Listener', 'Jaws_EventListener'); 85 $res = $GLOBALS['app']->Listener->Listen($call, $param); 92 86 if (Jaws_Error::IsError($res)) { 93 87 return new Jaws_Error(_t('GLOBAL_ERROR_EVENTS_LISTENER_ERROR'), 'CORE'); branches/0.8/jaws/html/include/Jaws/Gadget.php
r9927 r9951 543 543 $GLOBALS['app']->ACL->deleteCacheFile($gadget); 544 544 545 //remove all cached actions files546 $GLOBALS['app']->Cache->delete($gadget);547 548 545 // After anything finished 549 546 $res = $GLOBALS['app']->Shouter->Shout('onAfterUninstallingGadget', $gadget); … … 726 723 // Commit all the recent core changes 727 724 $GLOBALS['app']->Registry->Commit('core'); 728 729 //remove all cached actions files730 $GLOBALS['app']->Cache->delete($gadget);731 725 732 726 // After anything finished branches/0.8/jaws/html/include/Jaws/Layout.php
r9925 r9951 78 78 79 79 /** 80 * Is gadget's action cacheable?81 * @var boolean82 * @access private83 */84 var $_IsCurrentActionCacheable = true;85 86 /**87 80 * Requested gadget's action 88 81 * … … 188 181 { 189 182 return !isset($this->_SectionAttributes['narrow']); 190 }191 192 /**193 * Is gadget's action cacheable?194 *195 * @access public196 * @return boolean197 */198 function IsCurrentActionCacheable()199 {200 return $this->_IsCurrentActionCacheable;201 }202 203 /**204 * Set is gadget's action cacheable?205 *206 * @access public207 * @return boolean208 */209 function SetCurrentActionCacheable($state = true)210 {211 $this->_IsCurrentActionCacheable = $state;212 183 } 213 184 … … 592 563 } else { 593 564 if ($requested === true) { 594 $request =& Jaws_Request::getInstance(); 595 $params = $request->getRawAll('get'); 596 unset($params['gadget'], $params['action']); 597 $output = $GLOBALS['app']->Cache->get($gadget, $action, $params); 598 if (is_null($output)) { 599 $this->SetCurrentActionCacheable(false); 600 $goGadget = $GLOBALS['app']->loadGadget($gadget, 'HTML'); 601 $goGadget->SetAction($action); 602 //$this->_Template->SetVariable('ELEMENT', $goGadget->Execute()); 603 $output = $goGadget->Execute(); 604 if ($this->IsCurrentActionCacheable()) { 605 $GLOBALS['app']->Cache->set($gadget, $action, $params, $output); 606 } 607 } 565 $goGadget = $GLOBALS['app']->loadGadget($gadget, 'HTML'); 566 $goGadget->SetAction($action); 567 //$this->_Template->SetVariable('ELEMENT', $goGadget->Execute()); 568 $output = $goGadget->Execute(); 608 569 } else { 609 570 preg_match_all('/^([a-z0-9]+)\((.*?)\)$/i', $action, $matches); … … 614 575 } 615 576 616 $output = $GLOBALS['app']->Cache->get($gadget, $action, $params); 617 if (is_null($output)) { 618 $this->SetCurrentActionCacheable(false); 619 $goGadget = $GLOBALS['app']->loadGadget($gadget, 'LayoutHTML'); 620 if (!Jaws_Error::isError($goGadget)) { 621 $GLOBALS['app']->Registry->LoadFile($gadget); 622 if (method_exists($goGadget, $action)) { 623 $output = $goGadget->$action($params); 624 if ($this->IsCurrentActionCacheable()) { 625 $GLOBALS['app']->Cache->set($gadget, $action, $params, $output); 626 } 627 } elseif (isset($GLOBALS['log'])) { 628 $GLOBALS['log']->Log(JAWS_LOG_ERR, "Action $action in $gadget's LayoutHTML dosn't exist."); 629 } 630 } else { 631 //$this->_Template->SetVariable('ELEMENT', ''); 632 if (isset($GLOBALS['log'])) { 633 $GLOBALS['log']->Log(JAWS_LOG_ERR, $gadget ." is missing the LayoutHTML. Jaws can't execute Layout " . 634 "actions if the file doesn't exists"); 635 } 577 $goGadget = $GLOBALS['app']->loadGadget($gadget, 'LayoutHTML'); 578 if (!Jaws_Error::isError($goGadget)) { 579 $GLOBALS['app']->Registry->LoadFile($gadget); 580 if (method_exists($goGadget, $action)) { 581 $output = $goGadget->$action($params); 582 } elseif (isset($GLOBALS['log'])) { 583 $GLOBALS['log']->Log(JAWS_LOG_ERR, "Action $action in $gadget's LayoutHTML dosn't exist."); 584 } 585 } else { 586 //$this->_Template->SetVariable('ELEMENT', ''); 587 if (isset($GLOBALS['log'])) { 588 $GLOBALS['log']->Log(JAWS_LOG_ERR, $gadget ." is missing the LayoutHTML. Jaws can't execute Layout " . 589 "actions if the file doesn't exists"); 636 590 } 637 591 }
