[pLog-svn] r572 - plog/trunk/class/view/admin
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Thu Dec 23 23:32:40 GMT 2004
Author: oscar
Date: 2004-12-23 23:32:40 +0000 (Thu, 23 Dec 2004)
New Revision: 572
Modified:
plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php
plog/trunk/class/view/admin/adminarticlecommentslistview.class.php
plog/trunk/class/view/admin/adminarticletrackbackslistview.class.php
plog/trunk/class/view/admin/admincustomfieldslistview.class.php
plog/trunk/class/view/admin/admineditresourceview.class.php
plog/trunk/class/view/admin/admineditsiteblogview.class.php
plog/trunk/class/view/admin/admineditsiteuserview.class.php
plog/trunk/class/view/admin/adminlinkcategorieslistview.class.php
plog/trunk/class/view/admin/adminlinkslistview.class.php
plog/trunk/class/view/admin/adminnewalbumview.class.php
plog/trunk/class/view/admin/adminnewlinkview.class.php
plog/trunk/class/view/admin/adminnewresourceview.class.php
plog/trunk/class/view/admin/adminpostslistview.class.php
plog/trunk/class/view/admin/adminresourceslistview.class.php
Log:
some of the views were not throwing events correctly, or not throwing them at all!
Modified: plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -48,6 +48,9 @@
if( !$blogCategories ) {
$blogCategories = Array();
}
+
+ // throw the even in case somebody's waiting for it!
+ $this->notifyEvent( EVENT_CATEGORIES_LOADED, Array( "categories" => &$blogCategories ));
$this->setValue( "categories", $blogCategories );
// the pager that will be used
Modified: plog/trunk/class/view/admin/adminarticlecommentslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminarticlecommentslistview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/adminarticlecommentslistview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -46,13 +46,14 @@
*/
function render()
{
- // load the comments
+ // load the comments and throw the correct event
$comments = new ArticleComments();
$postComments = $comments->getPostComments( $this->_article->getId(),
COMMENT_ORDER_NEWEST_FIRST,
$this->_commentStatus,
$this->_page,
DEFAULT_ITEMS_PER_PAGE );
+ $this->notifyEvent( EVENT_COMMENTS_LOADED, Array( "comments", &$postComments ));
// number of comments
$numPostComments = $comments->getNumPostComments( $this->_article->getId(), $this->_commentStatus );
Modified: plog/trunk/class/view/admin/adminarticletrackbackslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminarticletrackbackslistview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/adminarticletrackbackslistview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -32,6 +32,7 @@
$trackbacks = new Trackbacks();
// get the trackbacks
$postTrackbacks = $trackbacks->getArticleTrackbacks( $this->_article->getId(), $this->_page, DEFAULT_ITEMS_PER_PAGE );
+ $this->notifyEvent( EVENT_TRACKBACKS_LOADED, Array( "trackbacks" => &$postTrackbacks ));
$this->setValue( "trackbacks", $postTrackbacks);
// and the total number of trackbacks
$numTrackbacks = $trackbacks->getNumTrackbacksArticle( $this->_article->getId());
Modified: plog/trunk/class/view/admin/admincustomfieldslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/admincustomfieldslistview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/admincustomfieldslistview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -30,6 +30,7 @@
// load the custom fields that have been defined so far
$customFields = new CustomFields();
$blogFields = $customFields->getBlogCustomFields( $this->_blogInfo->getId(), true, $this->_page, DEFAULT_ITEMS_PER_PAGE );
+ $this->notifyEvent( EVENT_CUSTOM_FIELDS_LOADED, Array( "fields" => &$blogFields ));
// and the total number of them too
$numBlogFields = $customFields->getNumBlogCustomFields( $this->_blogInfo->getId());
Modified: plog/trunk/class/view/admin/admineditresourceview.class.php
===================================================================
--- plog/trunk/class/view/admin/admineditresourceview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/admineditresourceview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -1,19 +1,28 @@
<?php
include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
- include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
+ include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
+ include_once( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" );
/**
* shows the view that allows to see more information of a resource
*/
class AdminEditResourceView extends AdminTemplatedView
{
+ var $_resourceId;
function AdminEditResourceView( $blogInfo )
{
$this->AdminTemplatedView( $blogInfo, "resourceinfo" );
+
+ $this->_resourceId = $resourceId;
}
+ function getResourceId( $resourceId )
+ {
+ return( $this->_resourceId );
+ }
+
function render()
{
// load the nested list of albums
@@ -22,7 +31,7 @@
$blogAlbums = $albums->getNestedAlbumList( $this->_blogInfo->getId());
$this->notifyEvent( EVENT_ALBUMS_LOADED, Array( "albums" => &$blogAlbums ));
$this->setValue( "albums", $blogAlbums );
-
+
parent::render();
}
}
Modified: plog/trunk/class/view/admin/admineditsiteblogview.class.php
===================================================================
--- plog/trunk/class/view/admin/admineditsiteblogview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/admineditsiteblogview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -1,9 +1,9 @@
<?php
- include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
- include_once( PLOG_CLASS_PATH."class/locale/locales.class.php" );
- include_once( PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );
- include_once( PLOG_CLASS_PATH."class/dao/blogstatus.class.php" );
+ include_once( PLOG_CLASS_PATH.'class/view/admin/admintemplatedview.class.php' );
+ include_once( PLOG_CLASS_PATH.'class/locale/locales.class.php' );
+ include_once( PLOG_CLASS_PATH.'class/template/templatesets/templatesets.class.php' );
+ include_once( PLOG_CLASS_PATH.'class/dao/blogstatus.class.php' );
/**
* shows the view to edit a blog from the site
@@ -17,48 +17,48 @@
{
// fetch information about the blog we're editing
if( $editBlogInfo == null )
- $this->_editBlogInfo = $this->getSessionValue( "editBlogInfo" );
+ $this->_editBlogInfo = $this->getSessionValue( 'editBlogInfo' );
else
$this->_editBlogInfo = $editBlogInfo;
// this stuff is a bit weird but I couldn't find a better way to do it!
if( $this->_editBlogInfo ) {
- $this->AdminTemplatedView( $blogInfo, "editblog" );
+ $this->AdminTemplatedView( $blogInfo, 'editblog' );
$this->_error = false;
- $this->setSessionValue( "editBlogInfo", $this->_editBlogInfo );
+ $this->setSessionValue( 'editBlogInfo', $this->_editBlogInfo );
// ...
// export data to the view
- $this->setValue( "editblog", $this->_editBlogInfo );
- $this->setValue( "editblogsettings", $this->_editBlogInfo->getSettings());
+ $this->setValue( 'editblog', $this->_editBlogInfo );
+ $this->setValue( 'editblogsettings', $this->_editBlogInfo->getSettings());
// blog settings...
$blogTemplateSet = $this->_editBlogInfo->getTemplateSet();
- $this->setValue( "blogTemplate", $blogTemplateSet->getName());
+ $this->setValue( 'blogTemplate', $blogTemplateSet->getName());
$ts = new TemplateSets();
// get the blog template sets
- $this->setValue( "templates", $ts->getBlogTemplateSets( $this->_editBlogInfo->getId(), true ));
+ $this->setValue( 'templates', $ts->getBlogTemplateSets( $this->_editBlogInfo->getId(), true ));
// and the list of locale availables
- $this->setValue( "locales", Locales::getLocales());
- $this->setValue( "blogStatus", $this->_editBlogInfo->getStatus());
- $this->setValue( "blogStatusList", BlogStatus::getStatusList());
+ $this->setValue( 'locales', Locales::getLocales());
+ $this->setValue( 'blogStatus', $this->_editBlogInfo->getStatus());
+ $this->setValue( 'blogStatusList', BlogStatus::getStatusList());
$blogSettings = $this->_editBlogInfo->getSettings();
- $this->setValue( "blogTimeOffset", $blogSettings->getValue( "time_offset" ));
- $this->setValue( "blogOwner", $this->_editBlogInfo->getOwner());
- $this->setValue( "blogName", $this->_editBlogInfo->getBlog());
- $this->setValue( "blogResourcesQuota", $this->_editBlogInfo->getResourcesQuota());
+ $this->setValue( 'blogTimeOffset', $blogSettings->getValue( 'time_offset' ));
+ $this->setValue( 'blogOwner', $this->_editBlogInfo->getOwner());
+ $this->setValue( 'blogName', $this->_editBlogInfo->getBlog());
+ $this->setValue( 'blogResourcesQuota', $this->_editBlogInfo->getResourcesQuota());
// get all the users
$users = new Users();
$siteUsers = $users->getAllUsers();
- $this->notifyEvent( EVENT_USERS_LOADED, Array( "users" => &$siteUsers ));
+ $this->notifyEvent( EVENT_USERS_LOADED, Array( 'users' => &$siteUsers ));
// set the blog users and the available users
$blogUsers = $users->getBlogUsers( $this->_editBlogInfo->getId(), false );
- $this->setValue( "availableusers", $this->filterAvailableUsers( $siteUsers, $blogUsers ));
- $this->setValue( "blogusers", $blogUsers );
- $this->setValue( "siteusers", $siteUsers );
+ $this->setValue( 'availableusers', $this->filterAvailableUsers( $siteUsers, $blogUsers ));
+ $this->setValue( 'blogusers', $blogUsers );
+ $this->setValue( 'siteusers', $siteUsers );
}
else {
- $this->AdminTemplatedView( $blogInfo, "error" );
- $this->setValue( "message", "Unexpected error loading blog!" );
+ $this->AdminTemplatedView( $blogInfo, 'error' );
+ $this->setValue( 'message', 'Unexpected error loading blog!' );
$this->_error = true;
}
}
Modified: plog/trunk/class/view/admin/admineditsiteuserview.class.php
===================================================================
--- plog/trunk/class/view/admin/admineditsiteuserview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/admineditsiteuserview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -1,9 +1,9 @@
<?php
- include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
- include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
- include_once( PLOG_CLASS_PATH."class/dao/userstatus.class.php" );
+ include_once( PLOG_CLASS_PATH.'class/view/admin/admintemplatedview.class.php' );
+ include_once( PLOG_CLASS_PATH.'class/view/admin/adminerrorview.class.php' );
+ include_once( PLOG_CLASS_PATH.'class/dao/users.class.php' );
+ include_once( PLOG_CLASS_PATH.'class/dao/userstatus.class.php' );
/**
* shows the view to edit a user
@@ -17,29 +17,29 @@
{
// check if we have something in the session...
if( $userInfo == null ) {
- $this->_user = $this->getSessionValue( "editUserInfo" );
+ $this->_user = $this->getSessionValue( 'editUserInfo' );
}
else {
$this->_user = $userInfo;
- $this->setSessionValue( "editUserInfo", $this->_user );
+ $this->setSessionValue( 'editUserInfo', $this->_user );
}
if( $this->_user ) {
// in case everything went fine...
- $this->AdminTemplatedView( $blogInfo, "userprofile" );
+ $this->AdminTemplatedView( $blogInfo, 'userprofile' );
// user settings
- $this->setValue( "userId", $this->_user->getId());
- $this->setValue( "userStatus", $this->_user->getStatus());
- $this->setValue( "userName", $this->_user->getUsername());
- $this->setValue( "userEmail", $this->_user->getEmail());
- $this->setValue( "userIsSiteAdmin", $this->_user->isSiteAdmin());
- $this->setValue( "userAbout", $this->_user->getAboutMyself());
- $this->setValue( "userFullName", $this->_user->getFullName());
+ $this->setValue( 'userId', $this->_user->getId());
+ $this->setValue( 'userStatus', $this->_user->getStatus());
+ $this->setValue( 'userName', $this->_user->getUsername());
+ $this->setValue( 'userEmail', $this->_user->getEmail());
+ $this->setValue( 'userIsSiteAdmin', $this->_user->isSiteAdmin());
+ $this->setValue( 'userAbout', $this->_user->getAboutMyself());
+ $this->setValue( 'userFullName', $this->_user->getFullName());
}
else {
// or else an error
$this->AdminErrorView( $blogInfo );
- $this->setMessage( "Error loading user data from the session" );
+ $this->setMessage( 'Error loading user data from the session' );
}
}
@@ -48,14 +48,14 @@
// fetch the blogs to which this user belongs
$users = new Users();
$userBlogs = $users->getUsersBlogs( $this->_user->getId());
- $this->notifyEvent( EVENT_BLOGS_LOADED, Array( "blogs" => &$userBlogs ));
+ $this->notifyEvent( EVENT_BLOGS_LOADED, Array( 'blogs' => &$userBlogs ));
// otherwise, transfer it to the template context and let the
// template do the rest
- $this->setValue( "edituser", $this->_user );
- $this->setValue( "edituserblogs", $userBlogs );
+ $this->setValue( 'edituser', $this->_user );
+ $this->setValue( 'edituserblogs', $userBlogs );
// list of available status
- $this->setValue( "userStatusList", UserStatus::getStatusList());
+ $this->setValue( 'userStatusList', UserStatus::getStatusList());
parent::render();
}
Modified: plog/trunk/class/view/admin/adminlinkcategorieslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminlinkcategorieslistview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/adminlinkcategorieslistview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -32,6 +32,9 @@
// get the total number of link categories
$numLinkCategories = $linkCategories->getNumMyLinksCategories( $this->_blogInfo->getId());
+ // throw the event
+ $this->notifyEvent( EVENT_LINK_CATEGORIES_LOADED, Array( "linkcategories" => &$blogLinkCategories ));
+
// create the pager
$pager = new Pager( "?op=editLinkCategories&page=",
$this->_page,
Modified: plog/trunk/class/view/admin/adminlinkslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminlinkslistview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/adminlinkslistview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -42,17 +42,19 @@
// get the parameters
$order = $this->getValue( "showOrder" );
$categoryId = $this->getValue( "showCategory");
- // get all the links
+ // get all the links and throw the event
$links = new MyLinks();
$blogLinks = $links->getLinks( $this->_blogInfo->getId(),
$categoryId,
$this->_page,
DEFAULT_ITEMS_PER_PAGE );
+ $this->notifyEvent( EVENT_LINKS_LOADED, Array( "links" => &$blogLinks ));
// get the number of links
$numLinks = $links->getNumLinks( $this->_blogInfo->getId(), $categoryId );
// get all the link categories but we have to respect the order that the user asked
$linkCategories = new MyLinksCategories();
$blogLinkCategories = $linkCategories->getMyLinksCategories( $this->_blogInfo->getId(), $order );
+ $this->notifyEvent( EVENT_LINK_CATEGORIES_LOADED, Array ( "linkcategories" => &$blogLinkCategories ));
// prepare the pager
$pager = new Pager( "?op=editLinks&showCategory={$categoryId}&page=",
Modified: plog/trunk/class/view/admin/adminnewalbumview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminnewalbumview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/adminnewalbumview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -15,7 +15,9 @@
{
// get all the albums
$albums = new GalleryAlbums();
- $this->setValue( "albums", $albums->getNestedAlbumList( $this->_blogInfo->getId()));
+ $userAlbums = $albums->getNestedAlbumList( $this->_blogInfo->getId());
+ $this->notifyEvent( EVENT_ALBUMS_LOADED, Array( "albums" => &$userAlbums ));
+ $this->setValue( "albums", $userAlbums );
// transfer control to the parent class
parent::render();
Modified: plog/trunk/class/view/admin/adminnewlinkview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminnewlinkview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/adminnewlinkview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -41,6 +41,7 @@
$order = $this->getValue( "showOrder" );
$linkCategories = new MyLinksCategories();
$blogLinkCategories = $linkCategories->getMyLinksCategories( $this->_blogInfo->getId(), $order );
+ $this->notifyEvent( EVENT_LINK_CATEGORIES_LOADED, Array( "linkcategories" => &$blogLinkCategories ));
// put the data in the view
$this->setValue( "linkcategories", $blogLinkCategories );
Modified: plog/trunk/class/view/admin/adminnewresourceview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminnewresourceview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/adminnewresourceview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -16,6 +16,7 @@
// get all the albums
$albums = new GalleryAlbums();
$userAlbums = $albums->getNestedAlbumList( $this->_blogInfo->getId());
+ $this->notifyEvent( EVENT_ALBUMS_LOADED, Array( "albums" => &$userAlbums ));
$this->setValue( "albums", $userAlbums );
Modified: plog/trunk/class/view/admin/adminpostslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminpostslistview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/adminpostslistview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -158,11 +158,15 @@
$this->setValue( "posts", $posts );
+ // throw the even in case somebody is listening to it
+ $this->notifyEvent( EVENT_POSTS_LOADED, Array( "posts" => &$posts ));
+
// and the categories
$categories = new ArticleCategories();
$blogSettings = $this->_blogInfo->getSettings();
$categoriesOrder = $blogSettings->getValue( "categories_order" );
$blogCategories = $categories->getBlogCategories( $this->_blogInfo->getId(), false, $categoriesOrder );
+ $this->notifyEvent( EVENT_CATEGORIES_LOADED, Array( "categories" => &$blogCategories ));
// and all the users that belong to this blog
$users = new Users();
@@ -189,8 +193,6 @@
$this->setValue( "searchTerms", $this->_searchTerms );
$this->setValue( "pager", $pager );
- //print_r($_SESSION);
-
parent::render();
}
}
Modified: plog/trunk/class/view/admin/adminresourceslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminresourceslistview.class.php 2004-12-23 23:31:18 UTC (rev 571)
+++ plog/trunk/class/view/admin/adminresourceslistview.class.php 2004-12-23 23:32:40 UTC (rev 572)
@@ -68,6 +68,10 @@
// get a list with the nested albums
$userAlbums = $galleryAlbums->getNestedAlbumList( $this->_blogInfo->getId());
+
+ // event about the albums we just loaded
+ $this->notifyEvent( EVENT_ALBUMS_LOADED, Array( "albums" => &$userAlbums ));
+
$this->setValue( "albumsList", $userAlbums );
// fetch some statistics and continue
@@ -80,12 +84,15 @@
// and now export info about the albums and so on but only
// if we're browsing the first page only (albums do not appear anymore after the first page)
- $this->setValue( "album", $album );
+ $this->setValue( "album", $album );
if( $this->_albumId > ROOT_ALBUM_ID && $this->_page < 2 )
$this->setValue( "albums", $album->getChildren());
else
$this->setValue( "albums", $albums );
- $this->setValue( "resources", $resources );
+
+ // event about the resources
+ $this->notifyEvent( EVENT_RESOURCES_LOADED, Array ( "resources" => &$resources ));
+ $this->setValue( "resources", $resources );
// finally, create and export the pager
$pager = new Pager( $this->_pagerUrl, $this->_page, $numResources, DEFAULT_ITEMS_PER_PAGE );
More information about the pLog-svn
mailing list