예제 #1
0
파일: iviewer.php 프로젝트: rzamarripa/ase
    public function registerClientScripts()
    {
        //> .register js file;
        $this->cs->registerCoreScript('jquery')->registerScriptFile($this->baseUrl . '/jqueryui.js', CClientScript::POS_END);
        $this->cs->registerCoreScript('jquery')->registerScriptFile($this->baseUrl . '/jquery.iviewer.js', CClientScript::POS_END);
        $this->cs->registerCoreScript('jquery')->registerScriptFile($this->baseUrl . '/jquery.mousewheel.js', CClientScript::POS_END);
        if (empty($this->cssFile)) {
            $this->cs->registerCssFile($this->baseUrl . '/jquery.iviewer.css');
        } else {
            $this->cs->registerCssFile($this->cssFile);
        }
        if (empty($this->selector)) {
            // manually use it ?
            return $this;
        }
        if (empty($this->jsHandlerVar)) {
            $this->jsHandlerVar = 'iviewerHandler';
        }
        $jsCode = '';
        //> handle some settings
        $options = CJavaScript::encode($this->options);
        //>  the js code for setup
        $jsCode .= <<<SETUP
        var {$this->jsHandlerVar}=\$("{$this->selector}").iviewer({$options});
SETUP;
        //> register jsCode
        $this->cs->registerScript(__CLASS__ . '#' . $this->getId(), $jsCode, CClientScript::POS_READY);
        return $this;
    }
예제 #2
0
 /**
  * Init widget
  */
 public function init()
 {
     $assetsUrl = Yii::app()->assetManager->publish(dirname(__FILE__) . '/assets', false, -1, YII_DEBUG);
     $this->cs = Yii::app()->getClientScript();
     $this->cs->registerCoreScript('cookie');
     $this->cs->registerScriptFile($assetsUrl . '/jstree.js');
     $this->cs->registerCssFile($assetsUrl . '/themes/default/style.css');
 }
예제 #3
0
 /**
  * Init widget
  */
 public function init()
 {
     $this->assetsUrl = Yii::app()->assetManager->publish(dirname(__FILE__) . '/assets', false, -1, YII_DEBUG);
     $this->cs = Yii::app()->getClientScript();
     $this->cs->registerCoreScript('cookie');
     if (Yii::app()->request->isAjaxRequest) {
         Yii::app()->clientScript->scriptMap['jquery.js'] = false;
         Yii::app()->clientScript->scriptMap['cookie.js'] = false;
     }
     $this->cs->registerScriptFile($this->assetsUrl . '/jquery.jstree.js');
     $this->cs->registerCssFile($this->assetsUrl . "/themes/{$this->theme}/style.css");
 }
예제 #4
0
 /**
  * @return JTagIt
  */
 public function registerClientScripts()
 {
     $this->cs->registerCoreScript('jquery')->registerCoreScript('jquery.ui')->registerScriptFile($this->baseUrl . '/js/tag-it.js');
     //register the css file
     $this->cs->registerCssFile($this->baseUrl . '/css/jquery.tagit.css')->registerCssFile('http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/' . $this->theme . '/jquery-ui.css');
     return $this;
 }
 public function registerCssFile($name, $media = '')
 {
     if (in_array($name, $this->bannedCssFiles)) {
         return $this;
     }
     parent::registerCssFile($name, $media);
 }
 /**
  * {@inheritDoc}
  */
 public function registerCssFile($url, $media = '')
 {
     if ($this->isBundled($url)) {
         return $this;
     }
     return parent::registerCssFile($url, $media);
 }
예제 #7
0
 public function registerCssFile($url, $media = '')
 {
     if (!Yii::app()->request->isAjaxRequest) {
         return parent::registerCssFile($url, $media);
     } else {
         echo '<link rel="stylesheet" type="text/css" href="' . CHtml::encode($url) . '" media="' . $media . '" />';
         return $this;
     }
 }
예제 #8
0
 public function registerCssFile($url, $media = '')
 {
     //if the file extension is .less, use the lessparser.
     $file_extension = end(explode('.', $url));
     if ($file_extension == 'less') {
         $url = $this->compileLess($url, false);
     }
     //run the parent method to parse the less/css file like Yii normally does.
     return parent::registerCssFile($url, $media);
 }
예제 #9
0
 /**
  * Registers a Css file based in a less file
  * @param string $url URL of the Less file
  * @param string $media media that the Less file should be applied to. If empty, it means all media types.
  * @param string $path path to save css file if diferent from the path defined in options 
  * (Ex: Yii::app()->theme->baseUrl.'/css/' - to save in css folder under current theme)
  * Note: Folder must be writable
  * @return CClientScript the CClientScript object itself (to support method chaining, available since version 1.1.5).
  */
 public function registerLessFile($url, $media = '', $path = '')
 {
     $this->jLessOptions['type'] = 'file';
     $this->jLessOptions["url"] = $url;
     $this->jLessOptions["path"] = $path;
     $this->jLessOptions = CMap::mergeArray($this->_jLessOptions, $this->jLessOptions);
     $classa = "JLess\\vendors\\" . $this->jLessOptions[$this->jLessOptions['vendor']]['class'];
     $compiler = new $classa($this->jLessOptions);
     $compiler->compileFile();
     return parent::registerCssFile($compiler->getCss(), $media);
 }
