diff --git a/src/module_vmap/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.json b/src/module_vmap/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.json index e0168f15efdbb3674d714c7de0f294e58283bb88..8cb2ecdec963ced0325b07610c491658275c9c5c 100644 --- a/src/module_vmap/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.json +++ b/src/module_vmap/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.json @@ -511,6 +511,61 @@ } ] }, + { + "fields": [ + { + "type": "radio", + "options": { + "choices": [ + { + "label": "Oui", + "value": true + }, + { + "label": "Non", + "value": false + } + ] + }, + "name": "enable_location", + "label": "FORM_LOCATABLE_VMAP_BUSINESS_OBJECT", + "tooltip": { + "title": "", + "content": "FORM_LOCATABLE_VMAP_BUSINESS_OBJECT_TOOLTIP", + "container": "body" + }, + "disabled": false, + "required": true, + "nb_cols": 12, + "default_value": true + }, { + "type": "radio", + "options": { + "choices": [ + { + "label": "Oui", + "value": true + }, + { + "label": "Non", + "value": false + } + ] + }, + "name": "enable_selection", + "label": "FORM_SELECTABLE_VMAP_BUSINESS_OBJECT", + "tooltip": { + "title": "", + "content": "FORM_SELECTABLE_VMAP_BUSINESS_OBJECT_TOOLTIP", + "container": "body" + }, + "disabled": false, + "required": true, + "nb_cols": 12, + "default_value": true + } + ] + }, { "fields": [ { @@ -949,6 +1004,60 @@ "nb_cols": 6 } ] + }, { + "fields": [ + { + "type": "radio", + "options": { + "choices": [ + { + "label": "Oui", + "value": true + }, + { + "label": "Non", + "value": false + } + ] + }, + "name": "enable_location", + "label": "FORM_LOCATABLE_VMAP_BUSINESS_OBJECT", + "tooltip": { + "title": "", + "content": "FORM_LOCATABLE_VMAP_BUSINESS_OBJECT_TOOLTIP", + "container": "body" + }, + "disabled": false, + "required": true, + "nb_cols": 12, + "default_value": true + }, { + "type": "radio", + "options": { + "choices": [ + { + "label": "Oui", + "value": true + }, + { + "label": "Non", + "value": false + } + ] + }, + "name": "enable_selection", + "label": "FORM_SELECTABLE_VMAP_BUSINESS_OBJECT", + "tooltip": { + "title": "", + "content": "FORM_SELECTABLE_VMAP_BUSINESS_OBJECT_TOOLTIP", + "container": "body" + }, + "disabled": false, + "required": true, + "nb_cols": 12, + "default_value": true + } + ] }, { "fields": [ @@ -1169,7 +1278,7 @@ { "fields": [ { - "type": "number", + "type": "label", "name": "max_snapping_scale", "label": "FORM_MAX_SNAPPING_SCALE_VMAP_BUSINESS_OBJECT", "nb_cols": 12 @@ -1179,13 +1288,33 @@ { "fields": [ { - "type": "number", + "type": "label", "name": "min_snapping_scale", "label": "FORM_MIN_SNAPPING_SCALE_VMAP_BUSINESS_OBJECT", "nb_cols": 12 } ] }, + { + "fields": [ + { + "type": "label", + "name": "enable_location", + "label": "FORM_LOCATABLE_VMAP_BUSINESS_OBJECT", + "nb_cols": 12 + } + ] + }, + { + "fields": [ + { + "type": "label", + "name": "enable_selection", + "label": "FORM_SELECTABLE_VMAP_BUSINESS_OBJECT", + "nb_cols": 12 + } + ] + }, { "fields": [ { diff --git a/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmanager.js b/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmanager.js index d42d368d9bce08e8b42bcc399a3efab62aee2ec9..39bb4e0fdbd795ee3976ce6350430882451cd08f 100644 --- a/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmanager.js +++ b/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmanager.js @@ -1487,6 +1487,8 @@ nsVmap.nsMapManager.MapManager.prototype.getBusinessObjectsFromLayers = function 'bo_geom_type': aBos[ii]['geom_type'], 'bo_min_edition_scale': aBos[ii]['min_edition_scale'], 'bo_max_edition_scale': aBos[ii]['max_edition_scale'], + 'bo_enable_location': aBos[ii]['enable_location'], + 'bo_enable_selection': aBos[ii]['enable_selection'], 'bo_index': goog.isDefAndNotNull(aBos[ii]['index']) ? aBos[ii]['index'] : 1000000 }; } @@ -1498,19 +1500,40 @@ nsVmap.nsMapManager.MapManager.prototype.getBusinessObjectsFromLayers = function /** * Use getQueryableLayers to get the queryable business objects, group by bo_id if the same bo is used by two different layers * @param {boolean} bOnlyVisible true if you want to get only the visible layers + * @param {boolean} bSelectionEnabled true if you want to get only the selection enable bos + * @param {boolean} bLocationEnabled true if you want to get only the location enable bos * @returns {object} the queryables business objects * @export */ -nsVmap.nsMapManager.MapManager.prototype.getQueryableBusinessObjects = function (bOnlyVisible) { +nsVmap.nsMapManager.MapManager.prototype.getQueryableBusinessObjects = function (bOnlyVisible, bSelectionEnabled, bLocationEnabled) { oVmap.log('nsVmap.nsMapManager.MapManager.prototype.getQueryableBusinessObjects'); var oBusinessObjects = this.getBusinessObjectsFromLayers(this.getQueryableLayers(bOnlyVisible)); var oQueryableBOs = {}; + var bSelectionTestPass = true; + var bLocationTestPass = true; for (var key in oBusinessObjects) { if (goog.isDefAndNotNull(oBusinessObjects[key]['bo_user_rights'])) { if (oBusinessObjects[key]['bo_user_rights'].indexOf('SELECT') !== -1) { - oQueryableBOs[key] = oBusinessObjects[key]; + + bSelectionTestPass = true; + bLocationTestPass = true; + + if (bSelectionEnabled) { + if (!oBusinessObjects[key]['bo_enable_selection']) { + bSelectionTestPass = false; + } + } + if (bLocationEnabled) { + if (!oBusinessObjects[key]['bo_enable_location']) { + bLocationTestPass = false; + } + } + + if (bSelectionTestPass && bLocationTestPass) { + oQueryableBOs[key] = oBusinessObjects[key]; + } } } } @@ -1521,14 +1544,16 @@ nsVmap.nsMapManager.MapManager.prototype.getQueryableBusinessObjects = function /** * Use getQueryableLayers to get the queryable business objects, group by bo_id if the same bo is used by two different layers * @param {boolean} bOnlyVisible true if you want to get only the visible layers + * @param {boolean} bSelectionEnabled true if you want to get only the selection enable bos + * @param {boolean} bLocationEnabled true if you want to get only the location enable bos * @returns {array} the queryables business objects * @export */ -nsVmap.nsMapManager.MapManager.prototype.getQueryableBusinessObjectsAsArray = function (bOnlyVisible) { +nsVmap.nsMapManager.MapManager.prototype.getQueryableBusinessObjectsAsArray = function (bOnlyVisible, bSelectionEnabled, bLocationEnabled) { oVmap.log('nsVmap.nsMapManager.MapManager.prototype.getQueryableBusinessObjectsAsArray'); var aQueryableBOs = []; - var oQueryableBOs = this.getQueryableBusinessObjects(bOnlyVisible); + var oQueryableBOs = this.getQueryableBusinessObjects(bOnlyVisible, bSelectionEnabled, bLocationEnabled); for (var key in oQueryableBOs) { aQueryableBOs.push(oQueryableBOs[key]); @@ -1578,16 +1603,35 @@ nsVmap.nsMapManager.MapManager.prototype.getQueryableGetFeatureInfoLayers = func * @returns {object} * @export */ -nsVmap.nsMapManager.MapManager.prototype.getInsertableBusinessObjects = function () { +nsVmap.nsMapManager.MapManager.prototype.getInsertableBusinessObjects = function (bOnlyVisible, bSelectionEnabled, bLocationEnabled) { oVmap.log('nsVmap.nsMapManager.MapManager.prototype.getInsertableBusinessObjects'); - var oBusinessObjects = this.getBusinessObjectsFromLayers(this.getQueryableLayers()); + var oBusinessObjects = this.getBusinessObjectsFromLayers(this.getQueryableLayers(bOnlyVisible)); var aInsertableBOs = []; + var bSelectionTestPass = true; + var bLocationTestPass = true; for (var key in oBusinessObjects) { if (goog.isDefAndNotNull(oBusinessObjects[key]['bo_user_rights'])) { if (oBusinessObjects[key]['bo_user_rights'].indexOf('INSERT') !== -1) { - aInsertableBOs.push(oBusinessObjects[key]); + + bSelectionTestPass = true; + bLocationTestPass = true; + + if (bSelectionEnabled) { + if (!oBusinessObjects[key]['bo_enable_selection']) { + bSelectionTestPass = false; + } + } + if (bLocationEnabled) { + if (!oBusinessObjects[key]['bo_enable_location']) { + bLocationTestPass = false; + } + } + + if (bSelectionTestPass && bLocationTestPass) { + aInsertableBOs.push(oBusinessObjects[key]); + } } } } diff --git a/src/module_vmap/module/javascript/app/vmap/tools/insert.js b/src/module_vmap/module/javascript/app/vmap/tools/insert.js index ce07b2686567b9c5002a2441209ecb8a80568318..3e2a40ce1ede6f7d9f266c25b9d54b077e6eb669 100644 --- a/src/module_vmap/module/javascript/app/vmap/tools/insert.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/insert.js @@ -256,7 +256,7 @@ nsVmap.nsToolsManager.Insert.prototype.inserttoolController = function ($scope, /** * Queryable Business Objects */ - $scope['aQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjectsAsArray(true); + $scope['aQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjectsAsArray(true, true, false); /** * Business objects avaliable for avoiding superpositions @@ -416,8 +416,8 @@ nsVmap.nsToolsManager.Insert.prototype.inserttoolController.prototype.loadInsert this.$scope_.$applyAsync(function () { setTimeout(function () { - this_.$scope_['aInsertableBOs'] = oVmap.getMapManager().getInsertableBusinessObjects(); - this_.$scope_['aQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjectsAsArray(true); + this_.$scope_['aInsertableBOs'] = oVmap.getMapManager().getInsertableBusinessObjects(true, true, false); + this_.$scope_['aQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjectsAsArray(true, true, false); // Mobile: cache le bouton "Insertion" si aucun bo est insertable if (goog.isDefAndNotNull(this_.$scope_['aInsertableBOs'])) { diff --git a/src/module_vmap/module/javascript/app/vmap/tools/location.js b/src/module_vmap/module/javascript/app/vmap/tools/location.js index 415bd9cb19f286c3fcb11ea2c8818f5b60dc3c30..f5af7b5693fa3f287a97555e391ad4a5f4a9422f 100644 --- a/src/module_vmap/module/javascript/app/vmap/tools/location.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/location.js @@ -348,7 +348,7 @@ nsVmap.nsToolsManager.Location.prototype.locationController.prototype.addScale = nsVmap.nsToolsManager.Location.prototype.locationController.prototype.setBusinessObjectsList = function () { oVmap.log('nsVmap.nsToolsManager.Location.prototype.locationController.prototype.setBusinessObjectsList'); - this['oBusinessObjects'] = oVmap.getMapManager().getQueryableBusinessObjects(); + this['oBusinessObjects'] = oVmap.getMapManager().getQueryableBusinessObjects(false, false, true); }; /** diff --git a/src/module_vmap/module/javascript/app/vmap/tools/select/advancedselect.js b/src/module_vmap/module/javascript/app/vmap/tools/select/advancedselect.js index 85c43ac9b53b1510174e8165b7d3b609a2f9099a..1d4d012dc803bac2e46aa6a8995e1bf062c38feb 100644 --- a/src/module_vmap/module/javascript/app/vmap/tools/select/advancedselect.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/select/advancedselect.js @@ -185,7 +185,7 @@ nsVmap.nsToolsManager.AdvancedSelect.prototype.AdvancedSelectController = functi /** * Queryable business objects */ - this['oQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjects(true); + this['oQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjects(true, true, false); /** * Business objects list @@ -237,7 +237,7 @@ nsVmap.nsToolsManager.AdvancedSelect.prototype.AdvancedSelectController = functi this_.$scope_.$applyAsync(function () { // rempli this.oQueryableBOs - this_['oQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjects(true); + this_['oQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjects(true, true, false); // rempli this.aBusinessObjectsList goog.array.clear(this_['aBusinessObjectsList']); @@ -448,7 +448,7 @@ nsVmap.nsToolsManager.AdvancedSelect.prototype.AdvancedSelectController.prototyp this.EWKTGeometry = EWKTGeometry; // Récupère la liste des bo interrogeables - var oQueryableBOs = oVmap.getMapManager().getQueryableBusinessObjects(true); + var oQueryableBOs = oVmap.getMapManager().getQueryableBusinessObjects(true, true, false); // Met le compteur de requêtes en cours au nombre de requêtes à effectuer this.requestCounter_ = Object.keys(oQueryableBOs).length; diff --git a/src/module_vmap/module/javascript/app/vmap/tools/select/basicselect.js b/src/module_vmap/module/javascript/app/vmap/tools/select/basicselect.js index 200baf000377bef18fafd189872aea028fddca67..cd9c3943d6433202f21825bcf74e4b98006c7185 100755 --- a/src/module_vmap/module/javascript/app/vmap/tools/select/basicselect.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/select/basicselect.js @@ -835,8 +835,8 @@ nsVmap.nsToolsManager.BasicSelect.prototype.basicSelectController.prototype.setQ // rempli this.oQueryableBOs et aQueryableBOs this_['aQueryableLayers'] = oVmap.getMapManager().getQueryableGetFeatureInfoLayers(true); - this_['oQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjects(true); - this_['aQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjectsAsArray(true); + this_['oQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjects(true, true, false); + this_['aQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjectsAsArray(true, true, false); this_['aBusinessObjectsList'] = Object.keys(this_['oQueryableBOs']); // Élément sélectionné par défaut diff --git a/src/module_vmap/module/javascript/app/vmap/tools/select/select.js b/src/module_vmap/module/javascript/app/vmap/tools/select/select.js index 0944cee5c36c0157e090e853d22cadfe027a9f6e..40e7600350320c0c3a9d0e026ba2554433e1bdad 100755 --- a/src/module_vmap/module/javascript/app/vmap/tools/select/select.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/select/select.js @@ -688,7 +688,7 @@ nsVmap.nsToolsManager.Select.prototype.selectController.prototype.loadQueryableB this_.$scope_.$applyAsync(function () { setTimeout(function () { - this_['aQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjectsAsArray(true); + this_['aQueryableBOs'] = oVmap.getMapManager().getQueryableBusinessObjectsAsArray(true, true, false); // Snapping for (var i = 0; i < this_['aQueryableBOs'].length; i++) { diff --git a/src/module_vmap/module/lang/lang-en.json b/src/module_vmap/module/lang/lang-en.json index eab78cc74027afaac5003c5388bb0b04712f5b35..22870579e4c6a05d7fee7d8247e3199325d51741 100644 --- a/src/module_vmap/module/lang/lang-en.json +++ b/src/module_vmap/module/lang/lang-en.json @@ -185,6 +185,10 @@ "FORM_MAX_SNAPPING_SCALE_VMAP_BUSINESS_OBJECT_TOOLTIP": "Maximum edition scale", "FORM_MIN_SNAPPING_SCALE_VMAP_BUSINESS_OBJECT": "Minimum edition scale", "FORM_MIN_SNAPPING_SCALE_VMAP_BUSINESS_OBJECT_TOOLTIP": "Minimum edition scale", + "FORM_SELECTABLE_VMAP_BUSINESS_OBJECT": "Enable selection", + "FORM_SELECTABLE_VMAP_BUSINESS_OBJECT_TOOLTIP": "Display the object on tools i, i+ and insertion", + "FORM_LOCATABLE_VMAP_BUSINESS_OBJECT": "Enable locate", + "FORM_LOCATABLE_VMAP_BUSINESS_OBJECT_TOOLTIP": "Display the object on the locate tool", "LIST_DELETE_CONFIRM_VMAP_BUSINESS_OBJECT": "Delete the selected items and associations with layers?", "": "", "FORM_TITLE_VMAP_MODULE_MODULE": "Module {{::label}}", diff --git a/src/module_vmap/module/lang/lang-fr.json b/src/module_vmap/module/lang/lang-fr.json index 0a145e8784af9e5a8040f3f221f37187279f8b87..c8fbb96d7d8d74812d0fe9c5e7fabd27320f4e91 100644 --- a/src/module_vmap/module/lang/lang-fr.json +++ b/src/module_vmap/module/lang/lang-fr.json @@ -185,6 +185,10 @@ "FORM_MAX_SNAPPING_SCALE_VMAP_BUSINESS_OBJECT_TOOLTIP": "Échelle à partir de laquelle la saisie ne sera plus possible : il faudra zoomer pour reprendre la saisie", "FORM_MIN_SNAPPING_SCALE_VMAP_BUSINESS_OBJECT": "Échelle minimale de saisie", "FORM_MIN_SNAPPING_SCALE_VMAP_BUSINESS_OBJECT_TOOLTIP": "Échelle à partir de laquelle la saisie sera possible : il faudra dézoomer pour reprendre la saisie", + "FORM_SELECTABLE_VMAP_BUSINESS_OBJECT": "Objet sélectionnable", + "FORM_SELECTABLE_VMAP_BUSINESS_OBJECT_TOOLTIP": "Affiche l'objet dans les listes des outils i, i+ et insertion (ne garantit pas la sécurité de la donnée)", + "FORM_LOCATABLE_VMAP_BUSINESS_OBJECT": "Objet localisable", + "FORM_LOCATABLE_VMAP_BUSINESS_OBJECT_TOOLTIP": "Affiche l'objet dans la liste de l'outil de localisation (ne garantit pas la sécurité de la donnée)", "LIST_DELETE_CONFIRM_VMAP_BUSINESS_OBJECT": "Supprimer les objets métiers sélectionnés et les associations avec les calques ?", "": "", "FORM_TITLE_VMAP_MODULE_MODULE": "Module {{::label}}", diff --git a/src/module_vmap/web_service/sql/sqlQueries.xml b/src/module_vmap/web_service/sql/sqlQueries.xml index 154432cea097cc593b09d576b7179107eeeaf144..d3109edecc1cc39dc4fecbfb44c362087fb92139 100644 --- a/src/module_vmap/web_service/sql/sqlQueries.xml +++ b/src/module_vmap/web_service/sql/sqlQueries.xml @@ -1160,6 +1160,10 @@ ALTER TABLE s_vmap.v_user_defaultmap OWNER TO u_vitis; GRANT ALL ON TABLE s_vmap.v_user_defaultmap TO vmap_admin; GRANT SELECT ON TABLE s_vmap.v_user_defaultmap TO vmap_user; + -- Armand 02/01/2019 10:27 Ajout des colonnes enable_selection et enable_location + ALTER TABLE s_vmap.business_object ADD COLUMN enable_selection boolean; + ALTER TABLE s_vmap.business_object ADD COLUMN enable_location boolean; + UPDATE s_vmap.business_object SET enable_selection=true, enable_location=true; ]]> </code> </query> diff --git a/src/module_vmap/web_service/ws/BusinessObject.class.inc b/src/module_vmap/web_service/ws/BusinessObject.class.inc index b3da1a450873ab4e1f76bae4ac4d0c60fe9c1f55..ba6c8a045c1f09fc523b786231592909c5fb546f 100644 --- a/src/module_vmap/web_service/ws/BusinessObject.class.inc +++ b/src/module_vmap/web_service/ws/BusinessObject.class.inc @@ -31,7 +31,7 @@ class BusinessObject extends Vmap { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array("business_object_id", "title", "formtitle", "summarytitle", "id_field", "database", "schema", "table", "sql_summary", "sql_list", "sorted_by", "geom_column", "search_field", "result_field", "search_use_strict", "event_id", "index", "add_form_size", "edit_form_size", "display_form_size", "selection_buffer", "user_rights", "max_edition_scale", "min_edition_scale"); + $this->aSelectedFields = Array("business_object_id", "title", "formtitle", "summarytitle", "id_field", "database", "schema", "table", "sql_summary", "sql_list", "sorted_by", "geom_column", "search_field", "result_field", "search_use_strict", "event_id", "index", "add_form_size", "edit_form_size", "display_form_size", "selection_buffer", "user_rights", "max_edition_scale", "min_edition_scale", "enable_selection", "enable_location"); } /** diff --git a/src/module_vmap/web_service/ws/BusinessObjects.class.inc b/src/module_vmap/web_service/ws/BusinessObjects.class.inc index fa7ca58d1eaf4d159d82c3498a6c75caf20b1d79..6479b6aa94a034329e6ad8d56a68076a75fc29f5 100755 --- a/src/module_vmap/web_service/ws/BusinessObjects.class.inc +++ b/src/module_vmap/web_service/ws/BusinessObjects.class.inc @@ -42,7 +42,7 @@ class BusinessObjects extends Vmap { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array("business_object_id", "title", "formtitle", "summarytitle", "id_field", "database", "schema", "table", "sql_summary", "sql_list", "sorted_by", "geom_column", "search_field", "result_field", "search_use_strict", "event_id", "index", "add_form_size", "edit_form_size", "display_form_size", "selection_buffer", "user_rights", "max_edition_scale", "min_edition_scale"); + $this->aSelectedFields = Array("business_object_id", "title", "formtitle", "summarytitle", "id_field", "database", "schema", "table", "sql_summary", "sql_list", "sorted_by", "geom_column", "search_field", "result_field", "search_use_strict", "event_id", "index", "add_form_size", "edit_form_size", "display_form_size", "selection_buffer", "user_rights", "max_edition_scale", "min_edition_scale", "enable_selection", "enable_location"); } /**