示例#1
0
    /**
     * Returns the HTML needed to include ExtJS, that is, CSS and JS includes.
     *
     * = Examples =
     *
     * <code title="Simple">
     * {namespace ext=TYPO3\ExtJS\ViewHelpers}
     *  ...
     * <ext:include/>
     * </code>
     * Renders the script and link tags needed to include everything needed to
     * use ExtJS.
     *
     * <code title="Use a specific theme">
     * <ext:include theme="xtheme-gray"/>
     * </code>
     *
     * @param string $theme The theme to include, simply the name of the CSS
     * @param boolean $debug Whether to use the debug version of ExtJS
     * @param boolean $includeStylesheets Include ExtJS CSS files if true
     * @return string HTML needed to include ExtJS
     * @api
     */
    public function render($theme = 'xtheme-blue', $debug = NULL, $includeStylesheets = TRUE)
    {
        if ($debug === NULL) {
            $debug = $this->objectManager->getContext()->isDevelopment() ?: FALSE;
        }
        $baseUri = $this->resourcePublisher->getStaticResourcesWebBaseUri() . 'Packages/TYPO3.ExtJS/';
        $output = '';
        if ($includeStylesheets) {
            $output .= '
<link rel="stylesheet" href="' . $baseUri . 'CSS/ext-all-notheme.css" />
<link rel="stylesheet" href="' . $baseUri . 'CSS/' . $theme . '.css" />';
        }
        if ($debug) {
            $output .= '
<script type="text/javascript" src="' . $baseUri . 'JavaScript/adapter/ext/ext-base-debug.js"></script>
<script type="text/javascript" src="' . $baseUri . 'JavaScript/ext-all-debug.js"></script>';
        } else {
            $output .= '
<script type="text/javascript" src="' . $baseUri . 'JavaScript/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="' . $baseUri . 'JavaScript/ext-all.js"></script>';
        }
        $output .= '
<script type="text/javascript">
	Ext.BLANK_IMAGE_URL = \'' . $baseUri . 'images/default/s.gif\';
	Ext.FlashComponent.EXPRESS_INSTALL_URL = \'' . $baseUri . 'Flash/expressinstall.swf\';
	Ext.chart.Chart.CHART_URL = \'' . $baseUri . 'Flash/chart.swf\';
</script>
';
        return $output;
    }
 /**
  * @return void
  */
 public function initializeObject()
 {
     // flush routing caches if in Development context & routing settings changed
     if ($this->objectManager->getContext()->isDevelopment() && $this->routeCache->get('routingSettings') !== $this->routingSettings) {
         $this->flushCaches();
         $this->routeCache->set('routingSettings', $this->routingSettings);
     }
 }
 /**
  * TODO: Document this Method! ( assignVariables )
  */
 public function preToolbarRendering()
 {
     $memoryUsage = memory_get_peak_usage(TRUE) / 1024 / 1024;
     $memoryUsage = number_format($memoryUsage, 1) . ' MB';
     \Debug\Toolbar\Service\Collector::getModule('Environment')->getToolbar()->addIcon('info-sign')->addText($memoryUsage)->getPopup()->addTable(array('PHP Version' => PHP_VERSION, 'Flow Context' => $this->objectManager->getContext(), 'Flow Version' => FLOW_VERSION_BRANCH))->getPanel()->addTable(array('PHP Version' => PHP_VERSION, 'Flow Context' => $this->objectManager->getContext(), 'Flow Version' => FLOW_VERSION_BRANCH));
     return;
     #$configurations = array();
     #foreach ($configurations as $configurationName => $configurationConstant) {
     #    $configuration = $this->configurationManager->getConfiguration($configurationConstant);
     #    $configurations[$configurationName] = \Symfony\Component\Yaml\Yaml::dump($configuration, 10);
     #}
     #$configurations["Constants"] = \Symfony\Component\Yaml\Yaml::dump(get_defined_constants(), 10);
     #$this->view->assign('configurations', $configurations);
 }
 /**
  * @return SubProcess
  */
 protected function getSubProcess()
 {
     if ($this->subProcess === NULL) {
         /** @var CacheManager $cacheManager */
         $cacheManager = $this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager');
         if ($cacheManager->hasCache('Flow_Security_Policy_Privilege_Method')) {
             $cacheManager->getCache('Flow_Security_Policy_Privilege_Method')->flush();
         }
         $objectConfigurationCache = $cacheManager->getCache('Flow_Object_Configuration');
         $objectConfigurationCache->remove('allAspectClassesUpToDate');
         $objectConfigurationCache->remove('allCompiledCodeUpToDate');
         $cacheManager->getCache('Flow_Object_Classes')->flush();
         $this->subProcess = new SubProcess($this->objectManager->getContext());
     }
     return $this->subProcess;
 }
 /**
  * Call the render() method and handle errors.
  *
  * @return string the rendered ViewHelper
  * @throws Exception
  */
 protected function callRenderMethod()
 {
     $renderMethodParameters = array();
     /** @var $argumentDefinition ArgumentDefinition */
     foreach ($this->argumentDefinitions as $argumentName => $argumentDefinition) {
         if ($argumentDefinition->isMethodParameter()) {
             $renderMethodParameters[$argumentName] = $this->arguments[$argumentName];
         }
     }
     try {
         return call_user_func_array(array($this, 'render'), $renderMethodParameters);
     } catch (Exception $exception) {
         if (!$this->objectManager->getContext()->isProduction()) {
             throw $exception;
         } else {
             $this->systemLogger->log('An Exception was captured: ' . $exception->getMessage() . '(' . $exception->getCode() . ')', LOG_ERR, 'TYPO3.Fluid', get_class($this));
             return '';
         }
     }
 }
 /**
  * @param ComponentContext $componentContext
  * @return void
  */
 public function handle(ComponentContext $componentContext)
 {
     $httpResponse = $componentContext->getHttpResponse();
     $httpResponse->setHeader($this->options['headerName'], $this->objectManager->getContext()->__toString());
 }