summaryrefslogtreecommitdiff
path: root/demos/blog/protected/Portlets
diff options
context:
space:
mode:
authorxue <>2006-05-30 03:30:14 +0000
committerxue <>2006-05-30 03:30:14 +0000
commit75f28186a995aa930f6db9f05ec7b63bbd2cd284 (patch)
tree9621a9db8c69daf951f87fb57996428d57d710a6 /demos/blog/protected/Portlets
parent2ea02214b2fb6bedb58dbbd318ef171a9e146524 (diff)
Merge from 3.0 branch till 1103
Diffstat (limited to 'demos/blog/protected/Portlets')
-rw-r--r--demos/blog/protected/Portlets/AccountPortlet.php17
-rw-r--r--demos/blog/protected/Portlets/AccountPortlet.tpl2
-rw-r--r--demos/blog/protected/Portlets/ArchivePortlet.php17
-rw-r--r--demos/blog/protected/Portlets/CategoryPortlet.php25
-rw-r--r--demos/blog/protected/Portlets/CategoryPortlet.tpl18
-rw-r--r--demos/blog/protected/Portlets/LoginPortlet.php19
-rw-r--r--demos/blog/protected/Portlets/LoginPortlet.tpl10
-rw-r--r--demos/blog/protected/Portlets/Portlet.php17
-rw-r--r--demos/blog/protected/Portlets/SearchPortlet.php17
-rw-r--r--demos/blog/protected/Portlets/SearchPortlet.tpl2
10 files changed, 129 insertions, 15 deletions
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 @@
<?php
+/**
+ * AccountPortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ */
Prado::using('Application.Portlets.Portlet');
+/**
+ * AccountPortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 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, <b><%= $this->User->Name %></b>!
<li><a href="<%= $this->Service->constructUrl('Posts.MyPost') %>">My post</a></li>
<li><a href="<%= $this->Service->constructUrl('Users.ViewUser',array('id'=>$this->User->ID)) %>">Profile</a></li>
<%%
-if($this->User->isInRole('admin'))
+if($this->User->IsAdmin)
echo '<li><a href="'.$this->Service->constructUrl('Admin.PostMan').'">Admin</a></li>';
%>
<li><com:TLinkButton Text="Logout" OnClick="logout" /></li>
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 @@
<?php
+/**
+ * ArchivePortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ */
Prado::using('Application.Portlets.Portlet');
+/**
+ * ArchivePortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 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 @@
<?php
+/**
+ * CategoryPortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ */
Prado::using('Application.Portlets.Portlet');
+/**
+ * CategoryPortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 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 %> />
</h2>
<div class="portlet-content">
-<ul>
-<com:TRepeater ID="CategoryList" EnableViewState="false">
- <prop:ItemTemplate>
- <li>
- <a href="<%# $this->Service->constructUrl('Posts.ListPost',array('cat'=>$this->DataItem->ID)) %>"><%# $this->DataItem->Name . ' (' . $this->DataItem->PostCount . ')' %></a>
- </li>
- </prop:ItemTemplate>
-</com:TRepeater>
-</ul>
+<com:TBulletedList
+ ID="CategoryList"
+ DisplayMode="HyperLink"
+ DataTextField="Name"
+ DataValueField="ID"
+ EnableViewState="false"
+ />
</div><!-- end of portlet-content -->
</div><!-- end of portlet -->
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 @@
<?php
+/**
+ * LoginPortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ */
Prado::using('Application.Portlets.Portlet');
+/**
+ * LoginPortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 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
<br/>
<com:TTextBox ID="Password" TextMode="Password" />
-<br/>
+<br/><br/>
+
<com:TLinkButton
ID="LoginButton"
Text="Login"
ValidationGroup="login"
+ CssClass="link-button"
OnClick="loginButtonClicked" />
-| <a href="<%= $this->Service->constructUrl('Users.NewUser') %>">Register</a>
+<com:THyperLink
+ Text="Register"
+ NavigateUrl=<%= $this->Service->constructUrl('Users.NewUser') %>
+ Visible=<%= TPropertyValue::ensureBoolean($this->Application->Parameters['MultipleUser']) %>
+ CssClass="link-button" />
</com:TPanel><!-- end of portlet-content -->
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 @@
<?php
+/**
+ * Portlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ */
+/**
+ * Portlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 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 @@
<?php
+/**
+ * SearchPortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ */
Prado::using('Application.Portlets.Portlet');
+/**
+ * SearchPortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 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"/>
<br/>
<com:TTextBox ID="Keyword" />
+<br/><br/>
<com:TLinkButton
ID="SearchButton"
Text="Search"
ValidationGroup="search"
+ CssClass="link-button"
OnClick="search" />
</com:TPanel><!-- end of portlet-content -->