Skip to content

Commit 8feea44

Browse files
committed
Merge remote-tracking branch 'origin/1.7' into 2.0
2 parents 695dd08 + cb6d097 commit 8feea44

File tree

9 files changed

+70
-44
lines changed

9 files changed

+70
-44
lines changed

public/js/pimcore/object/tags/numeric.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ pimcore.object.tags.numeric = Class.create(pimcore.object.tags.abstract, {
2323

2424
applyDefaultValue: function() {
2525
this.defaultValue = null;
26-
if ((typeof this.data === "undefined" || this.data === null) && this.fieldConfig.defaultValue) {
26+
if ((typeof this.data === "undefined" || this.data === null) &&
27+
(this.fieldConfig.defaultValue || this.fieldConfig.defaultValue === 0)
28+
) {
2729
this.data = this.fieldConfig.defaultValue;
2830
this.defaultValue = this.fieldConfig.defaultValue;
2931
}

public/js/pimcore/object/tree.js

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ pimcore.registerNS("pimcore.object.tree");
552552
var pasteMenu = [];
553553

554554
if (perspectiveCfg.inTreeContextMenu("object.paste")) {
555-
if (pimcore.cachedObjectId) {
555+
if (pimcore.cachedObjectId && (typeof perspectiveCfg.classes === "undefined" || typeof pimcore.copiedObject.get('className') === "undefined" || pimcore.copiedObject.get('className') in perspectiveCfg.classes)) {
556556
pasteMenu.push({
557557
text: t("paste_recursive_as_child"),
558558
iconCls: "pimcore_icon_paste",
@@ -580,28 +580,26 @@ pimcore.registerNS("pimcore.object.tree");
580580
}
581581
}
582582

583-
if (!isVariant) {
584-
if (pimcore.cutObject) {
585-
pasteMenu.push({
586-
text: t("paste_cut_element"),
587-
iconCls: "pimcore_icon_paste",
588-
handler: function () {
589-
this.pasteCutObject(pimcore.cutObject,
590-
pimcore.cutObjectParentNode, record, this.tree);
591-
pimcore.cutObjectParentNode = null;
592-
pimcore.cutObject = null;
593-
}.bind(this)
594-
});
595-
}
583+
if (pimcore.cutObject && (typeof perspectiveCfg.classes === "undefined" || typeof pimcore.cutObject.get('className') === "undefined" || pimcore.cutObject.get('className') in perspectiveCfg.classes)) {
584+
pasteMenu.push({
585+
text: t("paste_cut_element"),
586+
iconCls: "pimcore_icon_paste",
587+
handler: function () {
588+
this.pasteCutObject(pimcore.cutObject,
589+
pimcore.cutObjectParentNode, record, this.tree);
590+
pimcore.cutObjectParentNode = null;
591+
pimcore.cutObject = null;
592+
}.bind(this)
593+
});
594+
}
596595

597-
if (pasteMenu.length > 0) {
598-
menu.add(new Ext.menu.Item({
599-
text: t('paste'),
600-
iconCls: "pimcore_icon_paste",
601-
hideOnClick: false,
602-
menu: pasteMenu
603-
}));
604-
}
596+
if (pasteMenu.length > 0) {
597+
menu.add(new Ext.menu.Item({
598+
text: t('paste'),
599+
iconCls: "pimcore_icon_paste",
600+
hideOnClick: false,
601+
menu: pasteMenu
602+
}));
605603
}
606604
}
607605
}
@@ -851,6 +849,7 @@ pimcore.registerNS("pimcore.object.tree");
851849

852850
copy: function (tree, record) {
853851
pimcore.cachedObjectId = record.data.id;
852+
pimcore.copiedObject = record;
854853
},
855854

856855
cut: function (tree, record) {

public/js/pimcore/overrides.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ Ext.define('pimcore.tree.View', {
248248
},
249249
beforeitemupdate: function(record) {
250250
if(record.ptb) {
251-
record.ptb.destroy();
252251
delete record.ptb;
253252
}
254253
},

src/Controller/Admin/DataObject/DataObjectActionsTrait.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ private function prepareObjectData(
206206
}
207207
}
208208

209+
$object->markFieldDirty($field);
210+
209211
$activeGroups = $classificationStoreData->getActiveGroups() ?: [];
210212
$activeGroups[$groupId] = true;
211213
$classificationStoreData->setActiveGroups($activeGroups);

src/Controller/Admin/DataObject/DataObjectHelperController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,7 @@ public function batchAction(Request $request): JsonResponse
14831483
$dataDefinition->getDataFromEditmode($value),
14841484
$csLanguage
14851485
);
1486+
$object->markFieldDirty($field);
14861487
}
14871488
}
14881489
} elseif (count($parts) > 1) {

src/Service/ElementService.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
namespace Pimcore\Bundle\AdminBundle\Service;
1616

17+
use Pimcore;
1718
use Pimcore\Bundle\AdminBundle\Controller\Traits\AdminStyleTrait;
1819
use Pimcore\Bundle\AdminBundle\CustomView;
1920
use Pimcore\Bundle\AdminBundle\Event\ElementAdminStyleEvent;
@@ -28,6 +29,7 @@
2829
use Pimcore\Security\User\UserLoader;
2930
use Pimcore\Tool\Frontend;
3031

32+
use Pimcore\Workflow\Manager;
3133
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
3234

3335
/**
@@ -95,6 +97,8 @@ public function getElementTreeNodeConfig(ElementInterface $element): array
9597
$this->assignDataObjectTreeConfig($element, $tmpNode);
9698
}
9799

100+
$tmpNode['permissions'] = $this->mergeWorkflowPermissions($element, $tmpNode['permissions']);
101+
98102
$this->addAdminStyle($element, ElementAdminStyleEvent::CONTEXT_TREE, $tmpNode);
99103

100104
if ($element->isLocked()) {
@@ -353,4 +357,23 @@ private function assignDocumentSpecificSettings(Document $document, array &$tmpD
353357
$tmpDocument['cls'] .= 'pimcore_unpublished ';
354358
}
355359
}
360+
361+
private function mergeWorkflowPermissions(ElementInterface $element, array $permissions): array
362+
{
363+
$workflowManager = Pimcore::getContainer()->get(Manager::class);
364+
365+
$workflowPermission = [
366+
'settings' => !$workflowManager->isDeniedInWorkflow($element, 'settings'),
367+
'rename' => !$workflowManager->isDeniedInWorkflow($element, 'rename'),
368+
'publish' => !$workflowManager->isDeniedInWorkflow($element, 'publish'),
369+
];
370+
371+
if ($element instanceof Asset) {
372+
$workflowPermission['remove'] = !$workflowManager->isDeniedInWorkflow($element, 'delete');
373+
} elseif ($element instanceof DataObject) {
374+
$workflowPermission['delete'] = !$workflowManager->isDeniedInWorkflow($element, 'delete');
375+
}
376+
377+
return array_merge($permissions, $workflowPermission);
378+
}
356379
}

src/Service/PreviewGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function getLocalePreviewConfig(Concrete $object): array
8080

8181
$locales = [];
8282
foreach (Tool::getValidLanguages() as $locale) {
83-
$label = \Locale::getDisplayLanguage($locale, $userLocale);
83+
$label = sprintf('%s (%s)', \Locale::getDisplayLanguage($locale, $userLocale), $locale);
8484
$locales[$label] = $locale;
8585
}
8686

templates/admin/data_object/data_object/diff_versions.html.twig

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,30 @@
1111

1212
<table class="preview" border="0" cellpadding="0" cellspacing="0">
1313
<tr>
14-
<th>Name</th>
15-
<th>Key</th>
14+
<th>{{ 'Name'|trans([], 'admin') }}</th>
15+
<th>{{ 'Key'|trans([], 'admin') }}</th>
1616
{% if isImportPreview is defined %}
1717
{% if isNew is defined %}
18-
<th>New Object or unable to resolve</th>
18+
<th>{{ 'New Object or unable to resolve'|trans([], 'admin') }}</th>
1919
{% else %}
20-
<th>Before</th>
21-
<th>After</th>
20+
<th>{{ 'Before'|trans([], 'admin') }}</th>
21+
<th>{{ 'After'|trans([], 'admin') }}</th>
2222
{% endif %}
2323
{% else %}
24-
<th>Version 1</th>
25-
<th>Version 2</th>
24+
<th>{{ 'Version'|trans([], 'admin') }} 1</th>
25+
<th>{{ 'Version'|trans([], 'admin') }} 2</th>
2626
{% endif %}
2727
</tr>
2828
<tr class="system">
29-
<td>Date</td>
29+
<td>{{ 'Date'|trans([], 'admin') }}</td>
3030
<td>modificationDate</td>
3131
{% if isImportPreview is not defined or isNew is not defined %}
3232
<td>{{ object1.getModificationDate()|date('Y-m-d H:i:s') }}</td>
3333
{% endif %}
3434
<td>{{ object2.getModificationDate()|date('Y-m-d H:i:s') }}</td>
3535
</tr>
3636
<tr class="system">
37-
<td>Path</td>
37+
<td>{{ 'Path'|trans([], 'admin') }}</td>
3838
<td>path</td>
3939
{% if isImportPreview is not defined or isNew is not defined %}
4040
<td> {{ object1.getRealFullPath() }} </td>
@@ -43,7 +43,7 @@
4343
<td class="{{ modifiedPathClass }}">{{ object2.getRealFullPath() }}</td>
4444
</tr>
4545
<tr class="system">
46-
<td>Published</td>
46+
<td>{{ 'Published'|trans([], 'admin') }}</td>
4747
<td>published</td>
4848
{% if isImportPreview is not defined or isNew is not defined %}
4949
<td> {{ object1.getPublished() }} </td>
@@ -53,14 +53,14 @@
5353
</tr>
5454
{% if versionNote1 or versionNote2 %}
5555
<tr class="system">
56-
<td>Version Note</td>
56+
<td>{{ 'Version Note'|trans([], 'admin') }}</td>
5757
<td>&nbsp;</td>
5858
<td>{{ versionNote1|nl2br }}</td>
5959
<td>{{ versionNote2|nl2br }}</td>
6060
</tr>
6161
{% endif %}
6262
<tr class="system">
63-
<td>Id</td>
63+
<td>{{ 'Id'|trans([], 'admin') }}</td>
6464
<td>id</td>
6565
{% if isImportPreview is not defined or isNew is not defined %}
6666
<td> {{ object1.getId() }} </td>

templates/admin/data_object/data_object/preview_version.html.twig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@
1212

1313
<table class="preview" border="0" cellpadding="0" cellspacing="0">
1414
<tr>
15-
<th>Name</th>
16-
<th>Key</th>
17-
<th>Value</th>
15+
<th>{{ 'Name'|trans([], 'admin') }}</th>
16+
<th>{{ 'Key'|trans([], 'admin') }}</th>
17+
<th>{{ 'Value'|trans([], 'admin') }}</th>
1818
</tr>
1919
<tr class="system">
20-
<td>Date</td>
20+
<td>{{ 'Date'|trans([], 'admin') }}</td>
2121
<td>modificationDate</td>
2222
<td>{{ object.getModificationDate()|date('Y-m-d H:i:s') }}</td>
2323
</tr>
2424
<tr class="system">
25-
<td>Path</td>
25+
<td>{{ 'Path'|trans([], 'admin') }}</td>
2626
<td>path</td>
2727
<td>{{ object.getRealFullPath() }}</td>
2828
</tr>
2929
<tr class="system">
30-
<td>Published</td>
30+
<td>{{ 'Published'|trans([], 'admin') }}</td>
3131
<td>published</td>
3232
<td>{{ object.getPublished() ? 'true' : 'false' }}</td>
3333
</tr>
3434
{% if versionNote %}
3535
<tr class="system">
36-
<td>Version Note</td>
36+
<td>{{ 'Version Note'|trans([], 'admin') }}</td>
3737
<td>&nbsp;</td>
3838
<td>{{ versionNote|nl2br }}</td>
3939
</tr>

0 commit comments

Comments
 (0)