-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3b6fd3
commit 33b1c5b
Showing
7 changed files
with
195 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?php | ||
|
||
/* @var $this View */ | ||
/* @var $model hipanel\modules\hosting\models\Mail */ | ||
/* @var $type string */ | ||
|
||
use hipanel\base\View; | ||
use hipanel\modules\client\widgets\combo\ClientCombo; | ||
use hipanel\modules\hosting\widgets\combo\HdomainCombo; | ||
use hipanel\modules\hosting\widgets\combo\MailCombo; | ||
use hipanel\modules\hosting\widgets\combo\SshAccountCombo; | ||
use hipanel\modules\server\widgets\combo\ServerCombo; | ||
use hipanel\widgets\PasswordInput; | ||
use yii\helpers\Html; | ||
use yii\bootstrap\ActiveForm; | ||
use yii\helpers\Url; | ||
use yii\web\JsExpression; | ||
|
||
?> | ||
|
||
<?php $form = ActiveForm::begin([ | ||
'id' => 'dynamic-form', | ||
'enableAjaxValidation' => true, | ||
'validationUrl' => Url::toRoute([ | ||
'validate-form', | ||
'scenario' => $model->isNewRecord ? reset($models)->scenario : 'update' | ||
]), | ||
]) ?> | ||
|
||
<div class="container-items"><!-- widgetContainer --> | ||
<?php foreach ($models as $i => $model) { ?> | ||
<div class="row"> | ||
<div class="col-md-4"> | ||
<div class="box box-danger"> | ||
<div class="box-body"> | ||
<div class="mail-form" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html"> | ||
<?php | ||
if (!$model->isNewRecord) { | ||
$model->setScenario('update'); | ||
echo Html::activeHiddenInput($model, "[$i]id"); | ||
} | ||
?> | ||
|
||
<?php | ||
if (Yii::$app->user->can('support')) { | ||
print $form->field($model, "[$i]client")->widget(ClientCombo::className()); | ||
} | ||
|
||
print $form->field($model, "[$i]server")->widget(ServerCombo::className()); | ||
|
||
print $form->field($model, "[$i]account")->widget(SshAccountCombo::className()); | ||
|
||
print Html::label(Yii::t('app', 'E-mail'), Html::getInputId($model, "[$i]nick")); | ||
?> | ||
<div class="form-inline"> | ||
<?= $form->field($model, "[$i]nick")->input('text', ['data-field' => 'nick'])->label(false) ?> | ||
<?= Html::tag('span', '@') ?> | ||
<?= $form->field($model, "[$i]hdomain_id")->widget(HdomainCombo::className(), [ | ||
'activeWhen' => ['hosting/account'], | ||
'inputOptions' => [ | ||
'data-field' => 'dns_hdomain_id', | ||
], | ||
'pluginOptions' => [ | ||
'select2Options' => [ | ||
'width' => '250px', | ||
], | ||
'onChange' => new JsExpression("function () { | ||
$(this).closest('.form-instance').find('input[data-field=\"sub-with-domain\"]').trigger('update'); | ||
} | ||
") | ||
] | ||
])->label(false) ?> | ||
</div> | ||
|
||
<?php | ||
print $form->field($model, "[$i]password")->widget(PasswordInput::className()); | ||
|
||
print $form->field($model, "[$i]spam_action")->radioList([ | ||
'' => Yii::t('app', 'Do nothing'), | ||
'remove' => Yii::t('app', 'Remove'), | ||
'forward' => Yii::t('app', 'Forward to'), | ||
]); | ||
print $form->field($model, "[$i]spam_forward_mail", [ | ||
'inputOptions' => [ | ||
'disabled' => true | ||
] | ||
])->widget(MailCombo::className(), [ | ||
|
||
]); | ||
|
||
print $form->field($model, "[$i]forwards")->widget(MailCombo::className()); | ||
|
||
print $form->field($model, "[$i]autoanswer")->textarea(); | ||
|
||
print $form->field($model, "[$i]du_limit")->textarea(); | ||
?> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<?php } ?> | ||
</div> | ||
<?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-default']) ?> | ||
| ||
<?= Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'onclick' => 'history.go(-1)']) ?> | ||
<?php ActiveForm::end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
/* @var $this yii\web\View */ | ||
/* @var $model hipanel\modules\hosting\models\Mail */ | ||
/* @var $type string */ | ||
|
||
$this->title = Yii::t('app', 'Create mailbox'); | ||
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Mailboxes'), 'url' => ['index']]; | ||
$this->params['breadcrumbs'][] = $this->title; | ||
?> | ||
|
||
<div class="mailbox-create"> | ||
<?= $this->render('_form', compact('models')) ?> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace hipanel\modules\hosting\widgets\combo; | ||
|
||
use hiqdev\combo\Combo; | ||
use yii\helpers\ArrayHelper; | ||
use yii\web\JsExpression; | ||
|
||
class MailCombo extends Combo | ||
{ | ||
/** @inheritdoc */ | ||
public $type = 'hosting/mail'; | ||
|
||
/** @inheritdoc */ | ||
public $name = 'mail'; | ||
|
||
/** @inheritdoc */ | ||
public $url = '/hosting/mail/search'; | ||
|
||
/** @inheritdoc */ | ||
public $_return = ['id', 'account', 'server', 'client']; | ||
|
||
/** @inheritdoc */ | ||
public $_rename = ['text' => 'mail']; | ||
|
||
/** @inheritdoc */ | ||
public function getFilter() | ||
{ | ||
return ArrayHelper::merge(parent::getFilter(), [ | ||
'server' => 'server/server', | ||
'account' => 'hosting/account', | ||
'state' => ['format' => 'ok'], | ||
]); | ||
} | ||
|
||
/** @inheritdoc */ | ||
public function getPluginOptions($options = []) | ||
{ | ||
return parent::getPluginOptions([ | ||
'activeWhen' => ['server/server'], | ||
'select2Options' => [ | ||
'formatResult' => new JsExpression("function (data) { | ||
return data.text; | ||
}") | ||
] | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters