diff --git a/Phraseanet-production-client/dist/production.js b/Phraseanet-production-client/dist/production.js index c013188305..a2b4682591 100644 --- a/Phraseanet-production-client/dist/production.js +++ b/Phraseanet-production-client/dist/production.js @@ -10055,6 +10055,8 @@ var workzone = function workzone(services) { }, success: function success(data) { (0, _jquery2.default)('#DIALOG-field-mapping .databox-field-list').empty().html(data); + + (0, _jquery2.default)('.field-list').sortable().disableSelection(); } }); }); diff --git a/Phraseanet-production-client/dist/production.min.js b/Phraseanet-production-client/dist/production.min.js index c013188305..a2b4682591 100644 --- a/Phraseanet-production-client/dist/production.min.js +++ b/Phraseanet-production-client/dist/production.min.js @@ -10055,6 +10055,8 @@ var workzone = function workzone(services) { }, success: function success(data) { (0, _jquery2.default)('#DIALOG-field-mapping .databox-field-list').empty().html(data); + + (0, _jquery2.default)('.field-list').sortable().disableSelection(); } }); }); diff --git a/Phraseanet-production-client/src/components/ui/workzone/index.js b/Phraseanet-production-client/src/components/ui/workzone/index.js index 51241cf547..ae80181cbb 100644 --- a/Phraseanet-production-client/src/components/ui/workzone/index.js +++ b/Phraseanet-production-client/src/components/ui/workzone/index.js @@ -145,6 +145,8 @@ const workzone = (services) => { }, success: function (data) { $('#DIALOG-field-mapping .databox-field-list').empty().html(data); + + $('.field-list').sortable().disableSelection(); } }); }); diff --git a/lib/Alchemy/Phrasea/PhraseanetService/Controller/PSExposeController.php b/lib/Alchemy/Phrasea/PhraseanetService/Controller/PSExposeController.php index 69f016ae01..a32a2eca78 100644 --- a/lib/Alchemy/Phrasea/PhraseanetService/Controller/PSExposeController.php +++ b/lib/Alchemy/Phrasea/PhraseanetService/Controller/PSExposeController.php @@ -728,23 +728,21 @@ class PSExposeController extends Controller 'message' => "Expose configuration not set!" ]); } + $exposeMappingName = $this->getExposeMappingName(); $clientAnnotationProfile = $this->getClientAnnotationProfile($exposeClient, $exposeName, $profile); - $fields = $this->getFields(); + $actualFieldsList = !empty($clientAnnotationProfile[$exposeMappingName]) ? $clientAnnotationProfile[$exposeMappingName] : []; + $fields = $this->getFields($actualFieldsList); return $this->render('prod/WorkZone/ExposeFieldList.html.twig', [ 'fields' => $fields, - 'actualFieldsList' => !empty($clientAnnotationProfile[$exposeMappingName]) ? $clientAnnotationProfile[$exposeMappingName] : [] ]); } public function getFieldMappingAction(PhraseaApplication $app, Request $request) { - $fields = $this->getFields(); - return $this->render('prod/WorkZone/ExposeFieldMapping.html.twig', [ - 'fields' => $fields, 'exposeName' => $request->get('exposeName') ]); } @@ -854,16 +852,32 @@ class PSExposeController extends Controller * * @return array */ - private function getFields() + private function getFields($actualFieldsList) { $databoxes = $this->getApplicationBox()->get_databoxes(); - $fields = []; + $fieldFromProfile = []; + foreach ($actualFieldsList as $value) { + $t = explode('_', $value); + $databox = $this->getApplicationBox()->get_databox($t[0]); + $viewName = $databox->get_viewname(); + + $fieldFromProfile[$viewName][$t[1]]['id'] = $value; + $fieldFromProfile[$viewName][$t[1]]['name'] = $databox->get_meta_structure()->get_element($t[1])->get_label($this->app['locale']); + $fieldFromProfile[$viewName][$t[1]]['checked'] = true; + } + + $fields = $fieldFromProfile; foreach ($databoxes as $databox) { foreach ($databox->get_meta_structure() as $meta) { // get databoxID_metaID for the checkbox name + if (!empty($fields[$databox->get_viewname()][$meta->get_id()]) && in_array($databox->get_sbas_id().'_'.$meta->get_id(), $fields[$databox->get_viewname()][$meta->get_id()])) { + continue; + } + $fields[$databox->get_viewname()][$meta->get_id()]['id'] = $databox->get_sbas_id().'_'.$meta->get_id(); $fields[$databox->get_viewname()][$meta->get_id()]['name'] = $meta->get_label($this->app['locale']); + } } diff --git a/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php b/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php index 76ec81404a..7066be08b1 100644 --- a/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php +++ b/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php @@ -96,26 +96,32 @@ class ExposeUploadWorker implements WorkerInterface $record = $this->findDataboxById($payload['databoxId'])->get_record($payload['recordId']); $helpers = new PhraseanetExtension($this->app); - $canSeeBusiness = $helpers->isGrantedOnCollection($record->getBaseId(), [\ACL::CANMODIFRECORD]); - $captionsByfield = $record->getCaption($helpers->getCaptionFieldOrder($record, $canSeeBusiness)); - - // this is the unique reference for record in phraseanet and assets in expose + // the identification of phraseanet instance in expose $phraseanetLocalId = $this->app['conf']->get(['phraseanet-service', 'phraseanet_local_id']); + $fieldListToUpload = $this->getFieldListToUpload($exposeClient, $payload['accessToken'], $payload['publicationId'], $phraseanetLocalId); $description = "