some work on photo upload

This commit is contained in:
marijus 2014-10-30 14:10:55 +01:00
parent fc704d1f2f
commit 0ff4d9015b
7 changed files with 82 additions and 105 deletions

View File

@ -503,7 +503,6 @@ function photos_content(&$a) {
$can_post = perm_is_allowed($owner_uid,$observer['xchan_hash'],'post_photos'); $can_post = perm_is_allowed($owner_uid,$observer['xchan_hash'],'post_photos');
$can_view = perm_is_allowed($owner_uid,$observer['xchan_hash'],'view_photos'); $can_view = perm_is_allowed($owner_uid,$observer['xchan_hash'],'view_photos');
if(! $can_view) { if(! $can_view) {
notice( t('Access to this item is restricted.') . EOL); notice( t('Access to this item is restricted.') . EOL);
return; return;
@ -535,29 +534,6 @@ function photos_content(&$a) {
return; return;
} }
if(array_key_exists('albums', $a->data))
$albums = get_app()->data['albums'];
else
$albums = photos_albums_list($a->data['channel'],$a->data['observer']);
$selname = (($datum) ? hex2bin($datum) : '');
$albumselect = '<select id="photos-upload-album-select" name="album" size="4">';
$albumselect .= '<option value="" ' . ((! $selname) ? ' selected="selected" ' : '') . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
if(count($albums['albums'])) {
foreach($albums['albums'] as $album) {
if(! $album['text'])
continue;
$selected = (($selname === $album['text']) ? ' selected="selected" ' : '');
$albumselect .= '<option value="' . $album['text'] . '"' . $selected . '>' . $album['text'] . '</option>';
}
}
$albumselect .= '</select>';
$uploader = ''; $uploader = '';
$ret = array('post_url' => $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'], $ret = array('post_url' => $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'],
@ -579,10 +555,10 @@ function photos_content(&$a) {
$limit = service_class_fetch($a->data['channel']['channel_id'],'photo_upload_limit'); $limit = service_class_fetch($a->data['channel']['channel_id'],'photo_upload_limit');
if($limit !== false) { if($limit !== false) {
$usage_message = sprintf( t("You have used %1$.2f Mbytes of %2$.2f Mbytes photo storage."), $r[0]['total'] / 1024000, $limit / 1024000 ); $usage_message = sprintf( t("%1$.2f MB of %2$.2f MB photo storage used."), $r[0]['total'] / 1024000, $limit / 1024000 );
} }
else { else {
$usage_message = sprintf( t('You have used %1$.2f Mbytes of photo storage.'), $r[0]['total'] / 1024000 ); $usage_message = sprintf( t('%1$.2f MB photo storage used.'), $r[0]['total'] / 1024000 );
} }
if($_is_owner) { if($_is_owner) {
@ -596,19 +572,22 @@ function photos_content(&$a) {
); );
} }
$albumselect_e = $albumselect;
$aclselect_e = (($_is_owner) ? populate_acl($channel_acl,false) : ''); $aclselect_e = (($_is_owner) ? populate_acl($channel_acl,false) : '');
$selname = (($datum) ? hex2bin($datum) : '');
$albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer']));
$tpl = get_markup_template('photos_upload.tpl'); $tpl = get_markup_template('photos_upload.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$pagename' => t('Upload Photos'), '$pagename' => t('Upload Photos'),
'$sessid' => session_id(), '$sessid' => session_id(),
'$usage' => $usage_message, '$usage' => $usage_message,
'$nickname' => $a->data['channel']['channel_address'], '$nickname' => $a->data['channel']['channel_address'],
'$newalbum' => t('New album name: '), '$newalbum' => t('Enter a new album name or select an existing one:'),
'$existalbumtext' => t('or existing album name: '),
'$nosharetext' => t('Do not show a status post for this upload'), '$nosharetext' => t('Do not show a status post for this upload'),
'$albumselect' => $albumselect_e, '$albums' => $albums['albums'],
'$selname' => $selname,
'$permissions' => t('Permissions'), '$permissions' => t('Permissions'),
'$aclselect' => $aclselect_e, '$aclselect' => $aclselect_e,
'$uploader' => $ret['addon_text'], '$uploader' => $ret['addon_text'],
@ -671,11 +650,13 @@ function photos_content(&$a) {
else { else {
$album_e = $album; $album_e = $album;
} }
$albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer']));
$edit_tpl = get_markup_template('album_edit.tpl'); $edit_tpl = get_markup_template('album_edit.tpl');
$album_edit = replace_macros($edit_tpl,array( $album_edit = replace_macros($edit_tpl,array(
'$nametext' => t('New album name: '), '$nametext' => t('New album name: '),
'$nickname' => $a->data['channel']['channel_address'], '$nickname' => $a->data['channel']['channel_address'],
'$album' => $album_e, '$album' => $album_e,
'$albums' => $albums['albums'],
'$hexalbum' => bin2hex($album), '$hexalbum' => bin2hex($album),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$dropsubmit' => t('Delete Album') '$dropsubmit' => t('Delete Album')
@ -943,18 +924,14 @@ function photos_content(&$a) {
$edit = null; $edit = null;
if($can_post) { if($can_post) {
if(array_key_exists('albums', $a->data))
$albums = get_app()->data['albums'];
else
$albums = photos_albums_list($a->data['channel'],$a->data['observer']);
$album_e = $ph[0]['album']; $album_e = $ph[0]['album'];
$caption_e = $ph[0]['description']; $caption_e = $ph[0]['description'];
$aclselect_e = populate_acl($ph[0]); $aclselect_e = populate_acl($ph[0]);
$albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer']));
$edit = array( $edit = array(
'edit' => t('Edit photo'), 'edit' => t('Edit photo'),
'id' => $link_item['id'], //$ph[0]['id'], 'id' => $link_item['id'],
'rotatecw' => t('Rotate CW (right)'), 'rotatecw' => t('Rotate CW (right)'),
'rotateccw' => t('Rotate CCW (left)'), 'rotateccw' => t('Rotate CCW (left)'),
'albums' => $albums['albums'], 'albums' => $albums['albums'],

View File

@ -127,10 +127,6 @@ a.wall-item-name-link {
font-size: 1.112em; font-size: 1.112em;
} }
.wall-item-content img {
max-width: 95%;
}
.wall-item-title h3 { .wall-item-title h3 {
font-weight: bold; font-weight: bold;
margin: 0px; margin: 0px;

View File

@ -22,27 +22,12 @@
margin-bottom: 25px; margin-bottom: 25px;
} }
#photos-upload-newalbum-div {
float: left;
width: 175px;
}
#photos-upload-noshare { #photos-upload-noshare {
margin-bottom: 10px; margin-bottom: 10px;
} }
#photos-upload-existing-album-text { #photos-upload-spacer,
float: left; #photos-upload-new-end {
width: 175px;
}
#photos-upload-newalbum {
float: left;
}
#photos-upload-album-select {
float: left;
}
#photos-upload-spacer {
margin-top: 25px; margin-top: 25px;
} }
#photos-upload-new-end, #photos-upload-exist-end { #photos-upload-new-end, #photos-upload-exist-end {

View File

@ -2341,6 +2341,12 @@ aside .nav-pills > li > a {
margin-right: 10px; margin-right: 10px;
} }
.section-content-wrapper {
padding: 7px 10px;
background-color: $comment_item_colour;
border-bottom-left-radius: $radiuspx;
border-bottom-right-radius: $radiuspx;
}
@media screen and (max-width: 767px) { @media screen and (max-width: 767px) {
aside#region_1 { aside#region_1 {

View File

@ -226,7 +226,7 @@ if(! $a->install) {
if (! $input_linksubmit) if (! $input_linksubmit)
$input_linksubmit = "#0080FF"; $input_linksubmit = "#0080FF";
if (! $input_border) if (! $input_border)
$input_border = "#666"; $input_border = "#ccc";
if (! $input_colourhover) if (! $input_colourhover)
$input_colourhover = "#333"; $input_colourhover = "#333";
if (! $input_decohover) if (! $input_decohover)

View File

@ -3,7 +3,14 @@
<label id="photo-album-edit-name-label" for="photo-album-edit-name" >{{$nametext}}</label> <label id="photo-album-edit-name-label" for="photo-album-edit-name" >{{$nametext}}</label>
<input type="text" name="albumname" value="{{$album}}" > <input type="text" name="albumname" value="{{$album}}" list="dl-album-edit" />
<datalist id="dl-album-edit">
{{foreach $albums as $al}}
{{if $al.text}}
<option value="{{$al.text}}">
{{/if}}
{{/foreach}}
</datalist>
<div id="photo-album-edit-name-end"></div> <div id="photo-album-edit-name-end"></div>

View File

@ -1,36 +1,41 @@
<div class="section-title-wrapper"> <div class="generic-content-wrapper">
<div class="section-title-wrapper">
<div id="photos-usage-message" class="pull-right">{{$usage}}</div> <div id="photos-usage-message" class="pull-right">{{$usage}}</div>
<h2>{{$pagename}}</h2> <h2>{{$pagename}}</h2>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="generic-content-wrapper-styled"> <div class="section-content-wrapper">
<form action="photos/{{$nickname}}" enctype="multipart/form-data" method="post" name="photos-upload-form" id="photos-upload-form"> <form action="photos/{{$nickname}}" enctype="multipart/form-data" method="post" name="photos-upload-form" id="photos-upload-form">
<input type="hidden" id="photos-upload-source" name="source" value="photos" /> <input type="hidden" id="photos-upload-source" name="source" value="photos" />
<div id="photos-upload-new-wrapper" > <div id="photos-album-name-label" >
<div id="photos-upload-newalbum-div"> <label id="photos-upload-newalbum-text" for="photos-upload-newalbum">{{$newalbum}}</label>
<label id="photos-upload-newalbum-text" for="photos-upload-newalbum" >{{$newalbum}}</label>
</div> </div>
<input id="photos-upload-newalbum" type="text" name="newalbum" /> <div id="photos-album-name-input">
<input id="photos-upload-newalbum" type="text" value="{{$selname}}" name="newalbum" list="dl-photo-upload" />
<datalist id="dl-photo-upload">
{{foreach $albums as $al}}
{{if $al.text}}
<option value="{{$al.text}}">
{{/if}}
{{/foreach}}
</datalist>
</div> </div>
<div id="photos-upload-new-end"></div> <div id="photos-upload-new-end"></div>
<div id="photos-upload-exist-wrapper">
<div id="photos-upload-existing-album-text">{{$existalbumtext}}</div>
{{$albumselect}}
</div>
<div id="photos-upload-exist-end"></div>
<div id="photos-upload-noshare-div" class="photos-upload-noshare-div" > <div id="photos-upload-noshare-div" class="photos-upload-noshare-div" >
<input id="photos-upload-noshare" type="checkbox" name="not_visible" value="1" /> <input id="photos-upload-noshare" type="checkbox" name="not_visible" value="1" />
<label id="photos-upload-noshare-text" for="photos-upload-noshare" >{{$nosharetext}}</label> <label id="photos-upload-noshare-text" for="photos-upload-noshare" >{{$nosharetext}}</label>
</div> </div>
<div id="photos-upload-perms" class="photos-upload-perms" > <div id="photos-upload-perms" class="photos-upload-perms" >
<span id="jot-perms-icon" class="icon-{{$lockstate}}" ></span> <span id="jot-perms-icon" class="icon-{{$lockstate}}" ></span>
<button class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" onclick="return false;">{{$permissions}}</button> <button class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" onclick="return false;">{{$permissions}}</button>
</div> </div>
{{$aclselect}} {{$aclselect}}
<div id="photos-upload-perms-end"></div> <div id="photos-upload-perms-end"></div>
<div id="photos-upload-spacer"></div> <div id="photos-upload-spacer"></div>
@ -40,5 +45,6 @@
{{$default}} {{$default}}
<div class="photos-upload-end" ></div> <div class="photos-upload-end" ></div>
</form> </form>
</div>
</div> </div>