public function doGet(WebAppRequest $req, WebAppResponse $res)
 {
     // Start Innomatic and Tenant
     $innomatic = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     $innomatic->setInterface(\Innomatic\Core\InnomaticContainer::INTERFACE_EXTERNAL);
     $root = \Innomatic\Core\RootContainer::instance('\\Innomatic\\Core\\RootContainer');
     $innomatic_home = $root->getHome() . 'innomatic/';
     $innomatic->bootstrap($innomatic_home, $innomatic_home . 'core/conf/innomatic.ini');
     $innomatic->startDomain(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getName());
     $request_uri = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getRequest()->getUrlPath(true) . '/_xajax/call.xajax';
     $xajax = Xajax::instance('Xajax', $request_uri);
     // Set debug mode
     if ($innomatic->getState() == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) {
         $xajax->debugOn();
     }
     $xajax->setLogFile($innomatic->getHome() . 'core/log/ajax.log');
     $cfg = XajaxConfig::getInstance(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp(), \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome() . 'core/conf/ajax.xml');
     if (isset($cfg->functions)) {
         foreach ($cfg->functions as $name => $functionData) {
             $xajax->registerExternalFunction(array($name, $functionData['classname'], $functionData['method']), $functionData['classfile']);
         }
     }
     $xajax->processRequests();
 }
Exemple #2
0
 public function setPredefinedTags($block)
 {
     // Base tags
     $block->set('receiver', $this->context->getRequest()->getUrlPath(true));
     $block->set('baseurl', $this->context->getRequest()->getUrlPath(false) . '/');
     $block->set('module', $this->getModule());
     $block->set('page', $this);
     // Internal page name
     $block->set('page_name', $this->getName());
     // Set page parameters as tags
     $pageParams = $this->getParameters();
     foreach ($pageParams as $paramName => $paramValue) {
         $block->set('page_' . $paramName, $paramValue);
     }
     // Ajax support
     $xajax = \Innomatic\Ajax\Xajax::instance('\\Innomatic\\Ajax\\Xajax', $this->context->getRequest()->getUrlPath(false) . '/ajax/');
     $xajax->ajaxLoader = false;
     $xajax->setLogFile($this->context->getHome() . 'core/log/ajax.log');
     // Set debug mode
     if (\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getState() == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) {
         $xajax->debugOn();
     }
     // Register Ajax calls parsing the ajax.xml configuration file
     if (file_exists(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome() . 'core/conf/ajax.xml')) {
         $cfg = \Innomatic\Ajax\XajaxConfig::getInstance(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp(), \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome() . 'core/conf/ajax.xml');
         if (isset($cfg->functions)) {
             foreach ($cfg->functions as $name => $functionData) {
                 $xajax->registerExternalFunction(array($name, $functionData['classname'], $functionData['method']), $functionData['classfile']);
             }
         }
     }
     // Build the base javascript for ajax
     $xajax_js = $xajax->getJavascript($this->context->getRequest()->getUrlPath(false) . '/' . 'shared/javascript', 'xajax.js');
     // Setup calls.
     if ($this->context->countRegisteredAjaxSetupCalls() > 0) {
         $setup_calls = $this->context->getRegisteredAjaxSetupCalls();
         $xajax_js .= '<script type="text/javascript">' . "\n";
         foreach ($setup_calls as $call) {
             $xajax_js .= $call . ";\n";
         }
         $xajax_js .= '</script>' . "\n";
     }
     $block->set('xajax_js', $xajax_js);
     return $this;
 }