First commit. Blog theme and profilehome plugin

This commit is contained in:
Fabio Comuni 2012-07-11 14:02:31 +02:00
parent 53f043df69
commit 5cc8e0aa03
18 changed files with 661 additions and 0 deletions

1
README
View file

@ -0,0 +1 @@
Collection of themes and addons to make Friendika work more like a blog

View file

@ -0,0 +1,2 @@
{{ inc field_select.tpl with $field=$user }}{{ endinc }}
<div class="submit"><input type="submit" value="$submit" /></div>

View file

@ -0,0 +1,50 @@
<?php
/**
* Name: Profile home (friendicablog)
* Description: Redirect from homepage to a profile
* Version: 1.0
* Author: Fabio Comuni <http://kirgroup.com/profile/fabrixxm>
*/
function profilehome_install() {
register_hook('home_content', 'addon/profilehome/profilehome.php', 'profilehome_home');
logger("installed profilehome");
}
function profilehome_uninstall() {
unregister_hook('home_content', 'addon/profilehome/profilehome.php', 'profilehome_home');
logger("removed profilehome");
}
function profilehome_home(&$a, &$o){
$user = get_config("profilehome","user");
if ($user!==false) goaway($a->get_baseurl()."/profile/".$user);
}
function profilehome_plugin_admin(&$a, &$o){
$r = q("SELECT nickname, username FROM user WHERE verified=1 AND account_removed=0 AND account_expired=0");
$users = array("##no##"=>"No redirect (use default home)");
foreach ($r as $u) {
$users[$u['nickname']] = $u['username']." (".$u['nickname'].")";
}
$user = get_config("profilehome","user");
$t = file_get_contents(dirname(__file__)."/admin.tpl");
$o = '<input type="hidden" name="form_security_token" value="' .get_form_security_token("profilehomesave") .'">';
$o .= replace_macros( $t, array(
'$submit' => t('Submit'),
'$user' => array('user', t('Profile to use as home page'), $user, "", $users),
));
}
function profilehome_plugin_admin_post(&$a){
check_form_security_token('profilehomesave');
$user = ((x($_POST, 'user')) ? notags(trim($_POST['user'])) : false);
if ($user=='##no##') $user=false;
set_config('profilehome', 'user', $user);
info( t('Profile home settings updated.') .EOL);
}

View file

@ -0,0 +1,28 @@
{{ for $threads as $thread }}
<div id="tread-wrapper-$thread.id" class="tread-wrapper">
{{if $mode == display}}
{{ for $thread.items as $item }}
{{ if $item.type == tag }}
{{ inc wall_item_tag.tpl }}{{ endinc }}
{{ else }}
{{ inc $item.template }}{{ endinc }}
{{ endif }}
{{ endfor }}
{{ else}}
{{ inc $thread.items.0.template with $item=$thread.items.0 }}{{ endinc }}
<a href="$thread.items.0.plink.href">Commenti: {{if $thread.num_comments}}$thread.num_comments{{ else }}0{{ endif }}</a>
<hr>
{{ endif }}
</div>
{{ endfor }}
<div id="conversation-end"></div>
{{ if $dropping }}
<a href="#" onclick="deleteCheckedItems();return false;">
<span class="icon s22 delete text">$dropping</span>
</a>
{{ endif }}

View file

@ -0,0 +1,30 @@
<!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="page">
<?php
if(x($page,'nav')){
// header image
$img = $a->get_baseurl()."/view/theme/blog/headers/willow.jpg";
echo str_replace("~blog.header.image~", $img,
str_replace("~config.sitename~",get_config('config','sitename'),
str_replace("~system.banner~",get_config('system','banner'),
$page['nav']
)));
}
?>
<aside><?php if(x($page,'aside')) echo $page['aside']; ?></aside>
<section><?php if(x($page,'content')) echo $page['content']; ?>
<div id="page-footer"></div>
</section>
<right_aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></right_aside>
<footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

