mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 16:35:19 +00:00
tasks and notes
This commit is contained in:
parent
17599db5c9
commit
8cc49657f9
6 changed files with 84 additions and 56 deletions
|
@ -331,6 +331,7 @@ class Apps {
|
|||
'Suggest Channels' => t('Suggest Channels'),
|
||||
'Login' => t('Login'),
|
||||
'Channel Manager' => t('Channel Manager'),
|
||||
'Notes' => t('Notes'),
|
||||
'Network' => t('Stream'),
|
||||
'Settings' => t('Settings'),
|
||||
'Files' => t('Files'),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
|
||||
use App;
|
||||
|
||||
class Accounts {
|
||||
|
||||
|
@ -23,7 +23,7 @@ class Accounts {
|
|||
|
||||
check_form_security_token_redirectOnErr('/admin/accounts', 'admin_accounts');
|
||||
|
||||
// change to switch structure?
|
||||
|
||||
// account block/unblock button was submitted
|
||||
if (x($_POST, 'page_accounts_block')) {
|
||||
for ($i = 0; $i < count($users); $i++) {
|
||||
|
@ -36,6 +36,7 @@ class Accounts {
|
|||
}
|
||||
notice( sprintf( tt("%s account blocked/unblocked", "%s account blocked/unblocked", count($users)), count($users)) );
|
||||
}
|
||||
|
||||
// account delete button was submitted
|
||||
if (x($_POST, 'page_accounts_delete')) {
|
||||
foreach ($users as $uid){
|
||||
|
@ -43,12 +44,14 @@ class Accounts {
|
|||
}
|
||||
notice( sprintf( tt("%s account deleted", "%s accounts deleted", count($users)), count($users)) );
|
||||
}
|
||||
|
||||
// registration approved button was submitted
|
||||
if (x($_POST, 'page_accounts_approve')) {
|
||||
foreach ($pending as $hash) {
|
||||
account_allow($hash);
|
||||
}
|
||||
}
|
||||
|
||||
// registration deny button was submitted
|
||||
if (x($_POST, 'page_accounts_deny')) {
|
||||
foreach ($pending as $hash) {
|
||||
|
@ -112,7 +115,7 @@ class Accounts {
|
|||
}
|
||||
|
||||
/* get pending */
|
||||
$pending = q("SELECT account.*, register.hash from account left join register on account_id = register.uid where (account_flags & %d )>0 ",
|
||||
$pending = q("SELECT account.*, register.hash from account left join register on account_id = register.uid where (account_flags & %d ) != 0 ",
|
||||
intval(ACCOUNT_PENDING)
|
||||
);
|
||||
|
||||
|
@ -120,16 +123,17 @@ class Accounts {
|
|||
|
||||
$total = q("SELECT count(*) as total FROM account");
|
||||
if (count($total)) {
|
||||
\App::set_pager_total($total[0]['total']);
|
||||
\App::set_pager_itemspage(100);
|
||||
App::set_pager_total($total[0]['total']);
|
||||
App::set_pager_itemspage(100);
|
||||
}
|
||||
|
||||
$serviceclass = (($_REQUEST['class']) ? " and account_service_class = '" . dbesc($_REQUEST['class']) . "' " : '');
|
||||
|
||||
$key = (($_REQUEST['key']) ? dbesc($_REQUEST['key']) : 'account_id');
|
||||
$dir = 'asc';
|
||||
if(array_key_exists('dir',$_REQUEST))
|
||||
if (array_key_exists('dir',$_REQUEST)) {
|
||||
$dir = ((intval($_REQUEST['dir'])) ? 'asc' : 'desc');
|
||||
}
|
||||
|
||||
$base = z_root() . '/admin/accounts?f=';
|
||||
$odir = (($dir === 'asc') ? '0' : '1');
|
||||
|
@ -140,29 +144,25 @@ class Accounts {
|
|||
intval(ACCOUNT_BLOCKED),
|
||||
db_concat('ch.channel_address', ' '),
|
||||
intval(ACCOUNT_BLOCKED | ACCOUNT_PENDING),
|
||||
intval(\App::$pager['itemspage']),
|
||||
intval(\App::$pager['start'])
|
||||
intval(App::$pager['itemspage']),
|
||||
intval(App::$pager['start'])
|
||||
);
|
||||
|
||||
// function _setup_users($e){
|
||||
// $accounts = Array(
|
||||
// t('Normal Account'),
|
||||
// t('Soapbox Account'),
|
||||
// t('Community/Celebrity Account'),
|
||||
// t('Automatic Friend Account')
|
||||
// );
|
||||
if ($users) {
|
||||
for($x = 0; $x < count($users); $x ++) {
|
||||
$channel_arr = explode(' ',$users[$x]['channels']);
|
||||
if ($channel_arr) {
|
||||
$linked = [];
|
||||
foreach ( $channel_arr as $c) {
|
||||
$linked[] = '<a href="' . z_root() . '/channel/' . $c . '">' . $c . '</a>';
|
||||
}
|
||||
$users[$x]['channels'] = implode(' ',$linked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// $e['page_flags'] = $accounts[$e['page-flags']];
|
||||
// $e['register_date'] = relative_date($e['register_date']);
|
||||
// $e['login_date'] = relative_date($e['login_date']);
|
||||
// $e['lastitem_date'] = relative_date($e['lastitem_date']);
|
||||
// return $e;
|
||||
// }
|
||||
// $users = array_map("_setup_users", $users);
|
||||
|
||||
$t = get_markup_template('admin_accounts.tpl');
|
||||
$o = replace_macros($t, array(
|
||||
// strings //
|
||||
$t =
|
||||
$o = replace_macros(get_markup_template('admin_accounts.tpl'), [
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Accounts'),
|
||||
'$submit' => t('Submit'),
|
||||
|
@ -178,30 +178,25 @@ class Accounts {
|
|||
'$odir' => $odir,
|
||||
'$base' => $base,
|
||||
'$h_users' => t('Accounts'),
|
||||
'$th_users' => array(
|
||||
'$th_users' => [
|
||||
[ t('ID'), 'account_id' ],
|
||||
[ t('Email'), 'account_email' ],
|
||||
[ t('All Channels'), 'channels' ],
|
||||
[ t('Register date'), 'account_created' ],
|
||||
[ t('Last login'), 'account_lastlog' ],
|
||||
[ t('Expires'), 'account_expires' ],
|
||||
[ t('Service Class'), 'account_service_class'] ),
|
||||
|
||||
[ t('Service Class'), 'account_service_class']
|
||||
],
|
||||
'$confirm_delete_multi' => t('Selected accounts will be deleted!\n\nEverything these accounts had posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||
'$confirm_delete' => t('The account {0} will be deleted!\n\nEverything this account has posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||
|
||||
'$form_security_token' => get_form_security_token("admin_accounts"),
|
||||
|
||||
// values //
|
||||
'$baseurl' => z_root(),
|
||||
|
||||
'$pending' => $pending,
|
||||
'$users' => $users,
|
||||
));
|
||||
]);
|
||||
|
||||
$o .= paginate($a);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace Zotlabs\Module; /** @file */
|
|||
|
||||
use Zotlabs\Lib\Libsync;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
use Zotlabs\Lib\Apps;
|
||||
|
||||
class Notes extends Controller {
|
||||
|
||||
|
@ -26,7 +26,7 @@ class Notes extends Controller {
|
|||
set_pconfig(local_channel(),'notes','text.bak',$old_text);
|
||||
}
|
||||
set_pconfig(local_channel(),'notes','text',$body);
|
||||
}
|
||||
|
||||
|
||||
// push updates to channel clones
|
||||
|
||||
|
@ -38,5 +38,26 @@ class Notes extends Controller {
|
|||
json_return_and_die($ret);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function get() {
|
||||
|
||||
$desc = t('This app allows you to create private notes for your personal use.');
|
||||
|
||||
$text = '<div class="section-content-info-wrapper">' . $desc . '</div>';
|
||||
|
||||
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Notes'))) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
$desc = t('This app is installed. The Notes tool can be found on your network stream page.');
|
||||
|
||||
$text = '<div class="section-content-info-wrapper">' . $desc . '</div>';
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,21 +2,25 @@
|
|||
|
||||
namespace Zotlabs\Widget;
|
||||
|
||||
use Zotlabs\Lib\Apps;
|
||||
|
||||
class Notes {
|
||||
|
||||
function widget($arr) {
|
||||
if(! local_channel())
|
||||
if (! local_channel()) {
|
||||
return '';
|
||||
if(! feature_enabled(local_channel(),'private_notes'))
|
||||
}
|
||||
if (! Apps::system_app_installed(local_channel(),'Notes')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$text = get_pconfig(local_channel(),'notes','text');
|
||||
|
||||
$o = replace_macros(get_markup_template('notes.tpl'), array(
|
||||
$o = replace_macros(get_markup_template('notes.tpl'), [
|
||||
'$banner' => t('Notes'),
|
||||
'$text' => $text,
|
||||
'$save' => t('Save'),
|
||||
));
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
|
6
app/notes.apd
Normal file
6
app/notes.apd
Normal file
|
@ -0,0 +1,6 @@
|
|||
version: 1
|
||||
url: $baseurl/notes
|
||||
requires: local_channel
|
||||
name: Notes
|
||||
photo: icon:pencil
|
||||
categories: Productivity
|
|
@ -3,6 +3,7 @@
|
|||
[widget=activity_filter][/widget]
|
||||
[widget=savedsearch][/widget]
|
||||
[widget=suggestions][/widget]
|
||||
[widget=tasklist][/widget]
|
||||
[widget=notes][/widget]
|
||||
[/region]
|
||||
|
||||
|
|
Loading…
Reference in a new issue