Skip to content
Code-Schnipsel Gruppen Projekte
Commit b566623f erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'dev'

Übergeordnete e10d9aef d6517ec7
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
<?php
/**
* This file contains package_quiqqer_bricks_ajax_brick_save
*/
/**
* saves the brick
*
* @param string|Integer $brickId - Brick-ID
* @param string $title - title of the new brick
* @param string $description - description of the new brick
*
* @return array
*/
QUI::$Ajax->registerFunction(
'package_quiqqer_bricks_ajax_brick_copy',
function ($brickId, $params) {
$BrickManager = QUI\Bricks\Manager::init();
$newId = $BrickManager->copyBrick(
$brickId,
json_decode($params, true)
);
return $BrickManager->getBrickById($newId)->getAttributes();
},
array('brickId', 'params'),
'Permission::checkAdminUser'
);
.dialog-bricks-copy {
margin-top: 20px;
}
.dialog-bricks-copy .data-table-flexbox {
border: none;
}
.dialog-bricks-copy .data-table-flexbox td {
padding-left: 0;
padding-right: 0;
}
.dialog-bricks-copy [name="description"] {
height: 100px;
}
\ No newline at end of file
{{text}}
<form class="dialog-bricks-copy" action="" method="POST">
<table class="data-table data-table-flexbox">
<tbody>
<tr>
<td>
<label class="field-container">
<span class="field-container-item">Sprache</span>
<span class="dialog-bricks-copy-languages field-container-field field-container-field-no-padding"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item">Titel</span>
<input name="title" class="field-container-field"/>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
<span class="field-container-item">Beschreibung</span>
<textarea name="description" class="field-container-field"></textarea>
</label>
</td>
</tr>
</tbody>
</table>
</form>
...@@ -16,10 +16,14 @@ define('package/quiqqer/bricks/bin/Manager', [ ...@@ -16,10 +16,14 @@ define('package/quiqqer/bricks/bin/Manager', [
'Locale', 'Locale',
'Projects', 'Projects',
'Ajax', 'Ajax',
'Mustache',
'text!package/quiqqer/bricks/bin/Manager.Copy.html',
'css!package/quiqqer/bricks/bin/Manager.Copy.css',
'css!package/quiqqer/bricks/bin/Manager.css' 'css!package/quiqqer/bricks/bin/Manager.css'
], function (QUI, QUIPanel, QUISelect, QUIButton, QUISeparator, QUIConfirm, Grid, QUILocale, Projects, Ajax) { ], function (QUI, QUIPanel, QUISelect, QUIButton, QUISeparator, QUIConfirm, Grid, QUILocale, Projects, Ajax,
Mustache, templateCopy) {
"use strict"; "use strict";
var lg = 'quiqqer/bricks'; var lg = 'quiqqer/bricks';
...@@ -36,6 +40,7 @@ define('package/quiqqer/bricks/bin/Manager', [ ...@@ -36,6 +40,7 @@ define('package/quiqqer/bricks/bin/Manager', [
'$onCreate', '$onCreate',
'$onResize', '$onResize',
'$openCreateDialog', '$openCreateDialog',
'$openCopyDialog',
'$openDeleteDialog', '$openDeleteDialog',
'$onDblClick', '$onDblClick',
'$onClick' '$onClick'
...@@ -102,11 +107,13 @@ define('package/quiqqer/bricks/bin/Manager', [ ...@@ -102,11 +107,13 @@ define('package/quiqqer/bricks/bin/Manager', [
var selected = this.$Grid.getSelectedData(), var selected = this.$Grid.getSelectedData(),
AddButton = this.getButtons('brick-add'), AddButton = this.getButtons('brick-add'),
EditButton = this.getButtons('brick-edit'), EditButton = this.getButtons('brick-edit'),
CopyButton = this.getButtons('brick-copy'),
DelButton = this.getButtons('brick-delete'); DelButton = this.getButtons('brick-delete');
if (!selected.length) { if (!selected.length) {
AddButton.enable(); AddButton.enable();
DelButton.disable(); DelButton.disable();
CopyButton.disable();
EditButton.disable(); EditButton.disable();
return; return;
} }
...@@ -114,12 +121,14 @@ define('package/quiqqer/bricks/bin/Manager', [ ...@@ -114,12 +121,14 @@ define('package/quiqqer/bricks/bin/Manager', [
AddButton.enable(); AddButton.enable();
DelButton.enable(); DelButton.enable();
if (selected.length == 1) { if (selected.length === 1) {
EditButton.enable(); EditButton.enable();
CopyButton.enable();
} }
if (selected.length > 1) { if (selected.length > 1) {
AddButton.disable(); EditButton.disable();
CopyButton.disable();
} }
}, },
...@@ -164,19 +173,40 @@ define('package/quiqqer/bricks/bin/Manager', [ ...@@ -164,19 +173,40 @@ define('package/quiqqer/bricks/bin/Manager', [
}) })
); );
this.addButton(new QUISeparator());
this.addButton( this.addButton(
new QUIButton({ new QUIButton({
textimage: 'fa fa-edit', textimage: 'fa fa-edit',
text : QUILocale.get(lg, 'manager.button.edit'), text : QUILocale.get(lg, 'manager.button.edit.text'),
title : QUILocale.get(lg, 'manager.button.edit'), title : QUILocale.get(lg, 'manager.button.edit.title'),
name : 'brick-edit', name : 'brick-edit',
disabled : true, disabled : true,
events : { events : {
onClick: function () { onClick: function () {
this.editBrick( self.editBrick(
this.$Grid.getSelectedData()[0].id self.$Grid.getSelectedData()[0].id
); );
}.bind(this) }
}
})
);
this.addButton(
new QUIButton({
textimage: 'fa fa-copy',
text : QUILocale.get(lg, 'manager.button.copy.text'),
title : QUILocale.get(lg, 'manager.button.copy.title'),
name : 'brick-copy',
disabled : true,
events : {
onClick: function () {
var data = self.$Grid.getSelectedData();
if (data.length === 1) {
self.$openCopyDialog(data[0].id);
}
}
} }
}) })
); );
...@@ -290,7 +320,7 @@ define('package/quiqqer/bricks/bin/Manager', [ ...@@ -290,7 +320,7 @@ define('package/quiqqer/bricks/bin/Manager', [
}, },
/** /**
* Refresh the project language dropdown * Refresh the project language DropDown
*/ */
$refreshProjectLanguages: function () { $refreshProjectLanguages: function () {
var self = this, var self = this,
...@@ -302,7 +332,7 @@ define('package/quiqqer/bricks/bin/Manager', [ ...@@ -302,7 +332,7 @@ define('package/quiqqer/bricks/bin/Manager', [
continue; continue;
} }
if (activeProject != project) { if (activeProject !== project) {
continue; continue;
} }
...@@ -476,6 +506,97 @@ define('package/quiqqer/bricks/bin/Manager', [ ...@@ -476,6 +506,97 @@ define('package/quiqqer/bricks/bin/Manager', [
}).open(); }).open();
}, },
/**
* opens the copy dialog
*/
$openCopyDialog: function (brickId) {
var self = this;
new QUIConfirm({
title : QUILocale.get(lg, 'dialog.copy.title', {
id: brickId
}),
icon : 'fa fa-copy',
maxHeight: 600,
maxWidth : 800,
autoclose: false,
events: {
onOpen: function (Win) {
Win.Loader.show();
var Content = Win.getContent(),
project = self.$ProjectSelect.getValue(),
lang = self.$ProjectLangs.getValue(),
Project = Projects.get(project);
Content.set('html', Mustache.render(templateCopy, {
text: QUILocale.get(lg, 'dialog.copy.message')
}));
Project.getConfig().then(function (config) {
var Select = new QUISelect({
name: 'language-select'
});
var langs = config.langs.split(',');
for (var i = 0, len = langs.length; i < len; i++) {
Select.appendChild(
QUILocale.get('quiqqer/system', 'language.' + langs[i]),
langs[i],
URL_BIN_DIR + '16x16/flags/' + langs[i] + '.png'
);
}
Select.inject(Content.getElement('.dialog-bricks-copy-languages'));
Select.getElm().setStyle('width', '100%');
Select.getElm().setStyle('border', 0);
Select.setValue(lang);
Ajax.get('package_quiqqer_bricks_ajax_getBrick', function (data) {
var Form = Content.getElement('form');
Form.elements.title.value = data.attributes.title;
Form.elements.description.value = data.attributes.description;
Win.Loader.hide();
}, {
'package': 'quiqqer/bricks',
brickId : brickId
});
});
},
onSubmit: function (Win) {
Win.Loader.show();
var Content = Win.getContent(),
Form = Content.getElement('form');
var Select = Content.getElement('.dialog-bricks-copy-languages [data-quiid]');
var Language = QUI.Controls.getById(Select.get('data-quiid'));
Ajax.post('package_quiqqer_bricks_ajax_brick_copy', function (data) {
self.refresh();
Win.close();
self.editBrick(data['id']);
}, {
'package': 'quiqqer/bricks',
brickId : brickId,
params : JSON.encode({
'lang' : Language.getValue(),
'title' : Form.elements.title.value,
'description': Form.elements.description.value
})
});
}
}
}).open();
},
/** /**
* Opens the brick panel * Opens the brick panel
* *
...@@ -623,7 +744,7 @@ define('package/quiqqer/bricks/bin/Manager', [ ...@@ -623,7 +744,7 @@ define('package/quiqqer/bricks/bin/Manager', [
brickId = brickIds[i]; brickId = brickIds[i];
for (c = 0, clen = panels.length; c < clen; c++) { for (c = 0, clen = panels.length; c < clen; c++) {
if (panels[c].getAttribute('id') == brickId) { if (panels[c].getAttribute('id') === brickId) {
panels[c].destroy(); panels[c].destroy();
} }
} }
......
...@@ -608,9 +608,21 @@ M&ouml;chten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de> ...@@ -608,9 +608,21 @@ M&ouml;chten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de>
<de><![CDATA[Baustein hinzufügen]]></de> <de><![CDATA[Baustein hinzufügen]]></de>
<en><![CDATA[Add a Brick]]></en> <en><![CDATA[Add a Brick]]></en>
</locale> </locale>
<locale name="manager.button.edit"> <locale name="manager.button.edit.title">
<de><![CDATA[Baustein bearbeiten]]></de> <de><![CDATA[Markierten Baustein bearbeiten]]></de>
<en><![CDATA[Edit a Brick]]></en> <en><![CDATA[Edit marked Brick]]></en>
</locale>
<locale name="manager.button.edit.text">
<de><![CDATA[Bearbeiten]]></de>
<en><![CDATA[Edit]]></en>
</locale>
<locale name="manager.button.copy.title">
<de><![CDATA[Markierten Baustein kopieren]]></de>
<en><![CDATA[Copy marked Brick]]></en>
</locale>
<locale name="manager.button.copy.text">
<de><![CDATA[Kopieren]]></de>
<en><![CDATA[Copy]]></en>
</locale> </locale>
<locale name="manager.button.delete"> <locale name="manager.button.delete">
<de><![CDATA[Markierte Bausteine löschen]]></de> <de><![CDATA[Markierte Bausteine löschen]]></de>
...@@ -713,7 +725,25 @@ M&ouml;chten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de> ...@@ -713,7 +725,25 @@ M&ouml;chten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de>
<de><![CDATA[Slide bearbieten]]></de> <de><![CDATA[Slide bearbieten]]></de>
<en><![CDATA[Edit Slide]]></en> <en><![CDATA[Edit Slide]]></en>
</locale> </locale>
<locale name="dialog.copy.title">
<de><![CDATA[Baustein #[id] kopieren]]></de>
<en><![CDATA[Copy brick #[id]]]></en>
</locale>
<locale name="dialog.copy.message">
<de><![CDATA[
Bitte geben Sie an in welche Sprache der Baustein kopieren werden soll.
Zusätzlich können Sie Titel und Beschreibung für den neuen Baustein angeben.
Alle anderen Einstellungen werden in den neuen Baustein kopiert.
]]></de>
<en><![CDATA[
Please specify in which language the block should be copied.
You can also specify the title and description for the new module.
All other settings are copied to the new block.
]]></en>
</locale>
</groups> </groups>
<groups name="quiqqer/bricks" datatype="js,php"> <groups name="quiqqer/bricks" datatype="js,php">
<locale name="brick.control.navigation.setting.content"> <locale name="brick.control.navigation.setting.content">
<de><![CDATA[Text über dem Kontaktformular]]></de> <de><![CDATA[Text über dem Kontaktformular]]></de>
......
...@@ -6,13 +6,27 @@ ...@@ -6,13 +6,27 @@
// workaround for older patch // workaround for older patch
$Bricks = QUI\Bricks\Manager::init(); $Bricks = QUI\Bricks\Manager::init();
// database table
$columns = QUI::getDataBase()->table()->getColumns($Bricks->getUIDTable());
$columns = array_flip($columns);
if (isset($columns['id'])) {
QUI::getDataBase()->table()->deleteColumn(
$Bricks->getUIDTable(),
'id'
);
QUI::getPackage('quiqqer/bricks')->setup();
}
$result = QUI::getDataBase()->fetch(array( $result = QUI::getDataBase()->fetch(array(
'count' => 'count', 'count' => 'count',
'from' => $Bricks->getUIDTable(), 'from' => $Bricks->getUIDTable(),
)); ));
// if unique ids already exist, the pages no longer have to be passed through // if unique ids already exist, the pages no longer have to be passed through
if (false && isset($result[0]) && isset($result[0]['count']) && $result[0]['count']) { if (isset($result[0]) && isset($result[0]['count']) && $result[0]['count']) {
echo 'Already executed'.PHP_EOL; echo 'Already executed'.PHP_EOL;
return; return;
......
...@@ -15,3 +15,11 @@ ...@@ -15,3 +15,11 @@
width: 100%; width: 100%;
} }
} }
.quiqqer-bricks-promoslider-wallpaper-container .quiqqer-bricks-promoslider-wallpaper2Content-noScriptImage {
object-fit:contain;
object-position:0 0;
position: absolute;
top: 0;
width: 100%;
}
...@@ -17,6 +17,18 @@ ...@@ -17,6 +17,18 @@
{/if} {/if}
</div> </div>
</div> </div>
{if $key === 0}
<noscript>
{if $slide.url}
<a href="{$slide.url}">
{/if}
{image image=$slide.image class="quiqqer-bricks-promoslider-wallpaper2Content-noScriptImage"}
{if $slide.url}
</a>
{/if}
</noscript>
{/if}
</li> </li>
{/foreach} {/foreach}
</ul> </ul>
...@@ -40,6 +52,18 @@ ...@@ -40,6 +52,18 @@
{/if} {/if}
</div> </div>
</div> </div>
{if $key === 0}
<noscript>
{if $slide.url}
<a href="{$slide.url}">
{/if}
{image image=$slide.image class="quiqqer-bricks-promoslider-wallpaper2Content-noScriptImage"}
{if $slide.url}
</a>
{/if}
</noscript>
{/if}
</li> </li>
{/foreach} {/foreach}
</ul> </ul>
...@@ -54,4 +78,15 @@ ...@@ -54,4 +78,15 @@
<div class="quiqqer-bricks-promoslider-wallpaper-next hide-on-mobile"> <div class="quiqqer-bricks-promoslider-wallpaper-next hide-on-mobile">
<span class="fa fa-chevron-right"></span> <span class="fa fa-chevron-right"></span>
</div> </div>
{/if}
\ No newline at end of file <noscript>
{literal}
<style>
.quiqqer-bricks-promoslider-wallpaper-next,
.quiqqer-bricks-promoslider-wallpaper-prev {
display: none;
}
</style>
{/literal}
</noscript>
{/if}
...@@ -219,5 +219,7 @@ public static function onPackageSetup(QUI\Package\Package $Package) ...@@ -219,5 +219,7 @@ public static function onPackageSetup(QUI\Package\Package $Package)
if ($Package->getName() !== 'quiqqer/bricks') { if ($Package->getName() !== 'quiqqer/bricks') {
return; return;
} }
shell_exec('php '.OPT_DIR.'quiqqer/bricks/patches/uniqueIds.php');
} }
} }
...@@ -83,6 +83,24 @@ public function __construct($init = false) ...@@ -83,6 +83,24 @@ public function __construct($init = false)
} }
} }
/**
* Returns the bricks table name
*
* @return String
*/
public static function getTable()
{
return QUI::getDBTableName(self::TABLE);
}
/**
* @return string
*/
public static function getUIDTable()
{
return QUI::getDBTableName(self::TABLE_UID);
}
/** /**
* Creates a new brick for the project * Creates a new brick for the project
* *
...@@ -842,21 +860,52 @@ public function saveBrick($brickId, array $brickData) ...@@ -842,21 +860,52 @@ public function saveBrick($brickId, array $brickData)
} }
/** /**
* Returns the bricks table name * Copy a brick
* *
* @return String * @param integer|string $brickId
* @param array $params - project, lang, title, description
* @return integer
*
* @throws QUI\Exception
*/ */
public static function getTable() public function copyBrick($brickId, $params = array())
{ {
return QUI::getDBTableName(self::TABLE); QUI\Permissions\Permission::checkPermission('quiqqer.bricks.create');
}
/** $result = QUI::getDataBase()->fetch(array(
* @return string 'from' => $this->getTable(),
*/ 'where' => array(
public static function getUIDTable() 'id' => $brickId
{ )
return QUI::getDBTableName(self::TABLE_UID); ));
if (!isset($result[0])) {
throw new QUI\Exception('Brick not found');
}
$allowed = array('project', 'lang', 'title', 'description');
$allowed = array_flip($allowed);
$data = $result[0];
unset($data['id']);
if (!is_array($params)) {
$params = array();
}
foreach ($params as $param => $value) {
if (!isset($allowed[$param])) {
continue;
}
$data[$param] = $value;
}
QUI::getDataBase()->insert($this->getTable(), $data);
$lastId = QUI::getPDO()->lastInsertId();
return $lastId;
} }
/** /**
...@@ -989,7 +1038,16 @@ protected function getInheritedBricks($brickArea, Site $Site) ...@@ -989,7 +1038,16 @@ protected function getInheritedBricks($brickArea, Site $Site)
} }
foreach ($area as $brick) { foreach ($area as $brick) {
if (isset($brick['brickId']) && isset($brickIds[$brick['brickId']])) { $customFields = json_decode($brick['customfields'], true);
if ($customFields
&& isset($customFields['inheritance'])
&& $customFields['inheritance'] === false) {
continue;
}
if (isset($brick['brickId'])
&& isset($brickIds[$brick['brickId']])) {
$result[] = $brick; $result[] = $brick;
} }
} }
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren