aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-09-25 21:35:35 -0700
committerfriendica <info@friendica.com>2012-09-25 21:35:35 -0700
commitba4fe4ff919fa3250db33eee2425870f10107e81 (patch)
treebee66979ee5fa4457f77abff71236fd5c10f0a35
parent85f9d89a89c25c7a5bb2dd948931e36af5ac0d4c (diff)
downloadvolse-hubzilla-ba4fe4ff919fa3250db33eee2425870f10107e81.tar.gz
volse-hubzilla-ba4fe4ff919fa3250db33eee2425870f10107e81.tar.bz2
volse-hubzilla-ba4fe4ff919fa3250db33eee2425870f10107e81.zip
allow themes to add to and/or completely over-ride the module sidebar
-rw-r--r--index.php30
-rw-r--r--mod/profile.php27
-rw-r--r--view/tpl/categories_widget.tpl4
3 files changed, 38 insertions, 23 deletions
diff --git a/index.php b/index.php
index 919d3695f..3c45a3b4c 100644
--- a/index.php
+++ b/index.php
@@ -145,7 +145,10 @@ $a->apps = $arr['app_menu'];
*
* "module"_init
* "module"_post (only called if there are $_POST variables)
- * "module"_afterpost
+ * "module"_aside
+ * $theme_$module_aside (and $extends_$module_aside) are run first if either exist
+ * if either of these return false, module_aside is not called
+ * This allows a theme to over-ride the sidebar layout completely.
* "module"_content - the string return of this function contains our page body
*
* Modules which emit other serialisations besides HTML (XML,JSON, etc.) should do
@@ -246,8 +249,8 @@ if($a->module_loaded) {
$func = str_replace('-','_',current_theme()) . '_init';
$func($a);
}
- elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/theme.php")) {
- require_once("view/theme/".$a->theme_info["extends"]."/theme.php");
+ elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/php/theme.php")) {
+ require_once("view/theme/".$a->theme_info["extends"]."/php/theme.php");
if(function_exists(str_replace('-','_',$a->theme_info["extends"]) . '_init')) {
$func = str_replace('-','_',$a->theme_info["extends"]) . '_init';
$func($a);
@@ -262,10 +265,23 @@ if($a->module_loaded) {
$func($a);
}
- if((! $a->error) && (function_exists($a->module . '_afterpost'))) {
- call_hooks($a->module . '_mod_afterpost',$placeholder);
- $func = $a->module . '_afterpost';
- $func($a);
+
+ if(! $a->error) {
+ $aside_default = true;
+ call_hooks($a->module . '_mod_aside',$placeholder);
+ if(function_exists(str_replace('-','_',current_theme()) . '_' . $a->module . '_aside')) {
+ $func = str_replace('-','_',current_theme()) . '_' . $a->module . '_aside';
+ $aside_default = $func($a);
+ }
+ elseif(x($a->theme_info,"extends") && $aside_default
+ && (function_exists(str_replace('-','_',$a->theme_info["extends"]) . '_' . $a->module . '_aside'))) {
+ $func = str_replace('-','_',$a->theme_info["extends"]) . '_' . $a->module . '_aside';
+ $aside_default = $func($a);
+ }
+ elseif(function_exists($a->module . '_aside') && $aside_default) {
+ $func = $a->module . '_aside';
+ $func($a);
+ }
}
if((! $a->error) && (function_exists($a->module . '_content'))) {
diff --git a/mod/profile.php b/mod/profile.php
index aaa324078..4351c607a 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -2,23 +2,27 @@
function profile_init(&$a) {
+ $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ;
+
+}
+
+
+function profile_aside(&$a) {
+
require_once('include/contact_widgets.php');
+ require_once('include/items.php');
if(! x($a->page,'aside'))
$a->page['aside'] = '';
- $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
-
if(argc() > 1)
$which = argv(1);
else {
- logger('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG);
notice( t('Requested profile is not available.') . EOL );
$a->error = 404;
return;
}
-
$profile = 0;
$channel = $a->get_channel();
@@ -27,9 +31,12 @@ function profile_init(&$a) {
$profile = argv(1);
}
+ $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat']) : '');
+
profile_load($a,$which,$profile);
- $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ;
+ $a->page['aside'] .= posted_date_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],$a->profile['profile_uid'],true);
+ $a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],$cat);
}
@@ -46,17 +53,11 @@ function profile_content(&$a, $update = 0) {
else
$datequery = escape_tags(argv($x));
}
- else
- $category = argv($x);
}
}
- if(! x($category)) {
- $category = ((x($_GET,'category')) ? $_GET['category'] : '');
- }
-
if(get_config('system','block_public') && (! get_account_id()) && (! remote_user())) {
- return login();
+ return login();
}
require_once("include/bbcode.php");
@@ -146,8 +147,6 @@ function profile_content(&$a, $update = 0) {
$celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false);
- $a->page['aside'] .= posted_date_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],$a->profile['profile_uid'],true);
- $a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : ''));
if(can_write_wall($a,$a->profile['profile_uid'])) {
diff --git a/view/tpl/categories_widget.tpl b/view/tpl/categories_widget.tpl
index 5dbd871a8..19e91c560 100644
--- a/view/tpl/categories_widget.tpl
+++ b/view/tpl/categories_widget.tpl
@@ -1,11 +1,11 @@
<div id="categories-sidebar" class="widget">
<h3>$title</h3>
- <div id="nets-desc">$desc</div>
+ <div id="categories-sidebar-desc">$desc</div>
<ul class="categories-ul">
<li class="tool"><a href="$base" class="categories-link categories-all{{ if $sel_all }} categories-selected{{ endif }}">$all</a></li>
{{ for $terms as $term }}
- <li class="tool"><a href="$base?f=&category=$term.name" class="categories-link{{ if $term.selected }} categories-selected{{ endif }}">$term.name</a></li>
+ <li class="tool"><a href="$base?f=&cat=$term.name" class="categories-link{{ if $term.selected }} categories-selected{{ endif }}">$term.name</a></li>
{{ endfor }}
</ul>