From e9e5fdb139f9ef8762ceb2dd7710157b080f1612 Mon Sep 17 00:00:00 2001 From: Max Shinn Date: Tue, 28 Dec 2010 19:45:25 -0600 Subject: [PATCH] Matt's demands (ticket #217) --- plugins/GNUsocialPhotos/actions/editphoto.php | 5 +++ plugins/GNUsocialPhotos/actions/photo.php | 2 +- plugins/GNUsocialPhotos/actions/photos.php | 39 +++++++++++++------ .../GNUsocialPhotos/res/gnusocialphotos.js | 14 +++++++ plugins/GNUsocialPhotos/res/style.css | 6 +++ 5 files changed, 54 insertions(+), 12 deletions(-) diff --git a/plugins/GNUsocialPhotos/actions/editphoto.php b/plugins/GNUsocialPhotos/actions/editphoto.php index 2ebcd97aff..eacd09156d 100644 --- a/plugins/GNUsocialPhotos/actions/editphoto.php +++ b/plugins/GNUsocialPhotos/actions/editphoto.php @@ -172,12 +172,16 @@ class EditphotoAction extends Action $this->showForm(_('Error: The photo data is not valid.')); return; } + common_redirect('/photo/' . $this->photo->id, '303'); $this->showForm(_('Success!')); } function deletePhoto() { + //For redirection + $oldalbum = $this->album_id; + $this->photo->title = ""; $this->photo->photo_description = ""; $this->photo->profile_id = 0; @@ -192,6 +196,7 @@ class EditphotoAction extends Action return; } $this->showForm(_('Success!')); + common_redirect('/' . $this->user->nickname . '/photos/' . $oldalbum, '303'); return; } diff --git a/plugins/GNUsocialPhotos/actions/photo.php b/plugins/GNUsocialPhotos/actions/photo.php index f6ec063586..4d08e5bbd6 100644 --- a/plugins/GNUsocialPhotos/actions/photo.php +++ b/plugins/GNUsocialPhotos/actions/photo.php @@ -99,7 +99,7 @@ class PhotoAction extends Action $this->elementEnd('div'); } - $this->element('p', array(), $this->photo->photo_description); + $this->element('p', array('class' => 'photodescription'), $this->photo->photo_description); //This is a hack to hide the top-level comment $this->element('style', array(), "#notice-{$this->photo->notice_id} div { display: none } #notice-{$this->photo->notice_id} ol li div { display: inline }"); $this->conversation->show(); diff --git a/plugins/GNUsocialPhotos/actions/photos.php b/plugins/GNUsocialPhotos/actions/photos.php index 5b750a6501..a75c446be1 100644 --- a/plugins/GNUsocialPhotos/actions/photos.php +++ b/plugins/GNUsocialPhotos/actions/photos.php @@ -74,6 +74,16 @@ class PhotosAction extends Action $nav->show(); } + function showResizeImagesBox() + { + $this->elementStart('select', array('onchange' => 'return scalePhotosToSize(this.value)')); + $this->element('option', array('value' => ''), ""); + $this->element('option', array('value' => '60'), _("Thumbnail")); + $this->element('option', array('value' => '120'), _("Medium")); + $this->element('option', array('value' => '400'), _("Normal")); + $this->elementEnd('select'); + } + function showAlbums() { $album = new GNUsocialPhotoAlbum(); @@ -85,13 +95,17 @@ class PhotosAction extends Action } $this->elementStart('div', array('class' => 'galleryheader')); - $this->element('a', array('href' => '#', - 'onclick' => 'return increasePhotoSize()'), '+'); - $this->raw(' | '); - $this->element('a', array('href' => '#', - 'onclick' => 'return decreasePhotoSize()'), '-'); + //$this->element('a', array('href' => '#', + // 'onclick' => 'return increasePhotoSize()'), '+'); + //$this->raw(' | '); + //$this->element('a', array('href' => '#', + // 'onclick' => 'return decreasePhotoSize()'), '-'); + + $this->showResizeImagesBox(); $this->elementEnd('div'); + + while ($album->fetch()) { $this->elementStart('div', array('class' => 'photocontainer')); $this->elementStart('a', array('href' => $album->getPageLink())); @@ -126,13 +140,16 @@ class PhotosAction extends Action $this->element('a', array('href' => $album->getPageLink() . '?pageid=' . ($page+1) ), 'Next page'); $this->raw(' | '); } - $this->element('a', array('href' => '#', - 'onclick' => 'return increasePhotoSize()'), '+'); - $this->raw(' | '); - $this->element('a', array('href' => '#', - 'onclick' => 'return decreasePhotoSize()'), '-'); + + //$this->element('a', array('href' => '#', + // 'onclick' => 'return increasePhotoSize()'), '+'); + //$this->raw(' | '); + //$this->element('a', array('href' => '#', + // 'onclick' => 'return decreasePhotoSize()'), '-'); + //$this->raw(' | '); + + $this->showResizeImagesBox(); $this->elementEnd('div'); - foreach ($photos as $photo) { $this->elementStart('a', array('href' => $photo->getPageLink())); diff --git a/plugins/GNUsocialPhotos/res/gnusocialphotos.js b/plugins/GNUsocialPhotos/res/gnusocialphotos.js index 3a959a5db4..8681f61755 100644 --- a/plugins/GNUsocialPhotos/res/gnusocialphotos.js +++ b/plugins/GNUsocialPhotos/res/gnusocialphotos.js @@ -13,3 +13,17 @@ function decreasePhotoSize() { }); return false; } + +function scalePhotosToSize(size) { + $('.photoingallery, .albumingallery').each(function(index) { + if(this.height > this.width) { + this.width = this.width*size/this.height; + this.height = size; + } + else { + this.height = this.height*size/this.width; + this.width = size; + } + }); + return false; +} \ No newline at end of file diff --git a/plugins/GNUsocialPhotos/res/style.css b/plugins/GNUsocialPhotos/res/style.css index 78cd01f926..bb7b619278 100644 --- a/plugins/GNUsocialPhotos/res/style.css +++ b/plugins/GNUsocialPhotos/res/style.css @@ -6,3 +6,9 @@ margin: 15px; } +.photodescription { + display: block; + background-color: #dddddd; + padding: 20px; + margin: 15px; +} \ No newline at end of file -- 2.39.2