From d9f2cd39ecbc0249b7614a17ce4a575f1ce8aa7d Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 17 Feb 2006 01:08:16 +0000 Subject: Merged TTarAssetManager into TAssetManager. --- framework/Web/UI/TTarAssetManager.php | 74 ----------------------- framework/Web/UI/WebControls/THtmlArea.php | 68 ++++++++++----------- framework/Web/UI/WebControls/TTextHighlighter.php | 2 +- 3 files changed, 34 insertions(+), 110 deletions(-) delete mode 100644 framework/Web/UI/TTarAssetManager.php (limited to 'framework/Web/UI') diff --git a/framework/Web/UI/TTarAssetManager.php b/framework/Web/UI/TTarAssetManager.php deleted file mode 100644 index 4a05891e..00000000 --- a/framework/Web/UI/TTarAssetManager.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Revision: $ $Date: $ - * @package System.Web.UI - */ - -/** - * TTarAssetDeployer class. - * Publish a tar file by extracting its contents to the assets directory. - * Each tar file must be accomplished with its own MD5 check sum file. - * The MD5 file is published when the tar contents are successfully - * extracted to the assets directory. The presence of the MD5 file - * as published asset assumes that the tar file has already been extracted. - * - * Compressed tar files are not supported. - * - * @author Wei Zhuo - * @version $Revision: $ $Date: $ - * @package System.Web.UI - * @since 3.0 - */ -class TTarAssetManager extends TAssetManager -{ - /** - * Publish a tar file by extracting its contents to the assets directory. - * Each tar file must be accomplished with its own MD5 check sum file. - * The MD5 file is published when the tar contents are successfully - * extracted to the assets directory. The presence of the MD5 file - * as published asset assumes that the tar file has already been extracted. - * @param string tar filename - * @param string MD5 checksum for the corresponding tar file. - * @return string URL path to the directory where the tar file was extracted. - */ - public function publishTarFile($tarfile, $md5sum) - { - //if md5 file is published assume tar asset deployed - if(($md5Path = $this->getPublishedUrl($md5sum)) != null) - return dirname($md5Path); - - if(($fullpath=realpath($tarfile))===false) - throw new TIOException('unable_to_locate_tar_file', $tarfile); - else if(is_file($fullpath)) - { - $dir=$this->hash(dirname($fullpath)); - $destination = $this->getBasePath().'/'.$dir.'/'; - if($this->deployTarFile($fullpath, $destination)) - return dirname($this->publishFilePath($md5sum)); - } - - throw new TIOException('unable_to_publish_tar_file', $tarfile); - } - - /** - * Extracts the tar file to the destination directory. - * N.B Tar file must not be compressed. - * @param string tar file - * @param string path where the contents of tar file are to be extracted - * @return boolean true if extract successful, false otherwise. - */ - protected function deployTarFile($fullpath,$destination) - { - Prado::using('System.Data.TTarFileExtractor'); - $tar = new TTarFileExtractor($fullpath); - return $tar->extract($destination); - } -} - -?> \ No newline at end of file diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php index eb2c452f..d858a90f 100644 --- a/framework/Web/UI/WebControls/THtmlArea.php +++ b/framework/Web/UI/WebControls/THtmlArea.php @@ -17,19 +17,19 @@ * TinyMCE project {@link http://tinymce.moxiecode.com/}. * * THtmlArea displays a WYSIWYG text area on the Web page for user input - * in the HTML format. The text displayed in the THtmlArea component is + * in the HTML format. The text displayed in the THtmlArea component is * specified or determined by using the Text property. * * To enable the visual editting on the client side, set the property * EnableVisualEdit to true (which is default value). - * To set the size of the editor when the visual editting is enabled, + * To set the size of the editor when the visual editting is enabled, * set the Width and Height properties instead of * Columns and Rows because the latter has no meaning * under the situation. * * The default editor gives only the basic tool bar. To change or add * additional tool bars, use the Options property add to additional - * editor options with each options on a new line. + * editor options with each options on a new line. * See http://tinymce.moxiecode.com/tinymce/docs/index.html * for a list of options. The options can be change/added as shown in the * following example. @@ -43,11 +43,11 @@ * * * Compatibility - * The client-side visual editting capability is supported by - * Internet Explorer 5.0+ for Windows and Gecko-based browser. + * The client-side visual editting capability is supported by + * Internet Explorer 5.0+ for Windows and Gecko-based browser. * If the browser does not support the visual editting, * a traditional textarea will be displayed. - * + * * Browser support * * @@ -65,7 +65,7 @@ * * (1) - Partialy working * ---------------------------------------------------- * - * + * * @author Wei Zhuo * @version $Revision: $ $Date: $ * @package System.Web.UI.WebControls @@ -74,44 +74,44 @@ class THtmlArea extends TTextBox { protected $langs = array( - 'da' => array('da'), - 'fa' => array('fa'), + 'da' => array('da'), + 'fa' => array('fa'), 'hu' => array('hu'), 'nb' => array('nb'), 'pt_br' => array('pt_BR'), - 'sk' => array('sk'), + 'sk' => array('sk'), 'zh_tw_utf8' => array('zh_TW', 'zh_HK'), 'ar' => array('ar'), 'de' => array('de'), 'fi' => array('fi'), - 'is' => array('is'), - 'nl' => array('nl'), + 'is' => array('is'), + 'nl' => array('nl'), 'sv' => array('sv'), - 'ca' => array('ca'), - 'el' => array('el'), - 'fr' => array('fr'), - 'it' => array('it'), + 'ca' => array('ca'), + 'el' => array('el'), + 'fr' => array('fr'), + 'it' => array('it'), 'nn' => array('nn'), //what is nn? -// 'ru' => array('ru'), +// 'ru' => array('ru'), 'th' => array('th'), - 'cs' => array('cs'), - 'en' => array('en'), - 'fr_ca' => array('fr_CA'), + 'cs' => array('cs'), + 'en' => array('en'), + 'fr_ca' => array('fr_CA'), 'ja' => array('ja'), - 'pl' => array('pl'), + 'pl' => array('pl'), // 'ru_KOI8-R' => array('ru'), /// what is this? 'zh_cn' => array('zh_CN'), 'cy' => array('cy'), //what is this? - 'es' => array('es'), - 'he' => array('he'), + 'es' => array('es'), + 'he' => array('he'), 'ko' => array('ko'), - 'pt' => array('pt'), + 'pt' => array('pt'), 'ru_UTF-8' => array('ru'), 'tr' => array('tr'), 'si' => array('si'), // 'zh_tw' => array('zh_TW'), ); - + /** * Overrides the parent implementation. * TextMode for THtmlArea control is always 'MultiLine' @@ -235,7 +235,7 @@ class THtmlArea extends TTextBox /** * Adds attribute name-value pairs to renderer. - * This method overrides the parent implementation by registering + * This method overrides the parent implementation by registering * additional javacript code. * @param THtmlWriter the writer used for the rendering purpose */ @@ -248,7 +248,7 @@ class THtmlArea extends TTextBox $this->getStyle()->setWidth($width); if(($height=$this->getHeight()) != '') $this->getStyle()->setHeight($height); - + $this->registerEditorClientScript($writer); } parent::addAttributesToRender($writer); @@ -277,22 +277,20 @@ class THtmlArea extends TTextBox } /** - * Gets the editor script base URL by publishing the tarred source via TTarAssetManager. + * Gets the editor script base URL by publishing the tarred source via TTarAssetManager. * @return string URL base path to the published editor script */ protected function getScriptDeploymentPath() { - $manager = Prado::createComponent('System.Web.UI.TTarAssetManager'); - $manager->init(null); $tarfile = Prado::getPathOfNamespace('System.3rdParty.TinyMCE.tiny_mce', '.tar'); $md5sum = Prado::getPathOfNamespace('System.3rdParty.TinyMCE.tiny_mce', '.md5'); - return $manager->publishTarFile($tarfile, $md5sum); + return $this->getApplication()->getAssetManager()->publishTarFile($tarfile, $md5sum); } /** * Default editor options gives basic tool bar only. * @return array editor initialization options. - */ + */ protected function getEditorOptions() { $options['mode'] = 'exact'; @@ -332,8 +330,8 @@ class THtmlArea extends TTextBox * @return string localized editor interface language extension. */ protected function getLanguageSuffix($culture) - { - $app = $this->getApplication()->getGlobalization(); + { + $app = $this->getApplication()->getGlobalization(); if(empty($culture) && !is_null($app)) $culture = $app->getCulture(); $variants = array(); @@ -352,7 +350,7 @@ class THtmlArea extends TTextBox return $js; } } - + return 'en'; } } diff --git a/framework/Web/UI/WebControls/TTextHighlighter.php b/framework/Web/UI/WebControls/TTextHighlighter.php index 281f131e..22717d05 100644 --- a/framework/Web/UI/WebControls/TTextHighlighter.php +++ b/framework/Web/UI/WebControls/TTextHighlighter.php @@ -85,7 +85,7 @@ class TTextHighlighter extends TWebControl { parent::onPreRender($writer); $this->registerHighlightStyleSheet(); - $this->getPage()->getClientScript()->registerClientScript('prado'); + //$this->getPage()->getClientScript()->registerClientScript('prado'); } /** -- cgit v1.2.3