[pLog-svn] r5576 - in plog/trunk: class/action/admin class/dao templates/admin
mark at devel.lifetype.net
mark at devel.lifetype.net
Mon Jun 25 06:18:11 EDT 2007
Author: mark
Date: 2007-06-25 06:18:11 -0400 (Mon, 25 Jun 2007)
New Revision: 5576
Modified:
plog/trunk/class/action/admin/adminaddfriendaction.class.php
plog/trunk/class/action/admin/admindeletefriendaction.class.php
plog/trunk/class/action/admin/admineditfriendaction.class.php
plog/trunk/class/action/admin/adminupdatefriendaction.class.php
plog/trunk/class/dao/friends.class.php
plog/trunk/templates/admin/editfriends.template
plog/trunk/templates/admin/newfriend.template
Log:
More updates of Friend Admin Panel. Still some bugs exist ...
Modified: plog/trunk/class/action/admin/adminaddfriendaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddfriendaction.class.php 2007-06-23 20:43:20 UTC (rev 5575)
+++ plog/trunk/class/action/admin/adminaddfriendaction.class.php 2007-06-25 10:18:11 UTC (rev 5576)
@@ -37,8 +37,8 @@
// register two validators
$this->registerFieldValidator( "friendName", new StringValidator());
$this->registerFieldValidator( "friendGroupId", new IntegerValidator());
- $this->registerFieldValidator( "friendDescription", new StringValidator());
$this->registerFieldValidator( "invitationText", new StringValidator());
+ $this->registerField( "friendDescription" );
// and the view we should show in case there is a validation error
$errorView = new AdminNewFriendView( $this->_blogInfo );
$errorView->setErrorMessage( $this->_locale->tr("error_adding_friend" ));
@@ -134,8 +134,6 @@
$this->_userInfo->getId(),
$friendGroup->getId(),
"",
- 0,
- 0,
USER_AUTHORIZATION_WAITING,
FRIEND_AUTHORIZATION_APPROVED );
$friends->addFriend( $friendToUser );
Modified: plog/trunk/class/action/admin/admindeletefriendaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeletefriendaction.class.php 2007-06-23 20:43:20 UTC (rev 5575)
+++ plog/trunk/class/action/admin/admindeletefriendaction.class.php 2007-06-25 10:18:11 UTC (rev 5576)
@@ -70,14 +70,15 @@
// load the friend
$friend = $friends->getFriend( $friendId, $this->_userInfo->getId());
if( $friend ) {
+ $friendInfo = $friend->getFriendInfo();
if( !$friends->deleteFriend( $friendId, $this->_userInfo->getId()))
- $errorMessage .= $this->_locale->pr("error_removing_friend", $friend->getUsername())."<br/>";
+ $errorMessage .= $this->_locale->pr("error_removing_friend", $friendInfo->getUsername())."<br/>";
else {
$numOk++;
if( $numOk > 1 )
$successMessage = $this->_locale->pr("friends_deleted_ok", $numOk );
else
- $successMessage = $this->_locale->pr("friend_deleted_ok", $friend->getUsername());
+ $successMessage = $this->_locale->pr("friend_deleted_ok", $friendInfo->getUsername());
}
}
else {
Modified: plog/trunk/class/action/admin/admineditfriendaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditfriendaction.class.php 2007-06-23 20:43:20 UTC (rev 5575)
+++ plog/trunk/class/action/admin/admineditfriendaction.class.php 2007-06-25 10:18:11 UTC (rev 5576)
@@ -62,15 +62,16 @@
$this->notifyEvent( EVENT_FRIEND_LOADED, Array( "friend" => &$friend ) );
// otherwise show the form to edit its fields
+ $friendInfo = $friend->getFriendInfo();
$this->_view = new AdminEditFriendView( $this->_blogInfo );
- $this->_view->setValue( "friendName", $friend->getUsername() );
+ $this->_view->setValue( "friendName", $friendInfo->getUsername() );
$this->_view->setValue( "friendGroupId", $friend->getGroupId() );
$this->_view->setValue( "friendDescription", $friend->getDescription() );
$this->_view->setValue( "friendId", $this->_friendId );
if( $friend->getUserAuthorizationStatus() == USER_AUTHORIZATION_WAITING )
{
- $this->_view->setValue( "userAuthorizationStatus", $friend->getAuthorizationStatus() );
+ $this->_view->setValue( "userAuthorizationStatus", $friend->getUserAuthorizationStatus() );
$this->_view->setValue( "userAuthorizationStatusList", UserAuthorizationStatus::getStatusList() );
}
Modified: plog/trunk/class/action/admin/adminupdatefriendaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatefriendaction.class.php 2007-06-23 20:43:20 UTC (rev 5575)
+++ plog/trunk/class/action/admin/adminupdatefriendaction.class.php 2007-06-25 10:18:11 UTC (rev 5576)
@@ -38,7 +38,7 @@
$this->registerFieldValidator( "friendId", new IntegerValidator());
$this->registerFieldValidator( "friendName", new StringValidator());
$this->registerFieldValidator( "friendGroupId", new IntegerValidator());
- $this->registerFieldValidator( "friendDescription", new StringValidator());
+ $this->registerField( "friendDescription" );
$this->registerField( "userAuthorizationStatus" );
// and the view we should show in case there is a validation error
$errorView = new AdminEditFriendView( $this->_blogInfo );
@@ -111,7 +111,8 @@
$success = false;
if( $success ) {
- $this->_view->setSuccessMessage( $this->_locale->pr("friend_updated_ok", $friend->getUsername()));
+ $friendInfo = $friend->getFriendInfo();
+ $this->_view->setSuccessMessage( $this->_locale->pr("friend_updated_ok", $friendInfo->getUsername()));
// fire the post-event
$this->notifyEvent( EVENT_POST_UPDATE_FRIEND, Array( "friend" => &$friend ) );
Modified: plog/trunk/class/dao/friends.class.php
===================================================================
--- plog/trunk/class/dao/friends.class.php 2007-06-23 20:43:20 UTC (rev 5575)
+++ plog/trunk/class/dao/friends.class.php 2007-06-25 10:18:11 UTC (rev 5576)
@@ -87,25 +87,25 @@
{
lt_include( PLOG_CLASS_PATH."class/dao/friendgroups.class.php" );
$groups = new FriendGroups();
- $newGroup = $groups->getFriendGroup( $newFriend->getFriendGroupId() );
+ $newGroup = $groups->getFriendGroup( $newFriend->getGroupId() );
if( $newGroup ) {
$newGroup->setNumFriends($this->getNumItems( $this->getPrefix().'friends', 'group_id = '.$newGroup->getId()));
$newGroup->setNumAuthorizedFriends($this->getNumItems( $this->getPrefix().'friends', 'group_id = '.$newGroup->getId().' AND user_authorization_status = '.USER_AUTHORIZATION_APPROVED.' AND friend_authorization_status = '.FRIEND_AUTHORIZATION_APPROVED ));
$newGroup->setNumWaitingFriends($this->getNumItems( $this->getPrefix().'friends', 'group_id = '.$newGroup->getId().' AND user_authorization_status = '.USER_AUTHORIZATION_WAITING.' AND friend_authorization_status = '.FRIEND_AUTHORIZATION_APPROVED ));
$newGroup->setNumPendingFriends($this->getNumItems( $this->getPrefix().'friends', 'group_id = '.$newGroup->getId().' AND user_authorization_status = '.USER_AUTHORIZATION_APPROVED.' AND friend_authorization_status = '.FRIEND_AUTHORIZATION_WAITING ));
- $friendGroups->updateFriendGroup( $newGroup );
+ $groups->updateFriendGroup( $newGroup );
}
if( $oldFriend ) {
- $oldGroup = $friendGroups->getFriendGroup( $oldFriend->getGroupId() );
+ $oldGroup = $groups->getFriendGroup( $oldFriend->getGroupId() );
if ($oldGroup)
{
$oldGroup->setNumFriends($this->getNumItems( $this->getPrefix().'friends', 'group_id = '.$oldGroup->getId()));
$oldGroup->setNumAuthorizedFriends($this->getNumItems( $this->getPrefix().'friends', 'group_id = '.$oldGroup->getId().' AND user_authorization_status = '.USER_AUTHORIZATION_APPROVED.' AND friend_authorization_status = '.FRIEND_AUTHORIZATION_APPROVED ));
$oldGroup->setNumWaitingFriends($this->getNumItems( $this->getPrefix().'friends', 'group_id = '.$oldGroup->getId().' AND user_authorization_status = '.USER_AUTHORIZATION_WAITING.' AND friend_authorization_status = '.FRIEND_AUTHORIZATION_APPROVED ));
$oldGroup->setNumPendingFriends($this->getNumItems( $this->getPrefix().'friends', 'group_id = '.$oldGroup->getId().' AND user_authorization_status = '.USER_AUTHORIZATION_APPROVED.' AND friend_authorization_status = '.FRIEND_AUTHORIZATION_WAITING ));
- $friendGroups->updateFriendGroup( $oldGroup );
+ $groups->updateFriendGroup( $oldGroup );
}
}
Modified: plog/trunk/templates/admin/editfriends.template
===================================================================
--- plog/trunk/templates/admin/editfriends.template 2007-06-23 20:43:20 UTC (rev 5575)
+++ plog/trunk/templates/admin/editfriends.template 2007-06-25 10:18:11 UTC (rev 5576)
@@ -53,15 +53,16 @@
</thead>
<tbody>
{foreach from=$friends item=friend}
+ {assign var=friendInfo value=$friend->getFriendInfo()}
<tr class="{cycle values="odd, even"}">
<td>
<input class="checkbox" type="checkbox" name="friendIds[{counter}]" id="checks_{$friend->getId()}" value="{$friend->getId()}" />
</td>
<td class="col_highlighted">
- <a href="admin.php?op=editFriend&friendId={$friend->getId()}">{$friend->getUsername()}</a>
+ <a href="admin.php?op=editFriend&friendId={$friend->getId()}">{$friendInfo->getUsername()}</a>
</td>
<td>
- {foreach from=$friend->getBlogs() item=friendBlog}
+ {foreach from=$friendInfo->getBlogs() item=friendBlog}
{assign var=url value=$friendBlog->getBlogRequestGenerator()}
<a href="{$url->blogLink()}">{$friendBlog->getBlog()}</a><br/>
{/foreach}
@@ -71,13 +72,13 @@
<a href="admin.php?op=editFriends&showGroup={$group->getId()}">{$group->getName()}</a>
</td>
<td>
- {foreach from=$userAuthorizedStatus key=name item=status}
- {if $friend->getUserAuthorized() == $status}{$locale->tr($name)}{/if}
+ {foreach from=$userAuthorizationStatusList key=name item=status}
+ {if $friend->getUserAuthorizationStatus() == $status}{$locale->tr($name)}{/if}
{/foreach}
</td>
<td>
- {foreach from=$friendAuthorizedStatus key=name item=status}
- {if $friend->getFriendAuthorized() == $status}{$locale->tr($name)}{/if}
+ {foreach from=$friendAuthorizationStatusList key=name item=status}
+ {if $friend->getFriendAuthorizationStatus() == $status}{$locale->tr($name)}{/if}
{/foreach}
</td>
<td>
Modified: plog/trunk/templates/admin/newfriend.template
===================================================================
--- plog/trunk/templates/admin/newfriend.template 2007-06-23 20:43:20 UTC (rev 5575)
+++ plog/trunk/templates/admin/newfriend.template 2007-06-25 10:18:11 UTC (rev 5576)
@@ -12,7 +12,7 @@
<label for="friendName">{$locale->tr("name")}</label>
<span class="required">*</span><br/>
<div class="formHelp">{$locale->tr("friend_name_help")}</div>
- <input type="text" value="{$friendName}" id="friendName" name="friendName" readonly="readonly" />
+ <input type="text" value="{$friendName}" id="friendName" name="friendName"/>
{include file="$admintemplatepath/validate.template" field=friendName message=$locale->tr("error_empty_name")}
</div>
More information about the pLog-svn
mailing list