[pLog-svn] r6254 - plog/branches/lifetype-1.2/class/action/admin
Jon Daley
plogworld at jon.limedaley.com
Fri Mar 21 14:48:10 EDT 2008
Do people have any objections to my overriding setCommonData here?
Particularly with adding a parameter? I needed the "common" stuff set in
a bunch of places, so it seemed like a good place to put it. I could make
a separate function if people thought this was confusing.
On Fri, 21 Mar 2008, jondaley at devel.lifetype.net wrote:
> Author: jondaley
> Date: 2008-03-21 14:46:50 -0400 (Fri, 21 Mar 2008)
> New Revision: 6254
>
> Modified:
> plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php
> Log:
> show message properly when regenerating, and stay on page during errors, so you can try again, or something
>
> Modified: plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php
> ===================================================================
> --- plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php 2008-03-21 18:45:08 UTC (rev 6253)
> +++ plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php 2008-03-21 18:46:50 UTC (rev 6254)
> @@ -25,7 +25,16 @@
> $view->setErrorMessage( $this->_locale->tr("error_loading_resource"));
> $this->setValidationErrorView( $view );
> }
> -
> +
> + function setCommonData($resource=null){
> + if($resource){
> + $this->_view->setValue( "resourceDescription", $resource->getDescription());
> + $this->_view->setValue( "albumId", $resource->getAlbumId());
> + $this->_view->setValue( "resource", $resource );
> + }
> + parent::setCommonData();
> + }
> +
> function perform(){
> // first of all, fetch the resource
> $this->_resourceId = $this->_request->getValue( "resourceId" );
> @@ -43,18 +52,18 @@
> // if so, continue... first by checking if the resource is an image or not
> // because if not, then there is no point in generating a thumbnail of it!
> if( !$resource->isImage()) {
> - $this->_view = new AdminResourcesListView( $this->_blogInfo );
> + $this->_view = new AdminEditResourceView( $this->_blogInfo );
> $this->_view->setErrorMessage( $this->_locale->tr("error_resource_is_not_an_image" ));
> - $this->setCommonData();
> + $this->setCommonData($resource);
> return false;
> }
>
> // Get a helper to read the metadata
> $reader = $resource->getMetadataReader();
> if(!$reader){
> - $this->_view = new AdminResourcesListView( $this->_blogInfo );
> + $this->_view = new AdminEditResourceView( $this->_blogInfo );
> $this->_view->setErrorMessage( $this->_locale->tr("error_updating_resource" ));
> - $this->setCommonData();
> + $this->setCommonData($resource);
> return false;
> }
>
> @@ -78,9 +87,9 @@
> GalleryResourceStorage::getUserFolder($resource->getOwnerId()).$resource->getFileName(),
> $resource->getId(), $resource->getOwnerId(), $thumbHeight, $thumbWidth );
> if( !$result ) {
> - $this->_view = new AdminResourcesListView( $this->_blogInfo );
> - $this->_view->setErrorMessage( $this->_locale->tr("error_updatin_resource" ));
> - $this->setCommonData();
> + $this->_view = new AdminEditResourceView( $this->_blogInfo );
> + $this->_view->setErrorMessage( $this->_locale->tr("error_updating_resource" ));
> + $this->setCommonData($resource);
> return false;
> }
>
> @@ -96,17 +105,14 @@
> $resource->getId(), $resource->getOwnerId(), $thumbHeight, $thumbWidth );
>
> if( !$result ) {
> - $this->_view = new AdminResourcesListView( $this->_blogInfo );
> + $this->_view = new AdminEditResourceView( $this->_blogInfo );
> $this->_view->setErrorMessage( $this->_locale->tr("error_updating_resource" ));
> }
> else {
> $this->_view = new AdminEditResourceView( $this->_blogInfo );
> $this->_view->setSuccessMessage( $message = $this->_locale->tr("resource_preview_generated_ok" ));
> - $this->_view->setValue( "resourceDescription", $resource->getDescription());
> - $this->_view->setValue( "albumId", $resource->getAlbumId());
> - $this->_view->setValue( "resource", $resource );
> }
> - $this->setCommonData();
> + $this->setCommonData($resource);
>
> return true;
> }
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>
--
Jon Daley
http://jon.limedaley.com/
You've all heard of the asteroid that will crash into the planet in
2028. If that's the case, I think we should definitely pollute
the environment.
-- Professor Tygar
More information about the pLog-svn
mailing list