[pLog-svn] r5579 - in plog/trunk: class/action/admin class/dao class/view/admin install locale/admin templates/admin
mark at devel.lifetype.net
mark at devel.lifetype.net
Mon Jun 25 15:01:03 EDT 2007
Author: mark
Date: 2007-06-25 15:01:03 -0400 (Mon, 25 Jun 2007)
New Revision: 5579
Modified:
plog/trunk/class/action/admin/adminaddfriendgroupaction.class.php
plog/trunk/class/action/admin/admineditfriendgroupaction.class.php
plog/trunk/class/action/admin/adminupdatefriendgroupaction.class.php
plog/trunk/class/dao/friendgroup.class.php
plog/trunk/class/dao/friendgroups.class.php
plog/trunk/class/view/admin/adminfriendgroupslistview.class.php
plog/trunk/install/dbschemas.properties.php
plog/trunk/locale/admin/locale_en_UK.php
plog/trunk/locale/admin/locale_zh_CN.php
plog/trunk/locale/admin/locale_zh_TW.php
plog/trunk/templates/admin/editfriendgroup.template
plog/trunk/templates/admin/newfriendgroup.template
Log:
Add a show_group field to FriendGroup object to indicate the friend group can show up in blog main page or not.
Modified: plog/trunk/class/action/admin/adminaddfriendgroupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddfriendgroupaction.class.php 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/class/action/admin/adminaddfriendgroupaction.class.php 2007-06-25 19:01:03 UTC (rev 5579)
@@ -18,6 +18,7 @@
var $_groupName;
var $_groupDescription;
var $_properties;
+ var $_showGroup;
/**
* Constructor. If nothing else, it also has to call the constructor of the parent
@@ -30,6 +31,7 @@
// data validation
$this->registerFieldValidator( "groupName", new StringValidator() );
$this->registerField( "groupDescription" );
+ $this->registerField( "showGroup" );
$this->setValidationErrorView( new AdminTemplatedView( $this->_blogInfo, "newfriendgroup" ));
}
@@ -39,14 +41,19 @@
*/
function perform()
{
- // add the new link category to the database
+ // add the new friend group to the database
$this->_groupName = Textfilter::filterAllHTML($this->_request->getValue( "groupName" ));
$this->_groupDescription = Textfilter::filterAllHTML($this->_request->getValue( "groupDescription" ));
+ $this->_showGroup = $this->_request->getValue("showGroup") ? 1 : 0;
+
+ // create the group
$friendGroups = new FriendGroups();
$friendGroup = new FriendGroup( $this->_userInfo->getId(),
$this->_groupName,
$this->_groupDescription,
- $this->_properties );
+ $this->_properties,
+ $this->_showGroup );
+
// the view is the same for both conditions
$this->_view = new AdminFriendGroupsListView( $this->_blogInfo );
Modified: plog/trunk/class/action/admin/admineditfriendgroupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditfriendgroupaction.class.php 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/class/action/admin/admineditfriendgroupaction.class.php 2007-06-25 19:01:03 UTC (rev 5579)
@@ -54,6 +54,7 @@
$this->_view->setValue( "groupId", $group->getId());
$this->_view->setValue( "groupName", $group->getName());
$this->_view->setValue( "groupDescription", $group->getDescription());
+ $this->_view->setValue( "showGroup", $group->getShowGroup());
$this->setCommonData();
// better to return true if everything fine
Modified: plog/trunk/class/action/admin/adminupdatefriendgroupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatefriendgroupaction.class.php 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/class/action/admin/adminupdatefriendgroupaction.class.php 2007-06-25 19:01:03 UTC (rev 5579)
@@ -18,6 +18,7 @@
var $_groupName;
var $_groupDescription;
+ var $_showGroup;
var $_groupId;
/**
@@ -32,6 +33,7 @@
$this->registerFieldValidator( "groupName", new StringValidator());
$this->registerFieldValidator( "groupId", new IntegerValidator());
$this->registerField( "groupDescription" );
+ $this->registerField( "showGroup" );
$errorView = new AdminTemplatedView( $this->_blogInfo, "editfriendgroup" );
$errorView->setErrorMessage( $this->_locale->tr("error_updating_friend_group"));
$this->setValidationErrorView( $errorView );
@@ -46,6 +48,8 @@
$this->_groupId = $this->_request->getValue( "groupId" );
$this->_groupName = Textfilter::filterAllHTML($this->_request->getValue( "groupName" ));
$this->_groupDescription = Textfilter::filterAllHTML($this->_request->getValue( "groupDescription" ));
+ $this->_showGroup = $this->_request->getValue("showGroup") ? 1 : 0;
+
$groups = new FriendGroups();
$group = $groups->getFriendGroup( $this->_groupId, $this->_userInfo->getId());
if( !$group ) {
@@ -59,6 +63,7 @@
// update the fields
$group->setName( $this->_groupName );
$group->setDescription( $this->_groupDescription );
+ $group->setShowGroup( $this->_showGroup );
$this->notifyEvent( EVENT_PRE_UPDATE_FRIEND_GROUP, Array( "friendgroup" => &$group ));
if( !$groups->updateFriendGroup( $group )) {
$this->_view = new AdminFriendGroupsListView( $this->_blogInfo );
Modified: plog/trunk/class/dao/friendgroup.class.php
===================================================================
--- plog/trunk/class/dao/friendgroup.class.php 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/class/dao/friendgroup.class.php 2007-06-25 19:01:03 UTC (rev 5579)
@@ -17,13 +17,14 @@
var $_name;
var $_description;
var $_properties;
+ var $_showGroup;
var $_mangledName;
var $_numFriends;
var $_numAuthorizedFriends;
var $_numWaitingFriends;
var $_numPendingFriends;
- function FriendGroup( $userId, $name, $description = "", $properties = Array(), $id = -1 )
+ function FriendGroup( $userId, $name, $description = "", $properties = Array(), $showGroup, $id = -1 )
{
$this->DbObject();
@@ -32,6 +33,7 @@
$this->_name = $name;
$this->_description = $description;
$this->setProperties( $properties );
+ $this->_showGroup = $showGroup;
$this->_numFriends = 0;
$this->_numAuthorizedFriends = 0;
$this->_numWaitingFriends = 0;
@@ -43,6 +45,7 @@
"name" => "getName",
"description" => "getDescription",
"properties" => "getProperties",
+ "show_group" => "getShowGroup",
"num_friends" => "getNumFriends",
"num_authorized_friends" => "getNumAuthorizedFriends",
"num_waiting_friends" => "getNumWaitingFriends",
@@ -84,6 +87,19 @@
$this->_description = $desc;
}
+ /**
+ * Sets whether this group has to be shown in the main page or not.
+ *
+ * @param showGroup A boolean value
+ * @return Always true.
+ */
+ function setShowGroup( $showGroup )
+ {
+ $this->_showGroup = $showGroup;
+
+ return true;
+ }
+
/**
* Returns the identifier assigned to this category.
*
@@ -210,6 +226,16 @@
return( $this->_properties );
}
+ /**
+ * Returns whether this group has to be shown in the main page or not.
+ *
+ * @return A boolean value.
+ */
+ function getShowGroup()
+ {
+ return $this->_showGroup;
+ }
+
function setMangledName( $mangledName )
{
$this->_mangledName = $mangledName;
Modified: plog/trunk/class/dao/friendgroups.class.php
===================================================================
--- plog/trunk/class/dao/friendgroups.class.php 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/class/dao/friendgroups.class.php 2007-06-25 19:01:03 UTC (rev 5579)
@@ -19,13 +19,15 @@
* @param id
* @return false if there was an error loading or a FriendGroup object if it was found
*/
- function getFriendGroup( $id, $userId = -1 )
+ function getFriendGroup( $id, $userId = -1, $onlyShownGroups = false )
{
$group = $this->get( "id", $id, CACHE_FRIEND_GROUPS );
if( !$group )
return false;
if( $userId > -1 && $group->getUserId() != $userId )
return false;
+ if( $onlyShownGroups && !$album->getShowGroup())
+ return false;
return( $group );
}
@@ -39,7 +41,7 @@
* @param itemsPerPage
* @return An array containing all the categories from a given blog.
*/
- function getUserFriendGroups( $userId, $searchTerms = "", $page = -1, $itemsPerPage = 15 )
+ function getUserFriendGroups( $userId, $onlyShownGroups = false, $searchTerms = "", $page = -1, $itemsPerPage = 15 )
{
$groups = $this->getMany( "user_id",
$userId,
@@ -53,6 +55,16 @@
if( !$groups )
return Array();
+ $result = Array();
+ if( $onlyShownGroups ) {
+ foreach( $groups as $group ) {
+ if( $group->getShowGroup())
+ $result[] = $group;
+ }
+ }
+ else
+ $result = $groups;
+
return( $groups );
}
@@ -159,6 +171,7 @@
$row["name"],
$row["description"],
unserialize($row["properties"]),
+ $row["show_group"],
$row["id"] );
$group->setNumFriends( $row["num_friends"] );
$group->setNumAuthorizedFriends( $row["num_authorized_friends"] );
Modified: plog/trunk/class/view/admin/adminfriendgroupslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminfriendgroupslistview.class.php 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/class/view/admin/adminfriendgroupslistview.class.php 2007-06-25 19:01:03 UTC (rev 5579)
@@ -30,9 +30,10 @@
// get the link categories
$groups = new FriendGroups();
$friendGroups = $groups->getUserFriendGroups( $this->_userInfo->getId(),
- $this->_searchTerms,
- $this->_page,
- DEFAULT_ITEMS_PER_PAGE );
+ false,
+ $this->_searchTerms,
+ $this->_page,
+ DEFAULT_ITEMS_PER_PAGE );
// get the total number of friend groups
$numFriendGroups = $groups->getNumUserFriendGroups( $this->_userInfo->getId(), $this->_searchTerms );
Modified: plog/trunk/install/dbschemas.properties.php
===================================================================
--- plog/trunk/install/dbschemas.properties.php 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/install/dbschemas.properties.php 2007-06-25 19:01:03 UTC (rev 5579)
@@ -400,6 +400,7 @@
mangled_name C(255) NOTNULL DEFAULT '',
description C(255) DEFAULT NULL,
properties TEXT NOTNULL DEFAULT '',
+ show_group I1(1) DEFAULT 1,
num_friends I(10) NOTNULL DEFAULT '0',
num_authorized_friends I(10) NOTNULL DEFAULT '0',
num_waiting_friends I(10) NOTNULL DEFAULT '0',
Modified: plog/trunk/locale/admin/locale_en_UK.php
===================================================================
--- plog/trunk/locale/admin/locale_en_UK.php 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/locale/admin/locale_en_UK.php 2007-06-25 19:01:03 UTC (rev 5579)
@@ -1197,6 +1197,7 @@
// new friend group
$messages['group_name_help'] = 'Name that will be used to display the friend group.';
$messages['group_description_help'] = 'Longer description for this friend group.';
+$messages['show_group_help'] = 'If disabled, the group will not be shown in the list of friends available in this blog.';
$messages['error_adding_friend_group'] = 'There was an error adding the new friend group. Please check the data and try again';
$messages['friend_group_added_ok'] = 'Friend group "%s" was successfully added to the user.';
Modified: plog/trunk/locale/admin/locale_zh_CN.php
===================================================================
--- plog/trunk/locale/admin/locale_zh_CN.php 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/locale/admin/locale_zh_CN.php 2007-06-25 19:01:03 UTC (rev 5579)
@@ -147,7 +147,7 @@
$messages['post_status_all'] = '全部';
$messages['author_all'] = '全部作者';
$messages['search_terms'] = '搜寻关键字';
-$messages['show'] = '更新';
+$messages['show'] = '显示';
$messages['delete'] = '删除';
$messages['actions'] = '动作';
$messages['all'] = '全部';
@@ -1198,6 +1198,7 @@
// new friend group
$messages['group_name_help'] = '请输入好友群组的名称。';
$messages['group_description_help'] = '关于这个好友群组的描述。';
+$messages['show_group_help'] = '取消勾选,这个好友群组将不会出现在网志好友列表中。';
$messages['error_adding_friend_group'] = '新增好友群组时发生错误。';
$messages['friend_group_added_ok'] = '好友群组“%s”已顺利新增';
Modified: plog/trunk/locale/admin/locale_zh_TW.php
===================================================================
--- plog/trunk/locale/admin/locale_zh_TW.php 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/locale/admin/locale_zh_TW.php 2007-06-25 19:01:03 UTC (rev 5579)
@@ -147,7 +147,7 @@
$messages['post_status_all'] = '全部';
$messages['author_all'] = '全部作者';
$messages['search_terms'] = '搜尋關鍵字';
-$messages['show'] = '更新';
+$messages['show'] = '顯示';
$messages['delete'] = '刪除';
$messages['actions'] = '動作';
$messages['all'] = '全部';
@@ -1198,6 +1198,7 @@
// new friend group
$messages['group_name_help'] = '請輸入好友群組的名稱。';
$messages['group_description_help'] = '關於這個好友群組的描述。';
+$messages['show_group_help'] = '取消勾選,這個好友群組將不會出現在網誌好友列表中。';
$messages['error_adding_friend_group'] = '新增好友群組時發生錯誤。';
$messages['friend_group_added_ok'] = '好友群組「%s」已順利新增';
Modified: plog/trunk/templates/admin/editfriendgroup.template
===================================================================
--- plog/trunk/templates/admin/editfriendgroup.template 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/templates/admin/editfriendgroup.template 2007-06-25 19:01:03 UTC (rev 5579)
@@ -23,6 +23,14 @@
{include file="$admintemplatepath/validate.template" field=groupDescription message=$locale->tr("error_empty_description")}
</div>
+ <div class="field">
+ <label for="showGroup">{$locale->tr("show")}</label>
+ <div class="formHelp">
+ <input class="checkbox" type="checkbox" id="showGroup" name="showGroup" value="1" {if $showGroup == 1} checked="checked"{/if} />
+ {$locale->tr("show_group_help")}
+ </div>
+ </div>
+
</fieldset>
<div class="buttons">
<input type="reset" name="reset" value="{$locale->tr("reset")}" />
Modified: plog/trunk/templates/admin/newfriendgroup.template
===================================================================
--- plog/trunk/templates/admin/newfriendgroup.template 2007-06-25 16:03:06 UTC (rev 5578)
+++ plog/trunk/templates/admin/newfriendgroup.template 2007-06-25 19:01:03 UTC (rev 5579)
@@ -22,6 +22,14 @@
{include file="$admintemplatepath/validate.template" field=groupDescription message=$locale->tr("error_empty_description")}
</div>
+ <div class="field">
+ <label for="showGroup">{$locale->tr("show")}</label>
+ <div class="formHelp">
+ <input class="checkbox" type="checkbox" id="showGroup" name="showGroup" value="1"
+ checked="checked" />
+ {$locale->tr("show_group_help")}
+ </div>
+
</fieldset>
<div class="buttons">
<input type="hidden" name="op" value="addFriendGroup" />
More information about the pLog-svn
mailing list