From 8aea8eaca162aac52e0b79d05e791517e95022f1 Mon Sep 17 00:00:00 2001 From: Walter Lorenzetti Date: Thu, 9 May 2024 09:39:19 +0200 Subject: [PATCH] Exlude layer from TOC (#841) * Restyling not show capabilities in layer list page. * Exclude from toc workflow * Exclude from toc workflow * Add toc property to layertree * Fix tests * Fix tests * :sparkles: Client https://github.com/g3w-suite/g3w-client/pull/625/commits/4b531f46495acdaaea97b7cc464cf8f8c3ad3597 * exclude_from_toc nullable for retro compatibility * fro retro compatibility * :sparkles: Client https://github.com/g3w-suite/g3w-client/pull/625/commits/ff575d8071a47f46c51a29233e1a53d48884e4b4 * i18n * Update g3wadmin.min.css * Update i18n --------- Co-authored-by: wlorenzetti Co-authored-by: volterra79 Co-authored-by: Raruto --- g3w-admin/client/static/client/js/app.min.js | 2 +- .../client/static/client/js/app.min.js.map | 2 +- g3w-admin/client/tests/test_api.py | 6 +- g3w-admin/core/static/css/g3wadmin.css | 12 +- .../core/static/dist/css/g3wadmin.min.css | 2 +- g3w-admin/qdjango/api/projects/serializers.py | 4 + .../qdjango/locale/de/LC_MESSAGES/djangojs.mo | Bin 0 -> 380 bytes .../qdjango/locale/it/LC_MESSAGES/django.mo | Bin 24426 -> 24273 bytes .../qdjango/locale/it/LC_MESSAGES/django.po | 346 ++++++++++-------- .../migrations/0119_layer_exclude_from_toc.py | 18 + .../0120_alter_layer_exclude_from_toc.py | 18 + g3w-admin/qdjango/models/projects.py | 8 + .../templates/qdjango/layers_list.html | 80 ++-- g3w-admin/qdjango/tests/test_api.py | 3 + g3w-admin/qdjango/views/projects.py | 4 + 15 files changed, 303 insertions(+), 202 deletions(-) create mode 100644 g3w-admin/qdjango/locale/de/LC_MESSAGES/djangojs.mo create mode 100644 g3w-admin/qdjango/migrations/0119_layer_exclude_from_toc.py create mode 100644 g3w-admin/qdjango/migrations/0120_alter_layer_exclude_from_toc.py diff --git a/g3w-admin/client/static/client/js/app.min.js b/g3w-admin/client/static/client/js/app.min.js index 9d616a2f8..b60aab1e4 100644 --- a/g3w-admin/client/static/client/js/app.min.js +++ b/g3w-admin/client/static/client/js/app.min.js @@ -1,2 +1,2 @@ -!function r(i,a,o){function s(t,e){if(!a[t]){if(!i[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}n=a[t]={exports:{}},i[t][0].call(n.exports,function(e){return s(i[t][1][e]||e)},n,n.exports,r,i,a,o)}return a[t].exports}for(var l="function"==typeof require&&require,e=0;e=",lte:"<=",NOT:"!=",eq:"=",gt:">",lt:"<",IN:"IN","NOT IN":"NOT IN",LIKE:"LIKE",ILIKE:"ILIKE",AND:"AND",OR:"OR"}),r=n.FILTER_EXPRESSION_OPERATORS=r({lte:"<=",ltgt:"!=",ilike:"ILIKE",like:"LIKE"},o),s=n.GEOMETRY_FIELDS=["geometryProperty","boundedBy","geom","the_geom","geometry","bbox","GEOMETRY","geoemtria","geometria"],l=n.GEOMETRY_TYPES={POINT:"Point",POINTZ:"PointZ",POINTM:"PointM",POINTZM:"PointZM",POINT25D:"Point25D",MULTIPOINT:"MultiPoint",MULTIPOINTZ:"MultiPointZ",MULTIPOINTM:"MutliPointM",MULTIPOINTZM:"MultiPointZM",MULTIPOINT25D:"MultiPoint25D",LINESTRING:"LineString",LINESTRINGZ:"LineStringZ",LINESTRINGM:"LineStringM",LINESTRINGZM:"LineStringZM",LINESTRING25D:"LineString25D",LINE:"Line",LINEZ:"LineZ",LINEM:"LineM",LINEZM:"LineZM",LINE25D:"Line25D",MULTILINESTRING:"MultiLineString",MULTILINESTRINGZ:"MultiLineStringZ",MULTILINESTRINGM:"MultiLineStringM",MULTILINESTRINGZM:"MultiLineStringZM",MULTILINESTRING25D:"MultiLineString25D",MULTILINE:"MultiLine",MULTILINEZ:"MultiLineZ",MULTILINEM:"MultiLineM",MULTILINEZM:"MultiLineZM",MULTILINE25D:"MultiLine25D",POLYGON:"Polygon",POLYGONZ:"PolygonZ",POLYGONM:"PolygonM",POLYGONZM:"PolygonZM",POLYGON25D:"Polygon25D",MULTIPOLYGON:"MultiPolygon",MULTIPOLYGONZ:"MultiPolygonZ",MULTIPOLYGONM:"MultiPolygonM",MULTIPOLYGONZM:"MultiPolygonZM",MULTIPOLYGON25D:"MultiPolygon25D",GEOMETRYCOLLECTION:"GeometryCollection",GEOMETRYCOLLECTIONZ:"GeometryCollectionZ",GEOMETRYCOLLECTIONM:"GeometryCollectionM",GEOMETRYCOLLECTIONZM:"GeometryCollectionZM",GEOMETRYCOLLECTION25D:"GeometryCollection25D"},u=(n.LIST_OF_RELATIONS_TITLE="info.list_of_relations",n.LIST_OF_RELATIONS_ID="__G3W_LIST_OF_RELATIONS_ID__",n.LOCALSTORAGE_EXTERNALWMS_ITEM="externalwms",n.MAP_SETTINGS={ZOOM:{maxScale:1e3},ANIMATION:{duration:2e3},LAYER_POSITIONS:{default:"top",getPositions:function(){return["top","bottom"]}}}),c=n.PRINT_FORMATS=[{value:"png",label:"PNG"},{value:"pdf",label:"PDF"},{value:"geopdf",label:"GEOPDF"}],d=n.PRINT_RESOLUTIONS=[150,300],p=n.PRINT_SCALES=[{value:100,label:"1:100"},{value:200,label:"1:200"},{value:500,label:"1:500"},{value:1e3,label:"1:1.000"},{value:2e3,label:"1:2.000"},{value:2500,label:"1:2.500"},{value:5e3,label:"1:5.000"},{value:1e4,label:"1:10.000"},{value:2e4,label:"1:20.000"},{value:25e3,label:"1:25.000"},{value:5e4,label:"1:50.000"},{value:1e5,label:"1:100.000"},{value:25e4,label:"1:250.000"},{value:5e5,label:"1:500.000"},{value:1e6,label:"1:1.000.000"},{value:25e5,label:"1:2.500.000"},{value:5e6,label:"1:5.000.000"},{value:1e7,label:"1:10.000.000"},{value:2e7,label:"1:20.000.000"},{value:5e7,label:"1:50.000.000"},{value:1e8,label:"1:100.000.000"},{value:25e7,label:"1:250.000.000"},{value:5e8,label:"1:500.000.000"}],f=n.QUERY_POINT_TOLERANCE={unit:"pixel",value:10},h=(n.SEARCH_ALLVALUE="__G3W_ALL__",n.SEARCH_RETURN_TYPES=["data","search"]),g=(n.TIMEOUT=6e4,n.TOC_LAYERS_INIT_STATUS="not_collapsed",n.TOC_THEMES_INIT_STATUS="collapsed",n.VIEWPORT={resize:{map:{min:200},content:{min:200}}}),v=n.ZINDEXES={usermessage:{tool:2}},m=n.API_BASE_URLS={ABOUT:{macrogroups:"/about/api/macrogroup/",nomacrogoups:"/about/api/group/nomacrogroup/",projects:"/about/api/group/__G3W_GROUP_ID__/projects/",group:"/about/api/group/"},CRS:"/crs/"},y=n.FONT_AWESOME_ICONS={"change-map":"fas fa-map-signs",map:"far fa-map",file:"fas fa-file-code",marker:"fas fa-map-marker-alt",relation:"fas fa-sitemap",tools:"fas fa-cogs",tool:"fas fa-cog",search:"fas fa-search",print:"fas fa-print",info:"fas fa-info-circle","info-circle":"fas fa-info-circle",globe:"fas fa-globe",mail:"fas fa-envelope",mobile:"fas fa-mobile",fax:"fas fa-fax",user:"fas fa-user",bars:"fas fa-bars",uncheck:"far fa-square",check:"far fa-check-square",filluncheck:"fas fa-square",table:"fas fa-table",trash:"fas fa-trash","trash-o":"far fa-trash-alt",pencil:"fas fa-pencil-alt","ellips-h":"fas fa-ellipsis-h","ellips-v":"fas fa-ellipsis-v","arrow-up":"fas fa-chevron-up","arrow-down":"fas fa-chevron-down","arrow-left":"fas fa-chevron-left","arrow-right":"fas fa-chevron-right","resize-h":"fas fa-arrows-alt-h","resize-v":"fas fa-arrows-alt-v","resize-default":"fas fa-compress","caret-up":"fas fa-caret-up","caret-down":"fas fa-caret-down","caret-left":"fas fa-caret-left","caret-right":"fas fa-caret-right","empty-circle":"far fa-circle","cloud-upload":"fas fa-cloud-upload-alt",spinner:"fas fa-spinner",minus:"fas fa-minus","minus-square":"far fa-minus-square",plus:"fas fa-plus","plus-circle":"fas fa-plus-circle","plus-square":"far fa-plus-square",grid:"fas fa-th",home:"fas fa-home",folder:"fas fa-folder","sign-out":"fas fa-sign-out-alt",close:"fas fa-times",time:"far fa-clock",calendar:"fas fa-calendar-alt",list:"fas fa-list-alt",link:"fas fa-link",unlink:"fas fa-unlink",eye:"far fa-eye","eye-close":"far fa-eye-slash",save:"far fa-save",pdf:"fas fa-file-pdf",image:"far fa-image",video:"far fa-file-video",unknow:"far fa-question-circle",zip:"far fa-file-archive",text:"far fa-file-alt",excel:"far fa-file-excel",xls:"far fa-file-excel",gpx:"fas fa-location-arrow",gpkg:"fas fa-box-open",shapefile:"fas fa-file-archive",csv:"fas fa-file-csv",geotiff:"fas fa-th",ppt:"far fa-file-powerpoint",circle:"fas fa-circle",calculator:"fas fa-calculator",picture:"far fa-image",keyboard:"far fa-keyboard","file-download":"fas fa-file-download",copy:"far fa-copy",draw:"fas fa-draw-polygon",chart:"fas fa-chart-bar","chart-line":"fas fa-chart-line","chart-area":"fas fa-chart-area","chart-pie":"fas fa-chart-pie",run:"fas fa-play",warning:"fas fa-exclamation-circle",alert:"fas fa-exclamation-triangle",crosshairs:"fas fa-crosshairs",success:"far fa-check-circle",back:"fas fa-chevron-circle-left","file-upload":"fas fa-file-upload",wifi:"fas fa-wifi",mouse:"fas fa-mouse","copy-paste":"far fa-copy","vector-square":"fas fa-vector-square",download:"fas fa-download",credits:"fas fa-euro-sign",filter:"fas fa-filter",plugin:"fas fa-plug",invert:"fas fa-exchange-alt",clear:"fas fa-broom",palette:"fas fa-palette",layers:"fas fa-layer-group","sign-in":"fas fa-sign-in-alt",language:"fas fa-language",target:"fas fa-bullseye",pin:"fas fa-map-pin",square:"far fa-square",move:"fas fa-arrows-alt",moon:"fas fa-moon",sun:"fas fa-sun",refresh:"fas fa-sync-alt",pause:"fas fa-pause","step-backward":"fas fa-step-backward","fast-backward":"fas fa-fast-backward","step-forward":"fas fa-step-forward","fast-forward":"fas fa-fast-forward",crop:"fas fa-crop-alt",exit:"fas fa-door-open",slider:"fas fa-sliders-h",bookmark:"fas fa-bookmark",reply:"fas fa-reply",share:"fas fa-share"},_=n.LOCAL_ITEM_IDS={MESSAGES:{id:"MESSAGES",value:{}},SPATIALBOOKMARKS:{id:"SPATIALBOOKMARKS",value:{}}},b=(n.LOGO_GIS3W="images/logo_gis3w_156_85.png",n.SPATIAL_METHODS=["intersects","within"]),w=(n.DOTS_PER_INCH=96,n.INCHES_PER_UNIT={m:39.37,degrees:4374754});n.default={APP_VERSION:e,API_BASE_URLS:m,DEFAULT_EDITING_CAPABILITIES:i,DOTS_PER_INCH:96,DOWNLOAD_FORMATS:a,FILTER_OPERATORS:o,FILTER_EXPRESSION_OPERATORS:r,FONT_AWESOME_ICONS:y,G3W_FID:"g3w_fid",GEOMETRY_FIELDS:s,GEOMETRY_TYPES:l,INCHES_PER_UNIT:w,LIST_OF_RELATIONS_TITLE:"info.list_of_relations",LIST_OF_RELATIONS_ID:"__G3W_LIST_OF_RELATIONS_ID__",LOCAL_ITEM_IDS:_,LOCALSTORAGE_EXTERNALWMS_ITEM:"externalwms",LOGO_GIS3W:"images/logo_gis3w_156_85.png",MAP_SETTINGS:u,PRINT_FORMATS:c,PRINT_RESOLUTIONS:d,PRINT_SCALES:p,QUERY_POINT_TOLERANCE:f,SEARCH_ALLVALUE:"__G3W_ALL__",SEARCH_RETURN_TYPES:h,SPATIAL_METHODS:b,TIMEOUT:6e4,TOC_LAYERS_INIT_STATUS:"not_collapsed",TOC_THEMES_INIT_STATUS:"collapsed",VIEWPORT:g,ZINDEXES:v}},{"../version":455}],6:[function(e,t,n){function r(){this._error=(0"+t+""):$(t):t,$(this._parent).append(n),o.push({content:n,options:e}),a.resolve()):t.mount&&"function"==typeof t.mount?(-1!==(r=o.findIndex(function(e){return e.content.getId&&e.content.getId()===t.getId()}))&&o[r].content.unmount().then(function(){return o.splice(r,1)}),t.mount(this._parent,e.append||!1).then(function(){$(i._parent).localize(),o.push({content:t,options:e}),a.resolve(t)})):(this._parent.appendChild(t),o.push({content:t,options:e}),a.resolve()),a.promise()}},{key:"_unmount",value:function(e){var t=$.Deferred();return e instanceof o.default||e instanceof a.default?e.unmount().then(function(){return t.resolve()}):($(this._parent).empty(),t.resolve()),t.promise()}},{key:"forEach",value:function(t){this.state.contentsdata.forEach(function(e){return t(e.content)})}},{key:"getLength",value:function(){return this.state.contentsdata.length}},{key:"getComponentById",value:function(t){return(this.getContentData().find(function(e){return e.content.id==t})||{}).content}}]),n}(e.default)},{"core/g3w-component":8,"core/g3w-panel":10,"core/g3wobject":11}],8:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e)){var n=t,r=[],i=!0,t=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(r.push(o.value),!n||r.length!==n);i=!0);}catch(e){t=!0,a=e}finally{try{!i&&s.return&&s.return()}finally{if(t)throw a}}return r}throw new TypeError("Invalid attempt to destructure non-iterable instance")},r=function(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e};function a(e,t){for(var n=0;n=this.state.maxscale&&e<=this.state.minscale)},e.getStyles=function(){return(this.config.source.external?this.config.source:this.config).styles},e.getStyle=function(){return this.config.source.external?this.config.source.styles:this.config.styles?this.config.styles.find(function(e){return e.current}).name:""},e.getOpacity=function(){return this.state.opacity},e.setCurrentStyle=function(t){var n=!1;return this.config.styles.forEach(function(e){e.name===t&&(n=!e.current),e.current=e.name===t}),n},e.getCurrentStyle=function(){return this.config.styles.find(function(e){return e.current})},e.setDisabled=function(e){if(this.state.scalebasedvisibility){for(var t=(0,o.getScaleFromResolution)(e,1=this.state.maxscale&&t<=this.state.minscale),this.state.disabled=0===this.state.minscale?!(t>=this.state.maxscale):this.state.disabled,!0),r=this.state.parentGroup;r;)n=n&&r.checked,r=r.parentGroup;n&&this.setVisible(!this.state.disabled),this.isFilterable()&&this.setTocHighlightable(!this.state.disabled)}else this.state.disabled=!1},e.getMultiLayerId=function(){return this.config.multilayerid},e.getGeometryType=function(){return this.config.geometrytype},e.getOwsMethod=function(){return this.config.ows_method},e.setProjection=function(){this.config.projection=l.get(0t&&(e=$(this).position().left,n>$(this).outerWidth()&&(t+=n-$(this).outerWidth()),$(this).css("left",t+"px"),t=e,n=$(this).outerWidth())}),$(this.element).hide()},e.setEnable=function(e){$(this.element).find("button").first().toggleClass("g3w-ol-disabled",!e),!e&&this._interaction&&this._interaction.setActive(!1),this._enabled=e},e.getEnable=function(){return this._enabled},e.setVisible=function(){var e=!(0\n \n ',watch:{method:function(e){return t.setSpatialMethod(e)}},created:function(){o.default.setCloseUserMessageBeforeSetContent(!1)},beforeDestroy:function(){o.default.setCloseUserMessageBeforeSetContent(!0)}};break;case"custom":this.toggledTool=r}"hover"===e&&this._createToolOnHoverButton()},e._createToolOnHoverButton=function(){var t=this;this._onhover&&(this._toolButton=$(''),$(this.element).prepend(this._toolButton),this._toolButton.on("click",function(e){e.stopPropagation(),t.showToggledTool(!0)}),$(this.element).hover(function(){return t._toggled&&t._toolButton.show()}),$(this.element).mouseleave(function(){return t._toolButton.hide()}))},e.showToggledTool=function(){!(0