From b7f95ce37ae577e95a81e64aa2aaf3e2e698109d Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 5 Aug 2006 21:34:30 +0000 Subject: merge from 3.0 branch till 1329. --- framework/Exceptions/messages.txt | 3 +- framework/I18N/TGlobalization.php | 27 +++++++++++++++-- framework/I18N/core/Gettext/MO.php | 1 + framework/I18N/core/Gettext/PO.php | 1 + framework/I18N/core/MessageSource_XLIFF.php | 7 ++++- framework/I18N/core/MessageSource_gettext.php | 6 +++- framework/IO/TTarFileExtractor.php | 2 ++ framework/PradoBase.php | 2 +- framework/TApplication.php | 3 ++ framework/Util/TSimpleDateFormatter.php | 5 +++- framework/Web/Javascripts/js/validator.js | 9 ++++-- framework/Web/Javascripts/prado/validation3.js | 14 ++++++++- framework/Web/TAssetManager.php | 3 ++ framework/Web/UI/TClientScriptManager.php | 34 +++++++++++++++------- framework/Web/UI/TPage.php | 21 +++++++++++-- framework/Web/UI/WebControls/TBaseValidator.php | 4 +++ framework/Web/UI/WebControls/TDataGrid.php | 1 + framework/Web/UI/WebControls/TDataList.php | 2 +- .../Web/UI/WebControls/TDataTypeValidator.php | 3 ++ framework/Web/UI/WebControls/TDatePicker.php | 3 +- framework/Web/UI/WebControls/TOutputCache.php | 2 +- framework/Web/UI/WebControls/TPanelStyle.php | 2 +- framework/Web/UI/WebControls/TStyle.php | 33 ++++++++++++++++++--- framework/Web/UI/WebControls/TStyleSheet.php | 18 +++++++++++- framework/Web/UI/WebControls/TWizard.php | 10 ++++--- framework/prado-cli.php | 4 --- 26 files changed, 179 insertions(+), 41 deletions(-) (limited to 'framework') diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt index 630f7b50..39d304be 100644 --- a/framework/Exceptions/messages.txt +++ b/framework/Exceptions/messages.txt @@ -323,7 +323,8 @@ databoundcontrol_datamember_invalid = databoundcontrol_datamember_invalid clientscript_invalid_file_position = Invalid file position '{1}' for TClientScript control '{0}', must be 'Head', 'Here' or 'Begin'. tdatepicker_autopostback_unsupported = '{0}' does not support AutoPostBack. - +globalization_cache_path_failed = Unable to create translation message cache path '{0}'. Make sure the parent directory exists and is writable by the Web process. +globalization_source_path_failed = Unable to create translation message path '{0}'. Make sure the parent directory exists and is writable by the Web process. callback_not_support_no_priority_state_update = Callback request does not support unprioritized pagestate update. callback_invalid_callback_options = '{1}' is not a valid TCallbackOptions control for Callback control '{0}'. callback_invalid_clientside_options = Callback ClientSide property must be either a string that is the ID of a TCallbackOptions control or an instance of TCallbackClientSideOptions.======= diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php index aa545d21..1ea7ce2b 100644 --- a/framework/I18N/TGlobalization.php +++ b/framework/I18N/TGlobalization.php @@ -168,12 +168,33 @@ class TGlobalization extends TModule { if($config['type'] == 'XLIFF' || $config['type'] == 'gettext') { - $config['source'] = Prado::getPathOfNamespace($config['source']); - if($config['source']===null || !is_dir($config['source'])) - throw new TException("invalid source dir '{$config['source']}'"); + if($config['source']) + { + $config['source'] = Prado::getPathOfNamespace($config['source']); + if(!is_dir($config['source'])) + { + if(@mkdir($config['source'])===false) + throw new TConfigurationException('globalization_source_path_failed', + $config['source']); + chmod($config['source'], 0777); //make it deletable + } + } + else + { + throw new TConfigurationException("invalid source dir '{$config['source']}'"); + } } if($config['cache']) + { $config['cache'] = $this->getApplication()->getRunTimePath().'/i18n'; + if(!is_dir($config['cache'])) + { + if(@mkdir($config['cache'])===false) + throw new TConfigurationException('globalization_cache_path_failed', + $config['cache']); + chmod($config['cache'], 0777); //make it deletable + } + } $this->_translation = $config; } diff --git a/framework/I18N/core/Gettext/MO.php b/framework/I18N/core/Gettext/MO.php index 5ee0057f..9f2d5799 100644 --- a/framework/I18N/core/Gettext/MO.php +++ b/framework/I18N/core/Gettext/MO.php @@ -349,6 +349,7 @@ class TGettext_MO extends TGettext // done @flock($this->_handle, LOCK_UN); @fclose($this->_handle); + chmod($file,0777); return true; } } diff --git a/framework/I18N/core/Gettext/PO.php b/framework/I18N/core/Gettext/PO.php index 015747a0..3a5fda04 100644 --- a/framework/I18N/core/Gettext/PO.php +++ b/framework/I18N/core/Gettext/PO.php @@ -154,6 +154,7 @@ class TGettext_PO extends TGettext //done @flock($fh, LOCK_UN); @fclose($fh); + chmod($file,0777); return true; } } diff --git a/framework/I18N/core/MessageSource_XLIFF.php b/framework/I18N/core/MessageSource_XLIFF.php index 2194ca41..7f2f27c5 100644 --- a/framework/I18N/core/MessageSource_XLIFF.php +++ b/framework/I18N/core/MessageSource_XLIFF.php @@ -473,10 +473,15 @@ class MessageSource_XLIFF extends MessageSource $variant = array_shift($variants); $file = $this->getSource($variant); $dir = dirname($file); - if(!is_dir($dir)) @mkdir($dir); + if(!is_dir($dir)) + { + @mkdir($dir); + @chmod($dir,0777); + } if(!is_dir($dir)) throw new TException("Unable to create directory $dir"); file_put_contents($file, $this->getTemplate($catalogue)); + chmod($file, 0777); return array($variant, $file); } diff --git a/framework/I18N/core/MessageSource_gettext.php b/framework/I18N/core/MessageSource_gettext.php index 78fa5259..c92577d4 100644 --- a/framework/I18N/core/MessageSource_gettext.php +++ b/framework/I18N/core/MessageSource_gettext.php @@ -431,7 +431,11 @@ class MessageSource_gettext extends MessageSource $po_file = $this->getPOFile($mo_file); $dir = dirname($mo_file); - if(!is_dir($dir)) @mkdir($dir); + if(!is_dir($dir)) + { + @mkdir($dir); + @chmod($dir,0777); + } if(!is_dir($dir)) throw new TException("Unable to create directory $dir"); diff --git a/framework/IO/TTarFileExtractor.php b/framework/IO/TTarFileExtractor.php index 9f61026d..1bd245ca 100644 --- a/framework/IO/TTarFileExtractor.php +++ b/framework/IO/TTarFileExtractor.php @@ -460,6 +460,7 @@ class TTarFileExtractor .$v_header['filename'].'}'); return false; } + chmod($v_header['filename'], 0777); } } else { if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) { @@ -549,6 +550,7 @@ class TTarFileExtractor $this->_error("Unable to create directory '$p_dir'"); return false; } + chmod($p_dir,0777); return true; } diff --git a/framework/PradoBase.php b/framework/PradoBase.php index 50e4ac82..4685ce83 100644 --- a/framework/PradoBase.php +++ b/framework/PradoBase.php @@ -516,7 +516,7 @@ class PradoBase */ public static function varDump($var,$depth=10,$highlight=false) { - require_once(PRADO_DIR.'/Util/TVarDumper.php'); + Prado::using('System.Util.TVarDumper'); return TVarDumper::dump($var,$depth,$highlight); } diff --git a/framework/TApplication.php b/framework/TApplication.php index ef2fd1a1..68064072 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -310,8 +310,11 @@ class TApplication extends TComponent $subdir=basename($this->_configFile); $this->_runtimePath.='/'.$subdir; if(!is_dir($this->_runtimePath)) + { if(@mkdir($this->_runtimePath)===false) throw new TConfigurationException('application_runtimepath_failed',$this->_runtimePath); + chmod($this->_runtimePath, 0777); //make it deletable + } } } else diff --git a/framework/Util/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php index 971225b5..03ae7b7d 100644 --- a/framework/Util/TSimpleDateFormatter.php +++ b/framework/Util/TSimpleDateFormatter.php @@ -185,7 +185,10 @@ class TSimpleDateFormatter */ public function isValidDate($value) { - return !is_null($this->parse($value, false)); + if(is_null($value)) + return false; + else + return !is_null($this->parse($value, false)); } /** diff --git a/framework/Web/Javascripts/js/validator.js b/framework/Web/Javascripts/js/validator.js index 5e896aa1..711c996e 100644 --- a/framework/Web/Javascripts/js/validator.js +++ b/framework/Web/Javascripts/js/validator.js @@ -97,7 +97,8 @@ control.addClassName(CssClass);}},hide:function() {this.isValid=true;this.updateControl();this.visible=false;},validate:function(invoker) {if(typeof(this.options.OnValidate)=="function") this.options.OnValidate(this,invoker);if(this.enabled) -this.isValid=this.evaluateIsValid();if(this.isValid) +this.isValid=this.evaluateIsValid();else +this.isValid=true;if(this.isValid) {if(typeof(this.options.OnSuccess)=="function") {this.visible=true;this.message.style.visibility="visible";this.updateControlCssClass(this.control,this.isValid);this.options.OnSuccess(this,invoker);} else @@ -126,7 +127,11 @@ return value;},getValidationValue:function(control) control=this.control switch(this.options.ControlType) {case'TDatePicker':if(control.type=="text") -return this.trim($F(control));else +{value=this.trim($F(control));if(this.options.DateFormat) +{date=value.toDate(this.options.DateFormat);return date==null?'':date;} +else +return value;} +else {this.observeDatePickerChanges();return Prado.WebUI.TDatePicker.getDropDownDate(control).getTime();} case'THtmlArea':if(typeof tinyMCE!="undefined") tinyMCE.triggerSave();return this.trim($F(control));case'TRadioButton':if(this.options.GroupName) diff --git a/framework/Web/Javascripts/prado/validation3.js b/framework/Web/Javascripts/prado/validation3.js index 1dba23da..7df6efeb 100644 --- a/framework/Web/Javascripts/prado/validation3.js +++ b/framework/Web/Javascripts/prado/validation3.js @@ -661,6 +661,8 @@ Prado.WebUI.TBaseValidator.prototype = if(this.enabled) this.isValid = this.evaluateIsValid(); + else + this.isValid = true; if(this.isValid) { @@ -776,7 +778,17 @@ Prado.WebUI.TBaseValidator.prototype = { case 'TDatePicker': if(control.type == "text") - return this.trim($F(control)); + { + value = this.trim($F(control)); + + if(this.options.DateFormat) + { + date = value.toDate(this.options.DateFormat); + return date == null ? '' : date; + } + else + return value; + } else { this.observeDatePickerChanges(); diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php index f9fe156f..f6384a08 100644 --- a/framework/Web/TAssetManager.php +++ b/framework/Web/TAssetManager.php @@ -199,7 +199,10 @@ class TAssetManager extends TModule protected function copyFile($src,$dst) { if(!is_dir($dst)) + { @mkdir($dst); + @chmod($dst, 0777); + } $dstFile=$dst.'/'.basename($src); if(@filemtime($dstFile)<@filemtime($src)) { diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 540ea01e..d1f3f457 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -145,7 +145,7 @@ class TClientScriptManager extends TApplicationComponent } } - /** + /** * Renders the