aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/conversation.php184
-rw-r--r--include/identity.php73
-rw-r--r--mod/network.php127
3 files changed, 186 insertions, 198 deletions
diff --git a/include/conversation.php b/include/conversation.php
index e20fef9f6..13990e89b 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1305,3 +1305,187 @@ function prepare_page($item) {
));
}
+
+function network_tabs() {
+ $a = get_app();
+ $no_active='';
+ $starred_active = '';
+ $new_active = '';
+ $all_active = '';
+ $search_active = '';
+ $conv_active = '';
+ $spam_active = '';
+ $postord_active = '';
+
+ if(x($_GET,'new')) {
+ $new_active = 'active';
+ }
+
+ if(x($_GET,'search')) {
+ $search_active = 'active';
+ }
+
+ if(x($_GET,'star')) {
+ $starred_active = 'active';
+ }
+
+ if(x($_GET,'conv')) {
+ $conv_active = 'active';
+ }
+
+ if(x($_GET,'spam')) {
+ $spam_active = 'active';
+ }
+
+
+
+ if (($new_active == '')
+ && ($starred_active == '')
+ && ($conv_active == '')
+ && ($search_active == '')
+ && ($spam_active == '')) {
+ $no_active = 'active';
+ }
+
+ if ($no_active=='active' && x($_GET,'order')) {
+ switch($_GET['order']){
+ case 'post': $postord_active = 'active'; $no_active=''; break;
+ case 'comment' : $all_active = 'active'; $no_active=''; break;
+ }
+ }
+
+ if ($no_active=='active') $all_active='active';
+
+ $cmd = $a->cmd;
+
+ // tabs
+ $tabs = array(
+ array(
+ 'label' => t('Commented Order'),
+ 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
+ 'sel'=>$all_active,
+ 'title'=> t('Sort by Comment Date'),
+ ),
+ array(
+ 'label' => t('Posted Order'),
+ 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
+ 'sel'=>$postord_active,
+ 'title' => t('Sort by Post Date'),
+ ),
+
+ array(
+ 'label' => t('Personal'),
+ 'url' => $a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1',
+ 'sel' => $conv_active,
+ 'title' => t('Posts that mention or involve you'),
+ ),
+ array(
+ 'label' => t('New'),
+ 'url' => $a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&new=1',
+ 'sel' => $new_active,
+ 'title' => t('Activity Stream - by date'),
+ ),
+
+ );
+
+ if(feature_enabled(local_user(),'star_posts'))
+ $tabs[] = array(
+ 'label' => t('Starred'),
+ 'url'=>$a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
+ 'sel'=>$starred_active,
+ 'title' => t('Favourite Posts'),
+ );
+
+ // Not yet implemented
+
+ if(feature_enabled(local_user(),'spam_filter'))
+ $tabs[] = array(
+ 'label' => t('Spam'),
+ 'url'=>$a->get_baseurl(true) . '/network?f=&spam=1',
+ 'sel'=> $spam_active,
+ 'title' => t('Posts flagged as SPAM'),
+ );
+
+ $arr = array('tabs' => $tabs);
+ call_hooks('network_tabs', $arr);
+
+ $tpl = get_markup_template('common_tabs.tpl');
+
+ return replace_macros($tpl,array('$tabs' => $arr['tabs']));
+
+}
+
+
+
+function profile_tabs($a, $is_owner=False, $nickname=Null){
+ //echo "<pre>"; var_dump($a->user); killme();
+
+ $channel = $a->get_channel();
+
+ if (is_null($nickname))
+ $nickname = $channel['channel_address'];
+
+ if(x($_GET,'tab'))
+ $tab = notags(trim($_GET['tab']));
+
+ $url = $a->get_baseurl() . '/channel/' . $nickname;
+ $pr = $a->get_baseurl() . '/profile/' . $nickname;
+
+ $tabs = array(
+ array(
+ 'label' => t('Channel'),
+ 'url' => $url,
+ 'sel' => ((argv(0) == 'channel') ? 'active' : ''),
+ 'title' => t('Status Messages and Posts'),
+ 'id' => 'status-tab',
+ ),
+ array(
+ 'label' => t('About'),
+ 'url' => $pr,
+ 'sel' => ((argv(0) == 'profile') ? 'active' : ''),
+ 'title' => t('Profile Details'),
+ 'id' => 'profile-tab',
+ ),
+ array(
+ 'label' => t('Photos'),
+ 'url' => $a->get_baseurl() . '/photos/' . $nickname,
+ 'sel' => ((argv(0) == 'photos') ? 'active' : ''),
+ 'title' => t('Photo Albums'),
+ 'id' => 'photo-tab',
+ ),
+ );
+
+
+ if ($is_owner){
+ $tabs[] = array(
+ 'label' => t('Events'),
+ 'url' => $a->get_baseurl() . '/events',
+ 'sel' => ((argv(0) == 'events') ? 'active' : ''),
+ 'title' => t('Events and Calendar'),
+ 'id' => 'events-tab',
+ );
+ if(feature_enabled(local_user(),'webpages')){
+ $tabs[] = array(
+ 'label' => t('Webpages'),
+ 'url' => $a->get_baseurl() . '/webpages/' . $nickname,
+ 'sel' => ((argv(0) == 'webpages') ? 'active' : ''),
+ 'title' => t('Manage Webpages'),
+ 'id' => 'webpages-tab',
+ );}
+ }
+ else {
+ // FIXME
+ // we probably need a listing of events that were created by
+ // this channel and are visible to the observer
+
+
+ }
+
+
+ $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
+ call_hooks('profile_tabs', $arr);
+
+ $tpl = get_markup_template('common_tabs.tpl');
+
+ return replace_macros($tpl,array('$tabs' => $arr['tabs']));
+}
diff --git a/include/identity.php b/include/identity.php
index 0856add44..e22bb8645 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -992,79 +992,6 @@ function advanced_profile(&$a) {
-function profile_tabs($a, $is_owner=False, $nickname=Null){
- //echo "<pre>"; var_dump($a->user); killme();
-
- $channel = $a->get_channel();
-
- if (is_null($nickname))
- $nickname = $channel['channel_address'];
-
- if(x($_GET,'tab'))
- $tab = notags(trim($_GET['tab']));
-
- $url = $a->get_baseurl() . '/channel/' . $nickname;
- $pr = $a->get_baseurl() . '/profile/' . $nickname;
-
- $tabs = array(
- array(
- 'label' => t('Channel'),
- 'url' => $url,
- 'sel' => ((argv(0) == 'channel') ? 'active' : ''),
- 'title' => t('Status Messages and Posts'),
- 'id' => 'status-tab',
- ),
- array(
- 'label' => t('About'),
- 'url' => $pr,
- 'sel' => ((argv(0) == 'profile') ? 'active' : ''),
- 'title' => t('Profile Details'),
- 'id' => 'profile-tab',
- ),
- array(
- 'label' => t('Photos'),
- 'url' => $a->get_baseurl() . '/photos/' . $nickname,
- 'sel' => ((argv(0) == 'photos') ? 'active' : ''),
- 'title' => t('Photo Albums'),
- 'id' => 'photo-tab',
- ),
- );
-
-
- if ($is_owner){
- $tabs[] = array(
- 'label' => t('Events'),
- 'url' => $a->get_baseurl() . '/events',
- 'sel' => ((argv(0) == 'events') ? 'active' : ''),
- 'title' => t('Events and Calendar'),
- 'id' => 'events-tab',
- );
- if(feature_enabled(local_user(),'webpages')){
- $tabs[] = array(
- 'label' => t('Webpages'),
- 'url' => $a->get_baseurl() . '/webpages/' . $nickname,
- 'sel' => ((argv(0) == 'webpages') ? 'active' : ''),
- 'title' => t('Manage Webpages'),
- 'id' => 'webpages-tab',
- );}
- }
- else {
- // FIXME
- // we probably need a listing of events that were created by
- // this channel and are visible to the observer
-
-
- }
-
-
- $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
- call_hooks('profile_tabs', $arr);
-
- $tpl = get_markup_template('common_tabs.tpl');
-
- return replace_macros($tpl,array('$tabs' => $arr['tabs']));
-}
-
function get_my_url() {
if(x($_SESSION,'zrl_override'))
diff --git a/mod/network.php b/mod/network.php
index b108b763f..18173043e 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -129,69 +129,6 @@ function saved_searches($search) {
}
-/**
- * Return selected tab from query
- *
- * urls -> returns
- * '/network' => $no_active = 'active'
- * '/network?f=&order=comment' => $comment_active = 'active'
- * '/network?f=&order=post' => $postord_active = 'active'
- * '/network?f=&conv=1', => $conv_active = 'active'
- * '/network/new', => $new_active = 'active'
- * '/network?f=&star=1', => $starred_active = 'active'
- * '/network?f=&spam=1', => $spam_active = 'active'
- *
- * @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $spam_active );
- */
-function network_query_get_sel_tab($a) {
- $no_active='';
- $starred_active = '';
- $new_active = '';
- $all_active = '';
- $search_active = '';
- $conv_active = '';
- $spam_active = '';
- $postord_active = '';
-
- if(x($_GET,'new')) {
- $new_active = 'active';
- }
-
- if(x($_GET,'search')) {
- $search_active = 'active';
- }
-
- if(x($_GET,'star')) {
- $starred_active = 'active';
- }
-
- if(x($_GET,'conv')) {
- $conv_active = 'active';
- }
-
- if(x($_GET,'spam')) {
- $spam_active = 'active';
- }
-
-
-
- if (($new_active == '')
- && ($starred_active == '')
- && ($conv_active == '')
- && ($search_active == '')
- && ($spam_active == '')) {
- $no_active = 'active';
- }
-
- if ($no_active=='active' && x($_GET,'order')) {
- switch($_GET['order']){
- case 'post': $postord_active = 'active'; $no_active=''; break;
- case 'comment' : $all_active = 'active'; $no_active=''; break;
- }
- }
-
- return array($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $spam_active);
-}
function network_content(&$a, $update = 0, $load = false) {
@@ -244,67 +181,9 @@ function network_content(&$a, $update = 0, $load = false) {
$o = '';
- // item filter tabs
- // TODO: fix this logic, reduce duplication
- //$a->page['content'] .= '<div class="tabs-wrapper">';
- list($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $spam_active) = network_query_get_sel_tab($a);
- // if no tabs are selected, defaults to comments
- if ($no_active=='active') $all_active='active';
- //echo "<pre>"; var_dump($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active); killme();
-
- $cmd = (($datequery) ? '' : $a->cmd);
- $len_naked_cmd = strlen(str_replace('/new','',$cmd));
-
- // tabs
- $tabs = array(
- array(
- 'label' => t('Commented Order'),
- 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
- 'sel'=>$all_active,
- 'title'=> t('Sort by Comment Date'),
- ),
- array(
- 'label' => t('Posted Order'),
- 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
- 'sel'=>$postord_active,
- 'title' => t('Sort by Post Date'),
- ),
-
- array(
- 'label' => t('Personal'),
- 'url' => $a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1',
- 'sel' => $conv_active,
- 'title' => t('Posts that mention or involve you'),
- ),
- array(
- 'label' => t('New'),
- 'url' => $a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&new=1',
- 'sel' => $new_active,
- 'title' => t('Activity Stream - by date'),
- ),
-
- );
-
- if(feature_enabled(local_user(),'star_posts'))
- $tabs[] = array(
- 'label' => t('Starred'),
- 'url'=>$a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
- 'sel'=>$starred_active,
- 'title' => t('Favourite Posts'),
- );
-
- // Not yet implemented
-
- if(feature_enabled(local_user(),'spam_filter'))
- $tabs[] = array(
- 'label' => t('Spam'),
- 'url'=>$a->get_baseurl(true) . '/network?f=&spam=1',
- 'sel'=> $spam_active,
- 'title' => t('Posts flagged as SPAM'),
- );
-
+ // if no tabs are selected, defaults to comments
$cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0);
$star = ((x($_GET,'star')) ? intval($_GET['star']) : 0);
@@ -344,10 +223,8 @@ function network_content(&$a, $update = 0, $load = false) {
$o .= $arr['html'];
}
- $arr = array('tabs' => $tabs);
- call_hooks('network_tabs', $arr);
- $o .= replace_macros(get_markup_template('common_tabs.tpl'), array('$tabs'=> $arr['tabs']));
+ $o .= network_tabs();
// --- end item filter tabs