From 75f28186a995aa930f6db9f05ec7b63bbd2cd284 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 30 May 2006 03:30:14 +0000 Subject: Merge from 3.0 branch till 1103 --- demos/blog/protected/Portlets/AccountPortlet.php | 17 +++++++++++++++ demos/blog/protected/Portlets/AccountPortlet.tpl | 2 +- demos/blog/protected/Portlets/ArchivePortlet.php | 17 +++++++++++++++ demos/blog/protected/Portlets/CategoryPortlet.php | 25 ++++++++++++++++++++++- demos/blog/protected/Portlets/CategoryPortlet.tpl | 18 ++++++++-------- demos/blog/protected/Portlets/LoginPortlet.php | 19 ++++++++++++++++- demos/blog/protected/Portlets/LoginPortlet.tpl | 10 +++++++-- demos/blog/protected/Portlets/Portlet.php | 17 +++++++++++++++ demos/blog/protected/Portlets/SearchPortlet.php | 17 +++++++++++++++ demos/blog/protected/Portlets/SearchPortlet.tpl | 2 ++ 10 files changed, 129 insertions(+), 15 deletions(-) (limited to 'demos/blog/protected/Portlets') diff --git a/demos/blog/protected/Portlets/AccountPortlet.php b/demos/blog/protected/Portlets/AccountPortlet.php index 0f0e60c6..3618d92d 100644 --- a/demos/blog/protected/Portlets/AccountPortlet.php +++ b/demos/blog/protected/Portlets/AccountPortlet.php @@ -1,7 +1,24 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + */ Prado::using('Application.Portlets.Portlet'); +/** + * AccountPortlet class + * + * @author Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + */ class AccountPortlet extends Portlet { public function logout($sender,$param) diff --git a/demos/blog/protected/Portlets/AccountPortlet.tpl b/demos/blog/protected/Portlets/AccountPortlet.tpl index 2a401f41..a55b7857 100644 --- a/demos/blog/protected/Portlets/AccountPortlet.tpl +++ b/demos/blog/protected/Portlets/AccountPortlet.tpl @@ -9,7 +9,7 @@ Welcome, <%= $this->User->Name %>!
  • My post
  • Profile
  • <%% -if($this->User->isInRole('admin')) +if($this->User->IsAdmin) echo '
  • Admin
  • '; %>
  • diff --git a/demos/blog/protected/Portlets/ArchivePortlet.php b/demos/blog/protected/Portlets/ArchivePortlet.php index a004c7a9..c50f0785 100644 --- a/demos/blog/protected/Portlets/ArchivePortlet.php +++ b/demos/blog/protected/Portlets/ArchivePortlet.php @@ -1,7 +1,24 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + */ Prado::using('Application.Portlets.Portlet'); +/** + * ArchivePortlet class + * + * @author Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + */ class ArchivePortlet extends Portlet { private function makeMonthTime($timestamp) diff --git a/demos/blog/protected/Portlets/CategoryPortlet.php b/demos/blog/protected/Portlets/CategoryPortlet.php index 9c2033aa..e0c417bb 100644 --- a/demos/blog/protected/Portlets/CategoryPortlet.php +++ b/demos/blog/protected/Portlets/CategoryPortlet.php @@ -1,13 +1,36 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + */ Prado::using('Application.Portlets.Portlet'); +/** + * CategoryPortlet class + * + * @author Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + */ class CategoryPortlet extends Portlet { public function onLoad($param) { parent::onLoad($param); - $this->CategoryList->DataSource=$this->Application->getModule('data')->queryCategories(); + $cats=$this->Application->getModule('data')->queryCategories(); + foreach($cats as $cat) + { + $cat->ID=$this->Service->constructUrl('Posts.ListPost',array('cat'=>$cat->ID)); + $cat->Name.=' (' . $cat->PostCount .')'; + } + $this->CategoryList->DataSource=$cats; $this->CategoryList->dataBind(); } } diff --git a/demos/blog/protected/Portlets/CategoryPortlet.tpl b/demos/blog/protected/Portlets/CategoryPortlet.tpl index acbd3bec..dd5623ff 100644 --- a/demos/blog/protected/Portlets/CategoryPortlet.tpl +++ b/demos/blog/protected/Portlets/CategoryPortlet.tpl @@ -6,19 +6,17 @@ Categories Text="[+]" Tooltip="Create a new category" NavigateUrl=<%= $this->Service->constructUrl('Posts.NewCategory') %> - Visible=<%= $this->User->isInRole('admin') %> /> + Visible=<%= $this->User->IsAdmin %> /> diff --git a/demos/blog/protected/Portlets/LoginPortlet.php b/demos/blog/protected/Portlets/LoginPortlet.php index 0085c17f..ae9373cb 100644 --- a/demos/blog/protected/Portlets/LoginPortlet.php +++ b/demos/blog/protected/Portlets/LoginPortlet.php @@ -1,13 +1,30 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + */ Prado::using('Application.Portlets.Portlet'); +/** + * LoginPortlet class + * + * @author Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + */ class LoginPortlet extends Portlet { public function validateUser($sender,$param) { $authManager=$this->Application->getModule('auth'); - if(!$authManager->login($this->Username->Text,$this->Password->Text)) + if(!$authManager->login(strtolower($this->Username->Text),$this->Password->Text)) $param->IsValid=false; } diff --git a/demos/blog/protected/Portlets/LoginPortlet.tpl b/demos/blog/protected/Portlets/LoginPortlet.tpl index 6f8c5d4a..f2ac7f36 100644 --- a/demos/blog/protected/Portlets/LoginPortlet.tpl +++ b/demos/blog/protected/Portlets/LoginPortlet.tpl @@ -23,13 +23,19 @@ Password
    -
    +

    + -| Register +Service->constructUrl('Users.NewUser') %> + Visible=<%= TPropertyValue::ensureBoolean($this->Application->Parameters['MultipleUser']) %> + CssClass="link-button" /> diff --git a/demos/blog/protected/Portlets/Portlet.php b/demos/blog/protected/Portlets/Portlet.php index 4b1c80e9..a3b03a71 100644 --- a/demos/blog/protected/Portlets/Portlet.php +++ b/demos/blog/protected/Portlets/Portlet.php @@ -1,5 +1,22 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + */ +/** + * Portlet class + * + * @author Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + */ class Portlet extends TTemplateControl { } diff --git a/demos/blog/protected/Portlets/SearchPortlet.php b/demos/blog/protected/Portlets/SearchPortlet.php index 1bad7f1c..102bf79d 100644 --- a/demos/blog/protected/Portlets/SearchPortlet.php +++ b/demos/blog/protected/Portlets/SearchPortlet.php @@ -1,7 +1,24 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + */ Prado::using('Application.Portlets.Portlet'); +/** + * SearchPortlet class + * + * @author Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + */ class SearchPortlet extends Portlet { public function onInit($param) diff --git a/demos/blog/protected/Portlets/SearchPortlet.tpl b/demos/blog/protected/Portlets/SearchPortlet.tpl index f88fca7e..32cbbf1d 100644 --- a/demos/blog/protected/Portlets/SearchPortlet.tpl +++ b/demos/blog/protected/Portlets/SearchPortlet.tpl @@ -11,10 +11,12 @@ Keyword Display="Dynamic"/>
    +

    -- cgit v1.2.3