Enh: Added Pending Registrations admin view with csv, xlsx support. + small cleanups

This commit is contained in:
buddh4 2017-08-01 22:14:06 +02:00
parent 03fdb7a5df
commit 3f741da0a2
6 changed files with 57 additions and 46 deletions

View File

@ -1,6 +1,7 @@
<?php <?php
use humhub\libs\Html; use humhub\libs\Html;
use yii\bootstrap\ActiveForm;
humhub\assets\TabbedFormAsset::register($this); humhub\assets\TabbedFormAsset::register($this);
?> ?>
@ -12,7 +13,7 @@ humhub\assets\TabbedFormAsset::register($this);
</div> </div>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<?php $form = \yii\bootstrap\ActiveForm::begin(['options' => ['data-ui-widget' => 'ui.form.TabbedForm', 'data-ui-init' => '']]); ?> <?php $form = ActiveForm::begin(['options' => ['data-ui-widget' => 'ui.form.TabbedForm', 'data-ui-init' => '', 'style' => 'display:none']]); ?>
<?= $hForm->render($form); ?> <?= $hForm->render($form); ?>
<?php \yii\bootstrap\ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div> </div>

View File

@ -8,6 +8,8 @@
namespace humhub\modules\admin\widgets; namespace humhub\modules\admin\widgets;
use humhub\modules\admin\models\UserApprovalSearch;
use humhub\modules\user\models\Invite;
use Yii; use Yii;
use yii\helpers\Url; use yii\helpers\Url;
@ -45,7 +47,21 @@ class UserMenu extends \humhub\widgets\BaseMenu
]) ])
]); ]);
$approvalCount = \humhub\modules\admin\models\UserApprovalSearch::getUserApprovalCount(); $inviteCount = Invite::find()->count();
if ($inviteCount > 0) {
$this->addItem([
'label' => Yii::t('AdminModule.user', 'Pending registrations') . ' <span class="label label-danger">' . $inviteCount . '</span>',
'url' => Url::to(['/admin/pending-registrations']),
'sortOrder' => 300,
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'pending-registrations'),
'isVisible' => Yii::$app->user->can([
new \humhub\modules\admin\permissions\ManageUsers(),
new \humhub\modules\admin\permissions\ManageGroups()
])
]);
}
$approvalCount = UserApprovalSearch::getUserApprovalCount();
if ($approvalCount > 0) { if ($approvalCount > 0) {
$this->addItem([ $this->addItem([
'label' => Yii::t('AdminModule.user', 'Pending approvals') . ' <span class="label label-danger">' . $approvalCount . '</span>', 'label' => Yii::t('AdminModule.user', 'Pending approvals') . ' <span class="label label-danger">' . $approvalCount . '</span>',

View File

@ -88,7 +88,7 @@ class Comment extends ContentAddonActiveRecord implements ContentOwner
try { try {
$this->updateContentSearch(); $this->updateContentSearch();
} catch (\yii\base\Exception $ex) { } catch (\yii\base\Exception $ex) {
; Yii::error($ex);
} }
parent::afterDelete(); parent::afterDelete();

View File

@ -49,7 +49,7 @@ class CreateController extends Controller
/** /**
* Creates a new Space * Creates a new Space
*/ */
public function actionCreate($visibility = null) public function actionCreate($visibility = null, $skip = 0)
{ {
// User cannot create spaces (public or private) // User cannot create spaces (public or private)
if (!Yii::$app->user->permissionmanager->can(new CreatePublicSpace) && !Yii::$app->user->permissionmanager->can(new CreatePrivateSpace)) { if (!Yii::$app->user->permissionmanager->can(new CreatePublicSpace) && !Yii::$app->user->permissionmanager->can(new CreatePrivateSpace)) {
@ -59,6 +59,9 @@ class CreateController extends Controller
$model = $this->createSpaceModel(); $model = $this->createSpaceModel();
if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
if($skip) {
return $this->htmlRedirect($model->getUrl());
}
return $this->actionModules($model->id); return $this->actionModules($model->id);
} }

View File

@ -13,12 +13,12 @@
/* @var $isNew boolean */ /* @var $isNew boolean */
/* @var $isNew boolean */ /* @var $isNew boolean */
/* @var $originator \humhub\modules\user\models\User */ /* @var $originator \humhub\modules\user\models\User */
/* @var source yii\db\ActiveRecord */ /* @var $source yii\db\ActiveRecord */
/* @var contentContainer \humhub\modules\content\components\ContentContainerActiveRecord */ /* @var $contentContainer \humhub\modules\content\components\ContentContainerActiveRecord */
/* @var space humhub\modules\space\models\Space */ /* @var $space humhub\modules\space\models\Space */
/* @var record \humhub\modules\notification\models\Notification */ /* @var $record \humhub\modules\notification\models\Notification */
/* @var html string */ /* @var $html string */
/* @var text string */ /* @var $text string */
?> ?>
<?php $this->beginContent('@notification/views/layouts/mail.php', $_params_); ?> <?php $this->beginContent('@notification/views/layouts/mail.php', $_params_); ?>

View File

@ -1,53 +1,44 @@
<?php <?php
use humhub\widgets\ActiveForm; use humhub\widgets\ActiveForm;
use humhub\widgets\ModalButton;
use humhub\widgets\ModalDialog;
use yii\helpers\Url; use yii\helpers\Url;
$animation = $model->hasErrors() ? 'shake' : 'fadeIn'; $animation = $model->hasErrors() ? 'shake' : 'fadeIn';
?> ?>
<div class="modal-dialog modal-dialog-small animated <?= $animation ?>"> <?php ModalDialog::begin(['header' => Yii::t('SpaceModule.views_create_create', '<strong>Create</strong> new space'), 'size' => 'small']) ?>
<div class="modal-content"> <?php $form = ActiveForm::begin(); ?>
<?php $form = ActiveForm::begin(); ?> <div class="modal-body">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"
id="myModalLabel"><?php echo Yii::t('SpaceModule.views_create_create', '<strong>Create</strong> new space'); ?></h4>
</div>
<div class="modal-body">
<?= humhub\modules\space\widgets\SpaceNameColorInput::widget(['form' => $form, 'model' => $model])?> <?= humhub\modules\space\widgets\SpaceNameColorInput::widget(['form' => $form, 'model' => $model]) ?>
<?php echo $form->field($model, 'description')->textarea(['placeholder' => Yii::t('SpaceModule.views_create_create', 'space description'), 'rows' => '3']); ?> <?php echo $form->field($model, 'description')->textarea(['placeholder' => Yii::t('SpaceModule.views_create_create', 'space description'), 'rows' => '3']); ?>
<a data-toggle="collapse" id="access-settings-link" href="#collapse-access-settings" <a data-toggle="collapse" id="access-settings-link" href="#collapse-access-settings" style="font-size: 11px;">
style="font-size: 11px;"><i <i class="fa fa-caret-right"></i> <?php echo Yii::t('SpaceModule.views_create_create', 'Advanced access settings'); ?>
class="fa fa-caret-right"></i> <?php echo Yii::t('SpaceModule.views_create_create', 'Advanced access settings'); ?> </a>
</a>
<div id="collapse-access-settings" class="panel-collapse collapse"> <div id="collapse-access-settings" class="panel-collapse collapse">
<br/> <br/>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<?= $form->field($model, 'join_policy')->radioList($joinPolicyOptions); ?> <?= $form->field($model, 'join_policy')->radioList($joinPolicyOptions); ?>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<?= $form->field($model, 'visibility')->radioList($visibilityOptions); ?> <?= $form->field($model, 'visibility')->radioList($visibilityOptions); ?>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn btn-primary" <?= ModalButton::submitModal(Url::to(['/space/create/create']), Yii::t('SpaceModule.views_create_create', 'Next')) ?>
data-action-click="ui.modal.submit" <?= ModalButton::submitModal(Url::to(['/space/create/create', 'skip' => 1]), Yii::t('SpaceModule.views_create_create', 'Skip'))
data-ui-loader ->setType('info')->icon('fa-forward', true)->cssClass('tt')->options(['title' => Yii::t('SpaceModule.views_create_create', 'Skip other steps')]) ?>
data-action-url="<?= Url::to(['/space/create/create']) ?>"> </div>
<?= Yii::t('SpaceModule.views_create_create', 'Next'); ?> <?php ActiveForm::end(); ?>
</a> <?php ModalDialog::end(); ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
$('#collapse-access-settings').on('show.bs.collapse', function () { $('#collapse-access-settings').on('show.bs.collapse', function () {