Skip to content

Commit

Permalink
merge from 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
qiang.xue committed Jul 4, 2009
1 parent e9ef35f commit 5c23ad3
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Expand Up @@ -20,24 +20,28 @@ Version 1.0.7 to be released
- Bug #393: Greek language code should be 'el' insead of 'gr' (Qiang)
- Bug #402: CNumberFormatter does not format decimals and percentages correctly (Qiang)
- Bug #404: AR would fail when CDbLogRoute uses the same DB connection (Qiang)
- Bug #421: Undefined variable: seconds in CDateTimeParser.php(140) (Qiang)
- Bug: CMemCache has a typo when using memcached (Qiang)
- Bug: COciCommandBuilder is referencing undefined variable (Qiang)
- Bug: yiic webapp may generate incorrect path to yii.php (Qiang)
- Bug: SQL with OFFSET generated by command builder for Oracle is incorrect (Qiang)
- Bug: yiic shell model command may fail when a foreign key is named as ID (Qiang)
- Bug: yiic shell controller command does not generate correct controller class file when the controller is under a sub-folder (Qiang)
- Bug: When using MySQL enum type, AR may incorrectly typcasting the column values (Qiang)
- Chg #391: defaultScope should not be applied to UPDATE (Qiang)
- New #360: Added anchor parameter to CController::redirect (Qiang)
- New #375: Added support to allow logout a user without cleaning up non-auth session data (Qiang)
- New #378: Added support to allow dynamically turning off and on log routes (Qiang)
- New #396: Improved error display when running yiic commands (Qiang)
- New #406: Added support to allow stopping saving and deletion by an ActiveRecord behavior (Qiang)
- New #415: Added HTML options to CHtml::errorSummary() and error() methods (Qiang)
- New: Rolled back the change about treating tinyint(1) in MySQL as boolean (Qiang)
- New: Added support for displaying call stack information in trace messages (Qiang)
- New: Added 'index' option to AR relations so that related objects can be indexed by specific column value (Qiang)
- New: Allow CHtml::activeLabel to override the automatically generated 'for' attribute (Qiang)
- New: Added 'csrf' to CHtml client options so that js-based form submission can submit CSRF token (Qiang)
- New: Removed typcasting in CNumberValidator so that it won't lose precision (Qiang)
- New: Added userAgent parameter to CHttpRequest::getBrowser() (Qiang)

Version 1.0.6 June 7, 2009
--------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/post.display.txt
Expand Up @@ -36,7 +36,7 @@ protected function loadPost($id=null)
}
~~~

Our change mainly lies in the `loadPost()` method. In this method, we query the `Post` table according to the `id` GET parameter. If the post is not found or if it is not published (when the user is a guest), we will throw a 500 HTTP error. Otherwise the post object is returned to `actionShow()` which in turn passes the post object to the `show` view for further display.
Our change mainly lies in the `loadPost()` method. In this method, we query the `Post` table according to the `id` GET parameter. If the post is not found or if it is not published (when the user is a guest), we will throw a 404 HTTP error. Otherwise the post object is returned to `actionShow()` which in turn passes the post object to the `show` view for further display.

> Tip: Yii captures HTTP exceptions (instances of [CHttpException]) and displays them in error pages using some predefined templates. These templates can be customized per application, which we will describe in detail at the end of this tutorial.

Expand Down
2 changes: 2 additions & 0 deletions docs/blog/toc.txt
Expand Up @@ -34,3 +34,5 @@
- [Customizing Error Display](final.error)
- [Final Tune-up and Deployment](final.deployment)
- [Future Enhancements](final.future)

<div class="revision">$Id$</div>
6 changes: 3 additions & 3 deletions framework/db/schema/mssql/CMssqlSchema.php
Expand Up @@ -65,7 +65,7 @@ public function compareTableNames($name1,$name2)

