Changeset 1495

Show
Ignore:
Timestamp:
11/15/2006 05:54:00 PM (2 years ago)
Author:
wei
Message:

add custom plugin path for THtmlArea

Location:
trunk/framework/Web
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/framework/Web/TAssetManager.php

    r1398 r1495  
    220220         * @todo a generic solution to ignore certain directories and files 
    221221         */ 
    222         protected function copyDirectory($src,$dst) 
     222        public function copyDirectory($src,$dst) 
    223223        { 
    224224                if(!is_dir($dst)) 
  • trunk/framework/Web/UI/WebControls/THtmlArea.php

    r1398 r1495  
    125125        public function __construct() 
    126126        { 
    127                 $this->setWidth('450px'); 
     127                $this->setWidth('470px'); 
    128128                $this->setHeight('250px'); 
    129129        } 
     
    210210        { 
    211211                $this->setViewState('Options', $value, ''); 
     212        } 
     213 
     214        /** 
     215         * @param string path to custom plugins to be copied. 
     216         */ 
     217        public function setCustomPluginPath($value) 
     218        { 
     219                $this->setViewState('CustomPluginPath', $value); 
     220        } 
     221 
     222        /** 
     223         * @return string path to custom plugins to be copied. 
     224         */ 
     225        public function getCustomPluginPath() 
     226        { 
     227                return $this->getViewState('CustomPluginPath'); 
    212228        } 
    213229 
     
    259275                if($tarfile===null || $md5sum===null) 
    260276                        throw new TConfigurationException('htmlarea_tarfile_invalid'); 
    261                 return $this->getApplication()->getAssetManager()->publishTarFile($tarfile, $md5sum); 
     277                $url = $this->getApplication()->getAssetManager()->publishTarFile($tarfile, $md5sum); 
     278                $this->copyCustomPlugins($url); 
     279                return $url; 
     280        } 
     281 
     282        protected function copyCustomPlugins($url) 
     283        { 
     284                if($plugins = $this->getCustomPluginPath()) 
     285                { 
     286                        $assets = $this->getApplication()->getAssetManager(); 
     287                        $path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); 
     288                        $dest = $assets->getBasePath().'/'.basename($url).'/tiny_mce/plugins/'; 
     289                        if(!is_dir($dest) || $this->getApplication()->getMode()!==TApplicationMode::Performance) 
     290                                $assets->copyDirectory($path, $dest); 
     291                } 
    262292        } 
    263293 
     
    296326        { 
    297327                $options = array(); 
    298                 $substrings = preg_split('/\n|,\n/', trim($string)); 
     328                $substrings = preg_split('/,\s*\n|\n/', trim($string)); 
    299329                foreach($substrings as $bits) 
    300330                { 
    301                         $option = explode(":",$bits); 
     331                        $option = explode(":",$bits,2); 
     332 
    302333                        if(count($option) == 2) 
    303334                                $options[trim($option[0])] = trim(preg_replace('/\'|"/','',  $option[1]));