diff --git a/com_sexypolling/admin/access.xml b/com_sexypolling/admin/access.xml new file mode 100644 index 0000000..b9f216b --- /dev/null +++ b/com_sexypolling/admin/access.xml @@ -0,0 +1,15 @@ + + +
+ + + + + + + + + + +
+
diff --git a/com_sexypolling/admin/config.xml b/com_sexypolling/admin/config.xml new file mode 100644 index 0000000..0f7f54f --- /dev/null +++ b/com_sexypolling/admin/config.xml @@ -0,0 +1,39 @@ + + +
+ + + + +
+ +
+ +
+ +
diff --git a/com_sexypolling/admin/language/de-DE/de-DE.com_sexypolling.ini b/com_sexypolling/admin/language/de-DE/de-DE.com_sexypolling.ini index e90358c..df470cb 100644 --- a/com_sexypolling/admin/language/de-DE/de-DE.com_sexypolling.ini +++ b/com_sexypolling/admin/language/de-DE/de-DE.com_sexypolling.ini @@ -227,4 +227,16 @@ COM_SEXYPOLLING_USER="Benutzer" COM_SEXYPOLLING_IP="IP" COM_SEXYPOLLING_COUNTRY="Land" COM_SEXYPOLLING_CITY="Stadt" -COM_SEXYPOLLING_REGION="Region" \ No newline at end of file +COM_SEXYPOLLING_REGION="Region" + +COM_SEXYPOLLING_CONFIG_GENERAL_SETTINGS_LABEL="Allgemein" +COM_SEXYPOLLING_CONFIG_GENERAL_SETTINGS_DESC="Allgemeine Einstellungen" +COM_SEXYPOLLING_CONFIG_PERMISSION_CONTROL_FOR_ANSWERS_AND_VOTES_LABEL="Berechtigung für die Anzeige von Antworten und Stimmen" +COM_SEXYPOLLING_CONFIG_PERMISSION_CONTROL_FOR_ANSWERS_AND_VOTES_DESC="Aktivieren der Berechtigung zum Anzeigen von Antworten und Stimmen. Diese Einstellung erlaubt eine striktere Handhabung der Berechtigungen für Antworten/Stimmen, z.B. wenn eine Umfrage für eine Wahl genutzt wird. Berechtigungen können für jede Benutzergruppe in den Einstellungen für Berechtigungen vorgenommen werden." + +COM_SEXYPOLLING_ACTION_VIEW_ANSWERS="Anzeigen von Antworten" +COM_SEXYPOLLING_ACTION_VIEW_ANSWERS_COMPONENT_DESC="Berechtigung zur Anzeige von Antworten im Backend. Nur relevant, wenn die Berechtigung für die Anzeige von Antworten/Stimmen in den allgemeinen Einstellungen aktiviert ist." +COM_SEXYPOLLING_ACTION_VIEW_ANSWERS_NO_PERMISSION="Sie haben nicht die erforderliche Berechtigung, um Antworten anzuzeigen." +COM_SEXYPOLLING_ACTION_VIEW_VOTES="Anzeigen von Stimmen" +COM_SEXYPOLLING_ACTION_VIEW_VOTES_COMPONENT_DESC="Berechtigung zur Anzeige von Stimmen im Backend. Nur relevant, wenn die Berechtigung für die Anzeige von Antworten/Stimmen in den allgemeinen Einstellungen aktiviert ist." +COM_SEXYPOLLING_ACTION_VIEW_VOTES_NO_PERMISSION="Sie haben nicht die erforderliche Berechtigung, um Stimmen anzuzeigen." \ No newline at end of file diff --git a/com_sexypolling/admin/language/en-GB/en-GB.com_sexypolling.ini b/com_sexypolling/admin/language/en-GB/en-GB.com_sexypolling.ini index f576fd5..0f263cb 100644 --- a/com_sexypolling/admin/language/en-GB/en-GB.com_sexypolling.ini +++ b/com_sexypolling/admin/language/en-GB/en-GB.com_sexypolling.ini @@ -229,3 +229,15 @@ COM_SEXYPOLLING_UP="Up" COM_SEXYPOLLING_DOWN="Down" COM_SEXYPOLLING_CUSTOM_STYLES="Custom Styles" COM_SEXYPOLLING_SEXY_TEMPLATE="Sexy Template" + +COM_SEXYPOLLING_CONFIG_GENERAL_SETTINGS_LABEL="General" +COM_SEXYPOLLING_CONFIG_GENERAL_SETTINGS_DESC="General settings" +COM_SEXYPOLLING_CONFIG_PERMISSION_CONTROL_FOR_ANSWERS_AND_VOTES_LABEL="Permission control for viewing answers and votes" +COM_SEXYPOLLING_CONFIG_PERMISSION_CONTROL_FOR_ANSWERS_AND_VOTES_DESC="Activate permission control for viewing answers and votes. This allows to establish stricter permission handling for answers/votes, e.g. if a poll is used for elections. Permissions can be set for each user group in the permissions settings." + +COM_SEXYPOLLING_ACTION_VIEW_ANSWERS="View answers" +COM_SEXYPOLLING_ACTION_VIEW_ANSWERS_COMPONENT_DESC="Permission, wether answers are shown in the administration backend. Only relevant if permission control for viewing answers/votes is activated in general settings." +COM_SEXYPOLLING_ACTION_VIEW_ANSWERS_NO_PERMISSION="You do not have the permission to view answers" +COM_SEXYPOLLING_ACTION_VIEW_VOTES="View votes" +COM_SEXYPOLLING_ACTION_VIEW_VOTES_COMPONENT_DESC="Permission, wether votes are shown in the administration backend. Only relevant if permission control for viewing answers/votes is activated in general settings." +COM_SEXYPOLLING_ACTION_VIEW_VOTES_NO_PERMISSION="You do not have the permission to view votes" diff --git a/com_sexypolling/admin/views/sexyanswers/tmpl/default.php b/com_sexypolling/admin/views/sexyanswers/tmpl/default.php index b0be85b..399d258 100644 --- a/com_sexypolling/admin/views/sexyanswers/tmpl/default.php +++ b/com_sexypolling/admin/views/sexyanswers/tmpl/default.php @@ -19,6 +19,8 @@ * @todo Use of $this in global code might be unatended */ +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; @@ -43,6 +45,22 @@ HTMLHelper::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn ?? ''), $saveOrderingUrl); } $sortFields = $this->getSortFields(); + +$application = Factory::getApplication(); +$user = $application->getIdentity(); + +if ($application->isClient('site')) { + $params = $application->getParams('com_sexypolling'); +} else { + $params = ComponentHelper::getParams('com_sexypolling'); +} + +//if permission control for answers is activated, use permission settings for viewing answers +if ($params->get('permission_control_for_answers_and_votes', 0)) { + $show_answers = $user !== null && $user->authorise('core.view.answers', 'com_sexypolling'); +} else { + $show_answers = true; +} ?>