Skip to content

Commit

Permalink
Translations moved to hipanel/server category, other minor
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Feb 8, 2016
1 parent 5db921b commit baa7e3b
Show file tree
Hide file tree
Showing 25 changed files with 186 additions and 160 deletions.
15 changes: 15 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ class Plugin extends \hiqdev\pluginmanager\Plugin
'class' => 'hipanel\modules\server\Module',
],
],
'components' => [
'i18n' => [
'translations' => [
'hipanel/server' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@hipanel/modules/server/messages',
'fileMap' => [
'hipanel/server' => 'server.php',
'hipanel/server/os' => 'os.php',
'hipanel/server/panel' => 'panel.php',
],
],
],
],
],
];

}
4 changes: 2 additions & 2 deletions src/SidebarMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public function items()
{
return [
'servers' => [
'label' => Yii::t('app', 'Servers'),
'label' => Yii::t('hipanel/server', 'Servers'),
'url' => ['/server/server/index'],
'icon' => 'fa-server',
'items' => [
'servers' => [
'label' => Yii::t('app', 'Servers'),
'label' => Yii::t('hipanel/server', 'Servers'),
'url' => ['/server/server/index'],
],
],
Expand Down
60 changes: 30 additions & 30 deletions src/controllers/ServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ public function actions()
],
'set-note' => [
'class' => SmartUpdateAction::class,
'success' => Yii::t('app', 'Note changed'),
'error' => Yii::t('app', 'Failed to change note'),
'success' => Yii::t('hipanel/server', 'Note changed'),
'error' => Yii::t('hipanel/server', 'Failed to change note'),
],
'set-label' => [
'class' => SmartUpdateAction::class,
'success' => Yii::t('app', 'Internal note changed'),
'error' => Yii::t('app', 'Failed to change internal note'),
'success' => Yii::t('hipanel/server', 'Internal note changed'),
'error' => Yii::t('hipanel/server', 'Failed to change internal note'),
],
'set-lock' => [
'class' => RenderAction::class,
'success' => Yii::t('app', 'Record was changed'),
'error' => Yii::t('app', 'Error occurred'),
'success' => Yii::t('hipanel/server', 'Record was changed'),
'error' => Yii::t('hipanel/server', 'Error occurred'),
'POST pjax' => [
'save' => true,
'success' => [
Expand Down Expand Up @@ -133,53 +133,53 @@ public function actions()
],
'reboot' => [
'class' => SmartUpdateAction::class,
'success' => 'Reboot task has been successfully added to queue',
'error' => 'Error during the rebooting',
'success' => Yii::t('hipanel/server', 'Reboot task has been successfully added to queue'),
'error' => Yii::t('hipanel/server', 'Error during the rebooting'),
],
'reset' => [
'class' => SmartUpdateAction::class,
'success' => 'Reset task has been successfully added to queue',
'error' => 'Error during the resetting',
'success' => Yii::t('hipanel/server', 'Reset task has been successfully added to queue'),
'error' => Yii::t('hipanel/server', 'Error during the resetting'),
],
'shutdown' => [
'class' => SmartUpdateAction::class,
'success' => 'Shutdown task has been successfully added to queue',
'error' => 'Error during the shutting down',
'success' => Yii::t('hipanel/server', 'Shutdown task has been successfully added to queue'),
'error' => Yii::t('hipanel/server', 'Error during the shutting down'),
],
'power-off' => [
'class' => SmartUpdateAction::class,
'success' => 'Power off task has been successfully added to queue',
'error' => 'Error during the turning power off',
'success' => Yii::t('hipanel/server', 'Power off task has been successfully added to queue'),
'error' => Yii::t('hipanel/server', 'Error during the turning power off'),
],
'power-on' => [
'class' => SmartUpdateAction::class,
'success' => 'Power on task has been successfully added to queue',
'error' => 'Error during the turning power on',
'success' => Yii::t('hipanel/server', 'Power on task has been successfully added to queue'),
'error' => Yii::t('hipanel/server', 'Error during the turning power on'),
],
'reset-password' => [
'class' => SmartUpdateAction::class,
'success' => 'Root password reset task has been successfully added to queue',
'error' => 'Error during the resetting root password',
'success' => Yii::t('hipanel/server', 'Root password reset task has been successfully added to queue'),
'error' => Yii::t('hipanel/server', 'Error during the resetting root password'),
],
'enable-block' => [
'class' => SmartUpdateAction::class,
'success' => 'Server was blocked successfully',
'error' => 'Error during the server blocking',
'success' => Yii::t('hipanel/server', 'Server was blocked successfully'),
'error' => Yii::t('hipanel/server', 'Error during the server blocking'),
],
'disable-block' => [
'class' => SmartUpdateAction::class,
'success' => 'Server was unblocked successfully',
'error' => 'Error during the server unblocking',
'success' => Yii::t('hipanel/server', 'Server was unblocked successfully'),
'error' => Yii::t('hipanel/server', 'Error during the server unblocking'),
],
'refuse' => [
'class' => SmartUpdateAction::class,
'success' => 'You have refused the service',
'error' => 'Error during the refusing the service',
'success' => Yii::t('hipanel/server', 'You have refused the service'),
'error' => Yii::t('hipanel/server', 'Error during the refusing the service'),
],
'enable-autorenewal' => [
'class' => SmartUpdateAction::class,
'success' => 'Server renewal enabled successfully',
'error' => 'Error during the renewing the service',
'success' => Yii::t('hipanel/server', 'Server renewal enabled successfully'),
'error' => Yii::t('hipanel/server', 'Error during the renewing the service'),
],
'reinstall' => [
'class' => SmartUpdateAction::class,
Expand All @@ -191,8 +191,8 @@ public function actions()
$model->panel = Yii::$app->request->post('panel');
}
},
'success' => 'Server reinstalling task has been successfully added to queue',
'error' => 'Error during the server reinstalling',
'success' => Yii::t('hipanel/server', 'Server reinstalling task has been successfully added to queue'),
'error' => Yii::t('hipanel/server', 'Error during the server reinstalling'),
],
'boot-live' => [
'class' => SmartUpdateAction::class,
Expand All @@ -203,8 +203,8 @@ public function actions()
$model->osmage = Yii::$app->request->post('osimage');
}
},
'success' => 'Live CD booting task has been successfully added to queue',
'error' => 'Error during the booting live CD',
'success' => Yii::t('hipanel/server', 'Live CD booting task has been successfully added to queue'),
'error' => Yii::t('hipanel/server', 'Error during the booting live CD'),
],
'validate-form' => [
'class' => ValidateFormAction::class,
Expand Down
4 changes: 2 additions & 2 deletions src/grid/ServerGridView.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function defaultColumns()
'value' => function ($model) {
$html = State::widget(compact('model'));
if ($model->status_time) {
$html .= ' ' . Yii::t('app', 'since') . ' ' . Yii::$app->formatter->asDate($model->status_time);
$html .= ' ' . Yii::t('hipanel/server', 'since {date}', ['date' => Yii::$app->formatter->asDate($model->status_time)]);
}
return $html;
},
Expand All @@ -74,7 +74,7 @@ public static function defaultColumns()
'format' => 'text',
'contentOptions' => ['class' => 'text-uppercase'],
'value' => function ($model) {
return $model->panel ?: Yii::t('app', 'No control panel');
return $model->panel ?: Yii::t('hipanel/server', 'No control panel');
}
],
'os' => [
Expand Down
6 changes: 3 additions & 3 deletions src/models/Osimage.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public function getSoftPack () { return $this->hasSoftPack() ? $this->softpack :
*/
public function attributeLabels () {
return [
'osimagae' => Yii::t('app', 'System name of image'),
'os' => Yii::t('app', 'OS'),
'softpack' => Yii::t('app', 'Soft package'),
'osimagae' => Yii::t('hipanel/server/os', 'System name of image'),
'os' => Yii::t('hipanel/server/os', 'OS'),
'softpack' => Yii::t('hipanel/server/os', 'Soft package'),
];
}
}
22 changes: 11 additions & 11 deletions src/models/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function getIsBlocked() {
public function checkOperable()
{
if (!$this->isOperable()) {
throw new NotSupportedException(\Yii::t('app', 'Server already has a running task. Can not start new.'));
throw new NotSupportedException(\Yii::t('hipanel/server', 'Server already has a running task. Can not start new.'));
}
return true;
}
Expand Down Expand Up @@ -189,16 +189,16 @@ public function canFullRefuse() {
public function attributeLabels()
{
return $this->mergeAttributeLabels([
'remoteid' => Yii::t('app', 'Remote ID'),
'name_like' => Yii::t('app', 'Name'),
'name' => Yii::t('app', 'Name'),
'status_time' => Yii::t('app', 'Last operation time'),
'block_reason_label' => Yii::t('app', 'Block reason label'),
'request_state_label' => Yii::t('app', 'Request state label'),
'ips' => Yii::t('app', 'IP addresses'),
'label' => Yii::t('app', 'Internal note'),
'os' => Yii::t('app', 'OS'),
'comment' => Yii::t('app', 'Comment'),
'remoteid' => Yii::t('hipanel/server', 'Remote ID'),
'name_like' => Yii::t('hipanel/server', 'Name'),
'name' => Yii::t('hipanel/server', 'Name'),
'status_time' => Yii::t('hipanel/server', 'Last operation time'),
'block_reason_label' => Yii::t('hipanel/server', 'Block reason label'),
'request_state_label' => Yii::t('hipanel/server', 'Request state label'),
'ips' => Yii::t('hipanel/server', 'IP addresses'),
'label' => Yii::t('hipanel/server', 'Internal note'),
'os' => Yii::t('hipanel/server', 'OS'),
'comment' => Yii::t('hipanel/server', 'Comment'),
]);
}
}
18 changes: 9 additions & 9 deletions src/views/server/_block.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
$modalButton = ModalButton::begin([
'model' => $model,
'scenario' => 'enable-block',
'button' => ['label' => '<i class="ion-locked"></i>' . Yii::t('app', 'Block server')],
'button' => ['label' => '<i class="ion-locked"></i>' . Yii::t('hipanel/server', 'Block server')],
'form' => [
'enableAjaxValidation' => true,
'validationUrl' => Url::toRoute(['validate-form', 'scenario' => 'enable-block']),
],
'modal' => [
'header' => Html::tag('h4', Yii::t('app', 'Confirm server blocking')),
'header' => Html::tag('h4', Yii::t('hipanel/server', 'Confirm server blocking')),
'headerOptions' => ['class' => 'label-danger'],
'footer' => [
'label' => Yii::t('app', 'Block'),
'data-loading-text' => Yii::t('app', 'Blocking...'),
'label' => Yii::t('hipanel/server', 'Block'),
'data-loading-text' => Yii::t('hipanel/server', 'Blocking...'),
'class' => 'btn btn-danger',
]
]
]); ?>
<div class="callout callout-warning">
<h4><?= Yii::t('app', 'This will immediately reject new SSH, FTP and WEB connections to the server!') ?></h4>
<h4><?= Yii::t('hipanel/server', 'This will immediately reject new SSH, FTP and WEB connections to the server!') ?></h4>
</div>

<?php echo $modalButton->form->field($model, 'type')->dropDownList($blockReasons); ?>
Expand All @@ -36,17 +36,17 @@
$modalButton = ModalButton::begin([
'model' => $model,
'scenario' => 'disable-block',
'button' => ['label' => '<i class="ion-unlocked"></i>' . Yii::t('app', 'Unblock server')],
'button' => ['label' => '<i class="ion-unlocked"></i>' . Yii::t('hipanel/server', 'Unblock server')],
'form' => [
'enableAjaxValidation' => true,
'validationUrl' => Url::toRoute(['validate-form', 'scenario' => 'disable-block']),
],
'modal' => [
'header' => Html::tag('h4', Yii::t('app', 'Confirm server unblocking')),
'header' => Html::tag('h4', Yii::t('hipanel/server', 'Confirm server unblocking')),
'headerOptions' => ['class' => 'label-info'],
'footer' => [
'label' => Yii::t('app', 'Unblock'),
'data-loading-text' => Yii::t('app', 'Unblocking...'),
'label' => Yii::t('hipanel/server', 'Unblock'),
'data-loading-text' => Yii::t('hipanel/server', 'Unblocking...'),
'class' => 'btn btn-info',
]
]
Expand Down
10 changes: 5 additions & 5 deletions src/views/server/_boot-live.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
ModalButton::begin([
'model' => $model,
'button' => [
'label' => Yii::t('app', 'Boot LiveCD'),
'label' => Yii::t('hipanel/server', 'Boot LiveCD'),
'class' => 'btn btn-default',
'disabled' => !$model->isOperable(),
'position' => ModalButton::BUTTON_IN_MODAL,
],
'modal' => [
'header' => Html::tag('h4', Yii::t('app', 'Confirm booting from Live CD')),
'header' => Html::tag('h4', Yii::t('hipanel/server', 'Confirm booting from Live CD')),
'headerOptions' => ['class' => 'label-info'],
'footer' => \yii\bootstrap\ButtonDropdown::widget([
'label' => Yii::t('app', 'Boot LiveCD'),
'label' => Yii::t('hipanel/server', 'Boot LiveCD'),
'dropdown' => [
'items' => $os_items
],
Expand All @@ -40,7 +40,7 @@

]);
echo Html::hiddenInput('osimage', null, ['class' => 'livecd-osimage']);
echo Yii::t('app', 'This action will shutdown the server and boot live cd image');
echo Yii::t('hipanel/server', 'This action will shutdown the server and boot live cd image');

ModalButton::end();
}
}
12 changes: 6 additions & 6 deletions src/views/server/_delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
echo ModalButton::widget([
'model' => $model,
'scenario' => 'delete',
'button' => ['label' => '<i class="fa fa-trash-o"></i>' . Yii::t('app', 'Delete')],
'body' => Yii::t('app', 'Are you sure you want to delete server {name}? You will loose everything!', ['name' => $model->name]),
'button' => ['label' => '<i class="fa fa-trash-o"></i>' . Yii::t('hipanel/server', 'Delete')],
'body' => Yii::t('hipanel/server', 'Are you sure you want to delete server {name}? You will loose everything!', ['name' => $model->name]),
'modal' => [
'header' => Html::tag('h4', Yii::t('app', 'Confirm server deleting')),
'header' => Html::tag('h4', Yii::t('hipanel/server', 'Confirm server deleting')),
'headerOptions' => ['class' => 'label-danger'],
'footer' => [
'label' => Yii::t('app', 'Delete server'),
'data-loading-text' => Yii::t('app', 'Deleting server...'),
'label' => Yii::t('hipanel/server', 'Delete server'),
'data-loading-text' => Yii::t('hipanel/server', 'Deleting server...'),
'class' => 'btn btn-danger',
]
]
]);
]);
6 changes: 3 additions & 3 deletions src/views/server/_log.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
use yii\helpers\Html;

if (empty($model->statuses)) {
echo Yii::t('app', 'No events were recorded');
echo Yii::t('hipanel/server', 'No events were recorded');
} else { ?>
<table class="table table-condensed">
<tr>
<th><?= Yii::t('app', 'Event') ?></th>
<th><?= Yii::t('app', 'Time') ?></th>
<th><?= Yii::t('hipanel/server', 'Event') ?></th>
<th><?= Yii::t('hipanel/server', 'Time') ?></th>
</tr>
<?php foreach ($model->statuses as $status => $time) {
echo Html::beginTag('tr');
Expand Down
14 changes: 7 additions & 7 deletions src/views/server/_power-off.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
'model' => $model,
'scenario' => 'power-off',
'button' => [
'label' => Yii::t('app', 'Power off'),
'label' => Yii::t('hipanel/server', 'Power off'),
'class' => 'btn btn-default',
'disabled' => !$model->isOperable(),
],
'modal' => [
'header' => Html::tag('h4', Yii::t('app', 'Confirm server power off')),
'header' => Html::tag('h4', Yii::t('hipanel/server', 'Confirm server power off')),
'headerOptions' => ['class' => 'label-warning'],
'footer' => [
'label' => Yii::t('app', 'Power OFF'),
'data-loading-text' => Yii::t('app', 'Turning power OFF...'),
'label' => Yii::t('hipanel/server', 'Power OFF'),
'data-loading-text' => Yii::t('hipanel/server', 'Turning power OFF...'),
'class' => 'btn btn-warning',
]
]
]);
?>
<div class="callout callout-warning">
<h4><?= Yii::t('app', 'This may cause data loose!') ?></h4>
<h4><?= Yii::t('hipanel/server', 'This may cause data loose!') ?></h4>

<p><?= Yii::t('app',
<p><?= Yii::t('hipanel/server',
'Power off will immediately interrupt all processes on the server in a dangerous way. Always try to shutdown it, before turning off the power. Are you sure you want to power off the server?') ?></p>
</div>

<?php ModalButton::end();
<?php ModalButton::end();
Loading

0 comments on commit baa7e3b

Please sign in to comment.