oh this is nice... http://kmkeen.com/jshon - this is what we need to make shred -- well "shred". I also had to change the photos album list API a bit to fix any imagined and/or real parsing issues and also fixed shred so it can find its auxiliary files.

This commit is contained in:
friendica 2014-06-18 16:26:27 -07:00
parent 80d84206ed
commit c16b403cf7
4 changed files with 17 additions and 12 deletions

View File

@ -277,6 +277,7 @@ function photos_albums_list($channel,$observer) {
if($albums) { if($albums) {
$ret['success'] = true; $ret['success'] = true;
$ret['albums'] = array();
foreach($albums as $k => $album) { foreach($albums as $k => $album) {
$entry = array( $entry = array(
'text' => $album['album'], 'text' => $album['album'],
@ -284,7 +285,7 @@ function photos_albums_list($channel,$observer) {
'url' => z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album['album']), 'url' => z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album['album']),
'urlencode' => urlencode($album['album']), 'urlencode' => urlencode($album['album']),
'bin2hex' => bin2hex($album['album'])); 'bin2hex' => bin2hex($album['album']));
$ret[] = $entry; $ret['albums'][] = $entry;
} }
} }
return $ret; return $ret;
@ -306,11 +307,11 @@ function photos_album_widget($channelx,$observer,$albums = null) {
$albums = photos_albums_list($channelx,$observer); $albums = photos_albums_list($channelx,$observer);
} }
if($albums) { if($albums['success']) {
$o = replace_macros(get_markup_template('photo_albums.tpl'),array( $o = replace_macros(get_markup_template('photo_albums.tpl'),array(
'$nick' => $channelx['channel_address'], '$nick' => $channelx['channel_address'],
'$title' => t('Photo Albums'), '$title' => t('Photo Albums'),
'$albums' => $albums, '$albums' => $albums['albums'],
'$baseurl' => z_root(), '$baseurl' => z_root(),
'$upload' => ((perm_is_allowed($channelx['channel_id'],(($observer) ? $observer['xchan_hash'] : ''),'post_photos')) '$upload' => ((perm_is_allowed($channelx['channel_id'],(($observer) ? $observer['xchan_hash'] : ''),'post_photos'))
? t('Upload New Photos') : '') ? t('Upload New Photos') : '')

View File

@ -539,8 +539,8 @@ function photos_content(&$a) {
$albumselect = '<select id="photos-upload-album-select" name="album" size="4">'; $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>'; $albumselect .= '<option value="" ' . ((! $selname) ? ' selected="selected" ' : '') . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
if(count($albums)) { if(count($albums['albums'])) {
foreach($albums as $album) { foreach($albums['albums'] as $album) {
if(! $album['text']) if(! $album['text'])
continue; continue;
$selected = (($selname === $album['text']) ? ' selected="selected" ' : ''); $selected = (($selname === $album['text']) ? ' selected="selected" ' : '');
@ -548,8 +548,6 @@ function photos_content(&$a) {
} }
} }
$celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
$albumselect .= '</select>'; $albumselect .= '</select>';
$uploader = ''; $uploader = '';

View File

@ -112,10 +112,14 @@ load_config () {
# Source Config # Source Config
[[ -f "$FCLI_RC" ]] && . "$FCLI_RC" || show_config_help 1 [[ -f "$FCLI_RC" ]] && . "$FCLI_RC" || show_config_help 1
THISDIR=$(dirname $0)
if [ $THISDIR != '' ]; then THISDIR=. ; fi
PATH=$THISDIR:$PATH
# Source FriendicaOAuth.sh
OAuth_sh=$(which FriendicaOAuth.sh) # Source ShredOAuth.sh
(( $? != 0 )) && echo 'Unable to locate FriendicaOAuth.sh! Make sure it is in searching PATH.' && exit 1 OAuth_sh=$(which ShredOAuth.sh)
(( $? != 0 )) && echo 'Unable to locate ShredOAuth.sh! Make sure it is in searching PATH.' && exit 1
source "$OAuth_sh" source "$OAuth_sh"
# Source JSON.sh # Source JSON.sh
@ -213,7 +217,9 @@ main () {
*) *)
FO_command $fcli_command FO_command $fcli_command
JS_Parsed=$(echo "$FO_ret" | tokenize | parse) echo $FO_ret
# JS_Parsed=$(echo "$FO_ret" | tokenize | parse)
# for a in ${JS_Parsed[@]}; do # for a in ${JS_Parsed[@]}; do
@ -222,7 +228,7 @@ main () {
# echo "$JS_Parsed" | js ${a} ${b} # echo "$JS_Parsed" | js ${a} ${b}
# done # done
# else # else
echo "$JS_Parsed" # echo "$JS_Parsed"
# fi # fi
# done # done
return $FO_rval return $FO_rval