Skip to content

Commit

Permalink
Merge branch 'master' into PHRAS-4062-admin-users-list-and-request-im…
Browse files Browse the repository at this point in the history
…provement
  • Loading branch information
nmaillat authored May 28, 2024
2 parents dc43a75 + 288d490 commit 062c8aa
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Phraseanet-production-client/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ module.exports = {
setupDir: _root + 'tests/setup/node.js',
karmaConf: _root + 'config/karma.conf.js',
// change this version when you change JS file for lazy loading
assetFileVersion: 104
assetFileVersion: 105
};
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=104";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=105";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/authenticate.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=104";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=105";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=104";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=105";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/commons.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=104";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=105";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
15 changes: 15 additions & 0 deletions Phraseanet-production-client/dist/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -10239,6 +10239,21 @@ var workzone = function workzone(services) {
}
});

(0, _jquery2.default)('#DIALOG-field-mapping').on('click', '.checkbox-field-mapping', function () {
if ((0, _jquery2.default)(this).is(":checked")) {
var nameEl = (0, _jquery2.default)(this).attr('data-field-name');
var inputName = (0, _jquery2.default)(this).closest('div').find('.name-expose-side');
var labelText = (0, _jquery2.default)(this).closest('label').find('span').text();
inputName.attr('name', nameEl);
inputName.attr('value', labelText);
inputName.removeClass('hidden');
} else {
var _inputName = (0, _jquery2.default)(this).closest('div').find('.name-expose-side');
_inputName.removeAttr('name');
_inputName.addClass('hidden');
}
});

