Changeset 1330

Show
Ignore:
Timestamp:
08/05/2006 04:34:30 PM (2 years ago)
Author:
xue
Message:

merge from 3.0 branch till 1329.

Location:
trunk
Files:
33 modified
10 copied

Legend:

Unmodified
Added
Removed
  • trunk/HISTORY

    r1321 r1330  
    1515BUG: Ticket#264 - Typos in some exception throw statements (Knut) 
    1616BUG: Ticket#268 - THttpResponse.redirect() may fail for some browsers (Qiang) 
     17BUG: Ticket#271 - Page method setFocus doesn't work (Wei) 
    1718BUG: Ticket#285 - NumberFormat Rounding Bug (Wei) 
    1819BUG: Ticket#297 - THttpRequest::constructUrl() encoding bug about array GET parameters (Qiang) 
     20BUG: Ticket#320 - Typo in calling TDataList::setSelectedItemIndex and a bug in inserting wizard steps (Qiang) 
    1921BUG: TDataGrid may complain getting ItemType on a non-object if the grid is not data-bound (Qiang) 
    2022BUG: TCheckBox.Value should be converted to string (Qiang) 
     
    3234ENH: Ticket#263 - TListBox and TDropDownList support optgroup now (Qiang) 
    3335ENH: Ticket#277 - Added TControl.CustomData property (Qiang) 
     36ENH: Ticket#278 - client-side validator enable/disable (conditional) (Wei) 
    3437ENH: Ticket#287 - TControl::broadcastEvent() may raise events now (Qiang) 
    3538ENH: Ticket#292 - Added THttpRequest::parseUrl() so that it is easier to be extended (Qiang) 
    3639ENH: Ticket#309 - Added THttpRequest.UrlParamSeparator property (Qiang) 
     40ENH: Ticket#313 - Added TTableStyle.BorderCollapse property (Qiang) 
     41ENH: Ticket#316 - Added media type support to CSS files in a theme (Qiang) 
     42ENH: Validating TDatePicker does not need to explictly specific the DateFormat in validators. (Wei) 
     43ENH: TRequireFieldValidator can be used to validate a valid date (Wei). 
    3744NEW: Added TStyleSheet (Wei) 
    3845 
  • trunk/buildscripts/classtree/build.php

    r1219 r1330  
    77 
    88$exclusions=array( 
    9         'prado.php', 
     9//      'prado.php', 
    1010        'pradolite.php', 
    11         'PradoBase.php', 
     11//      'PradoBase.php', 
    1212        'clientscripts.php', 
    1313        '.svn', 
  • trunk/demos/quickstart/protected/controls/DocLink.php

    r801 r1330  
    2323                        $classFile=array_pop($paths).'.html'; 
    2424                        $this->setNavigateUrl(self::BASE_URL . '/' . implode('.',$paths) . '/' . $classFile); 
    25                         $this->setText('API Manual'); 
     25                        if($this->getText() === '') 
     26                                $this->setText('API Manual'); 
    2627                } 
    2728        } 
  • trunk/demos/quickstart/protected/pages/Advanced/Themes.page

    r1265 r1330  
    2929To use the Javascript files and CSS files contained in a theme, a <tt>THead</tt> control must be placed on the page template. This is because the theme will register those files with the page and <tt>THead</tt> is the right place to load those files. 
    3030</p> 
     31<p> 
     32It is possible to specify media types of CSS files contained in a theme. By default, a CSS file applies to all media types. If the CSS file is named like <tt>mystyle.print.css</tt>, it will be applied only to <tt>print</tt> media type. As another example, <tt>mystyle.screen.css</tt> applies to <tt>screen</tt> media only, and <tt>mystyle.css</tt> applies to all media types. 
     33</p> 
    3134 
    3235<h2 id="5905">Theme Storage</h2> 
  • trunk/demos/quickstart/protected/pages/Controls/Validation.page

    r1265 r1330  
    152152<com:RunBar PagePath="Controls.Samples.TValidationSummary.Home" /> 
    153153 
     154<h2>Client and Server Side Conditional Validation</h2> 
     155<p> 
     156        All validators contains the following events. 
     157        <ul> 
     158                <li>The <tt>OnValidate</tt> event is raise before the validator validation functions are called.</li> 
     159                <li>The <tt>OnSuccess</tt> event is raised after the validator has successfully validate the control.</li> 
     160                <li>The <tt>OnError</tt> event is raised after the validator fails validation.</li> 
     161        </ul> 
     162        The corresponding events for the client side is available as sub-properties 
     163        of the <tt>ClientSide</tt> property of the validator.  
     164</p> 
     165<p>The following example pop-up a message saying "hello" when the validator fails on the client-side. 
     166<com:TTextHighlighter Language="prado" CssClass="source"> 
     167&lt;com:TRequiredFieldValidator ... &gt; 
     168        &lt;prop:ClientSide.OnError&gt; 
     169                alert("hello"); 
     170        &lt;/prop:ClientSide.OnError&gt; 
     171&lt;/com:TRequiredFieldValidator&gt; 
     172</com:TTextHighlighter> 
     173The resulting client-side event callback function is of the following form. 
     174<com:TTextHighlighter Language="javascript" CssClass="source"> 
     175function onErrorHandler(validator, sender) 
     176{ 
     177        alert("hello"); 
     178} 
     179</com:TTextHighlighter> 
     180Where <tt>validator</tt> is the current client-side validator and <tt>sender</tt> 
     181is the control that invoked the validator. 
     182</p> 
     183<h3>Conditional Validation Example</h3> 
     184<p> 
     185The following example show the use of client-side and server side validator events. The example 
     186demonstrates conditional validation.  
     187<com:RunBar PagePath="Controls.Samples.TClientSideValidator.Home" /> 
     188</p> 
    154189</com:TContent> 
  • trunk/demos/quickstart/protected/pages/Search.php

    r1186 r1330  
    1414                        $this->quickstart_results->setDataSource($hits_1); 
    1515                        $this->quickstart_results->dataBind(); 
    16                          
     16 
    1717                        $this->emptyResult->setVisible(!count($hits_1)); 
    1818                } 
    1919        } 
    20          
     20 
    2121        public function highlightSearch($text) 
    2222        { 
     
    3434                        } 
    3535                } 
    36                  
     36 
    3737                $min =  $where - 15 < 0 ? 0 : $where - 15; 
    3838                $max =  $where + 15 > $t ? $t : $where + 15; 
     
    4242                return $prefix.implode(' ', $subtext).$suffix; 
    4343        } 
    44          
     44 
    4545        protected function containsKeys($word, $keys) 
    4646        { 
     
    4848                { 
    4949                        if(is_int(strpos($word, $key))) 
    50                                 return true;     
     50                                return true; 
    5151                } 
    5252                return false; 
  • trunk/framework/Exceptions/messages.txt

    r1321 r1330  
    324324 
    325325tdatepicker_autopostback_unsupported    = '{0}' does not support AutoPostBack. 
    326  
     326globalization_cache_path_failed                 = Unable to create translation message cache path '{0}'. Make sure the parent directory exists and is writable by the Web process. 
     327globalization_source_path_failed                = Unable to create translation message path '{0}'. Make sure the parent directory exists and is writable by the Web process. 
    327328callback_not_support_no_priority_state_update   = Callback request does not support unprioritized pagestate update. 
    328329callback_invalid_callback_options               = '{1}' is not a valid TCallbackOptions control for Callback control '{0}'. 
  • trunk/framework/I18N/TGlobalization.php

    r851 r1330  
    169169                if($config['type'] == 'XLIFF' || $config['type'] == 'gettext') 
    170170                { 
    171                         $config['source'] = Prado::getPathOfNamespace($config['source']); 
    172                         if($config['source']===null || !is_dir($config['source'])) 
    173                                 throw new TException("invalid source dir '{$config['source']}'"); 
     171                        if($config['source']) 
     172                        { 
     173                                $config['source'] = Prado::getPathOfNamespace($config['source']); 
     174                                if(!is_dir($config['source'])) 
     175                                { 
     176                                        if(@mkdir($config['source'])===false) 
     177                                        throw new TConfigurationException('globalization_source_path_failed', 
     178                                                $config['source']); 
     179                                        chmod($config['source'], 0777); //make it deletable                                                                      
     180                                } 
     181                        } 
     182                        else 
     183                        { 
     184                                throw new TConfigurationException("invalid source dir '{$config['source']}'"); 
     185                        } 
    174186                } 
    175187                if($config['cache']) 
     188                { 
    176189                        $config['cache'] = $this->getApplication()->getRunTimePath().'/i18n'; 
     190                        if(!is_dir($config['cache'])) 
     191                        { 
     192                                if(@mkdir($config['cache'])===false) 
     193                                        throw new TConfigurationException('globalization_cache_path_failed', 
     194                                                $config['cache']); 
     195                                chmod($config['cache'], 0777); //make it deletable                               
     196                        } 
     197                } 
    177198                $this->_translation = $config; 
    178199        } 
  • trunk/framework/I18N/core/Gettext/MO.php

    r1029 r1330  
    350350        @flock($this->_handle, LOCK_UN); 
    351351        @fclose($this->_handle); 
     352        chmod($file,0777); 
    352353        return true; 
    353354    } 
  • trunk/framework/I18N/core/Gettext/PO.php

    r1029 r1330  
    155155        @flock($fh, LOCK_UN); 
    156156        @fclose($fh); 
     157        chmod($file,0777); 
    157158        return true; 
    158159    } 
  • trunk/framework/I18N/core/MessageSource_XLIFF.php

    r851 r1330  
    474474                $file = $this->getSource($variant); 
    475475                $dir = dirname($file); 
    476                 if(!is_dir($dir)) @mkdir($dir); 
     476                if(!is_dir($dir))  
     477                { 
     478                        @mkdir($dir); 
     479                        @chmod($dir,0777); 
     480                } 
    477481                if(!is_dir($dir)) 
    478482                        throw new TException("Unable to create directory $dir"); 
    479483                file_put_contents($file, $this->getTemplate($catalogue)); 
     484                chmod($file, 0777); 
    480485                return array($variant, $file); 
    481486        } 
  • trunk/framework/I18N/core/MessageSource_gettext.php

    r851 r1330  
    432432 
    433433                $dir = dirname($mo_file); 
    434                 if(!is_dir($dir)) @mkdir($dir); 
     434                if(!is_dir($dir)) 
     435                {  
     436                        @mkdir($dir); 
     437                        @chmod($dir,0777); 
     438                } 
    435439                if(!is_dir($dir)) 
    436440                        throw new TException("Unable to create directory $dir"); 
  • trunk/framework/IO/TTarFileExtractor.php

    r1029 r1330  
    461461                    return false; 
    462462                } 
     463                chmod($v_header['filename'], 0777); 
    463464            } 
    464465          } else { 
     
    550551            return false; 
    551552        } 
     553        chmod($p_dir,0777); 
    552554 
    553555        return true; 
  • trunk/framework/PradoBase.php

    r1321 r1330  
    517517        public static function varDump($var,$depth=10,$highlight=false) 
    518518        { 
    519                 require_once(PRADO_DIR.'/Util/TVarDumper.php'); 
     519                Prado::using('System.Util.TVarDumper'); 
    520520                return TVarDumper::dump($var,$depth,$highlight); 
    521521        } 
  • trunk/framework/TApplication.php

    r925 r1330  
    311311                                $this->_runtimePath.='/'.$subdir; 
    312312                                if(!is_dir($this->_runtimePath)) 
     313                                { 
    313314                                        if(@mkdir($this->_runtimePath)===false) 
    314315                                                throw new TConfigurationException('application_runtimepath_failed',$this->_runtimePath); 
     316                                        chmod($this->_runtimePath, 0777); //make it deletable 
     317                                } 
    315318                        } 
    316319                } 
  • trunk/framework/Util/TSimpleDateFormatter.php

    r1321 r1330  
    186186        public function isValidDate($value) 
    187187        { 
    188                 return !is_null($this->parse($value, false)); 
     188                if(is_null($value)) 
     189                        return false; 
     190                else 
     191                        return !is_null($this->parse($value, false)); 
    189192        } 
    190193 
  • trunk/framework/Web/Javascripts/js/validator.js

    r1306 r1330  
    9898{if(typeof(this.options.OnValidate)=="function") 
    9999this.options.OnValidate(this,invoker);if(this.enabled) 
    100 this.isValid=this.evaluateIsValid();if(this.isValid) 
     100this.isValid=this.evaluateIsValid();else 
     101this.isValid=true;if(this.isValid) 
    101102{if(typeof(this.options.OnSuccess)=="function") 
    102103{this.visible=true;this.message.style.visibility="visible";this.updateControlCssClass(this.control,this.isValid);this.options.OnSuccess(this,invoker);} 
     
    127128switch(this.options.ControlType) 
    128129{case'TDatePicker':if(control.type=="text") 
    129 return this.trim($F(control));else 
     130{value=this.trim($F(control));if(this.options.DateFormat) 
     131{date=value.toDate(this.options.DateFormat);return date==null?'':date;} 
     132else 
     133return value;} 
     134else 
    130135{this.observeDatePickerChanges();return Prado.WebUI.TDatePicker.getDropDownDate(control).getTime();} 
    131136case'THtmlArea':if(typeof tinyMCE!="undefined") 
  • trunk/framework/Web/Javascripts/prado/validation3.js

    r1306 r1330  
    662662                if(this.enabled) 
    663663                        this.isValid = this.evaluateIsValid(); 
     664                else 
     665                        this.isValid = true; 
    664666 
    665667                if(this.isValid) 
     
    777779                        case 'TDatePicker': 
    778780                                if(control.type == "text") 
    779                                         return this.trim($F(control)); 
     781                                { 
     782                                        value = this.trim($F(control)); 
     783                                         
     784                                        if(this.options.DateFormat) 
     785                                        { 
     786                                                date = value.toDate(this.options.DateFormat); 
     787                                                return date == null ? '' : date; 
     788                                        } 
     789                                        else 
     790                                                return value; 
     791                                } 
    780792                                else 
    781793                                { 
  • trunk/framework/Web/TAssetManager.php

    r1055 r1330  
    200200        { 
    201201                if(!is_dir($dst)) 
     202                { 
    202203                        @mkdir($dst); 
     204                        @chmod($dst, 0777); 
     205                }        
    203206                $dstFile=$dst.'/'.basename($src); 
    204207                if(@filemtime($dstFile)<@filemtime($src)) 
  • trunk/framework/Web/UI/TClientScriptManager.php

    r1200 r1330  
    146146        } 
    147147 
    148         /**  
     148        /** 
    149149         * Renders the <script> tag that will load the javascript library files. 
    150150         * @param THtmlWriter writer that renders the <script> tag. 
     
    164164        } 
    165165 
    166         /**  
     166        /** 
    167167         * Returns javascript statement that create a new callback request object. 
    168168         * @param ICallbackEventHandler callback response handler 
     
    245245        public function registerFocusControl($target) 
    246246        { 
    247                 $this->registerPradoScriptInternal('prado'); 
    248                 $this->_endScripts['prado:focus']='Prado.Focus.setFocus("'.TJavaScript::quoteString($target).'");'; 
     247                $this->registerPradoScriptInternal('effects'); 
     248                if($target instanceof TControl) 
     249                        $target=$target->getClientID(); 
     250                $id = TJavaScript::quoteString($target); 
     251                $this->_endScripts['prado:focus'] = 'new Effect.ScrollTo("'.$id.'"); Prado.Element.focus("'.$id.'");'; 
    249252 
    250253                $params=func_get_args(); 
     
    269272         * @param string a unique key identifying the file 
    270273         * @param string URL to the CSS file 
    271          */ 
    272         public function registerStyleSheetFile($key,$url) 
    273         { 
    274                 $this->_styleSheetFiles[$key]=$url; 
     274         * @param string media type of the CSS (such as 'print', 'screen', etc.). Defaults to empty, meaning the CSS applies to all media types. 
     275         */ 
     276        public function registerStyleSheetFile($key,$url,$media='') 
     277        { 
     278                if($media==='') 
     279                        $this->_styleSheetFiles[$key]=$url; 
     280                else 
     281                        $this->_styleSheetFiles[$key]=array($url,$media); 
    275282 
    276283                $params=func_get_args(); 
     
    283290         * @param string CSS block 
    284291         */ 
    285         public function registerStyleSheet($key,$css) 
     292        public function registerStyleSheet($key,$css,$media='') 
    286293        { 
    287294                $this->_styleSheets[$key]=$css; 
     
    432439                return isset($this->_endScripts[$key]); 
    433440        } 
    434          
     441 
    435442        /** 
    436443         * @return boolean true if any end scripts are registered. 
     
    440447                return count($this->_endScripts) > 0; 
    441448        } 
    442          
     449 
    443450        /** 
    444451         * @return boolean true if any begin scripts are registered. 
     
    465472                $str=''; 
    466473                foreach($this->_styleSheetFiles as $url) 
    467                         $str.="<link rel=\"stylesheet\" type=\"text/css\" href=\"".THttpUtility::htmlEncode($url)."\" />\n"; 
     474                { 
     475                        if(is_array($url)) 
     476                                $str.="<link rel=\"stylesheet\" type=\"text/css\" media=\"{$url[1]}\" href=\"".THttpUtility::htmlEncode($url[0])."\" />\n"; 
     477                        else 
     478                                $str.="<link rel=\"stylesheet\" type=\"text/css\" href=\"".THttpUtility::htmlEncode($url)."\" />\n"; 
     479                } 
    468480                $writer->write($str); 
    469481        } 
  • trunk/framework/Web/UI/TPage.php

    r1265 r1330  
    638638                { 
    639639                        foreach($this->_theme->getStyleSheetFiles() as $url) 
    640                                 $cs->registerStyleSheetFile($url,$url); 
     640                                $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); 
    641641                        foreach($this->_theme->getJavaScriptFiles() as $url) 
    642642                                $cs->registerHeadScriptFile($url,$url);