more photos work

This commit is contained in:
redmatrix 2015-06-17 18:26:56 -07:00
parent 6ab20eb1b5
commit 2963be60e5
4 changed files with 15 additions and 6 deletions

View file

@ -351,12 +351,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$album = (($arr) ? $arr['album'] : '');
$newalbum = (($arr) ? $arr['newalbum'] : '');
$hash = (($arr && $arr['hash']) ? $arr['hash'] : null);
$upload_path = (($arr && $arr['directory']) ? $arr['directory'] : '');
logger('arr: ' . print_r($arr,true));
// This is currently used only in mod/wall_attach
$str_contact_allow = perms2str(((is_array($arr['contact_allow'])) ? $arr['contact_allow'] : explode(',',$arr['contact_allow'])));
if(! perm_is_allowed($channel_id,get_observer_hash(), 'write_storage')) {
$ret['message'] = t('Permission denied.');

View file

@ -563,14 +563,20 @@ function photos_content(&$a) {
$albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer']));
$def_album = get_pconfig($a->data['channel']['channel_id'],'system','photo_path');
if($def_album) {
$selname = filepath_macro($def_album);
$albums['album'][] = array('text' => $selname);
}
$tpl = get_markup_template('photos_upload.tpl');
$upload_form = replace_macros($tpl,array(
'$pagename' => t('Upload Photos'),
'$sessid' => session_id(),
'$usage' => $usage_message,
'$nickname' => $a->data['channel']['channel_address'],
'$newalbum_label' => t('Enter a new album name'),
'$newalbum_placeholder' => t('or select an existing one (doubleclick)'),
'$newalbum_label' => t('Enter an album name'),
'$newalbum_placeholder' => t('or select an existing album (doubleclick)'),
'$visible' => array('visible', t('Create a status post for this upload'), 0, '', array(t('No'), t('Yes'))),
'$albums' => $albums['albums'],
'$selname' => $selname,
@ -899,7 +905,7 @@ function photos_content(&$a) {
}
}
if((local_channel()) && (local_user() == $link_item['uid'])) {
if((local_channel()) && (local_channel() == $link_item['uid'])) {
q("UPDATE `item` SET item_unseen = 0 WHERE parent = %d and uid = %d and item_unseen = 1",
intval($link_item['parent']),
intval(local_channel())

View file

@ -38,7 +38,10 @@ function wall_attach_post(&$a) {
// }
// }
$r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : ''),'', array('source' => 'editor', 'visible' => 0, 'contact_allow' => array($channel['channel_hash'])));
$def_album = get_pconfig($channel['channel_id'],'system','photo_path');
$def_attach = get_pconfig($channel['channel_id'],'system','attach_path');
$r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : ''),'', array('source' => 'editor', 'visible' => 0, 'album' => $def_album, 'directory' => $def_attach, 'allow_cid' => '<' . $channel['channel_hash'] . '>'));
if(! $r['success']) {
notice( $r['message'] . EOL);

View file

@ -9,7 +9,7 @@
<datalist id="dl-photo-upload">
{{foreach $albums as $al}}
{{if $al.text}}
<option value="{{$al.text}}">
<option value="{{$al.text}}" />
{{/if}}
{{/foreach}}
</datalist>