107
view/theme/blog/nav.tpl Normal file
View file

@ -0,0 +1,107 @@
<header id="branding" role="banner">
<hgroup>
<h1 id="site-title"><span><a href="$baseurl">~config.sitename~</a></span></h1>
<h2 id="site-description">~system.banner~</h2>
</hgroup>
<div id="site-location">$sitelocation</div>
<a id="headerimage" href="$baseurl">
<img width="1000" height="288" alt="" src="~blog.header.image~">
</a>
<form id="searchform" action="$baseurl/search" method="get" role="search">
<label class="assistive-text" for="search">Search</label>
<input id="search" class="field" type="text" placeholder="Search" name="search">
<input id="searchsubmit" class="submit" type="submit" value="Search" name="submit">
</form>
<nav id="access" role="navigation">
<div class="menu">
<ul>
{{ if $nav.home }}
<li class="$sel.home"><a id="nav-home-link" class="nav-commlink $nav.home.2" href="$nav.home.0" title="$nav.home.3" >$nav.home.1</a></li>
<span id="home-update" class="nav-ajax-left"></span>
{{ endif }}
{{ if $nav.community }}<li class="$sel.community"><a id="nav-community-link" class="nav-commlink $nav.community.2 " href="$nav.community.0" title="$nav.community.3" >$nav.community.1</a></li>{{ endif }}
{{ if $nav.login }}<li class="$sel.login"><a id="nav-login-link" class="nav-login-link $nav.login.2" href="$nav.login.0" title="$nav.login.3" >$nav.login.1</a></li>{{ endif }}
{{ if $nav.register }}<li class="$sel.register"><a id="nav-register-link" class="nav-commlink $nav.register.2 " href="$nav.register.0" title="$nav.register.3" >$nav.register.1</a></li>{{ endif }}
{{ if $nav.apps }}<li class="$sel.apps"><a id="nav-apps-link" class="nav-link $nav.apps.2" href="$nav.apps.0" title="$nav.apps.3" >$nav.apps.1</a></li>{{ endif }}
{#<li><a id="nav-search-link" class="nav-link $nav.search.2" href="$nav.search.0" title="$nav.search.3" >$nav.search.1</a></li> #}
{{ if $nav.directory }}<li class="$sel.directory"><a id="nav-directory-link" class="nav-link $nav.directory.2" href="$nav.directory.0" title="$nav.directory.3" >$nav.directory.1</a></li>{{ endif }}
{{ if $nav.help }} <li class="$sel.help"><a id="nav-help-link" class="nav-link $nav.help.2" target="friendika-help" href="$nav.help.0" title="$nav.help.3" >$nav.help.1</a></li>{{ endif }}
</ul>
</div>
</nav>
{{ if $nav.logout }}
<nav id="tools" role="navigation">
<div class="user">
<ul>
{{ if $userinfo }}
<li class='dropmenu'><a href="$nav.home.0" title="$sitelocation"><img src="$userinfo.icon" alt="$userinfo.name">$userinfo.name</a>
<ul id="nav-user-menu" class="menu-popup">
{{ for $nav.usermenu as $usermenu }}
<li><a class="$usermenu.2" href="$usermenu.0" title="$usermenu.3">$usermenu.1</a></li>
{{ endfor }}
{{ if $nav.contacts }}<li><a class="$nav.contacts.2" href="$nav.contacts.0" title="$nav.contacts.3" >$nav.contacts.1</a></li>{{ endif }}
{{ if $nav.manage }}<li><a class="$nav.manage.2 sep" href="$nav.manage.0" title="$nav.manage.3">$nav.manage.1</a></li>{{ endif }}
{{ if $nav.settings }}<li><a class="$nav.settings.2 sep" href="$nav.settings.0" title="$nav.settings.3">$nav.settings.1</a></li>{{ endif }}
{{ if $nav.admin }}<li><a class="$nav.admin.2" href="$nav.admin.0" title="$nav.admin.3" >$nav.admin.1</a></li>{{ endif }}
{{ if $nav.logout }}<li><a class="$nav.logout.2 sep" href="$nav.logout.0" title="$nav.logout.3" >$nav.logout.1</a></li>{{ endif }}
</ul>
</li>
{{ endif }}
{{ if $nav.network }}
<li class="$sel.network">
<a class="$nav.network.2" href="$nav.network.0" title="$nav.network.3" >$nav.network.1</a>
<span id="net-update" class="nav-notify"></span>
</li>
{{ endif }}
{{ if $nav.notifications }}
<li class="$sel.notifications dropmenu">
<a id="nav-notifications-linkmenu" class="nav-commlink" href="$nav.notifications.0" rel="#nav-notifications-menu" title="$nav.notifications.1">$nav.notifications.1</a>
<span id="notify-update" class="nav-ajax-left"></span>
<ul id="nav-notifications-menu" class="menu-popup">
<li id="nav-notifications-see-all"><a href="$nav.notifications.all.0">$nav.notifications.all.1</a></li>
<li id="nav-notifications-mark-all"><a href="#" onclick="notifyMarkAll(); return false;">$nav.notifications.mark.1</a></li>
<li class="empty">$emptynotifications</li>
</ul>
</li>
{{ endif }}
{{ if $nav.introductions }}
<li class="$sel.introductions">
<a id="nav-notify-link" class="nav-commlink $nav.introductions.2" href="$nav.introductions.0" title="$nav.introductions.3" >$nav.introductions.1</a>
<span id="intro-update" class="nav-ajax-left"></span>
</li>
{{ endif }}
{{ if $nav.messages }}
<li class="$sel.messages">
<a id="nav-messages-link" class="nav-commlink $nav.messages.2" href="$nav.messages.0" title="$nav.messages.3" >$nav.messages.1</a>
<span id="mail-update" class="nav-ajax-left"></span>
</li>
{{ endif }}
</ul>
</div>
</nav>
{{ endif }}
</header>
<script type="text/plain" id="nav-notifications-template" rel="template">
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
</script>

432
view/theme/blog/style.css Normal file
View file

@ -0,0 +1,432 @@
/* 'inspired' by http://wp-themes.com/twentyeleven/ */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
border: 0 none;
font-family: inherit;
font-size: 100%;
font-style: inherit;
font-weight: inherit;
margin: 0;
outline: 0 none;
padding: 0;
vertical-align: baseline;
}
:focus {
outline: 0 none;
}
ol, ul {
list-style: none outside none;
}
table {
border-collapse: separate;
border-spacing: 0;
}
caption, th, td {
font-weight: normal;
text-align: left;
}
blockquote:before, blockquote:after, q:before, q:after {
content: "";
}
blockquote, q {
quotes: "" "";
}
a img {
border: 0 none;
}
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
body, input, textarea {
color: #373737;
font: 300 15px/1.625 "Helvetica Neue",Helvetica,Arial,sans-serif;
}
body {
padding: 0 2em;
line-height: 1;
background: none repeat scroll 0 0 #E2E2E2;
}
#page {
margin: 2em auto;
max-width: 1000px;
background: none repeat scroll 0 0 #FFFFFF;
}
h1, h2, h3, h4, h5, h6 {
clear: both;
}
hr {
background-color: #CCCCCC;
border: 0 none;
height: 1px;
margin-bottom: 1.625em;
}
p {
margin-bottom: 1.625em;
}
ul, ol {
margin: 0 0 1.625em 2.5em;
}
ul {
list-style: square outside none;
}
ol {
list-style-type: decimal;
}
ol ol {
list-style: upper-alpha outside none;
}
ol ol ol {
list-style: lower-roman outside none;
}
ol ol ol ol {
list-style: lower-alpha outside none;
}
ul ul, ol ol, ul ol, ol ul {
margin-bottom: 0;
}
dl {
margin: 0 1.625em;
}
dt {
font-weight: bold;
}
dd {
margin-bottom: 1.625em;
}
strong {
font-weight: bold;
}
cite, em, i {
font-style: italic;
}
blockquote {
font-family: Georgia,"Bitstream Charter",serif;
font-style: italic;
font-weight: normal;
margin: 0 3em;
}
blockquote em, blockquote i, blockquote cite {
font-style: normal;
}
blockquote cite {
color: #666666;
font: 300 12px "Helvetica Neue",Helvetica,Arial,sans-serif;
letter-spacing: 0.05em;
text-transform: uppercase;
}
pre {
background: none repeat scroll 0 0 #F4F4F4;
font: 13px/1.5 "Courier 10 Pitch",Courier,monospace;
margin-bottom: 1.625em;
overflow: auto;
padding: 0.75em 1.625em;
}
code, kbd, samp, var {
font: 13px Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace;
}
abbr, acronym, dfn {
border-bottom: 1px dotted #666666;
cursor: help;
}
address {
display: block;
margin: 0 0 1.625em;
}
ins {
background: none repeat scroll 0 0 #FFF9C0;
text-decoration: none;
}
sup, sub {
font-size: 10px;
height: 0;
line-height: 1;
position: relative;
vertical-align: baseline;
}
sup {
bottom: 1ex;
}
sub {
top: 0.5ex;
}
input[type="text"], input[type="password"], textarea {
background: none repeat scroll 0 0 #FAFAFA;
border: 1px solid #DDDDDD;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1) inset;
color: #888888;
}
input[type="text"]:focus, textarea:focus {
color: #373737;
}
textarea {
padding-left: 3px;
width: 98%;
}
input[type="text"] {
padding: 3px;
}
input#search {
background: url("images/search.png") no-repeat scroll 5px 6px transparent;
border-radius: 2px 2px 2px 2px;
font-size: 14px;
height: 22px;
line-height: 1.2em;
padding: 4px 10px 4px 28px;
}
input#searchsubmit {
display: none;
}
a {
color: #1982D1;
text-decoration: none;
}
a:focus, a:active, a:hover {
text-decoration: underline;
}
.assistive-text {
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
}
/* header */
#branding hgroup {
margin: 0 7.6%;
}
#branding {
border-top: 2px solid #BBBBBB;
padding-bottom: 10px;
position: relative;
z-index: 9999;
}
#site-title {
margin-right: 15%;
padding: 3.65625em 0 0;
}
#site-title a {
color: #111111;
font-size: 30px;
font-weight: bold;
line-height: 36px;
text-decoration: none;
}
#site-title a:hover, #site-title a:focus, #site-title a:active {
color: #1982D1;
}
#site-description {
color: #7A7A7A;
font-size: 14px;
margin: 0 15% 3.65625em 0;
}
#branding img {
height: auto;
margin-bottom: -7px;
width: 100%;
}
#access {
background: repeat scroll 0 0 #0A0A0A;
background: -moz-linear-gradient(#252525, #0A0A0A);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
clear: both;
display: block;
float: left;
margin: 0 auto 6px;
width: 100%;
}
#access div {
margin: 0 7.6%;
}
#access ul {
font-size: 13px;
list-style: none outside none;
margin: 0 0 0 -0.8125em;
padding-left: 0;
}
#access li {
float: left;
position: relative;
}
#access a {
color: #EEEEEE;
display: block;
line-height: 3.333em;
padding: 0 1.2125em;
text-decoration: none;
}
#access ul ul {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
display: none;
float: left;
left: 0;
margin: 0;
position: absolute;
top: 3.333em;
width: 188px;
z-index: 99999;
}
#access ul ul ul {
left: 100%;
top: 0;
}
#access ul ul a {
background: none repeat scroll 0 0 #F9F9F9;
border-bottom: 1px dotted #DDDDDD;
color: #444444;
font-size: 13px;
font-weight: normal;
height: auto;
line-height: 1.4em;
padding: 10px;
width: 168px;
}
#access li:hover > a, #access ul ul *:hover > a, #access a:focus {
background: none repeat scroll 0 0 #EFEFEF;
}
#access li:hover > a, #access a:focus {
background: none repeat scroll 0 0 #EFEFEF;
background: -moz-linear-gradient(#F9F9F9, #E5E5E5);
color: #373737;
}
#access ul li:hover > ul {
display: block;
}
.selected > a, #access .current-menu-item > a, #access .current-menu-ancestor > a, #access .current_page_item > a, #access .current_page_ancestor > a {
font-weight: bold;
}
#branding #searchform {
position: absolute;
right: 7.6%;
text-align: right;
top: 3.8em;
}
#branding #searchform div {
margin: 0;
}
#branding #search {
-moz-transition-duration: 400ms;
-moz-transition-property: width, background;
-moz-transition-timing-function: ease;
float: right;
width: 72px;
}
#branding #search:focus {
background-color: #F9F9F9;
width: 196px;
}
#branding #searchsubmit {
display: none;
}
#branding .only-search #searchform {
top: 5px;
z-index: 1;
}
#branding .only-search #search {
background-color: #666666;
border-color: #000000;
color: #222222;
}
#branding .only-search #s, #branding .only-search #s:focus {
width: 85%;
}
#branding .only-search #s:focus {
background-color: #BBBBBB;
}
#branding .with-image #searchform {
bottom: -27px;
max-width: 195px;
top: auto;
}
#branding .only-search + #access div {
padding-right: 205px;
}
#branding #site-location {
font-size: 0.7em;
color: #BBBBBB;
position: absolute;
right: 7.6%;
text-align: right;
top: 13.5em;
}
/* user bar */
#tools {
background: repeat scroll 0 0 #222222;
background: -moz-linear-gradient(#444444, #222222);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
clear: both;
display: block;
position: fixed;
top: 0px;
left: auto;
margin: 0 auto 6px;
width: 1000px;
}
#tools div {
margin: 0 7.6%;
}
#tools ul {
font-size: 10px;
list-style: none outside none;
margin: 0 0 0 -0.8125em;
padding-left: 0;
}
#tools li {
float: left;
position: relative;
}
#tools a {
color: #EEEEEE;
display: block;
line-height: 3.333em;
padding: 0 1.2125em;
text-decoration: none;
}
#tools ul ul {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
display: none;
float: left;
left: 0;
margin: 0;
position: absolute;
top: 3.333em;
width: 188px;
z-index: 99999;
}
#tools ul ul .sep {
border-top: 1px dotted #DDDDDD;
}
#tools ul ul ul {
left: 100%;
top: 0;
}
#tools ul ul a {
background: none repeat scroll 0 0 #F9F9F9;
border-bottom: 1px dotted #DDDDDD;
color: #444444;
font-size: 13px;
font-weight: normal;
height: auto;
line-height: 1.4em;
padding: 10px;
width: 168px;
}
#tools li:hover > a, #access ul ul *:hover > a, #access a:focus {
background: none repeat scroll 0 0 #EFEFEF;
}
#tools li:hover > a, #access a:focus {
background: none repeat scroll 0 0 #EFEFEF;
background: -moz-linear-gradient(#F9F9F9, #E5E5E5);
color: #373737;
}
#tools ul li:hover > ul {
display: block;
}
#tools img {
width: 16px;
margin-bottom: -5px;
margin-right: 5px;
}
.dropmenu { background: url(images/dropdown.png) center right no-repeat; margin-right: 1em; }

11
view/theme/blog/theme.php Normal file
View file

@ -0,0 +1,11 @@
<?php
/**
* Description: Blog-like theme
* Author: Fabio Comuni <http://kirgroup.com/u/fabrixxm>
**/
$a->theme_info = array(
);
function blog_init(&$a) {
}