testing audience app

This commit is contained in:
Mike Macgirvin 2023-11-10 18:37:43 +11:00
parent 496131b82a
commit 971f887ffc
5 changed files with 21 additions and 9 deletions

View file

@ -382,10 +382,10 @@ class AccessList
"SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC", "SELECT * FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval($channel['channel_id']) intval($channel['channel_id'])
); );
$grps[] = [ $grps = [
'name' => t('Public'), 'hash' => '', 'selected' => $channel['channel_allow_gid'] === '', ['name' => t('Public'), 'id' => '', 'selected' => $channel['channel_allow_gid'] === ''],
'name' => t('Connections'), 'hash' => 'connections:' . $channel['channel_hash'], ['name' => t('Connections'), 'id' => 'connections:' . $channel['channel_hash'],
'selected' => $channel['channel_allow_gid'] === '<' . 'connections:' . $channel['channel_hash'] . '>' 'selected' => $channel['channel_allow_gid'] === '<' . 'connections:' . $channel['channel_hash'] . '>']
]; ];
if ($r) { if ($r) {
foreach ($r as $rr) { foreach ($r as $rr) {
@ -399,7 +399,8 @@ class AccessList
'$desc' => t('Use this form to select your default posting audience and default permissions for media and file uploads.'), '$desc' => t('Use this form to select your default posting audience and default permissions for media and file uploads.'),
'$desc2' => t('Note: If you change your channel type, this form will be reset to the default audience for that type'), '$desc2' => t('Note: If you change your channel type, this form will be reset to the default audience for that type'),
'$label' => t('Default audience for posts and media access'), '$label' => t('Default audience for posts and media access'),
'$groups' => $grps '$groups' => $grps,
'$submit' => t('Submit')
]); ]);
} }

View file

@ -382,6 +382,7 @@ class Apps
'Access Lists' => t('Access Lists'), 'Access Lists' => t('Access Lists'),
'Apps' => t('Apps'), 'Apps' => t('Apps'),
'Articles' => t('Articles'), 'Articles' => t('Articles'),
'Audience' => t('Audience'),
'CalDAV' => t('CalDAV'), 'CalDAV' => t('CalDAV'),
'CardDAV' => t('CardDAV'), 'CardDAV' => t('CardDAV'),
'Cards' => t('Cards'), 'Cards' => t('Cards'),

View file

@ -2,7 +2,10 @@
namespace Code\Module; namespace Code\Module;
use App;
use Code\Lib\AccessControl; use Code\Lib\AccessControl;
use Code\Lib\AccessList;
use Code\Lib\Libsync;
use Code\Web\Controller; use Code\Web\Controller;
class Audience extends Controller class Audience extends Controller
@ -18,8 +21,8 @@ class Audience extends Controller
dbesc($channel_allow_gid), dbesc($channel_allow_gid),
intval($channel['channel_id']) intval($channel['channel_id'])
); );
App::$channel['channel_allow_gid'] = $channel_allow_gid;
Libsync::build_sync_packet();
} }
public function get() public function get()
@ -28,7 +31,6 @@ class Audience extends Controller
return login(); return login();
} }
return AccessList::AudienceSelect(); return AccessList::AudienceSelect();
} }

6
app/audience.apd Normal file
View file

@ -0,0 +1,6 @@
version: 1
url: $baseurl/audience
requires: local_channel
name: Audience
photo: icon:address-book-o
categories: social

View file

@ -1,6 +1,8 @@
<div class="generic-content-wrapper"> <div class="generic-content-wrapper">
<div class="section-title-wrapper clearfix"> <div class="section-title-wrapper clearfix">
<h2>
{{$title}} {{$title}}
</h2>
</div> </div>
<div class="descriptive-text">{{$desc}}</div> <div class="descriptive-text">{{$desc}}</div>
<div class="descriptive-text">{{$desc2}}</div> <div class="descriptive-text">{{$desc2}}</div>
@ -8,7 +10,7 @@
<form action="audience" method="post"> <form action="audience" method="post">
<div class="form-group field custom"> <div class="form-group field custom">
<label for="group-selection" id="group-selection-lbl">{{$label}}</label> <label for="group-selection" id="group-selection-lbl">{{$label}}</label>
<select class="form-control" name="group-selection" id="group-selection" > <select class="form-control" name="group_allow" id="group-selection" >
{{foreach $groups as $group}} {{foreach $groups as $group}}
<option value="{{$group.id}}" {{if $group.selected}}selected="selected"{{/if}} >{{$group.name}}</option> <option value="{{$group.id}}" {{if $group.selected}}selected="selected"{{/if}} >{{$group.name}}</option>
{{/foreach}} {{/foreach}}