diff --git a/src/module_vmap/module/forms/users/users_vitis_users_vmap_user.json b/src/module_vmap/module/forms/users/users_vitis_users_vmap_user.json index d922e45e1ba3d4d778a9e8e27b7b55a2a0e29ca5..1136d285e019d9c7209295c175e274becd0f57eb 100755 --- a/src/module_vmap/module/forms/users/users_vitis_users_vmap_user.json +++ b/src/module_vmap/module/forms/users/users_vitis_users_vmap_user.json @@ -1,4 +1,19 @@ { + "datasources": { + "datasource_1": { + "type": "web_service", + "dataType": "webService", + "name": "datasource_maps", + "description": "", + "ressource_id": "vmap/Maps", + "webservice": { + "name": "vmap" + }, + "ressource": { + "name": "Maps" + } + } + }, "search":{ }, @@ -19,6 +34,27 @@ } ] }, + { + "fields": [ + { + "type": "select", + "name": "default_map", + "label": "FORM_DEFAULT_MAP_USERS_USER_VMAP_USER", + "required": false, + "nb_cols": 12, + "datasource": { + "datasource_id": "datasource_1", + "sort_order": "ASC", + "distinct": "true", + "label_key": "name", + "order_by": "name", + "id_key": "map_id", + "attributs": "map_id|name" + }, + "id_from": "Element_0_6_1_from" + } + ] + }, { "fields":[ { @@ -87,6 +123,28 @@ } ] }, + { + "fields": [ + { + "type": "select", + "name": "default_map", + "label": "FORM_DEFAULT_MAP_USERS_USER_VMAP_USER", + "required": false, + "disabled": true, + "nb_cols": 12, + "datasource": { + "datasource_id": "datasource_1", + "sort_order": "ASC", + "distinct": "true", + "label_key": "name", + "order_by": "name", + "id_key": "map_id", + "attributs": "map_id|name" + }, + "id_from": "Element_0_6_1_from" + } + ] + }, { "fields":[ { @@ -117,4 +175,4 @@ } ] } -} \ No newline at end of file +} 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 dfca19f973cb24a29baabc9d4d03dbef574b89c8..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}}", @@ -217,6 +221,7 @@ "FORM_MAP_USERS_VMAP_PRINT_STYLE": "Users linked to style", "": "", "FORM_ID_USERS_USER_VMAP_USER": "ID", + "FORM_DEFAULT_MAP_USERS_USER_VMAP_USER": "Default map", "FORM_PRINT_STYLES_USERS_USER_VMAP_USER": "Print styles", "FORM_PRINT_STYLES_AVAILABLE_USERS_USER_VMAP_USER": "Available print styles", "FORM_GROUP_PRINT_STYLES_USERS_USER_VMAP_USER": "Print styles linked to user", diff --git a/src/module_vmap/module/lang/lang-fr.json b/src/module_vmap/module/lang/lang-fr.json index a1b1a7bbd94917d3d4b0021295bd5cac3f109774..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}}", @@ -217,6 +221,7 @@ "FORM_MAP_USERS_VMAP_PRINT_STYLE": "Utilisateurs liés au style", "": "", "FORM_ID_USERS_USER_VMAP_USER": "ID", + "FORM_DEFAULT_MAP_USERS_USER_VMAP_USER": "Carte par défaut", "FORM_PRINT_STYLES_USERS_USER_VMAP_USER": "Styles d'impression", "FORM_PRINT_STYLES_AVAILABLE_USERS_USER_VMAP_USER": "Styles d'impression disponibles", "FORM_GROUP_PRINT_STYLES_USERS_USER_VMAP_USER": "Styles d'impression liés à l'utilisateur", diff --git a/src/module_vmap/web_service/sql/sqlQueries.xml b/src/module_vmap/web_service/sql/sqlQueries.xml index a7a4ff6699e62b6fb67a7b5637015655befbf6d5..d3109edecc1cc39dc4fecbfb44c362087fb92139 100644 --- a/src/module_vmap/web_service/sql/sqlQueries.xml +++ b/src/module_vmap/web_service/sql/sqlQueries.xml @@ -1145,5 +1145,27 @@ ]]> </code> </query> + <query> + <type>update</type> + <version>2019.01.00</version> + <code> + <![CDATA[ + -- Armand 02/01/2019 Ajout carte par défaut par utilisateur + CREATE TABLE s_vmap.user_defaultmap ( user_id integer NOT NULL, map_id integer NOT NULL, CONSTRAINT user_defaultmap_pkey PRIMARY KEY (map_id, user_id), CONSTRAINT fk_user_defaultmap_user FOREIGN KEY (user_id) REFERENCES s_vitis."user" (user_id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE, CONSTRAINT fk_user_defaultmap_map FOREIGN KEY (map_id) REFERENCES s_vmap.map (map_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION) WITH ( OIDS=FALSE); + ALTER TABLE s_vmap.user_defaultmap OWNER TO u_vitis; + GRANT ALL ON TABLE s_vmap.user_defaultmap TO u_vitis; + GRANT ALL ON TABLE s_vmap.user_defaultmap TO vmap_admin; + GRANT SELECT ON TABLE s_vmap.user_defaultmap TO vmap_user; + CREATE OR REPLACE VIEW s_vmap.v_user_defaultmap AS SELECT user_defaultmap.map_id, user_defaultmap.user_id FROM s_vmap.user_defaultmap WHERE user_defaultmap.user_id = ( SELECT "user".user_id FROM s_vitis."user" WHERE "user".login::name = CURRENT_USER ); + 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> </queriesCollection> </sqlQueries> 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"); } /** diff --git a/src/module_vmap/web_service/ws/MapCatalog.class.inc b/src/module_vmap/web_service/ws/MapCatalog.class.inc index 34e8a343a09402b2728ff8e2f7952bb479d40099..01c90bad020d7a88026ee1481c30cd5cc3de0651 100755 --- a/src/module_vmap/web_service/ws/MapCatalog.class.inc +++ b/src/module_vmap/web_service/ws/MapCatalog.class.inc @@ -16,7 +16,7 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection * \brief This file contains the Map php class * * This class defines operation for one Map - * + * */ class MapCatalog extends Vmap { @@ -39,7 +39,7 @@ class MapCatalog extends Vmap { } /** - * @SWG\Get(path="/mapcatalog", + * @SWG\Get(path="/mapcatalog", * tags={"Catalog"}, * summary="Get Map", * description="Request to get Map by id", @@ -74,13 +74,13 @@ class MapCatalog extends Vmap { // Récupère les groupes correspondants $sGroups = $this->oConnection->sesGroup; - // Récupère les cartes correspondante + // Récupère les cartes correspondante $aMaps = $this->getMaps($sGroups); // Récupère les services correspondants $aServices = $this->getServices(); - $MapCatalog['usedMap'] = 0; + $MapCatalog['usedMap'] = $this->getDefaultMap($aMaps); $MapCatalog['maps'] = $aMaps; $MapCatalog['services'] = $aServices; @@ -238,6 +238,40 @@ class MapCatalog extends Vmap { return $aServices; } + /** + * getDefaultMap - get the default map index + * + * @param {array} $aMaps + * @return {number} default map index + */ + function getDefaultMap($aMaps) { + require $this->sRessourcesFile; + + $iDefaultMapId = false; + $iDefaultMapIndex = 0; + + // Récupère la carte par défaut de l'utilisateur en cours + $sSql = $aSql['getCurrentUserDefaultMap']; + $aSQLParams = array( + 'sSchemaFramework' => array('value' => $this->aProperties['schema_framework'], 'type' => 'schema_name'), + 'sSchemaVmap' => array('value' => $this->aProperties['schema_vmap'], 'type' => 'column_name') + ); + $oPDOresult = $this->oConnection->oBd->executeWithParams($sSql, $aSQLParams); + while($aLigne=$this->oConnection->oBd->ligneSuivante ($oPDOresult)) { + $iDefaultMapId = $aLigne['map_id']; + } + + if ($iDefaultMapId !== false) { + for ($i=0; $i < count($aMaps); $i++) { + if ($aMaps[$i]['map_id'] == $iDefaultMapId) { + $iDefaultMapIndex = $i; + } + } + } + + return $iDefaultMapIndex; + } + function httpPost($url, $params) { $postData = ''; //create name value pairs seperated by & @@ -262,4 +296,4 @@ class MapCatalog extends Vmap { } -?> \ No newline at end of file +?> diff --git a/src/module_vmap/web_service/ws/Vmap.class.sql.inc b/src/module_vmap/web_service/ws/Vmap.class.sql.inc index cf54181a5398368ea642685ca3d390afdb6f49e2..3b44532a96922a1c7600ff79d57e63dde66cc6ea 100755 --- a/src/module_vmap/web_service/ws/Vmap.class.sql.inc +++ b/src/module_vmap/web_service/ws/Vmap.class.sql.inc @@ -27,6 +27,10 @@ $aSql['updateMapLayerOpacity'] = "UPDATE [sSchemaVmap].map_layer SET layer_opaci // VmapUsers $aSql['getUserPrintStyles'] = "SELECT user_printstyle.printstyle_id,printstyle.name FROM [sSchemaVmap].user_printstyle LEFT JOIN [sSchemaVmap].printstyle ON user_printstyle.printstyle_id = printstyle.printstyle_id WHERE user_printstyle.user_id = [user_id]"; $aSql['insertUserPrintStyles'] = "INSERT INTO [sSchemaVmap].user_printstyle(user_id, printstyle_id) VALUES([user_id], [printstyle_id])"; +$aSql['getUserDefaultMap'] = "SELECT user_defaultmap.map_id FROM [sSchemaVmap].user_defaultmap WHERE user_defaultmap.user_id = [user_id]"; +$aSql['getCurrentUserDefaultMap'] = "SELECT map_id FROM [sSchemaVmap].v_user_defaultmap"; +$aSql['removeUserDefaultMap'] = "DELETE FROM [sSchemaVmap].user_defaultmap WHERE user_defaultmap.user_id = [user_id]"; +$aSql['insertUserDefaultMap'] = "INSERT INTO [sSchemaVmap].user_defaultmap(user_id, map_id) VALUES([user_id], [map_id])"; // PrintTemplates $aSql['getPrintTemplateParameters'] = "SELECT * FROM [sSchemaVmap].v_print_parameter WHERE printtemplate_id=[printtemplate_id]"; $aSql['insertPrintTemplateGroups'] = "INSERT INTO [sSchemaVmap].printtemplate_group(group_id, printtemplate_id) VALUES([group_id], [printtemplate_id])"; @@ -42,4 +46,4 @@ $aSql['setLayerBoId'] = "UPDATE [sSchemaVmap].layer SET bo_id = NULL WHERE layer $aSql['deleteAssociatedBos'] = "DELETE FROM [sSchemaVmap].layer_businessobject WHERE layer_id = [layer_id]"; $aSql['deleteAssociatedLayers'] = "DELETE FROM [sSchemaVmap].layer_businessobject WHERE business_object_id = [business_object_id]"; $aSql['addAssociatedBos'] = "INSERT INTO [sSchemaVmap].layer_businessobject(layer_id, business_object_id) VALUES ([layer_id], [business_object_id]);"; -?> \ No newline at end of file +?> diff --git a/src/module_vmap/web_service/ws/VmapUser.class.inc b/src/module_vmap/web_service/ws/VmapUser.class.inc index d2225a63c1ddcc1b2aa30fabf6ed3beac354bafa..41a75bbadce8a33b391ea037d1aa93291d5efc8c 100755 --- a/src/module_vmap/web_service/ws/VmapUser.class.inc +++ b/src/module_vmap/web_service/ws/VmapUser.class.inc @@ -10,10 +10,10 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection * \brief This file contains the VmapUser php class * * This class defines operation for one User -* +* */ class VmapUser extends Vmap { - + public $oError; /** * construct @@ -25,10 +25,10 @@ class VmapUser extends Vmap { */ function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); - $this->aSelectedFields = Array("user_id", "login", "print_styles"); + $this->aSelectedFields = Array("user_id", "login", "print_styles", "default_map"); } /** - * @SWG\Get(path="/vmapusers/{user_id}", + * @SWG\Get(path="/vmapusers/{user_id}", * tags={"Users"}, * summary="Get User", * description="Request to get user by id", @@ -69,31 +69,50 @@ class VmapUser extends Vmap { require $this->sRessourcesFile; $this->aFields = $this->getFields($this->aProperties['schema_framework'], "v_user", "user_id"); $this->getPrintStyles(); + $this->getDefaultMap(); } - + /** - * get print styles of user - */ + * get print styles of user + */ function getPrintStyles(){ require $this->sRessourcesFile; if (in_array("print_styles", $this->aSelectedFields)){ - $aParams['sSchemaVmap'] = array('value' => $this->aProperties['schema_vmap'], 'type' => 'schema_name'); - $aParams['user_id'] = array('value' => $this->aValues['my_vitis_id'], 'type' => 'number'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getUserPrintStyles'], $aParams); - $sListPrintStyleId = ""; - $aListPrintStyleId = array(); - while($aLigne=$this->oConnection->oBd->ligneSuivante ($oPDOresult)) { - if ($sListPrintStyleId == ""){ - $sListPrintStyleId = $aLigne["printstyle_id"]; - }else{ - $sListPrintStyleId .= "|".$aLigne["printstyle_id"]; - } - $aListPrintStyleId[] = $aLigne["name"]; - } - $oPDOresult=$this->oConnection->oBd->fermeResultat(); - $this->aFields['print_styles'] = $sListPrintStyleId; - $this->aFields['print_styles_label'] = implode(',', $aListPrintStyleId); + $aParams['sSchemaVmap'] = array('value' => $this->aProperties['schema_vmap'], 'type' => 'schema_name'); + $aParams['user_id'] = array('value' => $this->aValues['my_vitis_id'], 'type' => 'number'); + $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getUserPrintStyles'], $aParams); + $sListPrintStyleId = ""; + $aListPrintStyleId = array(); + while($aLigne=$this->oConnection->oBd->ligneSuivante ($oPDOresult)) { + if ($sListPrintStyleId == ""){ + $sListPrintStyleId = $aLigne["printstyle_id"]; + }else{ + $sListPrintStyleId .= "|".$aLigne["printstyle_id"]; + } + $aListPrintStyleId[] = $aLigne["name"]; + } + $oPDOresult=$this->oConnection->oBd->fermeResultat(); + $this->aFields['print_styles'] = $sListPrintStyleId; + $this->aFields['print_styles_label'] = implode(',', $aListPrintStyleId); + } + } + + /** + * get the user default map + */ + function getDefaultMap(){ + require $this->sRessourcesFile; + if (in_array("default_map", $this->aSelectedFields)){ + $aParams['sSchemaVmap'] = array('value' => $this->aProperties['schema_vmap'], 'type' => 'schema_name'); + $aParams['user_id'] = array('value' => $this->aValues['my_vitis_id'], 'type' => 'number'); + $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getUserDefaultMap'], $aParams); + $sDefaultMapId = ""; + while($aLigne=$this->oConnection->oBd->ligneSuivante ($oPDOresult)) { + $sDefaultMapId = $aLigne['map_id']; + } + $oPDOresult=$this->oConnection->oBd->fermeResultat(); + $this->aFields['default_map'] = $sDefaultMapId; } } } -?> \ No newline at end of file +?> diff --git a/src/module_vmap/web_service/ws/VmapUsers.class.inc b/src/module_vmap/web_service/ws/VmapUsers.class.inc index ed8262b4f3b894ad2249154423789106444ad166..84088f8bf484bd7216703065b3b10c63bbb05c29 100755 --- a/src/module_vmap/web_service/ws/VmapUsers.class.inc +++ b/src/module_vmap/web_service/ws/VmapUsers.class.inc @@ -9,7 +9,7 @@ * \brief This file contains the Modes php class * * This class defines Rest Api to Vmap Users -* +* */ require_once 'Vmap.class.inc'; require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; @@ -17,7 +17,7 @@ require_once 'VmapUser.class.inc'; require_once(dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'); class VmapUsers extends Vmap { - + /** * @SWG\Definition( * definition="/vmapusers", @@ -42,7 +42,7 @@ class VmapUsers extends Vmap { parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); $this->aSelectedFields = Array("user_id", "login", "print_styles"); } - + /** * get Users * @return Users @@ -51,7 +51,7 @@ class VmapUsers extends Vmap { $aReturn = $this->genericGet( $this->aProperties['schema_framework'], "v_user", "user_id"); return $aReturn['sMessage']; } - + /** * @SWG\Put(path="/vmapusers/{user_id}", * tags={"Users"}, @@ -106,10 +106,10 @@ class VmapUsers extends Vmap { $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); // Supprime les styles d'impression rattachés à l'utilisateur. $this->oConnection->oBd->delete($this->aProperties['schema_vmap'], 'user_printstyle', 'user_id', $this->aValues["my_vitis_id"]); - // Styles d'impression à rattacher au usere ? + // Styles d'impression à rattacher au user ? if (!empty($this->aValues['print_styles'])) { $aPrintStyles = explode('|', $this->aValues['print_styles']); - foreach ($aPrintStyles as $iPrintStyleId) { + foreach ($aPrintStyles as $iPrintStyleId) { $sSql = $aSql['insertUserPrintStyles']; $aSQLParams = array( 'sSchemaVmap' => array('value' => $this->aProperties['schema_vmap'], 'type' => 'column_name'), @@ -125,7 +125,31 @@ class VmapUsers extends Vmap { } } } + // Carte par défaut à rattacher au user ? + // Supprime la carte par défaut + $sSql = $aSql['removeUserDefaultMap']; + $aSQLParams = array( + 'sSchemaVmap' => array('value' => $this->aProperties['schema_vmap'], 'type' => 'column_name'), + 'user_id' => array('value' => $this->aValues["my_vitis_id"], 'type' => 'number') + ); + $resultat = $this->oConnection->oBd->executeWithParams($sSql, $aSQLParams); + if (!empty($this->aValues['default_map'])) { + // Ajoute la carte par défaut + $sSql = $aSql['insertUserDefaultMap']; + $aSQLParams = array( + 'sSchemaVmap' => array('value' => $this->aProperties['schema_vmap'], 'type' => 'column_name'), + 'user_id' => array('value' => $this->aValues["my_vitis_id"], 'type' => 'number'), + 'map_id' => array('value' => $this->aValues['default_map'], 'type' => 'number') + ); + $resultat = $this->oConnection->oBd->executeWithParams($sSql, $aSQLParams); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + $oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + } + } return $sMessage; } } -?> \ No newline at end of file +?> diff --git a/src/vitis/client/javascript/externs/formReader/formReaderDrtv.js b/src/vitis/client/javascript/externs/formReader/formReaderDrtv.js index b1d3ba9bc5d670cda51c35656f8dac26274c36a1..8c065e61e984b8a61df5f948fa42cac33e9d89bf 100644 --- a/src/vitis/client/javascript/externs/formReader/formReaderDrtv.js +++ b/src/vitis/client/javascript/externs/formReader/formReaderDrtv.js @@ -504,6 +504,7 @@ formReader.formReaderDirective = function ($q, formReaderService, propertiesSrvc } } } + /** * Ajoute des watchers pour déclencher les dynamic values * @@ -713,6 +714,20 @@ formReader.formReaderDirective = function ($q, formReaderService, propertiesSrvc return parseFloat(sField); } + /** + * Transforme une date en timestamp + * + * @param {type} sDate description + * @return {type} description + */ + scope['timestamp'] = function(sDate) { + var aDate=sDate.split("/"); + var aTime=sDate.split(" "); + var isoDate = aDate[1] + '/' + aDate[0] + '/' + aDate[2]; + var sTimestamp = new Date(isoDate).getTime(); + return sTimestamp; + } + // Attend la suppression du scope. scope.$on("$destroy", function () { // Supprime toutes les données du formulaire. diff --git a/src/vitis/client/javascript/externs/formReader/formReaderSrvc.js b/src/vitis/client/javascript/externs/formReader/formReaderSrvc.js index c4dfddeb1f64979e0a7e8cd0529c290ab78eab81..968cad293fc5ccd4b929e97cc640952d919e7fee 100644 --- a/src/vitis/client/javascript/externs/formReader/formReaderSrvc.js +++ b/src/vitis/client/javascript/externs/formReader/formReaderSrvc.js @@ -707,6 +707,8 @@ formReader.formReaderService = function ($translate, $rootScope, $q, $log, $time */ "translateCustomTernaryString": function (sString, bIsCondition, oFormValues, sFormDefinitionName) { + var this_ = this; + // Verif type if (!goog.isString(sString)) { return null; @@ -725,6 +727,7 @@ formReader.formReaderService = function ($translate, $rootScope, $q, $log, $time // Remplace les attributs var sReplacer; + var sValue; for (var i = 0; i < aAttrs.length; i++) { if (goog.isDefAndNotNull(aAttrs[i][0]) && goog.isDefAndNotNull(aAttrs[i][1])) { @@ -739,12 +742,26 @@ formReader.formReaderService = function ($translate, $rootScope, $q, $log, $time if (goog.isDefAndNotNull(oFormValues[sFormDefinitionName][aAttrs[i][1]]['selectedOption']['value'])) { sReplacer = 'oFormValues[sFormDefinitionName].' + aAttrs[i][1] + '.selectedOption.value'; } + sValue = oFormValues[sFormDefinitionName][aAttrs[i][1]]['selectedOption']['value']; + } else { + sValue = oFormValues[sFormDefinitionName][aAttrs[i][1]]; } } } } + // log toutes les secondes + var iLogCounter_ = Date.now(); + $rootScope.iLogCounter_ = angular.copy(iLogCounter_); + setTimeout(angular.bind(this, function (sAttr, sValue) { + if (iLogCounter_ === $rootScope.iLogCounter_ && + goog.isDefAndNotNull(sAttr) && + goog.isDefAndNotNull(sValue)) { + $log.log(sAttr + ' : ' + sValue); + } + }, aAttrs[i][0], sValue), 1000); + // Remplace sString = sString.replace(aAttrs[i][0], sReplacer); } } diff --git a/src/vitis/client/javascript/externs/studio/javascript/app/VisualizerMode/FormMode.js b/src/vitis/client/javascript/externs/studio/javascript/app/VisualizerMode/FormMode.js index 86872e18c1b4e658d1b5f6c10839cd58df6e80d5..70d74a4b1a7c931753a447b7924b3d29ed5d404c 100755 --- a/src/vitis/client/javascript/externs/studio/javascript/app/VisualizerMode/FormMode.js +++ b/src/vitis/client/javascript/externs/studio/javascript/app/VisualizerMode/FormMode.js @@ -147,7 +147,7 @@ nsVFB.nsVisualizerMode.FormMode.prototype.visualizerFormModeController = functio // Refresh le formReader angular.element($('#studio_form_reader').children()).scope()['ctrl'].refreshForm(); - angular.element($('#studio_form_reader').children()).scope().$broadcast('loadForm'); + angular.element($('#studio_form_reader').children()).scope()['setFormDynamicValues'](); } else { oVFB.log('visualizerFormModeController. Load JSON form fail: ' + $scope['selected_form_type'] + ' undefined in ', data); diff --git a/src/vitis/client/javascript/externs/studio/templates/ElementForm.html b/src/vitis/client/javascript/externs/studio/templates/ElementForm.html index 05698ebca5c59b75a0341f5788d648db36c6f634..6d8afd0c2bdf057cae928390853988119c2e6e32 100755 --- a/src/vitis/client/javascript/externs/studio/templates/ElementForm.html +++ b/src/vitis/client/javascript/externs/studio/templates/ElementForm.html @@ -2193,7 +2193,7 @@ <span id="Element_Form_dynamic_value_label" class="input-group-addon">{{::ctrl.text.Component.General.Value}}</span> <input ng-disabled="locker" ng-model="model.dynamic_value" - id="Element_Form_value_input" + id="Element_Form_dynamic_value_input" type="text" class="form-control" aria-describedby="Element_Form_dynamic_value_label" @@ -2203,10 +2203,10 @@ <!-- Champ visible --> <div ng-if="model.type != 'hidden'" class="input-group element-margin input-group-xs"> - <span id="Element_Form_visible_label" class="input-group-addon">{{::ctrl.text.Component.General.Visible}}</span> + <span id="Element_Form_dynamic_visible_label" class="input-group-addon">{{::ctrl.text.Component.General.Visible}}</span> <input ng-disabled="locker" ng-model="model.visible" - id="Element_Form_visible_input" + id="Element_Form_dynamic_visible_input" type="text" class="form-control" aria-describedby="Element_Form_visible_label"