(0, _jquery2.default)('#DIALOG-field-mapping').on('click', '#save-subdef-mapping', function (event) {
event.preventDefault();
if ((0, _jquery2.default)('#subdef-profile-mapping').val() == '') {
Expand Down
15 changes: 15 additions & 0 deletions Phraseanet-production-client/dist/production.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -10239,6 +10239,21 @@ var workzone = function workzone(services) {
}
});

(0, _jquery2.default)('#DIALOG-field-mapping').on('click', '.checkbox-field-mapping', function () {
if ((0, _jquery2.default)(this).is(":checked")) {
var nameEl = (0, _jquery2.default)(this).attr('data-field-name');
var inputName = (0, _jquery2.default)(this).closest('div').find('.name-expose-side');
var labelText = (0, _jquery2.default)(this).closest('label').find('span').text();
inputName.attr('name', nameEl);
inputName.attr('value', labelText);
inputName.removeClass('hidden');
} else {
var _inputName = (0, _jquery2.default)(this).closest('div').find('.name-expose-side');
_inputName.removeAttr('name');
_inputName.addClass('hidden');
}
});

(0, _jquery2.default)('#DIALOG-field-mapping').on('click', '#save-subdef-mapping', function (event) {
event.preventDefault();
if ((0, _jquery2.default)('#subdef-profile-mapping').val() == '') {
Expand Down
15 changes: 15 additions & 0 deletions Phraseanet-production-client/src/components/ui/workzone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,21 @@ const workzone = (services) => {
}
});

$('#DIALOG-field-mapping').on('click', '.checkbox-field-mapping', function() {
if ($(this).is(":checked")) {
let nameEl = $(this).attr('data-field-name');
let inputName = $(this).closest('div').find('.name-expose-side');
let labelText = $(this).closest('label').find('span').text();
inputName.attr('name', nameEl);
inputName.attr('value', labelText);
inputName.removeClass('hidden');
} else {
let inputName = $(this).closest('div').find('.name-expose-side');
inputName.removeAttr('name');
inputName.addClass('hidden');
}
});

$('#DIALOG-field-mapping').on('click', '#save-subdef-mapping', function(event) {
event.preventDefault();
if ($('#subdef-profile-mapping').val() == '') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ public function saveFieldMappingAction(PhraseaApplication $app, Request $request
$sendGeolocField = !empty($request->request->get('sendGeolocField')) ? array_keys($request->request->get('sendGeolocField')): [];
$sendVttField = !empty($request->request->get('sendVttField')) ? array_keys($request->request->get('sendVttField')) : [];

$fields = ($request->request->get('fields') === null) ? null : array_keys($request->request->get('fields'));
$fields = ($request->request->get('fields') === null) ? null : $request->request->get('fields');

$fieldMapping = [
'sendGeolocField' => $sendGeolocField,
Expand Down Expand Up @@ -1214,26 +1214,28 @@ private function getFields($actualFieldsList)
$databoxes = $this->getApplicationBox()->get_databoxes();

$fieldFromProfile = [];
foreach ($actualFieldsList as $value) {
$t = explode('_', $value);
foreach ($actualFieldsList as $key => $value) {
$t = explode('_', $key);
$databox = $this->getApplicationBox()->get_databox($t[0]);
$viewName = $t[0]. ':::' .$databox->get_viewname();

$fieldFromProfile[$viewName][$t[1]]['id'] = $value;
$fieldFromProfile[$viewName][$t[1]]['id'] = $key;
$fieldFromProfile[$viewName][$t[1]]['name'] = $databox->get_meta_structure()->get_element($t[1])->get_label($this->app['locale']);
$fieldFromProfile[$viewName][$t[1]]['exposeSideName'] = $value;
$fieldFromProfile[$viewName][$t[1]]['checked'] = true;
}

$fields = $fieldFromProfile;
foreach ($databoxes as $databox) {
$viewName = $databox->get_sbas_id().':::'.$databox->get_viewname();
foreach ($databox->get_meta_structure() as $meta) {
$viewName = $databox->get_sbas_id().':::'.$databox->get_viewname();
if (!empty($fields[$viewName][$meta->get_id()]) && in_array($databox->get_sbas_id().'_'.$meta->get_id(), $fields[$viewName][$meta->get_id()])) {
continue;
}
// get databoxID_metaID for the checkbox name
$fields[$viewName][$meta->get_id()]['id'] = $databox->get_sbas_id().'_'.$meta->get_id();
$fields[$viewName][$meta->get_id()]['name'] = $meta->get_label($this->app['locale']);
$fields[$viewName][$meta->get_id()]['exposeSideName'] = $meta->get_label($this->app['locale']);;
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getGlobals()
{
return [
// change this version when you change JS file to force the navigation to reload js file
'assetFileVersion' => 104
'assetFileVersion' => 105
];

}
Expand Down
12 changes: 5 additions & 7 deletions lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ public function process(array $payload)

$description = "<dl>";

foreach ($fieldListToUpload as $value) {
// value as databoxId_metaId
$t = explode('_', $value);
foreach ($fieldListToUpload as $key => $fieldLabel) {
// key as databoxId_metaId
$t = explode('_', $key);

// check if it is on the same databox
if ($payload['databoxId'] == $t[0]) {
Expand All @@ -134,12 +134,10 @@ public function process(array $payload)
// retrieve value for the corresponding field
$captionField = $record->get_caption()->get_field($fieldName);
$fieldValues = $captionField->get_values();

$fieldType = $captionField->get_databox_field()->get_type();
$fieldLabel = $helpers->getCaptionFieldLabel($record, $fieldName);

$description .= "<dt class='field-title field-type-". $fieldType ." field-name-". $fieldLabel ."' >" . $fieldLabel. "</dt>";
$description .= "<dd class='field-value field-type-". $fieldType ." field-name-". $fieldLabel ."' >" . $helpers->getCaptionField($record, $fieldName, $fieldValues). "</dd>";
$description .= "<dt class='field-title field-type-". $fieldType ." field-name-". $fieldName ."' >" . $fieldLabel. "</dt>";
$description .= "<dd class='field-value field-type-". $fieldType ." field-name-". $fieldName ."' >" . $helpers->getCaptionField($record, $fieldName, $fieldValues). "</dd>";
}
}
}
Expand Down
11 changes: 7 additions & 4 deletions templates/web/prod/WorkZone/ExposeFieldList.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@

<div class="field-list" style="margin-top:30px;">
{% for metaField in field %}
<label class="checkbox" for="fields[{{ metaField.id }}]" style="margin:5px 0">
<input type="checkbox" id="fields[{{ metaField.id }}]" name="fields[{{ metaField.id }}]" {% if metaField.checked %} checked {% endif %} value="1">
{{ metaField.name }}
</label>
<div>
<label class="checkbox" for="fields[{{ metaField.id }}]" style="margin:5px 0; min-width: 250px; display: inline-block;">
<input class="checkbox-field-mapping" type="checkbox" id="fields[{{ metaField.id }}]" {% if metaField.checked %} checked {% endif %} value="1" data-field-name="fields[{{ metaField.id }}]">
<span>{{ metaField.name }}</span>
</label>
<input type="text" {% if metaField.checked %} value="{{ metaField.exposeSideName }}" name="fields[{{ metaField.id }}]" {% endif %} class="name-expose-side {% if not metaField.checked %} hidden {% endif %}">
</div>
{% endfor %}
</div>
</fieldset>
Expand Down

0 comments on commit 062c8aa

Please sign in to comment.