first cut at choklet template

This commit is contained in:
friendica 2014-03-02 15:47:01 -08:00
parent eb2b2f504c
commit e931af8307
3 changed files with 107 additions and 16 deletions

View File

@ -97,9 +97,11 @@ function comanche_parser(&$a,$s) {
function comanche_menu($name,$class = '') { function comanche_menu($name,$class = '') {
$a = get_app(); $channel_id = comanche_get_channel_id();
$m = menu_fetch($name,$a->profile['profile_uid'],get_observer_hash()); if($channel_id) {
return menu_render($m,$class); $m = menu_fetch($name,$channel_id,get_observer_hash());
return menu_render($m,$class);
}
} }
function comanche_replace_region($match) { function comanche_replace_region($match) {
@ -109,20 +111,37 @@ function comanche_replace_region($match) {
} }
} }
function comanche_block($name) { /**
* @function comanche_get_channel_id()
$o = ''; * Returns the channel_id of the profile owner of the page, or the local_user if there is no profile owner.
$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", * Otherwise returns 0
intval(get_app()->profile['profile_uid']), */
dbesc($name)
);
if($r) {
$o = '<div class="widget bblock">';
if($r[0]['title'])
$o .= '<h3>' . $r[0]['title'] . '</h3>';
$o .= prepare_text($r[0]['body'],$r[0]['mimetype']);
$o .= '</div>';
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();
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 = '<div class="widget bblock">';
if($r[0]['title'])
$o .= '<h3>' . $r[0]['title'] . '</h3>';
$o .= prepare_text($r[0]['body'],$r[0]['mimetype']);
$o .= '</div>';
}
} }
return $o; return $o;
} }

49
view/css/choklet.css Normal file
View File

@ -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%;
}

23
view/php/choklet.php Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE html >
<html>
<head>
<title><?php if(x($page,'title')) echo $page['title'] ?></title>
<script>var baseurl="<?php echo $a->get_baseurl() ?>";</script>
<?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>
</head>
<body>
<div id="blog-margin">
<?php if(x($page,'nav')) echo $page['nav']; ?>
<div id="blog-banner"><?php if(x($page,'banner')) echo $page['banner']; ?></div>
<aside id="region_1"><?php if(x($page,'aside')) echo $page['aside']; ?></aside>
<section id="region_2"><?php if(x($page,'content')) echo $page['content']; ?>
<div id="page-footer"></div>
<div id="pause"></div>
</section>
<aside id="region_3"><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></aside>
<div class="clear"></div>
<footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
</div>
</body>
</html>