Commit 1ead5198 authored by Chenu Denis's avatar Chenu Denis
Browse files

[feature] New button : Global contact button

parent 15cdccd2
......@@ -5,7 +5,7 @@
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2020-2021 Denis Chenu <http://www.sondages.pro>
* @license GPL v3
* @version 0.13.0-beta3
* @version 0.14.0-beta4
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
......@@ -308,6 +308,20 @@ class TokenUsersListAndManage extends PluginBase
'help' => $this->translate('This allow to create new user and give right to restricted user. Open a dialog box for sending message.'),
'default' => '0',
),
'TulamContactUser' => array(
'name' => 'TulamContactUser',
'types' => 'X',
'category' => $this->translate('User management'),
'sortorder' => 240,
'inputtype' => 'switch',
'options' => array(
0 => gT('No'),
1 => gT('Yes'),
),
'caption' => $this->translate('Show contact button'),
'help' => $this->translate('Same than send message button with button to create or assign user.'),
'default' => '0',
),
);
$this->getEvent()->append('questionAttributes', $buttonsAttributes);
}
......@@ -367,6 +381,7 @@ class TokenUsersListAndManage extends PluginBase
if (empty($aAttributes['TulamUserManagement'])) {
return;
}
$qid = $this->getEvent()->get('qid');
$beforeQuestionRenderEvent = $this->getEvent();
$surveyId = $settingsSurveyId = $beforeQuestionRenderEvent->get('surveyId');
if (!$this->getSetting($surveyId,'active')) {
......@@ -453,7 +468,7 @@ class TokenUsersListAndManage extends PluginBase
array(
"plugin" => 'TokenUsersListAndManage',
"surveyid" => $surveyId,
"function" => "myaccount"
"function" => "myaccount",
)
);
}
......@@ -509,7 +524,7 @@ class TokenUsersListAndManage extends PluginBase
}
}
}
if($tokenAttributeRestricted && $useAttributeRestricted && !empty($aAttributes['TulamAssignUser'] && $allowedAssignUser)) {
if($tokenAttributeRestricted && $useAttributeRestricted && !empty($aAttributes['TulamAssignUser']) && $allowedAssignUser) {
$toolUrls['assignuser'] = App()->createUrl(
"plugins/direct",
array(
......@@ -530,13 +545,28 @@ class TokenUsersListAndManage extends PluginBase
"plugin" => 'TokenUsersListAndManage',
"surveyid" => $surveyId,
"srid" => $srid,
"function" => "sendmessage"
"function" => "sendmessage",
)
);
$toolOptions['sendmessage'] = array(
'disabled' => !$haveMessageToken
);
}
if(!empty($aAttributes['TulamContactUser']) && $allowedSendEmail) {
$toolUrls['contact'] = App()->createUrl(
"plugins/direct",
array(
"plugin" => 'TokenUsersListAndManage',
"surveyid" => $surveyId,
"srid" => $srid,
"function" => "sendmessage",
"qid" => $qid
)
);
//~ $toolOptions['contact'] = array(
//~ 'disabled' => !$haveMessageToken
//~ );
}
if(!empty($aAttributes['TulamCreateUser']) && $allowedCreateUser) {
$toolUrls['newuser'] = App()->createUrl(
"plugins/direct",
......@@ -544,7 +574,7 @@ class TokenUsersListAndManage extends PluginBase
"plugin" => 'TokenUsersListAndManage',
"surveyid" => $surveyId,
"srid" => $srid,
"function" => "newuser"
"function" => "newuser",
)
);
}
......@@ -562,6 +592,7 @@ class TokenUsersListAndManage extends PluginBase
"Assign user and send an email with survey link." => $this->translate("Assign user and send an email with survey link."),
"Assign user" => $this->translate("Assign user"),
"Send message" => $this->translate("Send message"),
"Contact user" => $this->translate("Contact user"),
"No valid user to send message" => $this->translate("No valid user to send message"),
"No user to assign" => $this->translate("No user to assign"),
);
......@@ -574,7 +605,7 @@ class TokenUsersListAndManage extends PluginBase
);
$TokenUsersListAndManagePlugin->createAndRegisterPackage();
$this->subscribe('getPluginTwigPath');
$renderFile = "subviews/include/TULAM_buttons_question.twig";
$renderFile = "subviews/usersmanage/buttons/TULAM_buttongroup_question.twig";
$extraPart = App()->twigRenderer->renderPartial(
$renderFile,
$renderDataTwig
......
This diff is collapsed.
......@@ -2,4 +2,4 @@
{% set subtitle = language['Assign user'] %}
{% include "./subviews/include/TULAM_title.twig" %}
{% endif %}
{% include "./subviews/usersmanage/TULAM_assignuser_form.twig" %}
{% include "./subviews/usersmanage/forms/TULAM_assignuser_form.twig" %}
......@@ -2,4 +2,4 @@
{% set subtitle = language['Create new user'] %}
{% include "./subviews/include/TULAM_title.twig" %}
{% endif %}
{% include "./subviews/usersmanage/TULAM_createuser_form.twig" %}
{% include "./subviews/usersmanage/forms/TULAM_createuser_form.twig" %}
......@@ -2,4 +2,4 @@
{% set subtitle = language['Delete account'] %}
{% include "./subviews/include/TULAM_title.twig" %}
{% endif %}
{% include "./subviews/usersmanage/TULAM_deleteaccount_form.twig" %}
{% include "./subviews/usersmanage/forms/TULAM_deleteaccount_form.twig" %}
......@@ -2,4 +2,4 @@
{% set subtitle = language['Disable access'] %}
{% include "./subviews/include/TULAM_title.twig" %}
{% endif %}
{% include "./subviews/usersmanage/TULAM_disableuser_form.twig" %}
{% include "./subviews/usersmanage/forms/TULAM_disableuser_form.twig" %}
......@@ -2,4 +2,4 @@
{% set subtitle = sprintf(language['Edit user %s'],"<em>" ~ oUserToken.firstname ~ " " ~ oUserToken.lastname ~ "</em>") %}
{% include "./subviews/include/TULAM_title.twig" %}
{% endif %}
{% include "./subviews/usersmanage/TULAM_edituser_form.twig" %}
{% include "./subviews/usersmanage/forms/TULAM_edituser_form.twig" %}
{% if not ajax %}
{% set subtitle = '' %}
{% include "./subviews/include/TULAM_title.twig" %}
{% include "./subviews/include/TULAM_button_group.twig" %}
{% include "./subviews/usersmanage/buttons/TULAM_buttongroup_manage.twig" %}
{% endif %}
<div class="clearfix">
{{ usersGridList | raw }}
......
......@@ -2,4 +2,4 @@
{% set subtitle = sprintf(language['Send a message to %s'],"<em>" ~ oUserToken.firstname ~ " " ~ oUserToken.lastname ~ "</em>") %}
{% include "./subviews/include/TULAM_title.twig" %}
{% endif %}
{% include "./subviews/usersmanage/TULAM_mailuser_form.twig" %}
{% include "./subviews/usersmanage/forms/TULAM_mailuser_form.twig" %}
......@@ -3,4 +3,4 @@
{% include "./subviews/include/TULAM_title.twig" %}
{% endif %}
{% set oUserToken = oManagerToken %}
{% include "./subviews/usersmanage/TULAM_myaccount_form.twig" %}
{% include "./subviews/usersmanage/forms/TULAM_myaccount_form.twig" %}
{% if not ajax %}
{% set subtitle = sprintf(language['Edit user %s'],"<em>" ~ oUserToken.firstname ~ " " ~ oUserToken.lastname ~ "</em>") %}
{% include "./subviews/include/TULAM_title.twig" %}
{% endif %}
{% include "./subviews/usersmanage/forms/TULAM_restrictuser_form.twig" %}
......@@ -2,4 +2,4 @@
{% set subtitle = language['Send message'] %}
{% include "./subviews/include/TULAM_title.twig" %}
{% endif %}
{% include "./subviews/usersmanage/TULAM_sendmessage_form.twig" %}
{% include "./subviews/usersmanage/forms/TULAM_sendmessage_form.twig" %}
{% extends './subviews/usersmanage/TULAM_setting_checkbox.twig' %}
{% extends './subviews/usersmanage/TULAM_setting_default.twig' %}
{% extends './subviews/usersmanage/TULAM_setting_checkbox.twig' %}
{% if disabled %}
<a class="btn btn-default btn-tulam btn-assignuser {% if current == 'assignuser' %} disabled active {% endif %}" data-modal='tulam-form' disabled title='{{ C.HTML.encode(language["No user to assign"]) }}'>
<i class="fa fa-envelope-o" aria-hidden="true"></i>
{{ language['Assign user'] }}
</a>
{% else %}
<a href="{{ url }}" class="btn btn-default btn-tulam btn-assignuser {% if current == 'assignuser' %} disabled active {% endif %}" data-modal='tulam-form'>
<i class="fa fa-envelope-o" aria-hidden="true"></i>
{{ language['Assign user'] }}
</a>
{% endif %}
<a href="{{ url }}" class="btn btn-default btn-tulam btn-sendmessage" data-modal='tulam-form' >
<i class="fa fa-envelope-o" aria-hidden="true"></i>
{{ language['Contact user'] }}
</a>
<a href="{{ url }}" class="btn btn-default btn-tulam btn-account" data-modal='tulam-form'>
<i class="fa fa-user" aria-hidden="true"></i>
{{ language['Update my account'] }}
</a>
<a href="{{ url }}" class="btn btn-default btn-tulam btn-createuser {% if current == 'newuser' %} disabled active {% endif %}" data-modal='tulam-form'>
<i class="fa fa-user-plus" aria-hidden="true"></i>
{{ language['Create a user'] }}
</a>
{% if disabled %}
<a class="btn btn-default btn-tulam btn-sendmessage {% if current == 'sendmessage' %} disabled active {% endif %}" data-modal='tulam-form' disabled title='{{ C.HTML.encode(language["No valid user to send message"]) }}'>
<i class="fa fa-envelope-o" aria-hidden="true"></i>
{{ language['Send message'] }}
</a>
{% else %}
<a href="{{ url }}" class="btn btn-default btn-tulam btn-sendmessage {% if current == 'sendmessage' %} disabled active {% endif %}" data-modal='tulam-form' >
<i class="fa fa-envelope-o" aria-hidden="true"></i>
{{ language['Send message'] }}
</a>
{% endif %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment