From 2d4b35fbc99062d52c6c32cacd158ceda661bb31 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 3 May 2023 22:42:52 +0200 Subject: provide possibility to flag via ajax calls to prevent pageloads --- Zotlabs/Module/Dircensor.php | 7 +++++ Zotlabs/Module/Directory.php | 13 ++++----- view/tpl/directory_header.tpl | 63 ++++++++++++++++++++++++++++++++++++++++++- view/tpl/direntry.tpl | 6 ++--- 4 files changed, 79 insertions(+), 10 deletions(-) diff --git a/Zotlabs/Module/Dircensor.php b/Zotlabs/Module/Dircensor.php index 3f03f7f87..4ce3a81c4 100644 --- a/Zotlabs/Module/Dircensor.php +++ b/Zotlabs/Module/Dircensor.php @@ -64,6 +64,13 @@ class Dircensor extends Controller { info( t('Entry OK') . EOL); } + if (isset($_REQUEST['aj'])) { + json_return_and_die([ + 'success' => 1, + 'flag' => $flag + ]); + } + goaway(z_root() . '/directory'); } diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index c463c544b..34d55a8fe 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -355,12 +355,12 @@ class Directory extends Controller { 'gender' => $gender, 'pdesc' => $pdesc, 'pdesc_label' => t('Description:'), - 'censor' => (($directory_admin && intval($rr['censored']) < 2) ? 'dircensor/' . $rr['hash'] . '?severity=' . ((intval($rr['censored']) > 0) ? 0 : 1) : ''), - 'censor_label' => ((intval($rr['censored']) === 1) ? t('Safe') : t('Unsafe')), - 'censor_class' => ((intval($rr['censored']) === 1) ? '' : '-outline'), + 'censor' => (($directory_admin) ? 'dircensor/' . $rr['hash'] . '?severity=' . ((intval($rr['censored']) > 0) ? 0 : 1) : ''), + 'censor_label' => t('Unsafe'), + 'censor_class' => ((intval($rr['censored']) === 1) ? 'active' : ''), 'censor_2' => (($directory_admin) ? 'dircensor/' . $rr['hash'] . '?severity=' . ((intval($rr['censored']) > 1) ? 0 : 2) : ''), - 'censor_2_label' => ((intval($rr['censored']) > 1) ? t('Show') : t('Hide')), - 'censor_2_class' => ((intval($rr['censored']) > 1) ? '' : '-outline'), + 'censor_2_label' => t('Hidden'), + 'censor_2_class' => ((intval($rr['censored']) > 1) ? 'active' : ''), 'marital' => $marital, 'homepage' => $homepage, 'homepageurl' => (($safe_mode > 0) ? $homepageurl : linkify($homepageurl)), @@ -444,7 +444,8 @@ class Directory extends Controller { '$reverse' => t('Reverse Alphabetic'), '$date' => t('Newest to Oldest'), '$reversedate' => t('Oldest to Newest'), - '$suggest' => $suggest ? '&suggest=1' : '' + '$suggest' => $suggest ? '&suggest=1' : '', + '$directory_admin' => $directory_admin )); diff --git a/view/tpl/directory_header.tpl b/view/tpl/directory_header.tpl index f5ce7ce0a..a261762ac 100644 --- a/view/tpl/directory_header.tpl +++ b/view/tpl/directory_header.tpl @@ -19,7 +19,68 @@ {{** make sure this element is at the bottom - we rely on that in endless scroll **}}
-
+ diff --git a/view/tpl/direntry.tpl b/view/tpl/direntry.tpl index 50714c072..16df987f4 100644 --- a/view/tpl/direntry.tpl +++ b/view/tpl/direntry.tpl @@ -1,11 +1,11 @@
-
+
{{if $entry.censor_2}} - {{$entry.censor_2_label}} + {{$entry.censor_2_label}} {{/if}} {{if $entry.censor}} - {{$entry.censor_label}} + {{$entry.censor_label}} {{/if}} {{if $entry.ignlink}} {{$entry.ignore_label}} -- cgit v1.2.3