aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-11-02 18:55:40 +1100
committerfriendica <info@friendica.com>2012-11-02 18:55:40 +1100
commit9bb1b7e3ed4cb297b0d2536725ddb510ef48aafc (patch)
tree1d20046f9366872d6b3df3974cc4cb5eaddf3a81
parent83cf11dd956c0fbb84c1c50c643b43a3824dc6da (diff)
downloadvolse-hubzilla-9bb1b7e3ed4cb297b0d2536725ddb510ef48aafc.tar.gz
volse-hubzilla-9bb1b7e3ed4cb297b0d2536725ddb510ef48aafc.tar.bz2
volse-hubzilla-9bb1b7e3ed4cb297b0d2536725ddb510ef48aafc.zip
fix default channel
-rw-r--r--mod/manage.php21
-rw-r--r--view/css/mod_manage.css2
-rw-r--r--view/tpl/channel.tpl8
3 files changed, 18 insertions, 13 deletions
diff --git a/mod/manage.php b/mod/manage.php
index 040857f5e..2cdfce115 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -11,14 +11,17 @@ function manage_content(&$a) {
$change_channel = ((argc() > 1) ? intval(argv(1)) : 0);
- if((argc() > 2) && (argv(2) === 'primary')) {
- q("update channel set channel_primary = 0 where channel_account_id = %d",
- intval(get_account_id())
- );
- q("update channel set channel_primary = 1 where channel_id = %d and channel_account_id = %d limit 1",
+ if((argc() > 2) && (argv(2) === 'default')) {
+ $r = q("select channel_id from channel where channel_id = %d and channel_account_id = %d limit 1",
intval($change_channel),
intval(get_account_id())
);
+ if($r) {
+ q("update account set account_default_channel = %d where account_id = %d limit 1",
+ intval($change_channel),
+ intval(get_account_id())
+ );
+ }
goaway(z_root() . '/manage');
}
@@ -38,6 +41,7 @@ function manage_content(&$a) {
);
$selected_channel = null;
+ $account = get_app()->get_account();
if($r && count($r)) {
$channels = $r;
@@ -45,7 +49,8 @@ function manage_content(&$a) {
$channels[$x]['link'] = 'manage/' . intval($channels[$x]['channel_id']);
if($channels[$x]['channel_id'] == local_user())
$selected_channel = $channels[$x];
- $channels[$x]['primary_links'] = '1';
+ $channels[$x]['default'] = (($channels[$x]['channel_id'] == $account['account_default_channel']) ? "1" : '');
+ $channels[$x]['default_links'] = '1';
}
}
}
@@ -60,8 +65,8 @@ function manage_content(&$a) {
'$msg_selected' => t('Current Channel'),
'$selected' => $selected_channel,
'$desc' => t('Attach to one of your channels by selecting it.'),
- '$msg_primary' => t('Default Channel'),
- '$msg_make_primary' => t('Make Default'),
+ '$msg_default' => t('Default Channel'),
+ '$msg_make_default' => t('Make Default'),
'$links' => $links,
'$all_channels' => $channels,
));
diff --git a/view/css/mod_manage.css b/view/css/mod_manage.css
index 15dd30ec6..51f5062ae 100644
--- a/view/css/mod_manage.css
+++ b/view/css/mod_manage.css
@@ -12,7 +12,7 @@
margin-bottom: 20px;
}
-.channel-selection-primary {
+.channel-selection-default {
font-size: 0.8em;
margin-bottom: 10px;
}
diff --git a/view/tpl/channel.tpl b/view/tpl/channel.tpl
index 5bae5ba33..af4f9b703 100644
--- a/view/tpl/channel.tpl
+++ b/view/tpl/channel.tpl
@@ -1,9 +1,9 @@
<div class="channel-selection">
-{{ if $channel.primary_links }}
-{{ if $channel.channel_primary }}
-<div class="channel-selection-primary primary">$msg_primary</div>
+{{ if $channel.default_links }}
+{{ if $channel.default }}
+<div class="channel-selection-default default">$msg_default</div>
{{ else }}
-<div class="channel-selection-primary"><a href="manage/$channel.channel_id/primary">$msg_make_primary</a></div>
+<div class="channel-selection-default"><a href="manage/$channel.channel_id/default">$msg_make_default</a></div>
{{ endif }}
{{ endif }}
<a href="$channel.link" class="channel-selection-photo-link" title="$channel.channel_name"><img class="channel-photo" src="$channel.xchan_photo_m" alt="$channel.channel_name" /></a>