From 2ea02214b2fb6bedb58dbbd318ef171a9e146524 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 29 May 2006 03:08:07 +0000 Subject: Merge from 3.0 branch till 1099. --- demos/blog/protected/Pages/Posts/EditCategory.php | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 demos/blog/protected/Pages/Posts/EditCategory.php (limited to 'demos/blog/protected/Pages/Posts/EditCategory.php') diff --git a/demos/blog/protected/Pages/Posts/EditCategory.php b/demos/blog/protected/Pages/Posts/EditCategory.php new file mode 100644 index 00000000..fd2d0707 --- /dev/null +++ b/demos/blog/protected/Pages/Posts/EditCategory.php @@ -0,0 +1,44 @@ +Request['id']); + if(($cat=$this->DataAccess->queryCategoryByID($id))!==null) + return $cat; + else + throw new BlogException('xxx'); + } + + public function onLoad($param) + { + parent::onLoad($param); + if(!$this->IsPostBack) + { + $catRecord=$this->getCurrentCategory(); + $this->CategoryName->Text=$catRecord->Name; + $this->CategoryDescription->Text=$catRecord->Description; + } + } + + public function saveButtonClicked($sender,$param) + { + if($this->IsValid) + { + $categoryRecord=$this->getCurrentCategory(); + $categoryRecord->Name=$this->CategoryName->Text; + $categoryRecord->Description=$this->CategoryDescription->Text; + $this->DataAccess->updateCategory($categoryRecord); + $this->gotoPage('Posts.ListPost',array('cat'=>$categoryRecord->ID)); + } + } + + public function checkCategoryName($sender,$param) + { + $name=$this->CategoryName->Text; + $param->IsValid=$this->DataAccess->queryCategoryByName($name)===null; + } +} + +?> \ No newline at end of file -- cgit v1.2.3