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_view = perm_is_allowed($owner_uid,$observer['xchan_hash'],'view_photos');
if(! $can_view) {
notice( t('Access to this item is restricted.') . EOL);
return;
@ -535,29 +534,6 @@ function photos_content(&$a) {
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 = '';
$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');
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 {
$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) {
@ -596,19 +572,22 @@ function photos_content(&$a) {
);
}
$albumselect_e = $albumselect;
$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');
$o .= replace_macros($tpl,array(
'$pagename' => t('Upload Photos'),
'$sessid' => session_id(),
'$usage' => $usage_message,
'$nickname' => $a->data['channel']['channel_address'],
'$newalbum' => t('New album name: '),
'$existalbumtext' => t('or existing album name: '),
'$newalbum' => t('Enter a new album name or select an existing one:'),
'$nosharetext' => t('Do not show a status post for this upload'),
'$albumselect' => $albumselect_e,
'$albums' => $albums['albums'],
'$selname' => $selname,
'$permissions' => t('Permissions'),
'$aclselect' => $aclselect_e,
'$uploader' => $ret['addon_text'],
@ -671,11 +650,13 @@ function photos_content(&$a) {
else {
$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');
$album_edit = replace_macros($edit_tpl,array(
'$nametext' => t('New album name: '),
'$nickname' => $a->data['channel']['channel_address'],
'$album' => $album_e,
'$albums' => $albums['albums'],
'$hexalbum' => bin2hex($album),
'$submit' => t('Submit'),
'$dropsubmit' => t('Delete Album')
@ -943,18 +924,14 @@ function photos_content(&$a) {
$edit = null;
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'];
$caption_e = $ph[0]['description'];
$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' => t('Edit photo'),
'id' => $link_item['id'], //$ph[0]['id'],
'id' => $link_item['id'],
'rotatecw' => t('Rotate CW (right)'),
'rotateccw' => t('Rotate CCW (left)'),
'albums' => $albums['albums'],

View File

@ -127,10 +127,6 @@ a.wall-item-name-link {
font-size: 1.112em;
}
.wall-item-content img {
max-width: 95%;
}
.wall-item-title h3 {
font-weight: bold;
margin: 0px;
@ -262,4 +258,4 @@ a.wall-item-name-link {
.item-forged {
color: #FF0000;
font-size: 1.5em !important;
}
}

View File

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

View File

@ -2341,6 +2341,12 @@ aside .nav-pills > li > a {
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) {
aside#region_1 {

View File

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

View File

@ -3,7 +3,14 @@
<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>

View File

@ -1,44 +1,50 @@
<div class="section-title-wrapper">
<div id="photos-usage-message" class="pull-right">{{$usage}}</div>
<h2>{{$pagename}}</h2>
<div class="clear"></div>
</div>
<div class="generic-content-wrapper-styled">
<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" />
<div id="photos-upload-new-wrapper" >
<div id="photos-upload-newalbum-div">
<label id="photos-upload-newalbum-text" for="photos-upload-newalbum" >{{$newalbum}}</label>
</div>
<input id="photos-upload-newalbum" type="text" name="newalbum" />
</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" >
<input id="photos-upload-noshare" type="checkbox" name="not_visible" value="1" />
<label id="photos-upload-noshare-text" for="photos-upload-noshare" >{{$nosharetext}}</label>
</div>
<div id="photos-upload-perms" class="photos-upload-perms" >
<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>
</div>
{{$aclselect}}
<div id="photos-upload-perms-end"></div>
<div id="photos-upload-spacer"></div>
{{$uploader}}
{{$default}}
<div class="photos-upload-end" ></div>
</form>
<div class="generic-content-wrapper">
<div class="section-title-wrapper">
<div id="photos-usage-message" class="pull-right">{{$usage}}</div>
<h2>{{$pagename}}</h2>
<div class="clear"></div>
</div>
<div class="section-content-wrapper">
<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" />
<div id="photos-album-name-label" >
<label id="photos-upload-newalbum-text" for="photos-upload-newalbum">{{$newalbum}}</label>
</div>
<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 id="photos-upload-new-end"></div>
<div id="photos-upload-noshare-div" class="photos-upload-noshare-div" >
<input id="photos-upload-noshare" type="checkbox" name="not_visible" value="1" />
<label id="photos-upload-noshare-text" for="photos-upload-noshare" >{{$nosharetext}}</label>
</div>
<div id="photos-upload-perms" class="photos-upload-perms" >
<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>
</div>
{{$aclselect}}
<div id="photos-upload-perms-end"></div>
<div id="photos-upload-spacer"></div>
{{$uploader}}
{{$default}}
<div class="photos-upload-end" ></div>
</form>
</div>
</div>