aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-02-12 18:40:26 -0800
committerzotlabs <mike@macgirvin.com>2017-02-12 18:40:26 -0800
commit321241da02330bf7ad710ce75ae3887d9e0a631c (patch)
tree1387f6466d1aba911c96f0c2c404546edf84952c
parent7c72886b1b00aea2b53233c0299e9f35b45dc34d (diff)
downloadvolse-hubzilla-321241da02330bf7ad710ce75ae3887d9e0a631c.tar.gz
volse-hubzilla-321241da02330bf7ad710ce75ae3887d9e0a631c.tar.bz2
volse-hubzilla-321241da02330bf7ad710ce75ae3887d9e0a631c.zip
add default permcat to channel settings form
-rw-r--r--Zotlabs/Module/Settings/Channel.php19
-rwxr-xr-xview/tpl/settings.tpl4
2 files changed, 22 insertions, 1 deletions
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index 9ea459dab..5b9cfdaca 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -18,6 +18,7 @@ class Channel {
$role = ((x($_POST,'permissions_role')) ? notags(trim($_POST['permissions_role'])) : '');
$oldrole = get_pconfig(local_channel(),'system','permissions_role');
+
if(($role != $oldrole) || ($role === 'custom')) {
@@ -144,6 +145,7 @@ class Channel {
$post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
$post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
$adult = (($_POST['adult'] == 1) ? 1 : 0);
+ $defpermcat = ((x($_POST,'defpermcat')) ? notags(trim($_POST['defpermcat'])) : 'default');
$cal_first_day = (((x($_POST,'first_day')) && (intval($_POST['first_day']) == 1)) ? 1: 0);
@@ -232,6 +234,7 @@ class Channel {
set_pconfig(local_channel(),'system','photo_path',$photo_path);
set_pconfig(local_channel(),'system','attach_path',$attach_path);
set_pconfig(local_channel(),'system','cal_first_day',$cal_first_day);
+ set_pconfig(local_channel(),'system','default_permcat',$defpermcat);
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d",
dbesc($username),
@@ -411,6 +414,19 @@ class Channel {
'$basepath' => \App::get_hostname()
));
+
+
+ $pcat = new \Zotlabs\Lib\Permcat(local_channel());
+ $pcatlist = $pcat->listing();
+ $permcats = [];
+ if($pcatlist) {
+ foreach($pcatlist as $pc) {
+ $permcats[$pc['name']] = $pc['localname'];
+ }
+ }
+
+ $default_permcat = get_pconfig(local_channel(),'system','default_permcat','default');
+
$stpl = get_markup_template('settings.tpl');
@@ -500,7 +516,8 @@ class Channel {
'$suggestme' => $suggestme,
'$group_select' => $group_select,
'$role' => array('permissions_role' , t('Channel permissions category:'), $permissions_role, '', $perm_roles),
-
+ '$defpermcat' => [ 'defpermcat', t('Default Permissions Group'), $default_permcat, '', $permcats ],
+ '$permcat_enable' => feature_enabled(local_channel(),'permcats'),
'$profile_in_dir' => $profile_in_dir,
'$hide_friends' => $hide_friends,
'$hide_wall' => $hide_wall,
diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl
index 15ddd7f71..19c2b42d5 100755
--- a/view/tpl/settings.tpl
+++ b/view/tpl/settings.tpl
@@ -84,6 +84,10 @@
{{include file="field_checkbox.tpl" field=$blocktags}}
{{include file="field_input.tpl" field=$expire}}
</div>
+ {{if $permcat_enable}}
+ {{include file="field_select.tpl" field=$defpermcat}}
+ {{/if}}
+
{{if $sec_addon}}
{{$sec_addon}}
{{/if}}