Matt's demands (ticket #217)

This commit is contained in:
Max Shinn 2010-12-28 19:45:25 -06:00
parent e525e9ab9b
commit e9e5fdb139
5 changed files with 54 additions and 12 deletions

View File

@ -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;
}

View File

@ -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();

View File

@ -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->elementEnd('div');
//$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()));

View File

@ -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;
}

View File

@ -6,3 +6,9 @@
margin: 15px;
}
.photodescription {
display: block;
background-color: #dddddd;
padding: 20px;
margin: 15px;
}