diff --git a/phpmyfaq/assets/templates/default/open-questions.twig b/phpmyfaq/assets/templates/default/open-questions.twig index 194cd0c15c..82434cd18d 100644 --- a/phpmyfaq/assets/templates/default/open-questions.twig +++ b/phpmyfaq/assets/templates/default/open-questions.twig @@ -1,54 +1,167 @@ {% extends 'index.twig' %} {% block content %} -
-

{{ pageHeader }}

+
+

{{ msgQuestionText }}

- - - - - + {% set showActionColumn = userHasPermissionToAnswer %} + + {% if not showActionColumn and isCloseQuestionEnabled %} + {% for question in openQuestions.questions %} + {% if question.answerId > 0 %} + {% set showActionColumn = true %} + {% endif %} + {% endfor %} + {% endif %} + + {% set totalColumns = showActionColumn ? 3 : 2 %} + {% set questionColspan = showActionColumn ? 2 : 1 %} + +
+
+
{{ msgDate_User }}{{ msgQuestion2 }}
0 %} aria-describedby="questions-info"{% endif %}> + + + + {% if showActionColumn %} + + + {% else %} + + {% endif %} + + + + + + + + + {% if openQuestions.numberQuestions > 0 %} + {% for question in openQuestions.questions %} + + + + + + {% if showActionColumn %} + + {% endif %} + + {% endfor %} + {% else %} + + + + {% endif %} + +
{{ pageHeader }}
{{ msgDate_User }}{{ msgQuestion2 }}
+ {{ question.date }}
+ + {{ question.userName }} + +
+
+
+ +
+
+ {{ question.categoryName }}: +
+
+
+
+ +
+
+ {{ question.question }} +
+
+
+ {% if isCloseQuestionEnabled and question.answerId > 0 %} + + {{ msg2answerFAQ }} + + {% elseif userHasPermissionToAnswer %} + + {{ msg2answer }} + + {% endif %} +
{{ msgNoQuestionsAvailable }}
+ + + +
0 %} aria-describedby="questions-info"{% endif %}> {% if openQuestions.numberQuestions > 0 %} {% for question in openQuestions.questions %} - - - {{ question.date }}
{{ question.userName }} - - - {{ question.categoryName }}:
{{ question.question }} - - {% if isCloseQuestionEnabled and question.answerId > 0 %} - - - {{ msg2answerFAQ }} - - - {% elseif userHasPermissionToAnswer %} - - - {{ msg2answer }} +
+
+
+ + {{ question.categoryName }} +
+ +
+ +
+
+ +
+
+ {{ question.question }} +
+
+ + {% if showActionColumn %} +
+ {% if isCloseQuestionEnabled and question.answerId > 0 %} + + {{ msg2answerFAQ }} + + {% elseif userHasPermissionToAnswer %} + + {{ msg2answer }} + + {% endif %} +
+ {% endif %} +
+
{% endfor %} {% else %} - - {{ msgNoQuestionsAvailable }} - - {% endif %} - {% if openQuestions.numberInvisibleQuestions > 0 %} - - - {{ openQuestions.numberInvisibleQuestions }} {{ msgQuestionsWaiting }} - - + +
+
+ + {{ msgNoQuestionsAvailable }} +
+
{% endif %} - +
+ + {% if openQuestions.numberInvisibleQuestions > 0 %} +
+ + {{ openQuestions.numberInvisibleQuestions }} {{ msgQuestionsWaiting }} +
+ {% endif %}
{% endblock %} diff --git a/phpmyfaq/src/phpMyFAQ/Controller/Frontend/QuestionsController.php b/phpmyfaq/src/phpMyFAQ/Controller/Frontend/QuestionsController.php index bc3c55638c..3f9b4c5f3d 100644 --- a/phpmyfaq/src/phpMyFAQ/Controller/Frontend/QuestionsController.php +++ b/phpmyfaq/src/phpMyFAQ/Controller/Frontend/QuestionsController.php @@ -64,14 +64,14 @@ public function index(Request $request): Response 'msgQuestion2' => Translation::get(key: 'msgQuestion2'), 'openQuestions' => $questionHelper->getOpenQuestions(), 'isCloseQuestionEnabled' => $this->configuration->get('records.enableCloseQuestion'), - 'userHasPermissionToAnswer' => $this->currentUser->perm->hasPermission( - $this->currentUser->getUserId(), - PermissionType::FAQ_ADD->value, - ), + 'userHasPermissionToAnswer' => + $this->currentUser->perm->hasPermission($this->currentUser->getUserId(), PermissionType::FAQ_ADD->value) + || $this->configuration->get('records.allowNewFaqsForGuests'), 'msgQuestionsWaiting' => Translation::get(key: 'msgQuestionsWaiting'), 'msgNoQuestionsAvailable' => Translation::get(key: 'msgNoQuestionsAvailable'), 'msg2answerFAQ' => Translation::get(key: 'msg2answerFAQ'), 'msg2answer' => Translation::get(key: 'msg2answer'), + 'msgEmailTo' => Translation::get(key: 'msgEmailTo'), ]); } diff --git a/phpmyfaq/translations/language_de.php b/phpmyfaq/translations/language_de.php index 2c89e47f03..161ea8e53f 100755 --- a/phpmyfaq/translations/language_de.php +++ b/phpmyfaq/translations/language_de.php @@ -99,10 +99,11 @@ $PMF_LANG['msgAskYourQuestion'] = "Frage"; $PMF_LANG['msgAskThx4Mail'] = "Vielen Dank für diese Anfrage."; $PMF_LANG['msgDate_User'] = "Datum / Verfasser"; -$PMF_LANG['msgQuestion2'] = "Frage"; +$PMF_LANG['msgQuestion2'] = "Kategorie / Frage"; $PMF_LANG['msg2answer'] = "beantworten"; $PMF_LANG['msgQuestionText'] = "Hier sind die Fragen anderer Nutzer zu sehen. Diese können hier beantwortet werden. Der Eintrag wird dadurch auch den FAQ-Beiträgen hinzugefügt."; $PMF_LANG['msgNoQuestionsAvailable'] = "Derzeit gibt es keine offenen Fragen."; +$PMF_LANG['msgEmailTo'] = "E-Mail an"; // Contact $PMF_LANG['msgContactEMail'] = "E-Mail an den Betreiber"; diff --git a/phpmyfaq/translations/language_en.php b/phpmyfaq/translations/language_en.php index ae9d3e1185..701b6b2be1 100644 --- a/phpmyfaq/translations/language_en.php +++ b/phpmyfaq/translations/language_en.php @@ -98,10 +98,11 @@ $PMF_LANG["msgAskYourQuestion"] = "Your question"; $PMF_LANG["msgAskThx4Mail"] = "Thank you for your question!"; $PMF_LANG["msgDate_User"] = "Date / User"; -$PMF_LANG["msgQuestion2"] = "Question"; +$PMF_LANG["msgQuestion2"] = "Category / Question"; $PMF_LANG["msg2answer"] = "Answer"; $PMF_LANG["msgQuestionText"] = "Here you can see questions asked by other users. If you answer these questions, your answers may be inserted into the FAQ."; $PMF_LANG["msgNoQuestionsAvailable"] = "Currently there are no pending questions."; +$PMF_LANG["msgEmailTo"] = "Email to"; // Contact $PMF_LANG["msgContactEMail"] = "Email the FAQ owner";