diff options
author | wei <> | 2007-09-05 01:43:17 +0000 |
---|---|---|
committer | wei <> | 2007-09-05 01:43:17 +0000 |
commit | 9db6e012559ae7bdb46a9519c360bb936173f200 (patch) | |
tree | e85d0aace7888df21dcf892866e566b25ff5e244 | |
parent | 78af8b5719980ba12c391e20ecabdf3703452b05 (diff) |
typos in blog tutorial. fixed empty result in active record relations. fixed keeping of post data in scaffold edit view when using renderer.
4 files changed, 11 insertions, 4 deletions
diff --git a/demos/blog-tutorial/protected/pages/Day4/CreateReadPost.page b/demos/blog-tutorial/protected/pages/Day4/CreateReadPost.page index d9b66d33..2b21023d 100644 --- a/demos/blog-tutorial/protected/pages/Day4/CreateReadPost.page +++ b/demos/blog-tutorial/protected/pages/Day4/CreateReadPost.page @@ -23,7 +23,7 @@ The <tt>ReadPost</tt> page template is very similar to the <tt>PostRenderer</tt> </h2>
<com:TControl Visible="<%= $this->canEdit() %>">
- <a href="<%= $this->Service->constructUrl('EditPost',array('id'=>$this->Post->post_id))%>">Edit</a> |
+ <a href="<%= $this->Service->constructUrl('posts.EditPost',array('id'=>$this->Post->post_id))%>">Edit</a> |
<com:TLinkButton Text="Delete"
OnClick="deletePost"
Attributes.onclick="javascript:if(!confirm('Are you sure?')) return false;" />
diff --git a/demos/blog-tutorial/protected/pages/Day4/id/CreateReadPost.page b/demos/blog-tutorial/protected/pages/Day4/id/CreateReadPost.page index 83c059e7..9aeaed7b 100644 --- a/demos/blog-tutorial/protected/pages/Day4/id/CreateReadPost.page +++ b/demos/blog-tutorial/protected/pages/Day4/id/CreateReadPost.page @@ -23,7 +23,7 @@ Template halaman <tt>ReadPost</tt> sangat mirip dengan template <tt>PostRenderer </h2>
<com:TControl Visible="<%= $this->canEdit() %>">
- <a href="<%= $this->Service->constructUrl('EditPost',array('id'=>$this->Post->post_id))%>">Edit</a> |
+ <a href="<%= $this->Service->constructUrl('posts.EditPost',array('id'=>$this->Post->post_id))%>">Edit</a> |
<com:TLinkButton Text="Delete"
OnClick="deletePost"
Attributes.onclick="javascript:if(!confirm('Are you sure?')) return false;" />
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php index 60afef89..de6e5331 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php @@ -64,7 +64,8 @@ abstract class TActiveRecordRelation static $stack=array();
$results = call_user_func_array(array($this->getSourceRecord(),$method),$args);
- if(is_array($results) || $results instanceof ArrayAccess || $results instanceof TActiveRecord)
+ $validArray = is_array($results) && count($results) > 0;
+ if($validArray || $results instanceof ArrayAccess || $results instanceof TActiveRecord)
{
$this->collectForeignObjects($results);
while($obj = array_pop($stack))
diff --git a/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php b/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php index 0550864b..ea9b2df5 100644 --- a/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php +++ b/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php @@ -214,6 +214,12 @@ class TScaffoldEditView extends TScaffoldBase $record->save();
return true;
}
+ else if($this->_editRenderer!==null)
+ {
+ //preserve the form data.
+ $this->_editRenderer->updateRecord($this->getCurrentRecord());
+ }
+
return false;
}
@@ -300,5 +306,5 @@ interface IScaffoldEditRenderer extends IDataRenderer */
public function updateRecord($record);
}
- +
?>
\ No newline at end of file |