예제 #10
0
 /**
  * Registers a CSS file
  * @param string $url URL of the CSS file
  * @param string $media media that the CSS file should be applied to. If empty, it means all media types.
  * @return YdClientScript the CClientScript object itself (to support method chaining, available since version 1.1.5).
  */
 public function registerCssFile($url, $media = '')
 {
     // do not load these scripts on ajax
     $ignoreAjax = array('yii.css', 'bootstrap-yii.css', 'bootstrap-yii.min.css', 'bootstrap-responsive.css', 'bootstrap-responsive.min.css', 'bootstrap.no-responsive.css', 'bootstrap.no-responsive.min.css', 'bootstrap.css', 'bootstrap.min.css', 'font-awesome.css', 'font-awesome.min.css', 'jquery-ui-bootstrap.css', 'jquery-ui-bootstrap.min.css', 'bootstrap-notify.css', 'bootstrap-notify.min.css', 'jquery.qtip.css', 'app.css', 'yii-dressing.css');
     if (Yii::app()->request->isAjaxRequest) {
         foreach ($ignoreAjax as $ignore) {
             if ($this->endsWith($url, $ignore)) {
                 return $this;
             }
         }
     }
     return parent::registerCssFile($url, $media);
 }
예제 #11
0
 /**
  * @param string $path
  * @param string $media
  * @param string $defaultAssetUrl
  */
 public function registerCssFile($path, $media = '')
 {
     $parsedPath = $this->_parseAssetsPath($path);
     if ($parsedPath) {
         return parent::registerCssFile($this->_getFileUrl($parsedPath['assetsUrl'], $parsedPath['path']), $media === null ? '' : $media);
     } else {
         return parent::registerCssFile($path, $media);
     }
 }
예제 #12
0
 public function registerCssFile($url, $media = '')
 {
     if (substr($url, 0, 1) !== '/' && strpos($url, '://') === false) {
         $url = $this->_baseUrl . '/' . $url;
     }
     return parent::registerCssFile($url, $media);
 }
예제 #13
0
 /**
  * Register CSS file and add revision to url
  *
  * @param string $url
  * @param string $media
  * @return CClientScript
  */
 public function registerCssFile($url, $media = '')
 {
     $url = $url . $this->getRevision();
     return parent::registerCssFile($url, $media);
 }
예제 #14
0
 public function registerCssFile($url, $media = '')
 {
     $url = strpos($url, '?') === false ? $url . '?v=' . $this->cssVersion : $url . '&v=' . $this->cssVersion;
     return parent::registerCssFile($url, $media);
 }
예제 #15
0
 public function registerCssFile($url, $media = '')
 {
     return parent::registerCssFile($this->addAppVersion($url), $media);
 }
예제 #16
0
 /**
  * Registers the external javascript files
  */
 public function registerClientScripts()
 {
     if ($this->baseUrl === '') {
         throw new CException(Yii::t('EJqueryUiWidget', 'baseUrl must be set. This is done automatically by calling publishAssets()'));
     }
     $this->clientScript = Yii::app()->getClientScript();
     $this->clientScript->registerCoreScript('jquery');
     switch ($this->getCompression()) {
         case 'none':
             $this->clientScript->registerScriptFile($this->baseUrl . '/js/jquery-ui-1.7.1.custom.js');
             break;
         case 'packed':
             $this->clientScript->registerScriptFile($this->baseUrl . '/js/jquery-ui-1.7.1.custom.packed.js');
             break;
         default:
             $this->clientScript->registerScriptFile($this->baseUrl . '/js/jquery-ui-1.7.1.custom.min.js');
             break;
     }
     if ($this->getUseBundledStyleSheet()) {
         $this->clientScript->registerCssFile($this->baseUrl . '/css/' . $this->getTheme() . '/jquery-ui-1.7.1.custom.css');
     }
 }
예제 #17
0
 /**
  * Registers a CSS file
  * @param string $url URL of the CSS file
  * @param string $media media that the CSS file should be applied to. If empty, it means all media types.
  * @return YdClientScript the CClientScript object itself (to support method chaining, available since version 1.1.5).
  */
 public function registerCssFile($url, $media = '')
 {
     // do not load these scripts on ajax
     if (Yii::app()->request->isAjaxRequest) {
         foreach ($this->ignoreAjaxCssFile as $ignore) {
             if ($this->endsWith($url, $ignore)) {
                 return $this;
             }
         }
     } else {
         foreach ($this->ignoreCssFile as $ignore) {
             if ($this->endsWith($url, $ignore)) {
                 return $this;
             }
         }
     }
     return parent::registerCssFile($url, $media);
 }
예제 #18
0
 public function registerCssFile($url, $media = '', $order = 0)
 {
     $order = CPropertyValue::ensureInteger($order);
     if ($order) {
         $this->orderCssFiles[$url] = $order;
     }
     return parent::registerCssFile($url, $media);
 }
예제 #19
0
 public function registerCssFile($url, $media = '')
 {
     $url .= '?v=' . Yii::app()->params['version'];
     parent::registerCssFile($url, $media);
     return $this;
 }
예제 #20
0
 public function registerCssFile($url, $media = '')
 {
     parent::registerCssFile($this->absolutizeURL($url), $media);
 }
예제 #21
0
 public function registerCssFile($url, $media = '', $order = null)
 {
     $this->setOrder($url, $order);
     return parent::registerCssFile($url, $media);
 }