mirror of
https://github.com/humhub/humhub.git
synced 2025-01-29 20:38:26 +01:00
Merge branch 'v1.1-dev' of github.com:humhub/humhub into v1.1-dev
Conflicts: protected/humhub/modules/admin/controllers/SettingController.php
This commit is contained in:
commit
8d5f63ef19
@ -5,11 +5,11 @@
|
||||
* @copyright Copyright (c) 2015 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace humhub\components;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\Url;
|
||||
use humhub\models\Setting;
|
||||
|
||||
/**
|
||||
* Description of Controller
|
||||
@ -21,10 +21,9 @@ class Controller extends \yii\web\Controller
|
||||
|
||||
public $subLayout;
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
}
|
||||
public $pageTitle;
|
||||
|
||||
public $actionTitlesMap = [];
|
||||
|
||||
public function renderAjaxContent($content)
|
||||
{
|
||||
@ -45,7 +44,9 @@ class Controller extends \yii\web\Controller
|
||||
*/
|
||||
public function htmlRedirect($url = "")
|
||||
{
|
||||
return $this->renderPartial('@humhub/views/htmlRedirect.php', array('url' => Url::to($url)));
|
||||
return $this->renderPartial('@humhub/views/htmlRedirect.php', array(
|
||||
'url' => Url::to($url)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,4 +57,63 @@ class Controller extends \yii\web\Controller
|
||||
return $this->renderPartial('@humhub/views/modalClose.php', array());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \yii\web\Controller::beforeAction()
|
||||
*/
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (parent::beforeAction($action)) {
|
||||
if (array_key_exists($this->action->id, $this->actionTitlesMap)) {
|
||||
$this->appendPageTitle($this->actionTitlesMap[$this->action->id]);
|
||||
}
|
||||
if (! empty($this->pageTitle)) {
|
||||
$this->getView()->pageTitle = $this->pageTitle;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a page title.
|
||||
*
|
||||
* @param string $title
|
||||
*/
|
||||
public function appendPageTitle($title)
|
||||
{
|
||||
$this->pageTitle .= empty($this->pageTitle) ? $title : ' - ' . $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepend a page title.
|
||||
*
|
||||
* @param string $title
|
||||
*/
|
||||
public function prependPageTitle($title)
|
||||
{
|
||||
$this->pageTitle = empty($this->pageTitle) ? $title : $title . ' - ' . $this->pageTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the page title.
|
||||
*
|
||||
* @param string $title
|
||||
*/
|
||||
public function setPageTitle($title)
|
||||
{
|
||||
$this->pageTitle = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a map that indicates what page title should be shown for the currently active action.
|
||||
* It will be appended to
|
||||
*
|
||||
* @param array $map
|
||||
* [action_id => action_page_title]
|
||||
*/
|
||||
public function setActionTitles($map = [])
|
||||
{
|
||||
$this->actionTitlesMap = is_array($map) ? $map : [];
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,11 @@ class Controller extends \humhub\components\Controller
|
||||
|
||||
public $subLayout = "@humhub/modules/admin/views/layouts/main";
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(\Yii::t('AdminModule.base', 'Administration'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
@ -29,5 +34,4 @@ class Controller extends \humhub\components\Controller
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,11 @@ use humhub\modules\admin\libs\HumHubAPI;
|
||||
class AboutController extends Controller
|
||||
{
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(Yii::t('AdminModule.base', 'About'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$isNewVersionAvailable = false;
|
||||
|
@ -24,6 +24,11 @@ use humhub\modules\admin\models\forms\ApproveUserForm;
|
||||
class ApprovalController extends Controller
|
||||
{
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(Yii::t('AdminModule.base', 'Approval'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -23,6 +23,11 @@ use humhub\modules\user\models\User;
|
||||
class GroupController extends Controller
|
||||
{
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(Yii::t('AdminModule.base', 'Groups'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* List all available user groups
|
||||
*/
|
||||
|
@ -20,6 +20,11 @@ use humhub\modules\admin\components\Controller;
|
||||
class LoggingController extends Controller
|
||||
{
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(Yii::t('AdminModule.base', 'Logging'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$pageSize = 10;
|
||||
|
@ -26,6 +26,11 @@ class ModuleController extends Controller
|
||||
|
||||
private $_onlineModuleManager = null;
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(Yii::t('AdminModule.base', 'Modules'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
Yii::$app->moduleManager->flushCache();
|
||||
|
@ -24,6 +24,31 @@ use humhub\modules\user\libs\Ldap;
|
||||
class SettingController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->setActionTitles([
|
||||
'basic' => Yii::t('AdminModule.base', 'Basic'),
|
||||
'authentication' => Yii::t('AdminModule.base', 'Authentication'),
|
||||
'authentication-ldap' => Yii::t('AdminModule.base', 'Authentication'),
|
||||
'caching' => Yii::t('AdminModule.base', 'Caching'),
|
||||
'statistic' => Yii::t('AdminModule.base', 'Statistics'),
|
||||
'mailing' => Yii::t('AdminModule.base', 'Mailing'),
|
||||
'mailing-server' => Yii::t('AdminModule.base', 'Mailing'),
|
||||
'design' => Yii::t('AdminModule.base', 'Design'),
|
||||
'security' => Yii::t('AdminModule.base', 'Security'),
|
||||
'file' => Yii::t('AdminModule.base', 'Files'),
|
||||
'cronjobs' => Yii::t('AdminModule.base', 'Cronjobs'),
|
||||
'proxy' => Yii::t('AdminModule.base', 'Proxy'),
|
||||
'oembed' => Yii::t('AdminModule.base', 'OEmbed providers'),
|
||||
'oembed-edit' => Yii::t('AdminModule.base', 'OEmbed providers'),
|
||||
'self-test' => Yii::t('AdminModule.base', 'Self test'),
|
||||
]);
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
Yii::$app->response->redirect(Url::toRoute('basic'));
|
||||
|
@ -23,6 +23,11 @@ use humhub\modules\space\models\Space;
|
||||
class SpaceController extends Controller
|
||||
{
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(Yii::t('AdminModule.base', 'Spaces'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows all available spaces
|
||||
*/
|
||||
|
@ -24,6 +24,11 @@ use humhub\modules\user\models\Group;
|
||||
class UserController extends Controller
|
||||
{
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(Yii::t('AdminModule.base', 'Users'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List of Users
|
||||
*/
|
||||
|
@ -24,6 +24,11 @@ use humhub\modules\user\models\fieldtype\BaseType;
|
||||
class UserProfileController extends Controller
|
||||
{
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(Yii::t('AdminModule.base', 'Userprofiles'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows overview of all
|
||||
*
|
||||
|
@ -5,16 +5,21 @@
|
||||
* @copyright Copyright (c) 2015 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace humhub\modules\dashboard\controllers;
|
||||
|
||||
use Yii;
|
||||
use yii\web\Controller;
|
||||
use humhub\components\Controller;
|
||||
use humhub\models\Setting;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->prependPageTitle(\Yii::t('DashboardModule.base', 'Dashboard'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@ -23,7 +28,10 @@ class DashboardController extends Controller
|
||||
return [
|
||||
'acl' => [
|
||||
'class' => \humhub\components\behaviors\AccessControl::className(),
|
||||
'guestAllowedActions' => ['index', 'stream']
|
||||
'guestAllowedActions' => [
|
||||
'index',
|
||||
'stream'
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
@ -35,8 +43,8 @@ class DashboardController extends Controller
|
||||
{
|
||||
return [
|
||||
'stream' => [
|
||||
'class' => \humhub\modules\dashboard\components\actions\DashboardStream::className(),
|
||||
],
|
||||
'class' => \humhub\modules\dashboard\components\actions\DashboardStream::className()
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
@ -50,18 +58,18 @@ class DashboardController extends Controller
|
||||
if (Yii::$app->user->isGuest) {
|
||||
return $this->render('index_guest', array());
|
||||
} else {
|
||||
return $this->render('index', array('showProfilePostForm' => Setting::Get('showProfilePostForm', 'dashboard')));
|
||||
return $this->render('index', array(
|
||||
'showProfilePostForm' => Setting::Get('showProfilePostForm', 'dashboard')
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update user settings for hiding share panel on dashboard
|
||||
*/
|
||||
* Update user settings for hiding share panel on dashboard
|
||||
*/
|
||||
public function actionHidePanel()
|
||||
{
|
||||
// set tour status to seen for current user
|
||||
return Yii::$app->user->getIdentity()->setSetting('hideSharePanel', 1, "share");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,3 @@
|
||||
<?php
|
||||
$this->pageTitle = Yii::t('DashboardModule.views_dashboard_index', 'Dashboard');
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8 layout-content-container">
|
||||
|
@ -16,6 +16,11 @@ namespace humhub\modules\directory\components;
|
||||
class Controller extends \humhub\components\Controller
|
||||
{
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(\Yii::t('DirectoryModule.base', 'Directory'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -25,6 +25,16 @@ use yii\web\HttpException;
|
||||
class DirectoryController extends \humhub\modules\directory\components\Controller
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setActionTitles([
|
||||
'members' => Yii::t('DirectoryModule.base', 'Members'),
|
||||
'spaces' => Yii::t('AdminModule.base', 'Spaces'),
|
||||
'user-posts' => Yii::t('AdminModule.base', 'User posts'),
|
||||
]);
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -29,6 +29,12 @@ class SearchController extends Controller
|
||||
const SCOPE_SPACE = "space";
|
||||
const SCOPE_CONTENT = "content";
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->prependPageTitle(\Yii::t('SearchModule.base', 'Search'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -17,7 +17,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*/
|
||||
|
||||
namespace humhub\modules\space\behaviors;
|
||||
|
||||
use Yii;
|
||||
@ -26,6 +25,7 @@ use yii\db\ActiveRecord;
|
||||
use humhub\modules\user\models\Follow;
|
||||
use humhub\modules\space\models\Space;
|
||||
use yii\web\HttpException;
|
||||
use humhub\components\Controller;
|
||||
|
||||
/**
|
||||
* SpaceControllerBehavior is a controller behavior used for space modules/controllers.
|
||||
@ -39,6 +39,13 @@ class SpaceController extends Behavior
|
||||
|
||||
public $space = null;
|
||||
|
||||
public function events()
|
||||
{
|
||||
return [
|
||||
Controller::EVENT_BEFORE_ACTION => 'beforeAction'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current selected space by parameter guid
|
||||
*
|
||||
@ -50,38 +57,38 @@ class SpaceController extends Behavior
|
||||
*/
|
||||
public function getSpace()
|
||||
{
|
||||
|
||||
if ($this->space != null) {
|
||||
return $this->space;
|
||||
}
|
||||
|
||||
|
||||
// Get Space GUID by parameter
|
||||
$guid = Yii::$app->request->get('sguid');
|
||||
|
||||
|
||||
// Try Load the space
|
||||
$this->space = Space::findOne(['guid' => $guid]);
|
||||
$this->space = Space::findOne([
|
||||
'guid' => $guid
|
||||
]);
|
||||
if ($this->space == null)
|
||||
throw new HttpException(404, Yii::t('SpaceModule.behaviors_SpaceControllerBehavior', 'Space not found!'));
|
||||
|
||||
|
||||
$this->checkAccess();
|
||||
return $this->space;
|
||||
}
|
||||
|
||||
public function checkAccess()
|
||||
{
|
||||
|
||||
if (\humhub\models\Setting::Get('allowGuestAccess', 'authentication_internal') && Yii::$app->user->isGuest && $this->space->visibility != Space::VISIBILITY_ALL) {
|
||||
throw new HttpException(401, Yii::t('SpaceModule.behaviors_SpaceControllerBehavior', 'You need to login to view contents of this space!'));
|
||||
}
|
||||
|
||||
|
||||
// Save users last action on this space
|
||||
$membership = $this->space->getMembership(Yii::$app->user->id);
|
||||
if ($membership != null) {
|
||||
$membership->updateLastVisit();
|
||||
} else {
|
||||
|
||||
|
||||
// Super Admin can always enter
|
||||
if (!Yii::$app->user->isAdmin()) {
|
||||
if (! Yii::$app->user->isAdmin()) {
|
||||
// Space invisible?
|
||||
if ($this->space->visibility == Space::VISIBILITY_NONE) {
|
||||
// Not Space Member
|
||||
@ -91,6 +98,10 @@ class SpaceController extends Behavior
|
||||
}
|
||||
}
|
||||
|
||||
public function beforeAction($action)
|
||||
{
|
||||
$this->owner->prependPageTitle($this->space->name);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -24,6 +24,7 @@ use Yii;
|
||||
use yii\base\Behavior;
|
||||
use yii\web\HttpException;
|
||||
use humhub\modules\user\models\User;
|
||||
use humhub\components\Controller;
|
||||
|
||||
/**
|
||||
* This Behavior needs to be attached to all controllers which are provides
|
||||
@ -38,6 +39,13 @@ class ProfileController extends Behavior
|
||||
|
||||
public $user = null;
|
||||
|
||||
public function events() {
|
||||
|
||||
return [
|
||||
Controller::EVENT_BEFORE_ACTION => 'beforeAction',
|
||||
];
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
if ($this->user != null) {
|
||||
@ -65,6 +73,11 @@ class ProfileController extends Behavior
|
||||
}
|
||||
}
|
||||
|
||||
public function beforeAction($action) {
|
||||
|
||||
$this->owner->prependPageTitle($this->user->displayName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -22,6 +22,11 @@ class BaseAccountController extends \humhub\components\Controller
|
||||
|
||||
public $subLayout = "@humhub/modules/user/views/account/_layout";
|
||||
|
||||
public function init() {
|
||||
$this->prependPageTitle(\Yii::t('UserModule.base', 'My Account'));
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -24,6 +24,23 @@ use humhub\modules\user\models\User;
|
||||
class AccountController extends BaseAccountController
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setActionTitles([
|
||||
'edit' => Yii::t('UserModule.base', 'Profile'),
|
||||
'edit-settings' => Yii::t('UserModule.base', 'Settings'),
|
||||
'security' => Yii::t('UserModule.base', 'Security'),
|
||||
'connected-accounts' => Yii::t('UserModule.base', 'Connected accounts'),
|
||||
'edit-modules' => Yii::t('UserModule.base', 'Modules'),
|
||||
'delete' => Yii::t('UserModule.base', 'Delete'),
|
||||
'emailing' => Yii::t('UserModule.base', 'Notifications'),
|
||||
'change-email' => Yii::t('UserModule.base', 'Email'),
|
||||
'change-email-validate' => Yii::t('UserModule.base', 'Email'),
|
||||
'change-password' => Yii::t('UserModule.base', 'Password'),
|
||||
]);
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit Users Profile
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user