mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
Added DataSavedWidget for showing flash messages after saving
This commit is contained in:
parent
abe9aaa85e
commit
0641e82d8c
@ -75,6 +75,9 @@ class SettingController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
|
||||
$this->redirect(Yii::app()->createUrl('//admin/setting/index'));
|
||||
}
|
||||
} else {
|
||||
@ -128,6 +131,9 @@ class SettingController extends Controller {
|
||||
$form->internalAllowAnonymousRegistration = HSetting::Set('anonymousRegistration', $form->internalAllowAnonymousRegistration, 'authentication_internal');
|
||||
$form->defaultUserGroup = HSetting::Set('defaultUserGroup', $form->defaultUserGroup, 'authentication_internal');
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
|
||||
$this->redirect(Yii::app()->createUrl('//admin/setting/authentication'));
|
||||
}
|
||||
}
|
||||
@ -189,6 +195,9 @@ class SettingController extends Controller {
|
||||
HSetting::Set('userFilter', $form->userFilter, 'authentication_ldap');
|
||||
HSetting::Set('usernameAttribute', $form->usernameAttribute, 'authentication_ldap');
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
|
||||
$this->redirect(Yii::app()->createUrl('//admin/setting/authenticationLdap'));
|
||||
}
|
||||
}
|
||||
@ -239,6 +248,9 @@ class SettingController extends Controller {
|
||||
HSetting::Set('type', $form->type, 'cache');
|
||||
HSetting::Set('expireTime', $form->expireTime, 'cache');
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved and flushed cache'));
|
||||
|
||||
$this->redirect(Yii::app()->createUrl('//admin/setting/caching'));
|
||||
}
|
||||
}
|
||||
@ -274,6 +286,10 @@ class SettingController extends Controller {
|
||||
if ($form->validate()) {
|
||||
|
||||
$form->trackingHtmlCode = HSetting::SetText('trackingHtmlCode', $form->trackingHtmlCode);
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
|
||||
$this->redirect(Yii::app()->createUrl('//admin/setting/statistic'));
|
||||
}
|
||||
} else {
|
||||
@ -323,6 +339,9 @@ class SettingController extends Controller {
|
||||
$form->systemEmailAddress = HSetting::Set('systemEmailAddress', $form->systemEmailAddress, 'mailing');
|
||||
$form->systemEmailName = HSetting::Set('systemEmailName', $form->systemEmailName, 'mailing');
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
|
||||
$this->redirect(Yii::app()->createUrl('//admin/setting/mailing'));
|
||||
}
|
||||
}
|
||||
@ -357,6 +376,9 @@ class SettingController extends Controller {
|
||||
$form->paginationSize = HSetting::Set('paginationSize', $form->paginationSize);
|
||||
$form->displayName = HSetting::Set('displayNameFormat', $form->displayName);
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
|
||||
$this->redirect(Yii::app()->createUrl('//admin/setting/design'));
|
||||
}
|
||||
} else {
|
||||
@ -439,6 +461,9 @@ class SettingController extends Controller {
|
||||
$form->useXSendfile = HSetting::Set('useXSendfile', $form->useXSendfile, 'file');
|
||||
$form->forbiddenExtensions = HSetting::Set('forbiddenExtensions', strtolower($form->forbiddenExtensions), 'file');
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved and flushed cache'));
|
||||
|
||||
$this->redirect(Yii::app()->createUrl('//admin/setting/file'));
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,9 @@ $form = $this->beginWidget('CActiveForm', array(
|
||||
|
||||
<?php echo CHtml::submitButton(Yii::t('AdminModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
|
||||
|
||||
|
@ -82,6 +82,9 @@ $form = $this->beginWidget('CActiveForm', array(
|
||||
|
||||
<?php echo CHtml::submitButton(Yii::t('AdminModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
|
||||
|
||||
|
@ -19,6 +19,9 @@
|
||||
<hr>
|
||||
<?php echo CHtml::submitButton(Yii::t('AdminModule.base', 'Save & Flush Caches'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
|
||||
|
||||
|
@ -24,6 +24,9 @@
|
||||
<hr>
|
||||
<?php echo CHtml::submitButton(Yii::t('AdminModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
|
||||
|
||||
@ -31,3 +34,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -38,6 +38,9 @@ $form = $this->beginWidget('CActiveForm', array(
|
||||
|
||||
<?php echo CHtml::submitButton(Yii::t('AdminModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
|
||||
|
||||
|
@ -41,6 +41,9 @@ $this->widget('application.modules_core.space.widgets.SpacePickerWidget', array(
|
||||
|
||||
<?php echo CHtml::submitButton(Yii::t('AdminModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
|
||||
|
||||
|
@ -54,6 +54,9 @@
|
||||
<hr>
|
||||
<?php echo CHtml::submitButton(Yii::t('AdminModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
|
||||
|
||||
|
@ -14,6 +14,9 @@
|
||||
|
||||
<?php echo CHtml::submitButton(Yii::t('AdminModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
|
||||
|
||||
|
@ -89,6 +89,10 @@ class AdminController extends Controller {
|
||||
|
||||
if ($model->validate()) {
|
||||
$model->save();
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
|
||||
$this->redirect($this->createUrl('admin/edit', array('sguid' => $this->getSpace()->guid)));
|
||||
}
|
||||
}
|
||||
@ -143,6 +147,7 @@ class AdminController extends Controller {
|
||||
if ($newOwnerId != $owner->id) {
|
||||
if ($workspace->isMember($newOwnerId)) {
|
||||
$workspace->setOwner($newOwnerId);
|
||||
|
||||
// Redirect to current workspace
|
||||
$this->redirect($this->createUrl('admin/members', array('sguid' => $this->getSpace()->guid)));
|
||||
}
|
||||
@ -150,6 +155,10 @@ class AdminController extends Controller {
|
||||
}
|
||||
}
|
||||
} // Loop over Users
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
|
||||
} // Updated Users
|
||||
|
||||
|
||||
|
@ -57,6 +57,10 @@
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo CHtml::submitButton(Yii::t('SpaceModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<div class="pull-right">
|
||||
<?php if ($space->status == Space::STATUS_ENABLED) { ?>
|
||||
<a href="<?php echo $this->createUrl('//space/admin/archive', array('sguid' => $space->guid)); ?>"
|
||||
|
@ -208,6 +208,10 @@
|
||||
</div>
|
||||
<hr>
|
||||
<?php echo CHtml::submitButton("Save", array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php echo Chtml::endForm(); ?>
|
||||
|
||||
</div>
|
||||
|
@ -69,6 +69,9 @@ class AccountController extends Controller {
|
||||
// Reload User in Session
|
||||
Yii::app()->user->reload();
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
|
||||
$this->refresh();
|
||||
|
||||
// form inputs are valid, do something here
|
||||
@ -138,6 +141,9 @@ class AccountController extends Controller {
|
||||
if ($form->submitted('save') && $form->validate()) {
|
||||
$this->forcePostRequest();
|
||||
$profile->save();
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
}
|
||||
|
||||
$this->render('edit', array('form' => $form));
|
||||
@ -220,6 +226,9 @@ class AccountController extends Controller {
|
||||
// Reload User in Session
|
||||
Yii::app()->user->reload();
|
||||
|
||||
// set flash message
|
||||
Yii::app()->user->setFlash('data-saved', Yii::t('base', 'Saved'));
|
||||
|
||||
$this->render('emailing', array('model' => $model));
|
||||
|
||||
// form inputs are valid, do something here
|
||||
|
@ -27,7 +27,6 @@
|
||||
<hr>
|
||||
<?php echo CHtml::submitButton(Yii::t('UserModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
</div>
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
<div class="panel-heading">
|
||||
<?php echo Yii::t('base', 'User details new'); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php echo $form; ?>
|
||||
|
@ -26,6 +26,9 @@
|
||||
|
||||
<?php echo CHtml::submitButton(Yii::t('UserModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
</div>
|
||||
|
||||
|
@ -51,6 +51,9 @@
|
||||
|
||||
<?php echo CHtml::submitButton(Yii::t('UserModule.base', 'Save'), array('class' => 'btn btn-primary')); ?>
|
||||
|
||||
<!-- show flash message after saving -->
|
||||
<?php $this->widget('application.widgets.DataSavedWidget'); ?>
|
||||
|
||||
<?php $this->endWidget(); ?>
|
||||
</div>
|
||||
|
||||
|
38
protected/widgets/DataSavedWidget.php
Normal file
38
protected/widgets/DataSavedWidget.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* HumHub
|
||||
* Copyright © 2014 The HumHub Project
|
||||
*
|
||||
* The texts of the GNU Affero General Public License with an additional
|
||||
* permission and of our proprietary license can be found at and
|
||||
* in the LICENSE file you have received along with this program.
|
||||
*
|
||||
* According to our dual licensing model, this program can be used either
|
||||
* under the terms of the GNU Affero General Public License, version 3,
|
||||
* or under a proprietary license.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DataSavedWidget shows an flash message after saving
|
||||
*
|
||||
* @package humhub.widgets
|
||||
* @since 0.5
|
||||
* @author Andreas Strobel
|
||||
*/
|
||||
|
||||
class DataSavedWidget extends HWidget {
|
||||
|
||||
/**
|
||||
* Displays / Run the Widget
|
||||
*/
|
||||
public function run() {
|
||||
$this->render('dataSaved', array());
|
||||
}
|
||||
|
||||
}
|
22
protected/widgets/views/dataSaved.php
Normal file
22
protected/widgets/views/dataSaved.php
Normal file
@ -0,0 +1,22 @@
|
||||
<!-- check if flash message exists -->
|
||||
<?php if(Yii::app()->user->hasFlash('data-saved')): ?>
|
||||
|
||||
<!-- <span> element to display the message -->
|
||||
<span class="data-saved"><i class="icon-ok-sign"></i> <?php echo Yii::app()->user->getFlash('data-saved'); ?></span>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
/* animate the flash message */
|
||||
$('.data-saved').hide();
|
||||
$('.data-saved').fadeIn('slow', function() {
|
||||
$('.data-saved').delay(1000).fadeOut('slow');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -754,6 +754,10 @@ ul.tag_input.focus {
|
||||
#contentFormError {
|
||||
color: #ff8989;
|
||||
}
|
||||
.data-saved {
|
||||
padding-left: 10px;
|
||||
color: #4cd9c0;
|
||||
}
|
||||
.errorMessage {
|
||||
color: #ff8989;
|
||||
}
|
||||
|
@ -1010,6 +1010,12 @@ ul.tag_input.focus {
|
||||
color: @colorDanger1;
|
||||
}
|
||||
|
||||
// Flash message after saving
|
||||
.data-saved {
|
||||
padding-left: 10px;
|
||||
color: @colorInfo2;
|
||||
}
|
||||
|
||||
//
|
||||
// 7) Yii Components
|
||||
// --------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user