From aff33531acfdee5b21a96bb1723ae656be13ce91 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 2 Sep 2012 20:30:47 -0700 Subject: channel/identity selection manage page --- mod/manage.php | 38 +++++++++++++++++++++++++++++++------- version.inc | 2 +- view/tpl/channel.tpl | 7 +++++-- view/tpl/channels.tpl | 7 ++----- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/mod/manage.php b/mod/manage.php index e0e99b123..c33f2c217 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -87,22 +87,46 @@ function manage_content(&$a) { return; } - $active = null; + $change_channel = ((argc() > 1) ? intval($argv(1)) : 0); + if($change_channel) { + $r = q("select * from entity where entity_id = %d and entity_account_id = %d limit 1", + intval($change_channel), + intval(get_account_id()) + ); + if($r && count($r)) { + $_SESSION['uid'] = intval($r[0]['entity_id']); + get_app()->identity = $r[0]; + $_SESSION['theme'] = $r[0]['entity_theme']; + date_default_timezone_set($r[0]['entity_timezone']); + } + } + + + $channels = null; if(local_user()) { - $r = q("select * from entity where entity_id = %d limit 1", - intval(local_user()) + $r = q("select entity.*, contact.* from entity left join contact on entity.entity_id = contact.uid + where entity.entity_account_id = %d and contact.self = 1", + intval(get_account_id()) ); - if($r && count($r)) - $active = $r[0]; + if($r && count($r)) { + $channels = $r; + for($x = 0; $x < count($channels); $x ++) + $channels[$x]['link'] = 'manage/' . intval($channels[$x]['entity_id']); + } } + $links = array( + array( 'zentity', t('Create a new channel'), t('New Channel')) + ); + $o = replace_macros(get_markup_template('channels.tpl'), array( - '$header' => t('Manage Profile Channels'), + '$header' => t('Manage Channels'), '$desc' => t('These are your Profile Channels. Select any Profile Channel to attach and make that the current channel.'), - '$active' => $active, + '$links' => $links, + '$all_channels' => $channels, )); diff --git a/version.inc b/version.inc index 4902adee3..2a8741dac 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2012-09-01.64 +2012-09-02.65 diff --git a/view/tpl/channel.tpl b/view/tpl/channel.tpl index a18c4c1bb..eb9635ce8 100644 --- a/view/tpl/channel.tpl +++ b/view/tpl/channel.tpl @@ -1,2 +1,5 @@ -$channel.name -
$channel.name
+
+$channel.entity_name +
$channel.entity_name
+
+
diff --git a/view/tpl/channels.tpl b/view/tpl/channels.tpl index bfff3964f..50366efa6 100644 --- a/view/tpl/channels.tpl +++ b/view/tpl/channels.tpl @@ -1,6 +1,5 @@

$header

-
$desc
{{ if $links }} {{ for $links as $l }} @@ -8,12 +7,10 @@ {{ endfor }} {{ endif }} -
{{ inc channel.tpl with $chn = $active }}
-
$act_desc
- +
$desc
{{ for $all_channels as $chn }} -{{ inc channel.tpl with $channel = $chn }} +{{ inc channel.tpl with $channel=$chn }}{{ endinc }} {{ endfor }}
-- cgit v1.2.3