[pLog-svn] r5709 - in plog/branches/lifetype-1.2/class: action/admin data/pager view/admin
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Sun Jul 22 15:00:02 EDT 2007
Author: oscar
Date: 2007-07-22 15:00:01 -0400 (Sun, 22 Jul 2007)
New Revision: 5709
Modified:
plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php
plog/branches/lifetype-1.2/class/action/admin/adminaddresourcealbumaction.class.php
plog/branches/lifetype-1.2/class/data/pager/pager.class.php
plog/branches/lifetype-1.2/class/view/admin/adminresourceslistview.class.php
Log:
Small usability improvement: jump right to the last page of the album when adding a new album or a new file to it.
Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php 2007-07-22 18:38:03 UTC (rev 5708)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php 2007-07-22 19:00:01 UTC (rev 5709)
@@ -90,7 +90,7 @@
$resources = new GalleryResources();
if( $this->_destView == "resourceList" ) {
- $this->_view = new AdminSimpleResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId ));
+ $this->_view = new AdminSimpleResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId, "gotoLastPage" => true ));
$this->_view->setValue( "destination", $this->_destination );
}
elseif ($this->_destView == "userPictureSelect" ) {
@@ -98,7 +98,7 @@
$this->_view->setValue( "destination", $this->_destination );
}
else
- $this->_view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId ));
+ $this->_view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId, "gotoLastPage" => true ));
$successMessage = "";
$errorMessage = "";
Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddresourcealbumaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddresourcealbumaction.class.php 2007-07-22 18:38:03 UTC (rev 5708)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddresourcealbumaction.class.php 2007-07-22 19:00:01 UTC (rev 5709)
@@ -66,7 +66,7 @@
$result = $albums->addAlbum( $album );
if( $this->userHasPermission( "view_resources" ))
- $this->_view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_parentId ));
+ $this->_view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_parentId, "gotoLastPage" => true ));
else
$this->_view = new AdminNewAlbumView( $this->_blogInfo );
Modified: plog/branches/lifetype-1.2/class/data/pager/pager.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/data/pager/pager.class.php 2007-07-22 18:38:03 UTC (rev 5708)
+++ plog/branches/lifetype-1.2/class/data/pager/pager.class.php 2007-07-22 19:00:01 UTC (rev 5709)
@@ -89,6 +89,17 @@
$this->_baseUrl = $url;
}
+ /**
+ * Sets the current page
+ *
+ * @param curPage
+ */
+ function setCurPage( $curPage )
+ {
+ $this->_curPage = $curPage;
+ $this->_init();
+ }
+
/**
* @return returns the base url
*/
Modified: plog/branches/lifetype-1.2/class/view/admin/adminresourceslistview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminresourceslistview.class.php 2007-07-22 18:38:03 UTC (rev 5708)
+++ plog/branches/lifetype-1.2/class/view/admin/adminresourceslistview.class.php 2007-07-22 19:00:01 UTC (rev 5709)
@@ -73,6 +73,19 @@
$this->_albumId = ROOT_ALBUM_ID;
}
else {
+ // total number of resources in this album, used by the pager
+ $numResources = $galleryResources->getNumUserResources( $this->_blogInfo->getId(),
+ $this->_albumId,
+ $this->_resourceType,
+ $this->_searchTerms );
+
+ // create and export the pager
+ $pager = new Pager( $this->_pagerUrl, $this->_page, $numResources, DEFAULT_ITEMS_PER_PAGE );
+ if( isset( $this->_viewParams["gotoLastPage"] )) {
+ $pager->setCurPage( $pager->getEndPage());
+ $this->_page = $pager->getEndPage();
+ }
+
// resources for this page
$resources = $galleryResources->getUserResources( $this->_blogInfo->getId(),
$this->_albumId,
@@ -81,34 +94,33 @@
$this->_page,
DEFAULT_ITEMS_PER_PAGE );
- // total number of resources in this album, used by the pager
- $numResources = $galleryResources->getNumUserResources( $this->_blogInfo->getId(),
- $this->_albumId,
- $this->_resourceType,
- $this->_searchTerms );
+
}
}
else {
$album = null;
// if we're at the root album but search terms, still call GalleryResources::getUserResources
if( $this->_searchTerms ) {
+ // total number of resources for the pager
+ $numResources = $galleryResources->getNumUserResources( $this->_blogInfo->getId(),
+ GALLERY_NO_ALBUM,
+ $this->_resourceType,
+ $this->_searchTerms );
+
// load the resources matching the given string from *all* albums
$resources = $galleryResources->getUserResources( $this->_blogInfo->getId(),
GALLERY_NO_ALBUM,
$this->_resourceType,
$this->_searchTerms,
$this->_page,
- DEFAULT_ITEMS_PER_PAGE );
- // total number of resources for the pager
- $numResources = $galleryResources->getNumUserResources( $this->_blogInfo->getId(),
- GALLERY_NO_ALBUM,
- $this->_resourceType,
- $this->_searchTerms );
+ DEFAULT_ITEMS_PER_PAGE );
}
else {
$albums = $galleryAlbums->getChildAlbums( $this->_albumId, $this->_blogInfo->getId(), $this->_searchTerms );
$resources = Array();
}
+ // create and export the pager
+ $pager = new Pager( $this->_pagerUrl, $this->_page, $numResources, DEFAULT_ITEMS_PER_PAGE );
}
// get a list with the nested albums
@@ -139,9 +151,7 @@
$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 );
- $this->setValue( "pager", $pager );
+ $this->setValue( "pager", $pager );
$this->setValue( "searchTerms", $this->_searchTerms );
parent::render();
More information about the pLog-svn
mailing list