diff options
author | friendica <info@friendica.com> | 2013-07-02 16:37:33 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-07-02 16:37:33 -0700 |
commit | da05b9736ec0f2712d1a6828ff819aa12dd9e391 (patch) | |
tree | d4abb67a4e0280ea86a29310f0e1d1423ab369f3 | |
parent | b86253c655f974920c4d3de0915611a7e66c7336 (diff) | |
download | volse-hubzilla-da05b9736ec0f2712d1a6828ff819aa12dd9e391.tar.gz volse-hubzilla-da05b9736ec0f2712d1a6828ff819aa12dd9e391.tar.bz2 volse-hubzilla-da05b9736ec0f2712d1a6828ff819aa12dd9e391.zip |
some work on issue #62 (comments collapsing on liveupdate), but still a work in progress
some work on photo consolidated "view/edit", but still a work in progress
-rwxr-xr-x | include/items.php | 3 | ||||
-rw-r--r-- | js/main.js | 37 | ||||
-rw-r--r-- | mod/photos.php | 134 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rwxr-xr-x | view/tpl/photo_edit.tpl | 55 | ||||
-rwxr-xr-x | view/tpl/photo_view.tpl | 55 |
6 files changed, 133 insertions, 153 deletions
diff --git a/include/items.php b/include/items.php index c4ffcbca6..a3d591899 100755 --- a/include/items.php +++ b/include/items.php @@ -1858,9 +1858,6 @@ function tag_deliver($uid,$item_id) { // See if we are the owner of the parent item and have given permission to tag our posts. // If so tag the parent post. - // FIXME --- If the item is deleted, remove the tag from the parent. - // (First ensure that deleted items use this function, or else do that part separately.) - logger('tag_deliver: community tag activity received'); if(($item['owner_xchan'] === $u[0]['channel_hash']) && (! get_pconfig($u[0]['channel_id'],'system','blocktags'))) { diff --git a/js/main.js b/js/main.js index 8b1114d19..c8c3ea48d 100644 --- a/js/main.js +++ b/js/main.js @@ -355,14 +355,22 @@ function updateConvItems(mode,data) { $('img',this).each(function() { $(this).attr('src',$(this).attr('dst')); }); -// expanded_comments = false; -// $('.collapsed-comments',this).each(function() { -// if($(this).is(':visible')) -// expanded_comments = this; -// }); + + // FIXME this doesn't work at all to prevent open comments from + // collapsing on update - but I'm leaving this experimental code here until + // I have time to dig into it again. Ideally we want to find + // the expanded comments div on the page and then expand the one we received + // over the wire (in the data variable) before placing the thread on the page, + // as then it won't blink. + + expanded_comments = false; + $('.collapsed-comments',this).each(function() { + if($('.thread-wrapper',this).is(':visible')) + expanded_comments = this; + }); $('#' + prev).after($(this)); -// if(expanded_comments) -// $(expanded_comments).show(); + if(expanded_comments) + $(expanded_comments).show(); $(".autotime").timeago(); // divgrow doesn't prevent itself from attaching a second (or 500th) // "show more" div to a content region - it also has a few other @@ -374,14 +382,15 @@ function updateConvItems(mode,data) { $('img',this).each(function() { $(this).attr('src',$(this).attr('dst')); }); -// expanded_comments = false; -// $('.collapsed-comments',this).each(function() { -// if($(this).is(':visible')) -// expanded_comments = this; -// }); + // more FIXME related to expanded comments + expanded_comments = false; + $('.collapsed-comments',this).each(function() { + if($('.thread-wrapper',this).is(':visible')) + expanded_comments = $(this); + }); $('#' + ident).replaceWith($(this)); -// if(expanded_comments) -// $(expanded_comments).show(); + if(expanded_comments) + $(expanded_comments).show(); $(".autotime").timeago(); // $("div.wall-item-body").divgrow({ initialHeight: 400 }); diff --git a/mod/photos.php b/mod/photos.php index 65bf866f1..f0b2b882e 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -633,6 +633,9 @@ function photos_content(&$a) { // dispatch request // + /** + * Display upload form + */ if($datatype === 'upload') { if(! ($can_post)) { @@ -640,12 +643,8 @@ function photos_content(&$a) { return; } - $selname = (($datum) ? hex2bin($datum) : ''); - - $albumselect = '<select id="photos-upload-album-select" name="album" size="4">'; - $albumselect .= '<option value="" ' . ((! $selname) ? ' selected="selected" ' : '') . '> </option>'; if(count($a->data['albums'])) { @@ -673,6 +672,7 @@ function photos_content(&$a) { $default_upload = '<input id="photos-upload-choose" type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" > <input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>'; + /* Show space usage */ $r = q("select sum(size) as total from photo where uid = %d and scale = 0 ", intval($a->data['channel']['channel_id']) @@ -687,15 +687,8 @@ function photos_content(&$a) { $usage_message = sprintf( t('You have used %1$.2f Mbytes of photo storage.'), $r[0]['total'] / 1024000 ); } - - if($a->get_template_engine() === 'internal') { - $albumselect_e = template_escape($albumselect); - $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb))); - } - else { - $albumselect_e = $albumselect; - $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb)); - } + $albumselect_e = $albumselect; + $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb)); $tpl = get_markup_template('photos_upload.tpl'); $o .= replace_macros($tpl,array( @@ -718,6 +711,10 @@ function photos_content(&$a) { return $o; } + /* + * Display a single photo album + */ + if($datatype === 'album') { $album = hex2bin($datum); @@ -793,6 +790,7 @@ function photos_content(&$a) { if(count($r)) $twist = 'rotright'; foreach($r as $rr) { + if($twist == 'rotright') $twist = 'rotleft'; else @@ -839,12 +837,12 @@ function photos_content(&$a) { } + /** + * Display one photo + */ if($datatype === 'image') { - - - //$o = ''; // fetch image, item containing image, then comments $ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' @@ -853,13 +851,16 @@ function photos_content(&$a) { dbesc($datum) ); - if(! count($ph)) { + if(! $ph) { + + /* Check again - this time without specifying permissions */ + $ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' LIMIT 1", intval($owner_uid), dbesc($datum) ); - if(count($ph)) + if($ph) notice( t('Permission denied. Access to this item may be restricted.')); else notice( t('Photo not available') . EOL ); @@ -893,9 +894,9 @@ function photos_content(&$a) { break; } } - $edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : ''); - $prevlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); - $nextlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); + + $prevlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); + $nextlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); } @@ -918,7 +919,6 @@ function photos_content(&$a) { if($can_post && ($ph[0]['uid'] == $owner_uid)) { $tools = array( - 'edit' => array($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? t('View photo') : t('Edit photo'))), 'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')), ); @@ -931,7 +931,7 @@ function photos_content(&$a) { } - if(! $cmd !== 'edit') { + if(! $can_post) { $a->page['htmlhead'] .= '<script> $(document).keydown(function(event) {' . "\n"; @@ -990,39 +990,33 @@ function photos_content(&$a) { } - $edit = Null; - if(($cmd === 'edit') && ($can_post)) { - if($a->get_template_engine() === 'internal') { - $album_e = template_escape($ph[0]['album']); - $caption_e = template_escape($ph[0]['desc']); - $aclselect_e = template_escape(populate_acl($ph[0])); - } - else { - $album_e = $ph[0]['album']; - $caption_e = $ph[0]['desc']; - $aclselect_e = populate_acl($ph[0]); - } + $edit = null; + if($can_post) { - $edit_tpl = get_markup_template('photo_edit.tpl'); - $edit = replace_macros($edit_tpl, array( - '$id' => $ph[0]['id'], - '$rotatecw' => t('Rotate CW (right)'), - '$rotateccw' => t('Rotate CCW (left)'), - '$album' => $album_e, - '$newalbum' => t('New album name'), - '$nickname' => $a->data['channel']['channel_address'], - '$resource_id' => $ph[0]['resource_id'], - '$capt_label' => t('Caption'), - '$caption' => $caption_e, - '$tag_label' => t('Add a Tag'), - '$tags' => $link_item['tag'], - '$permissions' => t('Permissions'), - '$aclselect' => $aclselect_e, - '$help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'), - '$item_id' => ((count($linked_items)) ? $link_item['id'] : 0), - '$submit' => t('Submit'), - '$delete' => t('Delete Photo') - )); + $album_e = $ph[0]['album']; + $caption_e = $ph[0]['desc']; + $aclselect_e = populate_acl($ph[0]); + + $edit = array( + 'edit' => t('Edit photo'), + 'id' => $ph[0]['id'], + 'rotatecw' => t('Rotate CW (right)'), + 'rotateccw' => t('Rotate CCW (left)'), + 'album' => $album_e, + 'newalbum' => t('New album name'), + 'nickname' => $a->data['channel']['channel_address'], + 'resource_id' => $ph[0]['resource_id'], + 'capt_label' => t('Caption'), + 'caption' => $caption_e, + 'tag_label' => t('Add a Tag'), + 'tags' => $link_item['tag'], + 'permissions' => t('Permissions'), + 'aclselect' => $aclselect_e, + 'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'), + 'item_id' => ((count($linked_items)) ? $link_item['id'] : 0), + 'submit' => t('Submit'), + 'delete' => t('Delete Photo') + ); } if(count($linked_items)) { @@ -1154,16 +1148,10 @@ function photos_content(&$a) { $drop = replace_macros(get_markup_template('photo_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete'))); - if($a->get_template_engine() === 'internal') { - $name_e = template_escape($profile_name); - $title_e = template_escape($item['title']); - $body_e = template_escape(bbcode($item['body'])); - } - else { - $name_e = $profile_name; - $title_e = $item['title']; - $body_e = bbcode($item['body']); - } + $name_e = $profile_name; + $title_e = $item['title']; + $body_e = bbcode($item['body']); + $comments .= replace_macros($template,array( '$id' => $item['item_id'], @@ -1184,18 +1172,10 @@ function photos_content(&$a) { $paginate = paginate($a); } - if($a->get_template_engine() === 'internal') { - $album_e = array($album_link,template_escape($ph[0]['album'])); - $tags_e = template_escape($tags); - $like_e = template_escape($like); - $dislike_e = template_escape($dislike); - } - else { - $album_e = array($album_link,$ph[0]['album']); - $tags_e = $tags; - $like_e = $like; - $dislike_e = $dislike; - } + $album_e = array($album_link,$ph[0]['album']); + $tags_e = $tags; + $like_e = $like; + $dislike_e = $dislike; $photo_tpl = get_markup_template('photo_view.tpl'); $o .= replace_macros($photo_tpl, array( diff --git a/version.inc b/version.inc index ab6fd81ae..71c7a401a 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-07-01.361 +2013-07-02.362 diff --git a/view/tpl/photo_edit.tpl b/view/tpl/photo_edit.tpl deleted file mode 100755 index fefe7f10b..000000000 --- a/view/tpl/photo_edit.tpl +++ /dev/null @@ -1,55 +0,0 @@ -{{* - * AUTOMATICALLY GENERATED TEMPLATE - * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN - * - *}} - -<form action="photos/{{$nickname}}/{{$resource_id}}" method="post" id="photo_edit_form" > - - <input type="hidden" name="item_id" value="{{$item_id}}" /> - - <label id="photo-edit-albumname-label" for="photo-edit-albumname">{{$newalbum}}</label> - <input id="photo-edit-albumname" type="text" size="32" name="albname" value="{{$album}}" /> - - <div id="photo-edit-albumname-end"></div> - - <label id="photo-edit-caption-label" for="photo-edit-caption">{{$capt_label}}</label> - <input id="photo-edit-caption" type="text" size="84" name="desc" value="{{$caption}}" /> - - <div id="photo-edit-caption-end"></div> - - <label id="photo-edit-tags-label" for="photo-edit-newtag" >{{$tag_label}}</label> - <input name="newtag" id="photo-edit-newtag" size="84" title="{{$help_tags}}" type="text" /> - - <div id="photo-edit-tags-end"></div> - <div id="photo-edit-rotate-wrapper"> - <div id="photo-edit-rotate-label"> - {{$rotatecw}}<br> - {{$rotateccw}} - </div> - <input type="radio" name="rotate" value="1" /><br> - <input type="radio" name="rotate" value="2" /> - </div> - <div id="photo-edit-rotate-end"></div> - - <div id="photo-edit-perms" class="photo-edit-perms" > - <a href="#photo-edit-perms-select" id="photo-edit-perms-menu" class="button popupbox" title="{{$permissions}}"/> - <span id="jot-perms-icon" class="icon {{$lockstate}}" ></span>{{$permissions}} - </a> - <div id="photo-edit-perms-menu-end"></div> - - <div style="display: none;"> - <div id="photo-edit-perms-select" > - {{$aclselect}} - </div> - </div> - </div> - <div id="photo-edit-perms-end"></div> - - <input id="photo-edit-submit-button" type="submit" name="submit" value="{{$submit}}" /> - <input id="photo-edit-delete-button" type="submit" name="delete" value="{{$delete}}" onclick="return confirmDelete()"; /> - - <div id="photo-edit-end"></div> -</form> - - diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl index fe090409a..fce6f6fa8 100755 --- a/view/tpl/photo_view.tpl +++ b/view/tpl/photo_view.tpl @@ -14,8 +14,6 @@ <div id="photo-edit-link-wrap"> {{if $tools}} -<a id="photo-edit-link" href="{{$tools.edit.0}}">{{$tools.edit.1}}</a> -| <a id="photo-toprofile-link" href="{{$tools.profile.0}}">{{$tools.profile.1}}</a> {{/if}} {{if $lock}} | <img src="images/lock_icon.gif" class="lockview" alt="{{$lock}}" onclick="lockview(event,'photo/{{$id}}');" /> {{/if}} @@ -32,7 +30,58 @@ {{/if}} {{if $tags.2}}<div id="tag-remove"><a href="{{$tags.2}}">{{$tags.3}}</a></div>{{/if}} -{{if $edit}}{{$edit}}{{/if}} +{{if $edit}} +<div id="photo-edit-edit-wrapper" class="fakelink" onclick="openClose('photo-edit-edit');">{{$edit.edit}}</div> +<div id="photo-edit-edit" style="display: none;"> +<form action="photos/{{$edit.nickname}}/{{$edit.resource_id}}" method="post" id="photo_edit_form" > + + <input type="hidden" name="item_id" value="{{$item_id}}" /> + + <label id="photo-edit-albumname-label" for="photo-edit-albumname">{{$edit.newalbum}}</label> + <input id="photo-edit-albumname" type="text" size="32" name="albname" value="{{$edit.album}}" /> + + <div id="photo-edit-albumname-end"></div> + + <label id="photo-edit-caption-label" for="photo-edit-caption">{{$edit.capt_label}}</label> + <input id="photo-edit-caption" type="text" size="84" name="desc" value="{{$edit.caption}}" /> + + <div id="photo-edit-caption-end"></div> + + <label id="photo-edit-tags-label" for="photo-edit-newtag" >{{$edit.tag_label}}</label> + <input name="newtag" id="photo-edit-newtag" size="84" title="{{$edit.help_tags}}" type="text" /> + + <div id="photo-edit-tags-end"></div> + <div id="photo-edit-rotate-wrapper"> + <div id="photo-edit-rotate-label"> + {{$edit.rotatecw}}<br> + {{$edit.rotateccw}} + </div> + <input type="radio" name="rotate" value="1" /><br> + <input type="radio" name="rotate" value="2" /> + </div> + <div id="photo-edit-rotate-end"></div> + + <div id="photo-edit-perms" class="photo-edit-perms" > + <a href="#photo-edit-perms-select" id="photo-edit-perms-menu" class="button popupbox" title="{{$edit.permissions}}"/> + <span id="jot-perms-icon" class="icon {{$edit.lockstate}}" ></span>{{$edit.permissions}} + </a> + <div id="photo-edit-perms-menu-end"></div> + + <div style="display: none;"> + <div id="photo-edit-perms-select" > + {{$edit.aclselect}} + </div> + </div> + </div> + <div id="photo-edit-perms-end"></div> + + <input id="photo-edit-submit-button" type="submit" name="submit" value="{{$edit.submit}}" /> + <input id="photo-edit-delete-button" type="submit" name="delete" value="{{$edit.delete}}" onclick="return confirmDelete()"; /> + + <div id="photo-edit-end"></div> +</form> +</div> +{{/if}} {{if $likebuttons}} <div id="photo-like-div"> |