Пример #1
0
    /**
     * Returns the HTML needed to include the ExtJS ux class.
     *
     * = Examples =
     *
     * <code title="Simple">
     * {namespace ext=F3\ExtJS\ViewHelpers}
     *  ...
     * <ext:ux name="StatusBar"/>
     * </code>
     * Renders the script tag to include the StatusBar ux class.
     *
     * @param string $name The name of the ux class
     * @return string HTML needed to include ExtJS
     * @author Karsten Dambekalns <*****@*****.**>
     * @api
     */
    public function render($name)
    {
        $baseUri = $this->resourcePublisher->getStaticResourcesWebBaseUri() . 'Packages/ExtJS/';
        return '
<script type="text/javascript" src="' . $baseUri . 'JavaScript/ux/' . $name . '.js"></script>
';
    }
 /**
  * Prepares a mirror of public package resources that is accessible through
  * the web server directly.
  *
  * @param array $activePackages
  * @return void
  * @author Karsten Dambekalns <*****@*****.**>
  */
 public function publishPublicPackageResources(array $activePackages)
 {
     if ($this->settings['resource']['publishing']['detectPackageResourceChanges'] === FALSE && $this->statusCache->has('packageResourcesPublished')) {
         return;
     }
     foreach ($activePackages as $packageKey => $package) {
         $this->resourcePublisher->publishStaticResources($package->getResourcesPath() . 'Public/', 'Packages/' . $packageKey . '/');
     }
     if (!$this->statusCache->has('packageResourcesPublished')) {
         $this->statusCache->set('packageResourcesPublished', 'y', array(\F3\FLOW3\Cache\Frontend\FrontendInterface::TAG_PACKAGE));
     }
 }
    /**
     * Returns the HTML needed to include ExtJS, that is, CSS and JS includes.
     *
     * = Examples =
     *
     * <code title="Simple">
     * {namespace ext=F3\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
     * @return string HTML needed to include ExtJS
     * @author Karsten Dambekalns <*****@*****.**>
     * @api
     */
    public function render($theme = 'xtheme-blue', $debug = FALSE)
    {
        $baseUri = $this->resourcePublisher->getStaticResourcesWebBaseUri() . 'Packages/ExtJS/';
        $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;
    }
 /**
  * Render the URI to the resource. The filename is used from child content.
  *
  * @param string $path The path and filename of the resource (relative to Public resource directory of the package)
  * @param string $package Target package key. If not set, the current package key will be used
  * @param \F3\FLOW3\Resource\Resource $resource If specified, this resource object is used instead of the path and package information
  * @param string $title If specified, this title is added to the resource uri to make it more descriptive
  * @return string The absolute URI to the resource
  * @author Robert Lemke <*****@*****.**>
  * @api
  */
 public function render($path = NULL, $package = NULL, $resource = NULL, $title = '')
 {
     if ($resource === NULL) {
         if ($path === NULL) {
             return '!!! No path specified in uri.resource view helper !!!';
         }
         $uri = $this->resourcePublisher->getStaticResourcesWebBaseUri() . 'Packages/' . ($package === NULL ? $this->controllerContext->getRequest()->getControllerPackageKey() : $package) . '/' . $path;
     } else {
         $uri = $this->resourcePublisher->getPersistentResourceWebUri($resource, $title);
         if ($uri === FALSE) {
             $uri = $this->resourcePublisher->getStaticResourcesWebBaseUri() . 'BrokenResource';
         }
     }
     return $uri;
 }