Commit a2ff90e4 authored by Henning Leutz's avatar Henning Leutz 🥋

Merge branch 'dev'

parents 7587556b 64723ac1
......@@ -25,7 +25,8 @@ QUI::$Ajax->registerFunction(
'attributes' => $attributes,
'has_children' => $Site->hasChildren(true),
'parentid' => $Site->getParentId(),
'url' => $Site->getUrlRewritten()
'url' => $Site->getUrlRewritten(),
'hostUrl' => $Site->getUrlRewrittenWithHost()
];
},
['project', 'id'],
......
......@@ -13,27 +13,30 @@ QUI::$Ajax->registerFunction(
$Auth = QUI\Users\Auth\Handler::getInstance();
$available = $Auth->getAvailableAuthenticators();
$list = array();
$list = [];
foreach ($available as $authenticator) {
try {
$Authenticator = new $authenticator($User->getUsername());
/* @var $Authenticator \QUI\Users\AuthenticatorInterface */
$list[] = array(
$list[] = [
'title' => $Authenticator->getTitle(),
'description' => $Authenticator->getDescription(),
'authenticator' => $authenticator
);
];
} catch (\Exception $Exception) {
\QUI\System\Log::writeException($Exception);
}
}
return array(
'global' => $Auth->getGlobalAuthenticators(),
return [
'global' => [
'frontend' => $Auth->getGlobalAuthenticators(),
'backend' => $Auth->getGlobalBackendAuthenticators()
],
'available' => $list
);
];
},
false,
'Permission::checkAdminUser'
......
......@@ -5,7 +5,7 @@
*
* @param integer|string $uid
* @param string $authenticator
* @return string
*
* @throws \QUI\Users\Exception
*/
QUI::$Ajax->registerFunction(
......@@ -22,9 +22,12 @@ QUI::$Ajax->registerFunction(
}
$Config = QUI::getConfig('etc/conf.ini.php');
$Config->del('auth');
$Config->del('auth_frontend');
$Config->del('auth_backend');
foreach ($authenticators as $authenticator) {
foreach ($authenticators as $authenticator => $range) {
try {
// exist authenticator?
QUI\Users\Auth\Handler::getInstance()->getAuthenticator(
......@@ -32,7 +35,16 @@ QUI::$Ajax->registerFunction(
$User->getUsername()
);
$Config->setValue('auth', $authenticator, 1);
if (!isset($range['frontend'])) {
$range['frontend'] = 0;
}
if (!isset($range['backend'])) {
$range['backend'] = 0;
}
$Config->setValue('auth_frontend', $authenticator, $range['frontend']);
$Config->setValue('auth_backend', $authenticator, $range['backend']);
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
......
......@@ -13,7 +13,16 @@
<span class="field-container-item">
{locale group="quiqqer/system" var="projects.project.site.panel.information.title"}
</span>
<input name="title" value="" class="field-container-field"/>
<button type="button"
name="open-in-structure"
class="qui-button site-open-in-structure field-container-field"
style="width: 50px; flex:inherit;"
disabled
>
<span class="fa fa-sitemap"></span>
</button>
</label>
</td>
</tr>
......
......@@ -79,18 +79,18 @@ define('controls/projects/project/Panel', [
title: Locale.get('quiqqer/system', 'projects.project.panel.title')
});
this.$Map = null;
this.$Map = null;
this.$projectmaps = {};
this.$Filter = null;
this.$Button = null;
this.$Filter = null;
this.$Button = null;
this.$ProjectList = null;
this.$ProjectList = null;
this.$ProjectContainer = null;
this.$ProjectSearch = null;
this.$ProjectContent = null;
this.$ProjectSearch = null;
this.$ProjectContent = null;
this.$LanguageSelect = null;
this.$MediaButton = null;
this.$MediaButton = null;
this.$__fx_run = false;
......@@ -165,9 +165,9 @@ define('controls/projects/project/Panel', [
Content.setStyle('opacity', 0);
this.$ProjectContainer = Content.getElement('.project-container');
this.$ProjectList = Content.getElement('.project-list');
this.$ProjectSearch = Content.getElement('.project-search');
this.$ProjectContent = Content.getElement('.project-content');
this.$ProjectList = Content.getElement('.project-list');
this.$ProjectSearch = Content.getElement('.project-search');
this.$ProjectContent = Content.getElement('.project-content');
this.$ProjectContainer.setStyles({
height: 'calc(100% - 40px)'
......@@ -644,10 +644,11 @@ define('controls/projects/project/Panel', [
* Opens the selected Project and create a Project Sitemap in the Panel
*
* @method controls/projects/project/Panel#openProject
* @return {Promise}
*/
openProject: function () {
if (this.$__fx_run) {
return;
return Promise.resolve();
}
this.$__fx_run = true;
......@@ -682,7 +683,7 @@ define('controls/projects/project/Panel', [
onChildClick : this.$openSitePanel,
onChildContextMenu: function (Item, MapItem, event) {
var title = MapItem.getAttribute('text') + ' - ' +
MapItem.getAttribute('value');
MapItem.getAttribute('value');
MapItem.getContextMenu().setTitle(title).setPosition(
event.page.x,
......@@ -709,7 +710,7 @@ define('controls/projects/project/Panel', [
this.$LanguageSelect.disable();
this.$MediaButton.enable();
Project.getConfig(false, 'langs').then(function (langs) {
return Project.getConfig(false, 'langs').then(function (langs) {
langs = langs.split(',');
if (!langs.length) {
......@@ -727,23 +728,25 @@ define('controls/projects/project/Panel', [
self.$LanguageSelect.enable();
self.$LanguageSelect.setValue(Project.getLang());
});
});
List.setStyle('boxShadow', '0 6px 20px 0 rgba(0, 0, 0, 0.19)');
moofx(List).animate({
left : List.getSize().x * -1,
opacity: 0
}, {
equation: 'ease-out',
duration: 300,
callback: function () {
Container.setStyle('overflow', null);
List.setStyle('display', 'none');
self.$Map.open();
self.$__fx_run = false;
}
List.setStyle('boxShadow', '0 6px 20px 0 rgba(0, 0, 0, 0.19)');
}).then(function () {
return new Promise(function (resolve) {
moofx(List).animate({
left : List.getSize().x * -1,
opacity: 0
}, {
equation: 'ease-out',
duration: 300,
callback: function () {
Container.setStyle('overflow', null);
List.setStyle('display', 'none');
self.$Map.open().then(resolve);
self.$__fx_run = false;
}
});
});
});
},
......
......@@ -169,10 +169,10 @@ define('controls/projects/project/Sitemap', [
var self = this;
self.$loadUsersSettings().then(function () {
return self.$loadUsersSettings().then(function () {
// if an specific id must be open
if (typeof self.$openids !== 'undefined' && self.$Map.firstChild()) {
var First = this.$Map.firstChild();
var First = self.$Map.firstChild();
if (First.isOpen()) {
self.fireEvent('openEnd', [First, self]);
......@@ -572,7 +572,7 @@ define('controls/projects/project/Sitemap', [
if ("nav_hide" in result) {
if (result.nav_hide == '1') {
if (parseInt(result.nav_hide) === 1) {
Itm.addIcon(URL_BIN_DIR + '16x16/navigation_hidden.png');
} else {
Itm.removeIcon(URL_BIN_DIR + '16x16/navigation_hidden.png');
......@@ -580,7 +580,7 @@ define('controls/projects/project/Sitemap', [
}
if ("linked" in result) {
if (result.linked == '1') {
if (parseInt(result.linked) === 1) {
Itm.setAttribute('linked', true);
Itm.addIcon(URL_BIN_DIR + '16x16/linked.png');
} else {
......@@ -658,8 +658,6 @@ define('controls/projects/project/Sitemap', [
}
}
})
).appendChild(
new QUIContextmenuSeparator()
).appendChild(
new QUIContextmenuItem({
disabled: true,
......@@ -686,6 +684,19 @@ define('controls/projects/project/Sitemap', [
})
).appendChild(
new QUIContextmenuSeparator()
).appendChild(
new QUIContextmenuItem({
name : 'open-in-website',
text : Locale.get('quiqqer/quiqqer', 'project.sitemap.open.in.window'),
icon : 'fa fa-external-link',
events: {
onClick: function () {
self.$openSiteInWebsite(Itm);
}
}
})
).appendChild(
new QUIContextmenuSeparator()
).appendChild(
new QUIContextmenuItem({
name : 'de-activate-site',
......@@ -901,7 +912,7 @@ define('controls/projects/project/Sitemap', [
// move site
if (data.copyType === 'cut') {
if (this.getAttribute('project') != Site.getProject().getName()) {
if (this.getAttribute('project') !== Site.getProject().getName()) {
return;
}
......@@ -958,16 +969,27 @@ define('controls/projects/project/Sitemap', [
Site = Project.get(data.id);
Site.linked(NewParentItem.getAttribute('value'), function () {
if (!NewParentItem.isOpen()) {
NewParentItem.open();
} else {
self.$open(NewParentItem);
}
});
},
/**
* Opens the site in the website
*
* @param {Object} Item - qui/controls/sitemap/Item
*/
$openSiteInWebsite: function (Item) {
SiteUtils.openSite(
this.$Project.getName(),
this.$Project.getLang(),
Item.getAttribute('value')
);
},
/**
* Opens the child create confirm
*
......
......@@ -42,6 +42,13 @@
box-shadow: none;
}
.site-open-in-structure {
border: 1px solid #DEDEDE !important;
border-radius: 0 !important;
box-shadow: none !important;
outline: none;
}
.site-url-display {
clear: both;
display: inline-block;
......
......@@ -67,6 +67,8 @@ define('controls/projects/project/site/Panel', [
'openMedia',
'openSort',
'deleteLinked',
'openSiteInPopup',
'openSiteInStructure',
'$onCreate',
'$onDestroy',
......@@ -95,6 +97,7 @@ define('controls/projects/project/site/Panel', [
this.$CategoryControl = null;
this.$Container = null;
this.$ButtonOpenWebsite = null;
this.$PreviousCategory = null;
this.$editorPeriodicalSave = false; // delay for the wysiwyg editor, to save to the locale storage
......@@ -180,6 +183,47 @@ define('controls/projects/project/site/Panel', [
return this.$Site;
},
/**
* Open the site in a popup
*/
openSiteInPopup: function () {
var Site = this.getSite(),
Project = Site.getProject();
SiteUtils.openSite(
Project.getName(),
Project.getLang(),
Site.getId()
);
},
/**
* Opens the site in the project panel
*/
openSiteInStructure: function () {
var Panel;
var projectPanels = QUI.Controls.getByType('controls/projects/project/Panel');
var Site = this.getSite(),
Project = Site.getProject();
for (var i = 0, len = projectPanels.length; i < len; i++) {
Panel = projectPanels[i];
if (Panel.getAttribute('project') === Project.getName() &&
Panel.getAttribute('lang') === Project.getLang()) {
Panel.openSite(Site.getId());
continue;
}
Panel.setAttribute('project', Project.getName());
Panel.setAttribute('lang', Project.getLang());
Panel.openProject().then(function () {
Panel.openSite(Site.getId());
});
}
},
/**
* Load the site attributes to the panel
*
......@@ -188,6 +232,10 @@ define('controls/projects/project/site/Panel', [
load: function () {
this.refresh();
if (this.getSite().getAttribute('active') && this.$ButtonOpenWebsite) {
this.$ButtonOpenWebsite.show();
}
if (this.getActiveCategory()) {
return this.$onCategoryEnter(this.getActiveCategory());
}
......@@ -316,7 +364,6 @@ define('controls/projects/project/site/Panel', [
}
}).inject(this.getHeader());
var self = this,
Site = this.getSite(),
Project = Site.getProject();
......@@ -389,6 +436,23 @@ define('controls/projects/project/site/Panel', [
self.addCategory(Category);
}
self.$ButtonOpenWebsite = new QUIButton({
textimage: 'fa fa-external-link',
name : 'sort',
text : Locale.get('quiqqer/quiqqer', 'project.sitemap.open.in.window'),
title : Locale.get('quiqqer/quiqqer', 'project.sitemap.open.in.window'),
events : {
onClick: self.openSiteInPopup
}
});
self.addButton(self.$ButtonOpenWebsite);
self.$ButtonOpenWebsite.hide();
if (Site.getAttribute('active')) {
self.$ButtonOpenWebsite.show();
}
if (isLocked) {
self.setLocked();
}
......@@ -971,9 +1035,14 @@ define('controls/projects/project/site/Panel', [
var LinkinTable = Body.getElement('.site-linking'),
LinkinLangTable = Body.getElement('.site-langs'),
Locked = Body.getElement('[data-locked]'),
Title = Body.getElement('[name="title"]')
Title = Body.getElement('[name="title"]'),
OpenInStructure = Body.getElement('[name="open-in-structure"]')
;
OpenInStructure.addEvent('click', self.openSiteInStructure);
OpenInStructure.set('disabled', false);
OpenInStructure.set('title', Locale.get('quiqqer/quiqqer', 'projects.project.site.panel.information.openInSiteStructure'));
Title.addEvent('blur', function () {
if (Site.getId() === 1) {
return;
......@@ -1502,7 +1571,7 @@ define('controls/projects/project/site/Panel', [
},
/**
*
* init the name input key events
*/
$bindNameInputUrlFilter: function () {
var Site = this.getSite(),
......@@ -1706,6 +1775,8 @@ define('controls/projects/project/site/Panel', [
* event : on {classes/projects/Site} activation
*/
$onSiteActivate: function () {
this.$ButtonOpenWebsite.show();
var Status = this.getButtons('status');
if (!Status) {
......@@ -1723,6 +1794,8 @@ define('controls/projects/project/site/Panel', [
* event : on {classes/projects/Site} deactivation
*/
$onSiteDeactivate: function () {
this.$ButtonOpenWebsite.hide();
var Status = this.getButtons('status');
if (!Status) {
......
<td>
<label class="field-container hasCheckbox">
<span class="field-container-item" title="{{title}}">
</span>
<span class="field-container-field">
</span>
<span class="field-container-field" style="width: 100px; flex: initial; text-align: center">
Frontend
</span>
<span class="field-container-field" style="width: 100px; flex: initial; text-align: center">
Backend
</span>
</label>
</td>
\ No newline at end of file
<td>
<label class="field-container hasCheckbox">
<div class="field-container-item" title="{{title}}">
<span class="field-container-item" title="{{title}}">
{{title}}
</div>
<div class="field-container-field">
<input type="checkbox" name="{{authenticator}}"/>
</span>
<span class="field-container-field">
{{description}}
</div>
</span>
<span class="field-container-field" style="width: 100px; flex: initial; text-align: center">
<input type="checkbox" name="{{authenticator}}" value="frontend"/>
</span>
<span class="field-container-field" style="width: 100px; flex: initial; text-align: center">
<input type="checkbox" name="{{authenticator}}" value="backend"/>
</span>
</label>
</td>
\ No newline at end of file
/**
* @module controls/users/auth/GlobalAuthenticatorSettings
*
* @require qui/QUI
* @require qui/controls/Control
* @require Ajax
* @author www.pcsg.de (Henning Leutz)
*/
define('controls/users/auth/GlobalAuthenticatorSettings', [
......@@ -13,15 +10,16 @@ define('controls/users/auth/GlobalAuthenticatorSettings', [
'Locale',
'Mustache',
'text!controls/users/auth/GlobalAuthenticatorSettings.Row.html'
'text!controls/users/auth/GlobalAuthenticatorSettings.Row.html',
'text!controls/users/auth/GlobalAuthenticatorSettings.Header.html'
], function (QUI, QUIControl, QUIAjax, QUILocale, Mustache, templateRow) {
], function (QUI, QUIControl, QUIAjax, QUILocale, Mustache, templateRow, templateHeader) {
"use strict";
var lg = 'quiqqer/quiqqer';
return new Class({
Type: 'controls/users/auth/GlobalAuthenticatorSettings',
Type : 'controls/users/auth/GlobalAuthenticatorSettings',
Extends: QUIControl,
Binds: [
......@@ -34,8 +32,7 @@ define('controls/users/auth/GlobalAuthenticatorSettings', [
this.$rows = [];
this.addEvents({
onImport: this.$onImport,
onRefresh: this.$onRefresh
onImport: this.$onImport
});
},
......@@ -47,35 +44,58 @@ define('controls/users/auth/GlobalAuthenticatorSettings', [
QUIAjax.get('ajax_users_authenticator_globalAuthenticators', function (result) {
var available = result.available,
globals = result.global;
globals = result.global;
new Element('div', {
html: QUILocale.get(lg, 'quiqqer.settings.auth.global.desc')
}).inject(self.getElm(), 'after');
var i, r, len, rlen, NewRow;
var i, r, len, rLen, NewRow;
var Row = self.getElm().getParent('tr');
var Row = self.getElm().getParent('tr');
var rows = [];
for (i = 0, len = available.length; i < len; i++) {
NewRow = new Element('tr', {
html: Mustache.render(templateRow, {
title: available[i].title,
description: available[i].description,
title : available[i].title,
description : available[i].description,
authenticator: available[i].authenticator
})
}).inject(Row, 'after');
rows.push(NewRow);
NewRow.getElement('input').addEvent('change', self.$onChange);
NewRow.getElements('input').addEvent('change', self.$onChange);
}
for (i = 0, len = globals.length; i < len; i++) {
for (r = 0, rlen = rows.length; r < rlen; r++) {
rows[r].getElements('[name="' + globals[i].escapeRegExp() + '"]')
.set('checked', true);
new Element('tr', {
html: Mustache.render(templateHeader, {})
}).inject(Row, 'after');
var condition;
var frontend = globals.frontend;
var backend = globals.backend;
for (i = 0, len = frontend.length; i < len; i++) {
for (r = 0, rLen = rows.length; r < rLen; r++) {
condition = [];
condition.push('[name="' + frontend[i].escapeRegExp() + '"]');
condition.push('[value="frontend"]');
condition = condition.join('');
rows[r].getElements(condition).set('checked', true);
}
}
for (i = 0, len = backend.length; i < len; i++) {
for (r = 0, rLen = rows.length; r < rLen; r++) {
condition = [];
condition.push('[name="' + backend[i].escapeRegExp() + '"]');
condition.push('[value="backend"]');
condition = condition.join('');
rows[r].getElements(condition).set('checked', true);
}
}
......@@ -88,14 +108,28 @@ define('controls/users/auth/GlobalAuthenticatorSettings', [
* event: on checkbox change
*/
$onChange: function () {
var checked = this.$rows.filter(function (Row) {
return Row.getElement('input').checked;
}).map(function (Row) {
return Row.getElement('input').name;
var i, len, elm;
var inputs = this.$rows.map(function (Row) {
var nodes = Row.getElements('input');
return [nodes[0], nodes[1]];
});
if (this.getElm().nodeName == 'INPUT') {
this.getElm().value = JSON.encode(checked);
inputs = inputs.flat();
var result = {};
for (i = 0, len = inputs.length; i < len; i++) {
elm = inputs[i];
if (typeof result[elm.name] === 'undefined') {
result[elm.name] = {};
}
result[elm.name][elm.value] = elm.checked;
}
if (this.getElm().nodeName === 'INPUT') {
this.getElm().value = JSON.encode(result);
}
},
......@@ -108,7 +142,7 @@ define('controls/users/auth/GlobalAuthenticatorSettings', [
return new Promise(function (resolve, reject) {
QUIAjax.post('ajax_users_authenticator_save', resolve, {
authenticators: this.getElm().value,
onError: reject
onError : reject
});
}.bind(this));
}
......
......@@ -32,29 +32,29 @@ define('utils/Site', [
*/
notAllowedUrlSigns: function () {
return {
'.': true,
',': true,
':': true,
';': true,
'#': true,
'`': true,
'!': true,
'§': true,
'$': true,
'%': true,
'&': true,
'?': true,
'<': true,
'>': true,
'=': true,
'.' : true,
',' : true,
':' : true,
';' : true,
'#' : true,
'`' : true,
'!' : true,
'§' : true,
'$' : true,
'%' : true,