Commit 8e723589 authored by Henning Leutz's avatar Henning Leutz 🥋

feat: #821

parent bd29f17d
......@@ -53,6 +53,19 @@
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item">
{locale group="quiqqer/quiqqer" var="user.settings.showNamesInSitemap"}
</span>
<span class="field-container-field">
<input type="checkbox" name="quiqqer.sitemap.showNames"/>
{locale group="quiqqer/quiqqer" var="user.settings.showNamesInSitemap.description"}
</span>
</label>
</td>
</tr>
</tbody>
</table>
......
......@@ -81,7 +81,9 @@ define('controls/projects/project/Sitemap', [
this.setAttribute('multiple', this.getAttribute('multible'));
}
this.$Elm = null;
this.$Elm = null;
this.$showNames = false;
this.$Map = new QUISitemap({
multiple: this.getAttribute('multiple')
});
......@@ -167,62 +169,59 @@ define('controls/projects/project/Sitemap', [
var self = this;
self.$loadUsersSettings().then(function () {
// if an specific id must be open
if (typeof self.$openids !== 'undefined' && self.$Map.firstChild()) {
var First = this.$Map.firstChild();
// if an specific id must be open
if (typeof this.$openids !== 'undefined' && this.$Map.firstChild()) {
var First = this.$Map.firstChild();
if (First.isOpen()) {
self.fireEvent('openEnd', [First, self]);
return;
}
if (First.isOpen()) {
this.fireEvent('openEnd', [First, this]);
First.open();
return;
}
First.open();
return;
}
self.$Map.clearChildren();
this.$Map.clearChildren();
if (this.getAttribute('id') === false) {
this.$getFirstChild(function (result) {
self.$Map.clearChildren();
if (self.getAttribute('id') === false) {
self.$getFirstChild(function (result) {
self.$Map.clearChildren();
self.$addSitemapItem(
self.$Map,
self.$parseArrayToSitemapitem(result)
);
self.$Map.firstChild().open();
self.$addSitemapItem(
self.$Map,
self.$parseArrayToSitemapitem(result)
);
// media
if (self.getAttribute('media')) {
self.$Map.appendChild(
new QUISitemapItem({
text : Locale.get('quiqqer/system', 'projects.project.sitemap.media'),
value : 'media',
icon : 'fa fa-picture-o',
dragable: true,
events : {
onClick: function () {
require(['controls/projects/project/Panel'], function (Panel) {
new Panel().openMediaPanel(
self.getAttribute('project')
);
});
self.$Map.firstChild().open();
// media
if (self.getAttribute('media')) {
self.$Map.appendChild(
new QUISitemapItem({
text : Locale.get('quiqqer/system', 'projects.project.sitemap.media'),
value : 'media',
icon : 'fa fa-picture-o',
dragable: true,
events : {
onClick: function () {
require(['controls/projects/project/Panel'], function (Panel) {
new Panel().openMediaPanel(
self.getAttribute('project')
);
});
}
}
}
})
);
}
});
})
);
}
});
return;
}
return;
}
this.$getSite(
this.getAttribute('id'),
function (result) {
self.$getSite(self.getAttribute('id')).then(function (result) {
self.$Map.clearChildren();
self.$addSitemapItem(
......@@ -231,8 +230,8 @@ define('controls/projects/project/Sitemap', [
);
self.$Map.firstChild().open();
}
);
});
});
},
/**
......@@ -256,7 +255,6 @@ define('controls/projects/project/Sitemap', [
// if not exist, search the path
Ajax.get('ajax_site_path', function (result, Request) {
if (!result) {
return;
}
......@@ -315,7 +313,6 @@ define('controls/projects/project/Sitemap', [
self.addEvent('onOpenEnd', open_event);
self.open();
}, {
project: this.$Project.encode(),
id : id
......@@ -377,19 +374,25 @@ define('controls/projects/project/Sitemap', [
*
* @method controls/projects/project/Sitemap#$getSite
* @param {integer} id - Seiten ID
* @param {Function} callback - call back function, if ajax is finish
* @param {Function} [callback] - call back function, if ajax is finish
*
* @private
* @ignore
*/
$getSite: function (id, callback) {
Ajax.get('ajax_site_get', function (result) {
if (typeof callback !== 'undefined') {
callback(result);
}
}, {
project: this.$Project.encode(),
id : id
var self = this;
return new Promise(function (resolve) {
Ajax.get('ajax_site_get', function (result) {
if (typeof callback !== 'undefined') {
callback(result);
}
resolve(result);
}, {
project: self.$Project.encode(),
id : id
});
});
},
......@@ -518,7 +521,7 @@ define('controls/projects/project/Sitemap', [
*
* @method controls/projects/project/Sitemap#$parseArrayToSitemapitem
* @param {Array} result
* @param {Object} Itm - qui/controls/sitemap/Item
* @param {Object} [Itm] - qui/controls/sitemap/Item
* @return {Object} qui/controls/sitemap/Item
*
* @param {{name:string}} result
......@@ -555,8 +558,8 @@ define('controls/projects/project/Sitemap', [
}
if ("title" in result) {
attributes.text = result.title;
attributes.title = result.title;
attributes.text = this.$showNames ? result.name : result.title;
attributes.title = this.$showNames ? result.name : result.title;
}
attributes.icon = 'fa fa-file-o';
......@@ -1149,6 +1152,33 @@ define('controls/projects/project/Sitemap', [
this.$Project.get(Parent.getAttribute('value')).load();
}.bind(this));
},
/**
* Load the user settings
* eq: quiqqer.sitemap.showNames
*
* @return {Promise}
*/
$loadUsersSettings: function () {
var self = this;
return new Promise(function (resolve) {
require(['Users'], function (Users) {
var CurrentUser = Users.getUserBySession();
if (CurrentUser.isLoaded()) {
self.$showNames = CurrentUser.getAttribute('quiqqer.sitemap.showNames');
resolve();
return;
}
CurrentUser.load().then(function () {
self.$showNames = CurrentUser.getAttribute('quiqqer.sitemap.showNames');
resolve();
});
});
});
}
});
});
{
"name": "quiqqer\/quiqqer",
"type": "quiqqer-system",
"description": "A modular based management system written in JavaScript and PHP",
"version": "dev-dev",
"license": "GPL-3.0+",
"authors": [
{
"name": "Henning Leutz",
"email": "leutz@pcsg.de",
"homepage": "http:\/\/www.pcsg.de",
"role": "Developer"
},
{
"name": "Moritz Scholz",
"email": "scholz@pcsg.de",
"homepage": "http:\/\/www.pcsg.de",
"role": "Developer"
}
],
"support": {
"email": "support@pcsg.de",
"url": "http:\/\/www.quiqqer.com"
},
"repositories": [
{
"type": "composer",
"url": "https:\/\/update.quiqqer.com"
}
],
"require": {
"php": ">=5.3",
"composer\/composer": "1.5.*",
"tedivm\/stash": "0.14.*",
"robloach\/component-installer": "0.0.12",
"phpmailer\/phpmailer": "~6.0",
"symfony\/http-foundation": ">=2.3|3.*|4.2.*",
"symfony\/console": "~2.7",
"html2text\/html2text": "1.0.1",
"intervention\/image": "2.*",
"t7systems\/blowfish": "1.0.0",
"pcsg\/composer-assets": "^1.0.1",
"dusank\/knapsack": "8.*",
"league\/climate": "3.*",
"ramsey\/uuid": "3.*",
"quiqqer\/composer": ">=1.3|dev-master|dev-dev",
"quiqqer\/controls": "1.*|dev-master|dev-dev",
"quiqqer\/dashboard": "1.*|dev-master|dev-dev",
"quiqqer\/qui": ">=1|dev-master|dev-dev",
"quiqqer\/qui-php": ">=0.12|dev-master|dev-dev",
"quiqqer\/smarty3": "1.*|dev-master|dev-dev",
"quiqqer\/ckeditor4": "2.*|1.*|dev-master|dev-dev",
"quiqqer\/calendar-controls": "1.*|dev-master|dev-dev",
"quiqqer\/countries": "1.*|dev-master|dev-dev",
"quiqqer\/colorpicker": ">=1.1|dev-master|dev-dev",
"quiqqer\/translator": "1.*|dev-master|dev-dev",
"quiqqer\/utils": ">=1.9|dev-master|dev-dev",
"quiqqer\/cron": "1.*|dev-master|dev-dev",
"quiqqer\/log": "1.*|dev-master|dev-dev",
"quiqqer\/diashow": ">=0.9|dev-master|dev-dev",
"quiqqer\/lockclient": "1.*|dev-master|dev-dev",
"quiqqer\/messages": "1.*|dev-master|dev-dev",
"quiqqer\/meta": "1.*|dev-master|dev-dev",
"quiqqer\/fontawesome": "*",
"quiqqer\/backendsearch": "1.*|dev-master|dev-dev",
"quiqqer\/requirements": "2.*",
"quiqqer\/demodata": "^1.0|dev-master|dev-dev",
"npm-asset\/intl": "1.*",
"npm-asset\/nouislider": "*",
"npm-asset\/mustache": "2.*",
"npm-asset\/urijs": "1.*"
},
"require-dev": {
"mikey179\/vfsStream": "1.*",
"phpstan\/phpstan": ">=0.5"
},
"scripts": {
"post-install-cmd": [
"QUI\\Update::onInstall"
],
"post-update-cmd": [
"QUI\\Update::onUpdate"
]
},
"autoload": {
"psr-0": {
"QUI": "lib\/"
}
},
"autoload-dev": {
"psr-4": {
"QUI\\Tests\\": "tests\/QUI\/"
}
}
}
{"name":"quiqqer\/quiqqer","type":"quiqqer-system","description":"A modular based management system written in JavaScript and PHP","version":"dev-821","license":"GPL-3.0+","authors":[{"name":"Henning Leutz","email":"leutz@pcsg.de","homepage":"http:\/\/www.pcsg.de","role":"Developer"},{"name":"Moritz Scholz","email":"scholz@pcsg.de","homepage":"http:\/\/www.pcsg.de","role":"Developer"}],"support":{"email":"support@pcsg.de","url":"http:\/\/www.quiqqer.com"},"repositories":[{"type":"composer","url":"https:\/\/update.quiqqer.com"}],"require":{"php":">=5.3","composer\/composer":"1.5.*","tedivm\/stash":"0.14.*","robloach\/component-installer":"0.0.12","phpmailer\/phpmailer":"~6.0","symfony\/http-foundation":">=2.3|3.*|4.2.*","symfony\/console":"~2.7","html2text\/html2text":"1.0.1","intervention\/image":"2.*","t7systems\/blowfish":"1.0.0","pcsg\/composer-assets":"^1.0.1","dusank\/knapsack":"8.*","league\/climate":"3.*","ramsey\/uuid":"3.*","quiqqer\/composer":">=1.3|dev-master|dev-dev","quiqqer\/controls":"1.*|dev-master|dev-dev","quiqqer\/dashboard":"1.*|dev-master|dev-dev","quiqqer\/qui":">=1|dev-master|dev-dev","quiqqer\/qui-php":">=0.12|dev-master|dev-dev","quiqqer\/smarty3":"1.*|dev-master|dev-dev","quiqqer\/ckeditor4":"2.*|1.*|dev-master|dev-dev","quiqqer\/calendar-controls":"1.*|dev-master|dev-dev","quiqqer\/countries":"1.*|dev-master|dev-dev","quiqqer\/colorpicker":">=1.1|dev-master|dev-dev","quiqqer\/translator":"1.*|dev-master|dev-dev","quiqqer\/utils":">=1.9|dev-master|dev-dev","quiqqer\/cron":"1.*|dev-master|dev-dev","quiqqer\/log":"1.*|dev-master|dev-dev","quiqqer\/diashow":">=0.9|dev-master|dev-dev","quiqqer\/lockclient":"1.*|dev-master|dev-dev","quiqqer\/messages":"1.*|dev-master|dev-dev","quiqqer\/meta":"1.*|dev-master|dev-dev","quiqqer\/fontawesome":"*","quiqqer\/backendsearch":"1.*|dev-master|dev-dev","quiqqer\/requirements":"2.*","quiqqer\/demodata":"^1.0|dev-master|dev-dev","npm-asset\/intl":"1.*","npm-asset\/nouislider":"*","npm-asset\/mustache":"2.*","npm-asset\/urijs":"1.*"},"require-dev":{"mikey179\/vfsStream":"1.*","phpstan\/phpstan":">=0.5"},"scripts":{"post-install-cmd":["QUI\\Update::onInstall"],"post-update-cmd":["QUI\\Update::onUpdate"]},"autoload":{"psr-0":{"QUI":"lib\/"}},"autoload-dev":{"psr-4":{"QUI\\Tests\\":"tests\/QUI\/"}}}
\ No newline at end of file
......@@ -1211,6 +1211,15 @@
<locale name="exception.crud.child.not.found">
<de><![CDATA[Der Eintrag konnte nicht gefunden werden.]]></de>
</locale>
<locale name="user.settings.showNamesInSitemap">
<de><![CDATA[Seitennamen in der Sitemap anzeigen]]></de>
</locale>
<locale name="user.settings.showNamesInSitemap.description">
<de><![CDATA[
Standardmäßig wird der Titel der einzelnen Seite in der Projekt Sitemap angezeigt.
Möchtest du jedoch den Namen in der Sitemap angezeigt bekommen, kannst du dies hier ändern.
]]></de>
</locale>
</groups>
<groups name="quiqqer/quiqqer" datatype="js">
<locale name="controls.email.select.email_invalid">
......
......@@ -1202,6 +1202,15 @@
<locale name="exception.crud.child.not.found">
<en><![CDATA[The entry could not be found.]]></en>
</locale>
<locale name="user.settings.showNamesInSitemap">
<en><![CDATA[Show site names in the sitemap]]></en>
</locale>
<locale name="user.settings.showNamesInSitemap.description">
<en><![CDATA[
By default, the title of each site is displayed in the project sitemap.
However, if you want the name to be displayed in the sitemap, you can change it here.
]]></en>
</locale>
</groups>
<groups name="quiqqer/quiqqer" datatype="js"> <!-- Control: controls/email/Select -->
<locale name="controls.email.select.email_invalid">
......
......@@ -3,6 +3,7 @@
<attributes>
<attribute>quiqqer.set.new.password</attribute>
<attribute>quiqqer.sitemap.showNames</attribute>
<attribute>qui-bookmarks</attribute>
</attributes>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment