mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
parent
db36b12657
commit
f94c7b83ce
@ -12,6 +12,8 @@ HumHub Changelog
|
||||
- Enh #7129: Link `wall-entry-controls`- color to `--text-color-soft`
|
||||
- Chg #7136: When opening a modal box, don't autofocus automatically on the first form input
|
||||
- Enh #7138: Added missing DB relations to UserInvite model
|
||||
- Enh #7139: Export `confirmUnload` function from `humhub.client.js`
|
||||
- Enh #7068: Bulk re-send email invites
|
||||
- Enh #7139 : Export `confirmUnload` function from `humhub.client.js`
|
||||
- Enh #7144: Add `DeviceDetectorHelper` class to detect devices such as the mobile app
|
||||
- Fix #7149: Fixed dropdown issue on mobile
|
||||
|
@ -144,6 +144,29 @@ class PendingRegistrationsController extends Controller
|
||||
return $this->render('delete', ['model' => $invite]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all invitations
|
||||
*
|
||||
* @param int $id
|
||||
* @return string
|
||||
* @throws HttpException
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function actionResendAll()
|
||||
{
|
||||
if (Yii::$app->request->isPost) {
|
||||
foreach (Invite::find()->each() as $invite) {
|
||||
$invite->sendInviteMail();
|
||||
}
|
||||
|
||||
$this->view->success(Yii::t(
|
||||
'AdminModule.user',
|
||||
'All open registration invitations were successfully re-sent.',
|
||||
));
|
||||
}
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all invitations
|
||||
*
|
||||
@ -173,15 +196,39 @@ class PendingRegistrationsController extends Controller
|
||||
* @throws HttpException
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function actionDeleteAllSelected()
|
||||
public function actionResendAllSelected()
|
||||
{
|
||||
if (Yii::$app->request->isPost) {
|
||||
|
||||
$ids = Yii::$app->request->post('id');
|
||||
if (!empty($ids)) {
|
||||
foreach ($ids as $id) {
|
||||
$invitation = Invite::findOne(['id' => $id]);
|
||||
$invitation->delete();
|
||||
foreach (Invite::findAll(['id' => $ids]) as $invite) {
|
||||
$invite->sendInviteMail();
|
||||
}
|
||||
$this->view->success(Yii::t(
|
||||
'AdminModule.user',
|
||||
'The selected invitations have been successfully re-sent!',
|
||||
));
|
||||
}
|
||||
}
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all or selected invitation
|
||||
*
|
||||
* @param int $id
|
||||
* @return string
|
||||
* @throws HttpException
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function actionDeleteAllSelected()
|
||||
{
|
||||
if (Yii::$app->request->isPost) {
|
||||
$ids = Yii::$app->request->post('id');
|
||||
if (!empty($ids)) {
|
||||
foreach (Invite::findAll(['id' => $ids]) as $invite) {
|
||||
$invite->delete();
|
||||
}
|
||||
$this->view->success(Yii::t(
|
||||
'AdminModule.user',
|
||||
|
@ -5,6 +5,20 @@ humhub.module('admin.PendingRegistrations', function (module, require, $) {
|
||||
|
||||
var PendingRegistrations = Widget.extend();
|
||||
|
||||
PendingRegistrations.prototype.resendAllSelected = function (evt) {
|
||||
var that = this;
|
||||
client.post(evt).then(function () {
|
||||
var keys = $("#grid").yiiGridView("getSelectedRows");
|
||||
$.ajax({
|
||||
url: that.options.urlResendSelected,
|
||||
type: "POST",
|
||||
data: {id: keys},
|
||||
})
|
||||
}).catch(function (e) {
|
||||
module.log.error(e, true);
|
||||
})
|
||||
};
|
||||
|
||||
PendingRegistrations.prototype.deleteAllSelected = function (evt) {
|
||||
var that = this;
|
||||
client.post(evt).then(function () {
|
||||
@ -19,6 +33,12 @@ humhub.module('admin.PendingRegistrations', function (module, require, $) {
|
||||
})
|
||||
};
|
||||
|
||||
PendingRegistrations.prototype.resendAll = function (evt) {
|
||||
client.post(evt).catch(function () {
|
||||
module.log.error(e, true);
|
||||
})
|
||||
};
|
||||
|
||||
PendingRegistrations.prototype.deleteAll = function (evt) {
|
||||
client.post(evt).catch(function () {
|
||||
module.log.error(e, true);
|
||||
@ -30,10 +50,16 @@ humhub.module('admin.PendingRegistrations', function (module, require, $) {
|
||||
this.$.find("input").change(function () {
|
||||
var $selection = that.$.find(':checked')
|
||||
if ($selection.length > 1) {
|
||||
$('.resend-all').html(that.options.noteResendSelected);
|
||||
$('.resend-all').attr('data-action-click', 'resendAllSelected');
|
||||
$('.resend-all').attr('data-action-click-url', that.options.urlResendSelected);
|
||||
$('.delete-all').html(that.options.noteDeleteSelected);
|
||||
$('.delete-all').attr('data-action-click', 'deleteAllSelected');
|
||||
$('.delete-all').attr('data-action-click-url', that.options.urlDeleteSelected);
|
||||
} else {
|
||||
$('.resend-all').html(that.options.noteResendAll);
|
||||
$('.resend-all').attr('data-action-click', 'resendAll');
|
||||
$('.resend-all').attr('data-action-click-url', that.options.urlResendAll);
|
||||
$('.delete-all').html(that.options.noteDeleteAll);
|
||||
$('.delete-all').attr('data-action-click', 'deleteAll');
|
||||
$('.delete-all').attr('data-action-click-url', that.options.urlDeleteAll);
|
||||
|
@ -9,10 +9,10 @@
|
||||
namespace humhub\modules\admin\widgets;
|
||||
|
||||
use humhub\modules\admin\models\PendingRegistrationSearch;
|
||||
use yii\helpers\Url;
|
||||
use humhub\widgets\JsWidget;
|
||||
use Yii;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/**
|
||||
* PendingRegistrations shows a grid view of all open/pending UserInvites
|
||||
@ -80,6 +80,10 @@ class PendingRegistrations extends JsWidget
|
||||
public function getData()
|
||||
{
|
||||
return [
|
||||
'url-resend-selected' => Url::to(['pending-registrations/resend-all-selected']),
|
||||
'url-resend-all' => Url::to(['pending-registrations/resend-all']),
|
||||
'note-resend-selected' => Yii::t('AdminModule.base', 'Resend to selected rows'),
|
||||
'note-resend-all' => Yii::t('AdminModule.base', 'Resend to all'),
|
||||
'url-delete-selected' => Url::to(['pending-registrations/delete-all-selected']),
|
||||
'url-delete-all' => Url::to(['pending-registrations/delete-all']),
|
||||
'note-delete-selected' => Yii::t('AdminModule.base', 'Delete selected rows'),
|
||||
|
@ -15,28 +15,33 @@ use yii\helpers\Url;
|
||||
AdminPendingRegistrationsAsset::register($this);
|
||||
?>
|
||||
<?= Html::beginTag('div', $options); ?>
|
||||
<h4><?= Yii::t('AdminModule.base', 'Pending user registrations') ?></h4>
|
||||
|
||||
<div class="help-block">
|
||||
<?= Yii::t(
|
||||
'AdminModule.user',
|
||||
'The following list contains all pending sign-ups and invites.'
|
||||
) ?>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<h4>
|
||||
<?= humhub\libs\Html::backButton(
|
||||
['/admin/user/index'],
|
||||
[
|
||||
'label' => Yii::t('AdminModule.base', 'Back to user overview'),
|
||||
'class' => 'btn-sm'
|
||||
]
|
||||
'class' => 'btn-sm pull-right',
|
||||
],
|
||||
) ?>
|
||||
<?= Yii::t('AdminModule.base', 'Pending user registrations') ?>
|
||||
</h4>
|
||||
|
||||
<div class="help-block">
|
||||
<?= Yii::t('AdminModule.user', 'The following list contains all pending sign-ups and invites.') ?>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<?php if ($dataProvider->totalCount > 0): ?>
|
||||
<?= Button::primary(Yii::t('AdminModule.user', 'Re-send to all'))
|
||||
->icon('paper-plane')
|
||||
->action('resendAll', Url::toRoute(['/admin/pending-registrations/resend-all']))
|
||||
->cssClass('resend-all btn-sm')->
|
||||
confirm(Yii::t('AdminModule.user', 'Resend invitations?'), Yii::t('AdminModule.user', 'Do you really want to re-send the invitations to pending registration users?')) ?>
|
||||
<?= Button::danger(Yii::t('AdminModule.user', 'Delete All'))
|
||||
->icon('trash')
|
||||
->action('deleteAll', Url::toRoute(['/admin/pending-registrations/delete-all']))
|
||||
->cssClass('delete-all btn-sm')->
|
||||
confirm('<b>Delete</b> pending registrations?', 'Do you really want to delete pending registrations?'); ?>
|
||||
confirm(Yii::t('AdminModule.user', 'Delete pending registrations?'), Yii::t('AdminModule.user', 'Do you really want to delete pending registrations?')) ?>
|
||||
<?php endif; ?>
|
||||
<?= ExportButton::widget(['filter' => 'PendingRegistrationSearch']) ?>
|
||||
</div>
|
||||
@ -82,19 +87,21 @@ AdminPendingRegistrationsAsset::register($this);
|
||||
'resend' => function ($url, $model, $key) {
|
||||
return Button::primary()
|
||||
->action('client.post', Url::to(['resend', 'id' => $model->id]))
|
||||
->icon('envelope')
|
||||
->icon('paper-plane')
|
||||
->confirm(Yii::t('AdminModule.user', 'Resend invitation?'))
|
||||
->xs();
|
||||
},
|
||||
'delete' => function ($url, $model, $key) {
|
||||
return
|
||||
Button::primary()
|
||||
Button::danger()
|
||||
->action('client.post', Url::to(['delete', 'id' => $model->id]))
|
||||
->icon('trash')
|
||||
->confirm(Yii::t('AdminModule.user', 'Delete pending registrations?'))
|
||||
->xs();
|
||||
},
|
||||
],
|
||||
],
|
||||
|
||||
]
|
||||
],
|
||||
]) ?>
|
||||
<?= Html::endTag('div');
|
||||
|
Loading…
x
Reference in New Issue
Block a user