From d192bcad65852bb9225a368d1bf42b8918ae6022 Mon Sep 17 00:00:00 2001 From: marijus Date: Mon, 27 Oct 2014 21:31:54 +0100 Subject: do not reload page for edit album and some minor cleanup --- mod/photos.php | 48 +++++++++++++++++---------------------- view/css/mod_photos.css | 16 +++---------- view/theme/redbasic/css/style.css | 1 + view/tpl/album_edit.tpl | 2 +- view/tpl/photo_album.tpl | 5 ++-- view/tpl/photo_top.tpl | 2 +- view/tpl/photo_view.tpl | 24 +++++++++----------- 7 files changed, 41 insertions(+), 57 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index cc0a963de..26a2bf50b 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -661,33 +661,25 @@ function photos_content(&$a) { intval($a->pager['itemspage']) ); - if($cmd === 'edit') { - if(($album !== t('Profile Photos')) && ($album !== 'Profile Photos') && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { - if($can_post) { - if($a->get_template_engine() === 'internal') { - $album_e = template_escape($album); - } - else { - $album_e = $album; - } - - $edit_tpl = get_markup_template('album_edit.tpl'); - $o .= replace_macros($edit_tpl,array( - '$nametext' => t('New album name: '), - '$nickname' => $a->data['channel']['channel_address'], - '$album' => $album_e, - '$hexalbum' => bin2hex($album), - '$submit' => t('Submit'), - '$dropsubmit' => t('Delete Album') - )); + //edit album name + $album_edit = null; + if(($album !== t('Profile Photos')) && ($album !== 'Profile Photos') && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { + if($can_post) { + if($a->get_template_engine() === 'internal') { + $album_e = template_escape($album); } - } - } - else { - if(($album !== t('Profile Photos')) && ($album !== 'Profile Photos') && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { - if($can_post) { - $edit = array(t('Edit Album'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '/edit'); - } + else { + $album_e = $album; + } + $edit_tpl = get_markup_template('album_edit.tpl'); + $album_edit = replace_macros($edit_tpl,array( + '$nametext' => t('New album name: '), + '$nickname' => $a->data['channel']['channel_address'], + '$album' => $album_e, + '$hexalbum' => bin2hex($album), + '$submit' => t('Submit'), + '$dropsubmit' => t('Delete Album') + )); } } @@ -727,6 +719,7 @@ function photos_content(&$a) { 'desc'=> $desc_e, 'ext' => $ext, 'hash'=> $rr['resource_id'], + 'unknown' => t('Unknown') ); } } @@ -749,10 +742,11 @@ function photos_content(&$a) { $o .= replace_macros($tpl, array( '$photos' => $photos, '$album' => $album, + '$album_edit' => array(t('Edit Album'), $album_edit), '$can_post' => $can_post, '$upload' => array(t('Upload'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album)), '$order' => $order, - '$edit' => $edit + )); } diff --git a/view/css/mod_photos.css b/view/css/mod_photos.css index 571aba57c..ed3e2ac26 100644 --- a/view/css/mod_photos.css +++ b/view/css/mod_photos.css @@ -87,28 +87,18 @@ } -#photo-edit-edit { +#photo-edit-edit, +#photo-album-edit-wrapper { + display: none; padding: 7px 10px; margin-bottom: 3px; } -#photo-edit-end { - margin-bottom: 35px; -} -#photo-caption { - margin-top: 15px; - margin-bottom: 15px; -} - #photo-album-edit-submit, #photo-album-edit-drop { margin-top: 15px; margin-bottom: 15px; } -#photo-album-edit-drop { - margin-left: 200px; -} - #photos-usage-message { line-height: 22px; } diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index be2eb05ae..e62949520 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -704,6 +704,7 @@ footer { cursor: pointer; } +#photo-album-edit-wrapper, #photo-view-wrapper, #photo-edit-edit { background-color: $item_colour; diff --git a/view/tpl/album_edit.tpl b/view/tpl/album_edit.tpl index 61653c47c..84a47378b 100755 --- a/view/tpl/album_edit.tpl +++ b/view/tpl/album_edit.tpl @@ -3,7 +3,7 @@ - +
diff --git a/view/tpl/photo_album.tpl b/view/tpl/photo_album.tpl index 0c878b950..0a26fc367 100755 --- a/view/tpl/photo_album.tpl +++ b/view/tpl/photo_album.tpl @@ -1,7 +1,7 @@
- {{if $edit}} - + {{if $album_edit.1}} + {{/if}} {{if $can_post}} @@ -12,6 +12,7 @@
+{{$album_edit.1}}
{{foreach $photos as $photo}} {{include file="photo_top.tpl"}} diff --git a/view/tpl/photo_top.tpl b/view/tpl/photo_top.tpl index ee21e5cce..a86aa7f80 100755 --- a/view/tpl/photo_top.tpl +++ b/view/tpl/photo_top.tpl @@ -1,4 +1,4 @@ - {{if $photo.album.name}}{{$photo.album.name}}{{elseif $photo.desc}}{{$photo.desc}}{{else}}{{$photo.alt}}{{/if}} + {{if $photo.album.name}}{{$photo.album.name}}{{elseif $photo.desc}}{{$photo.desc}}{{elseif $photo.alt}}{{$photo.alt}}{{else}}{{$photo.unknown}}{{/if}} diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl index 5e3518c9f..786145691 100755 --- a/view/tpl/photo_view.tpl +++ b/view/tpl/photo_view.tpl @@ -31,7 +31,7 @@
- - +
+
- + -{{$comments}} + {{$comments}} -{{if $commentbox}} -
- {{$commentbox}} -
-{{/if}} + {{if $commentbox}} +
+ {{$commentbox}} +
+ {{/if}} -
+
-- cgit v1.2.3