aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/identity.php5
-rw-r--r--mod/manage.php21
-rw-r--r--view/css/mod_manage.css14
-rw-r--r--view/tpl/channel.tpl5
4 files changed, 40 insertions, 5 deletions
diff --git a/include/identity.php b/include/identity.php
index b0a99a744..ca20fd22e 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -55,7 +55,10 @@ function create_identity($arr) {
$sig = base64url_encode(rsa_sign($guid,$key['prvkey']));
$hash = base64url_encode(hash('whirlpool',$guid . $sig,true));
- $primary = true;
+ $r = q("select channel_id from channel where channel_account_id = %d and channel_primary = 1 limit 1",
+ intval($arr['account_id'])
+ );
+ $primary = (! $r) ? true : false;
$r = q("insert into channel ( channel_account_id, channel_primary,
channel_name, channel_address, channel_guid, channel_guid_sig,
diff --git a/mod/manage.php b/mod/manage.php
index 9fbcea55d..d29830f90 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -11,6 +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",
+ intval($change_channel),
+ intval(get_account_id())
+ );
+ goaway(z_root() . '/manage');
+ }
+
if($change_channel) {
$r = change_channel($change_channel);
@@ -39,10 +50,12 @@ function manage_content(&$a) {
$o = replace_macros(get_markup_template('channels.tpl'), array(
- '$header' => t('Channel Manager'),
- '$desc' => t('Attach to one of your channels by selecting it.'),
- '$links' => $links,
- '$all_channels' => $channels,
+ '$header' => t('Channel Manager'),
+ '$desc' => t('Attach to one of your channels by selecting it.'),
+ '$msg_primary' => t('Default Channel'),
+ '$msg_make_primary' => t('Make Default'),
+ '$links' => $links,
+ '$all_channels' => $channels,
));
diff --git a/view/css/mod_manage.css b/view/css/mod_manage.css
new file mode 100644
index 000000000..5f06e5064
--- /dev/null
+++ b/view/css/mod_manage.css
@@ -0,0 +1,14 @@
+
+
+#channels-desc {
+ margin-top: 15px;
+ margin-bottom: 20px;
+}
+
+.channel-selection {
+ width: 120px;
+ float: left;
+}
+.channels-end {
+ clear: both;
+} \ No newline at end of file
diff --git a/view/tpl/channel.tpl b/view/tpl/channel.tpl
index 98c19caa5..9c8ded1d9 100644
--- a/view/tpl/channel.tpl
+++ b/view/tpl/channel.tpl
@@ -1,4 +1,9 @@
<div class="channel-selection">
+{{ if $channel.channel_primary }}
+<div class="channel-selection-primary primary">$msg_primary</div>
+{{ else }}
+<div class="channel-selection-primary"><a href="manage/$channel.channel_id/primary">$msg_make_primary</a></div>
+{{ 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>
<a href="$channel.link" class="channel-selection-name-link" title="$channel.channel_name"><div class="channel-name">$channel.channel_name</div></a>
</div>