From c6a75f407db0ab68a562442483b0f6402e34c0da Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 24 Apr 2015 11:36:49 +0200 Subject: webpages layout fixes --- mod/blocks.php | 2 +- mod/editlayout.php | 27 ++---------------- mod/layouts.php | 40 +++++++++++++++------------ view/css/mod_layouts.css | 29 ++++++++++++++++++++ view/theme/redbasic/css/style.css | 1 + view/tpl/layoutlist.tpl | 58 ++++++++++++++++++++++++++++++--------- 6 files changed, 101 insertions(+), 56 deletions(-) diff --git a/mod/blocks.php b/mod/blocks.php index f609164e0..ac78473ce 100644 --- a/mod/blocks.php +++ b/mod/blocks.php @@ -106,7 +106,7 @@ function blocks_content(&$a) { $editor = status_editor($a,$x); - $r = q("select * from item_id left join item on item_id.iid = item.id + $r = q("select iid, sid, mid, body, created, edited 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) ); diff --git a/mod/editlayout.php b/mod/editlayout.php index 437c164c1..5c9b62cbb 100644 --- a/mod/editlayout.php +++ b/mod/editlayout.php @@ -23,7 +23,6 @@ function editlayout_init(&$a) { function editlayout_content(&$a) { - if(! $a->profile) { notice( t('Requested profile is not available.') . EOL ); $a->error = 404; @@ -69,7 +68,6 @@ function editlayout_content(&$a) { $o = ''; - // Figure out which post we're editing $post_id = ((argc() > 2) ? intval(argv(2)) : 0); @@ -105,7 +103,9 @@ function editlayout_content(&$a) { $plaintext = true; $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( - '$title' => t('Edit Layout') + '$title' => t('Edit Layout'), + '$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( @@ -176,27 +176,6 @@ function editlayout_content(&$a) { '$feature_expire' => false, '$expires' => t('Set expiration date'), )); - - - if(($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) - $o .= '

' . t('Delete Layout') . '
'; - - - $x = array( - 'type' => 'layout', - '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; diff --git a/mod/layouts.php b/mod/layouts.php index 04d81f91e..e0021c35d 100644 --- a/mod/layouts.php +++ b/mod/layouts.php @@ -88,6 +88,9 @@ function layouts_content(&$a) { return; } + //This feature is not exposed in redbasic ui since it is not clear why one would want to + //download a json encoded pdl file - we dont have a possibility to import it. + //Use the buildin share/install feature instead. if((argc() > 3) && (argv(2) === 'share') && (argv(3))) { $r = q("select sid, service, mimetype, title, body from item_id left join item on item.id = item_id.iid @@ -103,18 +106,6 @@ function layouts_content(&$a) { } } - $tabs = array( - array( - 'label' => t('Layout Help'), - 'url' => 'help/Comanche', - 'sel' => '', - 'title' => t('Help with this feature'), - 'id' => 'layout-help-tab', - )); - - //$o .= replace_macros(get_markup_template('common_tabs.tpl'),array('$tabs' => $tabs)); - - // Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages // Nickname is set to the observers xchan, and profile_uid to the owners. // This lets you post pages at other people's channels. @@ -123,8 +114,6 @@ function layouts_content(&$a) { 'webpage' => ITEM_PDL, 'is_owner' => true, 'nickname' => $a->profile['channel_address'], - //do we need that at this place? - //'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'bang' => '', 'showacl' => false, 'visitor' => false, @@ -141,11 +130,10 @@ function layouts_content(&$a) { if($_REQUEST['pagetitle']) $x['pagetitle'] = $_REQUEST['pagetitle']; - $editor = status_editor($a,$x); - $r = q("select iid, sid, mid from item_id left join item on item.id = item_id.iid - where item_id.uid = %d and service = 'PDL' order by sid asc", + $r = q("select iid, sid, mid, body, created, edited from item_id left join item on item_id.iid = item.id + where item_id.uid = %d and service = 'PDL' order by item.created desc", intval($owner) ); @@ -154,10 +142,22 @@ function layouts_content(&$a) { if($r) { $pages = array(); foreach($r as $rr) { + $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'], - 'mid' => $rr['mid'] + 'mid' => $rr['mid'], + 'created' => $rr['created'], + 'edited' => $rr['edited'], + 'bb_element' => '[element]' . base64url_encode(json_encode($element_arr)) . '[/element]' ); } } @@ -171,8 +171,12 @@ function layouts_content(&$a) { '$help' => array('text' => t('Help'), 'url' => 'help/Comanche', 'title' => t('Comanche page description language help')), '$editor' => $editor, '$baseurl' => $url, + '$name' => t('Layout Name'), + '$created' => t('Created'), + '$edited' => t('Edited'), '$edit' => t('Edit'), '$share' => t('Share'), + '$download' => t('Download PDL file'), '$pages' => $pages, '$channel' => $which, '$view' => t('View'), diff --git a/view/css/mod_layouts.css b/view/css/mod_layouts.css index 7f65713e7..5a3c86733 100644 --- a/view/css/mod_layouts.css +++ b/view/css/mod_layouts.css @@ -1,3 +1,32 @@ #layout-editor { display: none; } + +#layout-list-table { + width: 100%; +} + +#layout-list-table th:nth-child(1){ + padding: 7px 3px 7px 10px; + white-space: nowrap; +} + +#layout-list-table td:nth-child(1){ + padding: 7px 3px 7px 10px; +} + +#layout-list-table th:nth-child(5), +#layout-list-table td:nth-child(5){ + padding: 7px 3px; + white-space: nowrap; +} + +#layout-list-table th:nth-child(6), +#layout-list-table td:nth-child(6){ + padding: 7px 10px 7px 7px; + white-space: nowrap; +} + +.webpage-list-tool { + padding: 7px 10px; +} diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 28d443c74..a5e5dffdb 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1938,6 +1938,7 @@ nav .dropdown-menu { [id^="webpage-list-item-"]:hover td, [id^="block-list-item-"]:hover td, +[id^="layout-list-item-"]:hover td, [id^="menu-list-item-"]:hover td, [id^="mitem-list-item-"]:hover td { background-color: $item_colour; diff --git a/view/tpl/layoutlist.tpl b/view/tpl/layoutlist.tpl index cd146377d..6812cf95b 100644 --- a/view/tpl/layoutlist.tpl +++ b/view/tpl/layoutlist.tpl @@ -15,19 +15,51 @@ {{/if}} {{if $pages}} -
+
+ + + + + + + + + {{foreach $pages as $key => $items}} - {{foreach $items as $item}} -
- {{if $edit}} {{/if}} - {{if $view}} {{/if}} - {{if $share}} {{/if}} - {{*if $preview}} {{/if*}} - {{$item.title}} -
- {{/foreach}} + {{foreach $items as $item}} + + + + + + + + {{/foreach}} - - -
+ {{/foreach}} +
{{$name}}
+ {{if $view}} + {{$item.title}} + {{else}} + {{$item.title}} + {{/if}} + + {{if $edit}} + + {{/if}} + + {{if $item.bb_element}} + + {{/if}} + + {{if $edit}} + + {{/if}} +
+
+
{{/if}} -- cgit v1.2.3