From e931af830701fdacc64e2cc014aa0057dc91e093 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 2 Mar 2014 15:47:01 -0800 Subject: first cut at choklet template --- include/comanche.php | 47 +++++++++++++++++++++++++++++++++-------------- view/css/choklet.css | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ view/php/choklet.php | 23 +++++++++++++++++++++++ 3 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 view/css/choklet.css create mode 100644 view/php/choklet.php diff --git a/include/comanche.php b/include/comanche.php index 4af081740..83e9af438 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -97,9 +97,11 @@ function comanche_parser(&$a,$s) { function comanche_menu($name,$class = '') { - $a = get_app(); - $m = menu_fetch($name,$a->profile['profile_uid'],get_observer_hash()); - return menu_render($m,$class); + $channel_id = comanche_get_channel_id(); + if($channel_id) { + $m = menu_fetch($name,$channel_id,get_observer_hash()); + return menu_render($m,$class); + } } function comanche_replace_region($match) { @@ -109,20 +111,37 @@ function comanche_replace_region($match) { } } +/** + * @function comanche_get_channel_id() + * Returns the channel_id of the profile owner of the page, or the local_user if there is no profile owner. + * Otherwise returns 0 + */ + +function comanche_get_channel_id() { + $channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0); + if((! $channel_id) && (local_user())) + $channel_id = local_user(); + return $channel_id; +} + function comanche_block($name) { + + $channel_id = comanche_get_channel_id(); - $o = ''; - $r = q("select * from item inner join item_id on iid = item.id and item_id.uid = item.uid and item.uid = %d and service = 'BUILDBLOCK' and sid = '%s' limit 1", - intval(get_app()->profile['profile_uid']), - dbesc($name) - ); - if($r) { - $o = '
'; - if($r[0]['title']) - $o .= '

' . $r[0]['title'] . '

'; - $o .= prepare_text($r[0]['body'],$r[0]['mimetype']); - $o .= '
'; + if($channel_id) { + $o = ''; + $r = q("select * from item inner join item_id on iid = item.id and item_id.uid = item.uid and item.uid = %d and service = 'BUILDBLOCK' and sid = '%s' limit 1", + intval($channel_id), + dbesc($name) + ); + if($r) { + $o = '
'; + if($r[0]['title']) + $o .= '

' . $r[0]['title'] . '

'; + $o .= prepare_text($r[0]['body'],$r[0]['mimetype']); + $o .= '
'; + } } return $o; } diff --git a/view/css/choklet.css b/view/css/choklet.css new file mode 100644 index 000000000..883bb1ed3 --- /dev/null +++ b/view/css/choklet.css @@ -0,0 +1,49 @@ +#blog-banner { + position: relative; + margin-top: 45px; + width: 100%; + height: 100px; + margin-bottom: 20px; +} + +nav.navbar { + width: 90%; + margin-left: 5%; + margin-right: 5%; +} + +aside#region_1 { + display: block; + min-width: 210px; + max-width: 220px; + width: 20%; + float: left; + margin-left: 10px; +} + +aside input[type='text'] { + width: 174px; +} + + +section { + margin-left: 15px; + margin-right: 15px; + float: left; + min-width: 650px; + width: 60%; + display: block; + padding-bottom: 350px; +} + +#region_3 { + float: right; + min-width: 210px; + max-width: 220px; + width: 20%; +} + +#blog-margin { + margin-right: 5%; + margin-left: 5%; +} \ No newline at end of file diff --git a/view/php/choklet.php b/view/php/choklet.php new file mode 100644 index 000000000..31b0b124c --- /dev/null +++ b/view/php/choklet.php @@ -0,0 +1,23 @@ + + + + <?php if(x($page,'title')) echo $page['title'] ?> + + + + +
+ +
+ +
+ +
+
+ +
+ +
+ + + -- cgit v1.2.3