Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/1.5' into 1.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.json
  • Loading branch information
kingjia90 committed Aug 7, 2024
2 parents e9a696d + 442e758 commit 7554a0f
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 33 deletions.
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"cbschuld/browser.php": "^1.9.6",
"phpoffice/phpspreadsheet": "^1.24 || ^2.1",
"pimcore/pimcore": "^11.3.0",
"pimcore/pimcore": "^11.3.1",
"symfony/webpack-encore-bundle": "^1.13.2"
},
"require-dev": {
Expand All @@ -40,9 +40,6 @@
"kernel/Kernel.php"
]
},
"conflict": {
"symfony/string": "<6.0"
},
"extra": {
"branch-alias": {
"1.x-dev": "1.6.x-dev"
Expand Down
6 changes: 6 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ services:
public: true
tags: ['controller.service_arguments']

Pimcore\Bundle\AdminBundle\Controller\Admin\IndexController:
public: true
arguments:
$httpClient: '@pimcore.http_client'
tags: [ 'controller.service_arguments' ]

#
# COMMANDS
#
Expand Down
13 changes: 13 additions & 0 deletions public/js/pimcore/document/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,19 @@ pimcore.document.document = Class.create(pimcore.element.abstract, {
}

if (this.toolbarButtons.save && this.toolbarButtons.publish) {
if (this.isAllowed("save")) {
const menuItem = this.toolbarButtons.publish.menu.items.items.find(
element => element.text === t('save_draft')
)
menuItem.setHidden(false)
}
if (this.isAllowed("settings")) {
const menuItem = this.toolbarButtons.publish.menu.items.items.find(
element => element.text === t('save_only_scheduled_tasks')
)
menuItem.setHidden(false)
}

this.toolbarButtons.publish.show();
}

Expand Down
2 changes: 1 addition & 1 deletion public/js/pimcore/document/page_snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ pimcore.document.page_snippet = Class.create(pimcore.document.document, {
height: 49,
});

const tabPanel = this.getTabPanel();
const toolbar = this.getLayoutToolbar();
const tabPanel = this.getTabPanel();

if (pimcore.helpers.checkIfNewHeadbarLayoutIsEnabled()) {
this.tab = new Ext.Panel({
Expand Down
4 changes: 2 additions & 2 deletions public/js/pimcore/object/helpers/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ pimcore.object.helpers.layout = {
button: [],
text: [],
root: ["panel", "region", "tabpanel", "accordion", "text", "iframe", "button", "fieldcontainer", "fieldset"],
localizedfields: ["panel", "tabpanel", "accordion", "fieldset", "fieldcontainer", "text", "region", "button", "iframe"],
block: ["panel", "tabpanel", "accordion", "fieldset", "fieldcontainer", "text", "region", "button", "iframe"]
localizedfields: ["data", "panel", "tabpanel", "accordion", "fieldset", "fieldcontainer", "text", "region", "button", "iframe"],
block: ["data", "panel", "tabpanel", "accordion", "fieldset", "fieldcontainer", "text", "region", "button", "iframe"]
};
},

Expand Down
12 changes: 6 additions & 6 deletions public/js/pimcore/object/tags/manyToOneRelation.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ pimcore.object.tags.manyToOneRelation = Class.create(pimcore.object.tags.abstrac
href.cls = 'pimcore_droptarget_display_edit';
href.fieldBodyCls = 'pimcore_droptarget_display x-form-trigger-wrap';
this.component = new Ext.form.field.Display(href);
this.component.on('afterrender', function (el) {
el.inputEl.setWidth(href.width);
el.inputEl.setStyle({
'overflow': 'hidden'
});
});
}

if (this.data.published === false) {
Expand Down Expand Up @@ -205,12 +211,6 @@ pimcore.object.tags.manyToOneRelation = Class.create(pimcore.object.tags.abstrac
pimcore.helpers.openElement(this.data.id, this.data.type, subtype);
}.bind(this));
}.bind(this));
this.component.on('afterrender', function (el) {
el.inputEl.setWidth(href.width);
el.inputEl.setStyle({
'overflow': 'hidden'
});
});

var items = [this.component, {
xtype: "button",
Expand Down
22 changes: 12 additions & 10 deletions public/js/pimcore/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,19 +562,21 @@ Ext.onReady(function () {
request.open('GET', Routing.generate('pimcore_admin_index_statistics'));
request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');

request.onload = function () {
if (this.status >= 200 && this.status < 400) {
var res = Ext.decode(this.response);
if (pimcore.currentuser.admin) {
request.onload = function () {
if (this.status >= 200 && this.status < 400) {
var res = Ext.decode(this.response);

var request = new XMLHttpRequest();
request.open('POST', "https://liveupdate.pimcore.org/statistics");
var request = new XMLHttpRequest();
request.open('POST', "https://liveupdate.pimcore.org/statistics");

var data = new FormData();
data.append('data', encodeURIComponent(JSON.stringify(res)));
var data = new FormData();
data.append('data', encodeURIComponent(JSON.stringify(res)));

request.send(data);
}
};
request.send(data);
}
};
}
request.send(data);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/ElementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public function getNicePathAction(Request $request): JsonResponse
$idProperty = $request->get('idProperty', 'id');
$methodName = 'get' . ucfirst($fieldname);
if ($ownerType == 'object' && method_exists($source, $methodName)) {
$data = $source->$methodName();
$data = DataObject\Service::useInheritedValues(true, [$source, $methodName]);
$editModeData = $fd->getDataForEditmode($data, $source);
// Inherited values show as an empty array
if (is_array($editModeData) && !empty($editModeData)) {
Expand Down
20 changes: 18 additions & 2 deletions src/Controller/Admin/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use Doctrine\DBAL\Connection;
use Exception;
use GuzzleHttp\ClientInterface;
use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController;
use Pimcore\Bundle\AdminBundle\Event\AdminEvents;
use Pimcore\Bundle\AdminBundle\Event\IndexActionSettingsEvent;
Expand Down Expand Up @@ -61,7 +62,8 @@ class IndexController extends AdminAbstractController implements KernelResponseE
{
public function __construct(
protected EventDispatcherInterface $eventDispatcher,
protected TranslatorInterface $translator
protected TranslatorInterface $translator,
protected ClientInterface $httpClient
) {
}

Expand Down Expand Up @@ -156,7 +158,21 @@ public function statisticsAction(Request $request, Connection $db, KernelInterfa
$data = [];
}

return $this->adminJson($data);
if ($this->getAdminUser()->isAdmin()) {
return $this->adminJson($data);
}

$response = $this->httpClient->request(
'POST',
'https://liveupdate.pimcore.org/statistics',
[
'body' => json_encode($data),
]
);

return $this->adminJson([
'success' => ($response->getStatusCode() >= 200 && $response->getStatusCode() < 400),
]);
}

protected function addRuntimePerspective(array &$templateParams, User $user): static
Expand Down
8 changes: 5 additions & 3 deletions src/Controller/Admin/TagsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ public function treeGetChildrenByIdAction(Request $request): JsonResponse

protected function convertTagToArray(Tag $tag, bool $showSelection, array $assignedTagIds, bool $loadChildren = false, bool $recursiveChildren = false): array
{
$hasChildren = $tag->hasChildren();

$tagArray = [
'id' => $tag->getId(),
'text' => $tag->getName(),
'path' => $tag->getNamePath(),
'expandable' => $tag->hasChildren(),
'leaf' => !$tag->hasChildren(),
'expandable' => $hasChildren,
'leaf' => !$hasChildren,
'iconCls' => 'pimcore_icon_element_tags',
'qtipCfg' => [
'title' => 'ID: ' . $tag->getId(),
Expand All @@ -170,7 +172,7 @@ protected function convertTagToArray(Tag $tag, bool $showSelection, array $assig
$tagArray['checked'] = isset($assignedTagIds[$tag->getId()]);
}

if ($loadChildren) {
if ($hasChildren && $loadChildren) {
$children = $tag->getChildren();
$loadChildren = $recursiveChildren;
foreach ($children as $child) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
{% endif %}

{% for activeGroupId, enabled in existingGroups %}
{% if activeGroups1[activeGroupId] is defined and activeGroups2[activeGroupId] is defined %}
{% if activeGroups1[activeGroupId] is defined or activeGroups2[activeGroupId] is defined %}
{% set groupDefinition = pimcore_object_classificationstore_group(activeGroupId) %}
{% if groupDefinition is not empty %}
{% set keyGroupRelations = groupDefinition.getRelations() %}
Expand All @@ -146,7 +146,8 @@
{% if isImportPreview is not defined or isNew is not defined %}
<td>{{ preview1 | raw }}</td>
{% endif %}
{% set fieldIsEqual = keyDef is instanceof('\\Pimcore\\Model\\DataObject\\ClassDefinition\\Data\\EqualComparisonInterface') and not keyDef.isEqual(keyData1, keyData2) ? 'modified' : '' %}
{% set isActiveInOneVersionOnly = activeGroups1[activeGroupId] is not defined or activeGroups2[activeGroupId] is not defined %}
{% set fieldIsEqual = keyDef is instanceof('\\Pimcore\\Model\\DataObject\\ClassDefinition\\Data\\EqualComparisonInterface') and not keyDef.isEqual(keyData1, keyData2) or isActiveInOneVersionOnly ? 'modified' : '' %}
<td class="{{ fieldIsEqual }}">{{ preview2 }}</td>
</tr>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<tr {% if loop.index is odd %}class="odd"{% endif %}>
<td>{{ lfd.getTitle()|trans([],'admin') }} ({{ language }})</td>
<td>{{ fieldItem.fieldName }} - {{ lfd.getName() }}/{{ language }}</td>
<td>{{ fieldItem.Localizedfields.getLocalizedValue(lfd.getName(), language) }}</td>
<td>{{ lfd.getVersionPreview(fieldItem.Localizedfields.getLocalizedValue(lfd.getName(), language)) | raw }}</td>
</tr>
{% endfor %}
{% endfor %}
Expand Down
3 changes: 2 additions & 1 deletion translations/admin.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ there_are_more_items: 'There are more items than displayed'
workflow_actions: Actions
workflow_notes_requred_field_message: '"%s" is a required field.'
workflow_transition_applied_successfully: 'Action applied successfully'
workflow_transition_unsaved_data: 'Your data changes have not been saved yet. Please, save changes before applying workflow transition.'
workflow_change_email_notification_subject: "Workflow update for %s in workflow '%s'"
workflow_details: 'Workflow Details'
workflow_graph: 'Workflow Graph'
Expand Down Expand Up @@ -1020,4 +1021,4 @@ female: Female
pdf_js_unsafe: This PDF file contains JavaScript. If you want to view it, please download and open it in your local PDF viewer.
pdf_scan_in_progress: 'Preview not available: PDF is being scanned. This may take a while.'
invalid_option: 'Invalid Option field [ {field} ]: Please choose a valid option for select / multiselect field [ {field} ]. Current value: "{option}"'
respect_timezone: 'Respect timezone'
respect_timezone: 'Respect timezone'

0 comments on commit 7554a0f

Please sign in to comment.