From c696860cc53bc25558d83de5eda65d9b583da382 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 23 Apr 2015 21:04:01 +0200 Subject: webpages blocks fixes --- mod/blocks.php | 28 +++++++++++++++++++++++----- mod/editblock.php | 31 ++++--------------------------- 2 files changed, 27 insertions(+), 32 deletions(-) (limited to 'mod') diff --git a/mod/blocks.php b/mod/blocks.php index b74b034e5..f609164e0 100644 --- a/mod/blocks.php +++ b/mod/blocks.php @@ -70,7 +70,6 @@ function blocks_content(&$a) { return; } - // Block design features from visitors if((! $uid) || ($uid != $owner)) { @@ -105,11 +104,10 @@ function blocks_content(&$a) { if($_REQUEST['pagetitle']) $x['pagetitle'] = $_REQUEST['pagetitle']; - - $editor = status_editor($a,$x); - $r = q("select * from item_id where uid = %d and service = 'BUILDBLOCK' order by sid asc", + $r = q("select * from item_id left join item on item_id.iid = item.id + where item_id.uid = %d and service = 'BUILDBLOCK' order by item.created desc", intval($owner) ); @@ -118,7 +116,22 @@ function blocks_content(&$a) { if($r) { $pages = array(); foreach($r as $rr) { - $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']); + $element_arr = array( + 'type' => 'block', + 'body' => $rr['body'], + 'created' => $rr['created'], + 'edited' => $rr['edited'], + 'mimetype' => $rr['mimetype'], + 'pagetitle' => $rr['sid'], + 'mid' => $rr['mid'] + ); + $pages[$rr['iid']][] = array( + 'url' => $rr['iid'], + 'title' => $rr['sid'], + 'created' => $rr['created'], + 'edited' => $rr['edited'], + 'bb_element' => '[element]' . base64url_encode(json_encode($element_arr)) . '[/element]' + ); } } @@ -128,8 +141,13 @@ function blocks_content(&$a) { $o .= replace_macros(get_markup_template('blocklist.tpl'), array( '$baseurl' => $url, '$title' => t('Blocks'), + '$name' => t('Block Name'), + '$created' => t('Created'), + '$edited' => t('Edited'), '$create' => t('Create'), '$edit' => t('Edit'), + '$share' => t('Share'), + '$delete' => t('Delete'), '$editor' => $editor, '$pages' => $pages, '$channel' => $which, diff --git a/mod/editblock.php b/mod/editblock.php index 73be6a9f3..a0ece8133 100644 --- a/mod/editblock.php +++ b/mod/editblock.php @@ -70,7 +70,6 @@ function editblock_content(&$a) { $o = ''; - // Figure out which post we're editing $post_id = ((argc() > 2) ? intval(argv(2)) : 0); @@ -96,7 +95,6 @@ function editblock_content(&$a) { return; } - $plaintext = true; $mimeselect = ''; @@ -110,22 +108,21 @@ function editblock_content(&$a) { else $mimeselect = mimetype_select($itm[0]['uid'],$mimetype); - $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( - '$title' => t('Edit Block') + '$title' => t('Edit Block'), + '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), + '$id' => $itm[0]['id'] )); - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => $a->get_baseurl(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$ispublic' => ' ', // t('Visible to everybody'), '$geotag' => '', '$nickname' => $channel['channel_address'], - '$confirmdelete' => t('Delete block?') + '$confirmdelete' => t('Delete block?') )); - $tpl = get_markup_template("jot.tpl"); $jotplugins = ''; @@ -184,26 +181,6 @@ function editblock_content(&$a) { '$expires' => t('Set expiration date'), )); - - if(($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) - $o .= '

' . t('Delete Block') . '
'; - - - $x = array( - 'type' => 'block', - 'title' => $itm[0]['title'], - 'body' => $itm[0]['body'], - 'term' => $itm[0]['term'], - 'created' => $itm[0]['created'], - 'edited' => $itm[0]['edited'], - 'mimetype' => $itm[0]['mimetype'], - 'pagetitle' => $page_title, - 'mid' => $itm[0]['mid'] - ); - - $o .= EOL . EOL . t('Share') . EOL . '' . EOL . EOL; - - return $o; } -- cgit v1.2.3