/**
* Creates a table instance representing the metadata for the named table.
* @return CMysqlTableSchema driver dependent table metadata. Null if the table does not exist.
* @return CMssqlTableSchema driver dependent table metadata. Null if the table does not exist.
*/
protected function createTable($name)
{
Expand All @@ -84,7 +84,7 @@ protected function createTable($name)

/**
* Generates various kinds of table names.
* @param CMysqlTableSchema the table instance
* @param CMssqlTableSchema the table instance
* @param string the unquoted table name
*/
protected function resolveTableNames($table,$name)
Expand Down Expand Up @@ -211,7 +211,7 @@ protected function findForeignKeys($table)

/**
* Collects the table column metadata.
* @param CMysqlTableSchema the table metadata
* @param CMssqlTableSchema the table metadata
* @return boolean whether the table exists in the database
*/
protected function findColumns($table)
Expand Down
4 changes: 3 additions & 1 deletion framework/db/schema/mysql/CMysqlColumnSchema.php
Expand Up @@ -24,7 +24,9 @@ class CMysqlColumnSchema extends CDbColumnSchema
*/
protected function extractType($dbType)
{
if(strpos($dbType,'bigint')!==false || strpos($dbType,'float')!==false || strpos($dbType,'double')!==false)
if(strncmp($dbType,'enum',4)===0)
$this->type='string';
else if(strpos($dbType,'bigint')!==false || strpos($dbType,'float')!==false || strpos($dbType,'double')!==false)
$this->type='double';
else if(strpos($dbType,'bool')!==false)
$this->type='boolean';
Expand Down
2 changes: 1 addition & 1 deletion framework/utils/CDateTimeParser.php
Expand Up @@ -137,7 +137,7 @@ public static function parse($value,$pattern='MM/dd/yyyy')
{
if(($second=self::parseInteger($value,$i,1,2))===false)
return false;
$i+=strlen($seconds);
$i+=strlen($second);
break;
}
case 'ss':
Expand Down
7 changes: 5 additions & 2 deletions framework/web/CHttpRequest.php
Expand Up @@ -458,12 +458,15 @@ public function getScriptFile()
}

/**
* Returns information about the capabilities of user browser.
* @param string the user agent to be analyzed. Defaults to null, meaning using the
* current User-Agent HTTP header information.
* @return array user browser capabilities.
* @see http://www.php.net/manual/en/function.get-browser.php
*/
public function getBrowser()
public function getBrowser($userAgent=null)
{
return get_browser();
return get_browser($userAgent,true);
}

/**
Expand Down
18 changes: 14 additions & 4 deletions framework/web/helpers/CHtml.php
Expand Up @@ -1368,11 +1368,13 @@ public static function getActiveId($model,$attribute)
* a single model or an array of models.
* @param string a piece of HTML code that appears in front of the errors
* @param string a piece of HTML code that appears at the end of the errors
* @param array additional HTML attributes to be rendered in the container div tag.
* This parameter has been available since version 1.0.7.
* @return string the error summary. Empty if no errors are found.
* @see CModel::getErrors
* @see errorSummaryCss
*/
public static function errorSummary($model,$header=null,$footer=null)
public static function errorSummary($model,$header=null,$footer=null,$htmlOptions=array())
{
$content='';
if(!is_array($model))
Expand All @@ -1392,7 +1394,9 @@ public static function errorSummary($model,$header=null,$footer=null)
{
if($header===null)
$header='<p>'.Yii::t('yii','Please fix the following input errors:').'</p>';
return self::tag('div',array('class'=>self::$errorSummaryCss),$header."\n<ul>\n$content</ul>".$footer);
if(!isset($htmlOptions['class']))
$htmlOptions['class']=self::$errorSummaryCss;
return self::tag('div',$htmlOptions,$header."\n<ul>\n$content</ul>".$footer);
}
else
return '';
Expand All @@ -1402,15 +1406,21 @@ public static function errorSummary($model,$header=null,$footer=null)
* Displays the first validation error for a model attribute.
* @param CModel the data model
* @param string the attribute name
* @param array additional HTML attributes to be rendered in the container div tag.
* This parameter has been available since version 1.0.7.
* @return string the error display. Empty if no errors are found.
* @see CModel::getErrors
* @see errorMessageCss
*/
public static function error($model,$attribute)
public static function error($model,$attribute,$htmlOptions=array())
{
$error=$model->getError($attribute);
if($error!='')
return self::tag('div',array('class'=>self::$errorMessageCss),$error);
{
if(!isset($htmlOptions['class']))
$htmlOptions['class']=self::$errorMessageCss;
return self::tag('div',$htmlOptions,$error);
}
else
return '';
}
Expand Down

0 comments on commit 5c23ad3

Please sign in to comment.