[pLog-svn] r4436 - in plog/trunk: class/action/admin class/dao
templates/admin
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Thu Dec 28 09:45:36 GMT 2006
Author: oscar
Date: 2006-12-28 09:45:35 +0000 (Thu, 28 Dec 2006)
New Revision: 4436
Modified:
plog/trunk/class/action/admin/adminupdateeditblogaction.class.php
plog/trunk/class/dao/userpermissions.class.php
plog/trunk/templates/admin/editblog.template
Log:
it probably is better if we use the 'admin mode' to edit user permissions, rather than complicating thiscreen a bit too much
Modified: plog/trunk/class/action/admin/adminupdateeditblogaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateeditblogaction.class.php 2006-12-28 08:46:08 UTC (rev 4435)
+++ plog/trunk/class/action/admin/adminupdateeditblogaction.class.php 2006-12-28 09:45:35 UTC (rev 4436)
@@ -152,9 +152,7 @@
}
$blogInfo->setCustomDomain( $blog_domain );
- }
-
-
+ }
$this->notifyEvent( EVENT_PRE_BLOG_UPDATE, Array( "blog" => &$blogInfo ));
if( !$blogs->updateBlog( $blogInfo )) {
@@ -164,16 +162,6 @@
return false;
}
- // update the user permissions, even if they didn't change (but we have no way to
- // check that anyway!)
- $permissions = new UserPermissions();
- if( !$permissions->updateBlogUserPermissions( $this->_editBlogId, $this->_blogUsers )) {
- $this->_view = new AdminSiteBlogsListView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->pr( "error_updating_blog_settings", $blogInfo->getBlog()));
- $this->setCommonData();
- return false;
- }
-
$this->notifyEvent( EVENT_POST_BLOG_UPDATE, Array( "blog" => &$blogInfo ));
// do it again, baby :)))
Modified: plog/trunk/class/dao/userpermissions.class.php
===================================================================
--- plog/trunk/class/dao/userpermissions.class.php 2006-12-28 08:46:08 UTC (rev 4435)
+++ plog/trunk/class/dao/userpermissions.class.php 2006-12-28 09:45:35 UTC (rev 4436)
@@ -4,12 +4,7 @@
lt_include( PLOG_CLASS_PATH."class/dao/userpermission.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/daocacheconstants.properties.php" );
- //
- // :KLUDGE: This should be done in a better way...
- //
- define( "PERMISSION_SITE_ADMIN", 1 );
define( "PERMISSION_BLOG_USER", 2 );
- define( "PERMISSION_BLOG_OWNER", 3 );
/**
* Handles user permissions.
@@ -174,44 +169,6 @@
}
/**
- * updates the list of users that have access to the blog. But this method works so
- * that it first removes all current permissions and then recreates them again
- * based on the given list of users
- *
- * @param blogId
- * @param userIdList An associative array with user ids
- * @return true if successful or false otherwise
- */
- function updateBlogUserPermissions( $blogId, $userList )
- {
- // first of all, remove all the permissions
- $this->revokeBlogPermissions( $blogId );
-
- // load the blog to check whether it is there and to filter out
- // the blog owner
- lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
- $blogs = new Blogs();
- $blog = $blogs->getBlogInfo( $blogId );
- if( !$blog )
- return false;
-
- // make sure that we're dealing with an array
- if( !is_array( $userList )) {
- return true;
- }
-
- // loop through the array and recreate the permissions
- foreach( $userList as $userId ) {
- if( $userId > 0 && $blog->getOwnerId() != $userId ) {
- $perm = new UserPermission( $userId, $blogId, PERMISSION_BLOG_USER );
- $this->grantPermission( $perm );
- }
- }
-
- return true;
- }
-
- /**
* revokes all the permissions that a user may have
*
* @param userId The identifier of the user
Modified: plog/trunk/templates/admin/editblog.template
===================================================================
--- plog/trunk/templates/admin/editblog.template 2006-12-28 08:46:08 UTC (rev 4435)
+++ plog/trunk/templates/admin/editblog.template 2006-12-28 09:45:35 UTC (rev 4436)
@@ -151,19 +151,12 @@
<div class="field">
<label for="blog_users">{$locale->tr("users")}</label>
<div class="formHelp">{$locale->tr("blog_users_help")}</div>
- <select id="userList" name="blogUsers[]" size="10" multiple="multiple" style="width:40%">
{assign var=owner value=$editblog->getOwnerInfo()}
{foreach from=$blogusers item=bloguser}
- {if $owner->getUsername() != $bloguser->getUsername()}
- <option value="{$bloguser->getId()}">{$bloguser->getUsername()}</option>
+ {if $owner->getUsername() != $bloguser->getUsername()}
+ {check_perms adminperm=edit_blog_admin_mode}<a href="admin.php?op=adminBlogSelect&blogId={$editblog->getId()}&action=editBlogUser&userId={$bloguser->getId()}">{/check_perms}{$bloguser->getUsername()}{check_perms adminperm=edit_blog_admin_mode}</a>{/check_perms}<br/>
{/if}
{/foreach}
- </select><br/>
- <a name="blog_users" href="#blog_users" onclick="window.open('?op=siteUsersChooser&mode=2','UserChooser','scrollbars=yes,resizable=yes,toolbar=no,height=450,width=600');">{$locale->tr("add")}</a>
- |
- <a href="#blog_users" onclick="editBlogRemoveSelected()">
- {$locale->tr("remove_selected")}
- </a>
</div>
</fieldset>
<div class="buttons">
More information about the pLog-svn
mailing list