From: Pierre-Luc P. <pa...@us...> - 2005-09-20 17:01:13
|
Update of /cvsroot/gallery/gallery2/modules/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2116/modules/remote Modified Files: GalleryRemote.inc module.inc Log Message: - when the applet is done uploading, it displays the list of uploaded files to the web page that contains it. - the protocol now supports bumping the view count, and the slideshow applet takes advantage of it. Index: GalleryRemote.inc =================================================================== RCS file: /cvsroot/gallery/gallery2/modules/remote/GalleryRemote.inc,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- GalleryRemote.inc 26 Aug 2005 05:15:13 -0000 1.35 +++ GalleryRemote.inc 20 Sep 2005 17:01:00 -0000 1.36 @@ -119,6 +119,13 @@ } break; + case 'increment-view-count': + $ret = $this->incrementViewCount($form, $response); + if ($ret->isError()) { + $status['controllerError'] = $ret->wrap(__FILE__, __LINE__); + } + break; + case 'no-op': $response->setProperty('status', $grStatusCodes['SUCCESS']); $response->setProperty('status_text', 'No-op successful'); @@ -414,6 +421,7 @@ $response->setProperty('status', $grStatusCodes['SUCCESS']); $response->setProperty('status_text', 'Add photo successful.'); + $response->setProperty('item_name', $newItem->getId()); return GalleryStatus::success(); } @@ -703,6 +711,37 @@ return GalleryStatus::success(); } + + /** + * Increment view count + * + * @param form array key value pairs from Gallery Remote + * @param object GalleryRemoteProperties a reference to our response object + * @return object GalleryStatus a status code + */ + function incrementViewCount($form, &$response) { + global $gallery; + $grStatusCodes = GalleryRemoteConstants::getStatusCodes(); + + if (empty($form['itemId'])) { + $response->setProperty('status', $grStatusCodes['MISSING_ARGUMENTS']); + $response->setProperty('status_text', 'increment-view-count failed.'); + return GalleryStatus::success(); + } + + $itemId = $form['itemId']; + + /* Increment the view count */ + $ret = GalleryCoreApi::incrementItemViewCount($itemId); + if ($ret->isError()) { + return $ret->wrap(__FILE__, __LINE__); + } + + $response->setProperty('status', $grStatusCodes['SUCCESS']); + $response->setProperty('status_text', 'increment-view-count successful.'); + + return GalleryStatus::success(); + } } /** Index: module.inc =================================================================== RCS file: /cvsroot/gallery/gallery2/modules/remote/module.inc,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- module.inc 10 Sep 2005 20:28:14 -0000 1.33 +++ module.inc 20 Sep 2005 17:01:00 -0000 1.34 @@ -32,7 +32,7 @@ $this->setId('remote'); $this->setName($gallery->i18n('Remote')); $this->setDescription($gallery->i18n('Implementation for the remote control protocol')); - $this->setVersion('1.0.0'); + $this->setVersion('1.0.1'); $this->setGroup('import', $this->translate('Import')); $this->setCallbacks('getSiteAdminViews'); $this->setRequiredCoreApi(array(6, 0)); |