Opened 15 years ago

Closed 13 years ago

#89 closed enhancement (fixed)

Database config

Reported by: adube Owned by: adube
Priority: major Milestone:
Component: server Version:
Keywords: Cc:

Description

The xml files in production environment are becoming very bigs and hard to maintain.

A new 'database' config with a GUI to administrate it could be a nice enhancement.

Change History (32)

comment:1 by adube, 15 years ago

why

  • the main reason is that is was becoming very hard to maintain huge xml config files (5000 lines and still growing).
  • the access to a config in a database will be faster than a xml file (since we need to read the entire file in order to get a specific resource for example, which is different in a DB where you can request for the single resource needed)

sample

  • there is a sample available, but you need to setup it locally in order for it to work. See in ./samples/geoexttoolbar/pgsqlconfig, there is a readme file.

major bug fix

  • widgets that don't need to be linked to resources (such as toolbars, scale, measuretools, etc.) no longer need to be linked to a dummy resource in order to be added. See in 'technical details' for more.

technical details

  • PHPCodeSniffer reveals no errors other than 'copyright must be Borealis', which should be changed in the sniffer configs in order to have anything.
  • in order to be "backward compatible" with the old configs and the current templating system (xslt), the new PGSQL still outputs the same config_secur.xml file as the other configs do.
  • changing the templating system (xslt) has been discussed among developers but is not going to be done at the same time as this new driver release. It's a potential change that could be made in a near/far future though (if there is a growing need of GeoPrisma among the community and a strong will to change xslt to an other templating system). For now, we'll keep xslt.
  • GeoPrisma core config objects (such as !Resource, DataStore, !Widget, !Layout, etc.) are now created from standard PHP arrays instead of !SimpleXMLElement objects.
  • The XMLConfig and XMLWorkspaceConfig were adjusted to convert their SimpleXMLElement object created from reading xml files n PHP arrays to fit the above change.
  • Widgets now have new methods defined in their .php file (in ./src/client/widgets/widgetname/widgetname.php), they are going to be mandatory to understand for new widget developpers :
    • getMandatoryResourceOptionList :
      • used to link widgets to resources in the new config. See the only available official example in ./src
      • (new) is also used by old and new configs to tell if the widget need to be linked to a resource in order to work (the methods returns 'null' by default, which means it doesn't need to be linked, which is the default value)
    • getOptionalResourceOptionList
      • additional optional options (see above)
    • mustClone
      • Defaults to 'false'. If true, that means the widget must have a 1:1 relation with a resource. If false, the widget supports having multiple resources and doesn't need to be cloned (done by the Workspace config and the new config).
  • In the new config, there is currently only these widgets supported :
    • all widgets that don't need to be linked to resources (such as all toolbars, measuretool, etc.)
    • shortcut (which is in the demo)
  • In the new config, there is currently hardcoded values to work only with the demo. More work to come.
  • A single config file was made : PGSQLMapContextConfig. At some point, this file might be split in 3 : MapContextConfig, XMLPGMapContextConfig and PGSQLMapContextConfig.

upcoming phases

  • (1) all widgets support in the new config
  • (2) remove hardcoded demo values from new config and replace them by an intelligent way to read the config with only what we need (instead of reading the whole config like we do for xml files)
  • (3) create a GUI to administrate the DB config

comment:2 by adube, 15 years ago

commited r810

comment:3 by adube, 14 years ago

commit r812, featuring :

  • widget_options new 'order' field
  • widgets in toolbars now supported
  • single 'control' and 'widget' node now supported in geoexttoolbar
  • widget clones management (addCloneName & getCloneNames methods)
  • widget clones now supported in geoexttoolbar widget (adjustToolbarWidgets method)
  • measuretool widget added
  • cleaner record multi-option management (with setOptionValue method)

comment:4 by adube, 14 years ago

r813 :

  • all widgets included in pgsqlconfig sample (but not drawn)

comment:5 by adube, 14 years ago

r814, widgets added to pgsqlconfig sample (proof of support by new config) :

  • zoomslider
  • getmouseposition
  • scale
  • mouseposition

comment:6 by adube, 14 years ago

r815, featuring :

  • new 'linkResource' method that can be defined in .php file of widgets(in ./src/client/widgets/sample/sample.php). Used to link widgets to resources when some options are too complicated to create using the existing hash in 'mandatory options' and 'optional options', such as the mapfishlayertree options (that need a complex way to dynamically create nodes per resource, etc.)
  • the <layername> node in the mapfishlayertree widget is now deprecated by a new <servicetype> node. Using the layername outside the <map> widget is a conceptual error. We should always use the combinaison of servicetype + resourcename to find the according layer object.
  • Resources now have a new property : 'title'.
  • 'layertreepath' is the mandatory option of resources that want to have layertree widgets linked to them (and create the according node(s)). All layers (regardless of the service type) will be created inside the layertreepath defined. The syntax is :

path/to/my/node container : text separated by '/', each text being a node and a '/' meaning we enter the child nodes.

If we want to have layers seperated by service types, we still need to define a layertreepath (to 'foo', the value doesn't matter) and specify the location of each service type by using 'layertreepath' + servicetype, for example : layertreepathwms, layertreepathtilecache, etc...

Here is a list of remaining 'todos' for the mapfishlayertree widget :

  • i18n support (have a way to define 'domain' and 'key' instead of plain 'textkey' for nodes)
  • add 'checked', 'minScale' and 'maxScale' options (currently unsupported)
  • find a way to define the 'type' of the folders we want to create (by 'type', I mean 'checked' true, false or undefined) They are currently all set to 'undefined'.

comment:7 by adube, 14 years ago

I forgot to mention that the pgsqlconfig sample was also updated with the lastest changes (and the according .sql sample files as well).

comment:8 by adube, 14 years ago

r820, featuring :

  • 'visibility', 'minscaledenom' and 'maxscaledenom' resource options supported by mapfishlayertree (for the new pgsqlconfig, of course). Added to samples (.sql files).
  • 'getOptionalResourceOptionList' should only be populated when used automatically, else it should contain (in comments) the list of readable options usable by the widget. What do others think ? See in ./src/client/widgets/mapfishlayertree/mapfishlayertree.php for an example.
  • The only mandatory resource option required by the mapfishlayertree is : layertreepath. Others (visibility, minscaledenom and maxscaledenom) are optionals. These (including 'layertreepath') are the default values used for all servicetypes. You can define a unique option to a service type by adding the type to the option, for example : visibilitywms set to false will affect all wms layers of the resource visibility to false.

More to come :

  • use of these resource options by the layers created from the resources

comment:9 by adube, 14 years ago

r821, featuring :

  • 'minresolution', 'minscale' and 'maxscale' options added to map widget. Doc updated as well.
  • 'visibility', 'minscaledenom' and 'maxscaledenom' resource options now supported by layers created from resources as well.

comment:10 by adube, 14 years ago

r822, featuring :

  • 'resourceHasRequiredWidgetOptions' method in Widget (core)
  • queryonclick single 'result' now supported (doc updated)
  • resultextgrid 'delegatecontext' now optional (was mandatory even if set to 'disabled', doc updated)
  • new 'getMandatoryResourceOptionValueList' method for widget.php files. See an example in ./src/client/widgets/resultextgrid/resultextgrid.php
  • queryonclick and resultextgrid widgets added to pgconfig sample (.sql)
  • multiple 'foreignTables' support in getRecords method
  • new 'fields', 'field_options' and 'resource_fields' tables
  • fields core file added and are now optionally addable to resource objects
  • resource fields sortable by order

comment:11 by adube, 14 years ago

more details about last commit :

  • queryonclick 'markerstyle' option not yet supported in new config
  • resultextgrid 'delegatefeature' option not yet supported in new config

comment:12 by adube, 14 years ago

r824, featuring :

  • resource 'title' now in config_secur.xml
  • resource 'title' used by queryonclick in dropDown menu (next to 'i' button).

comment:13 by adube, 14 years ago

r826, featuring :

  • featurepanel_selector added, currently replaces the resultextgrid widget in sample (.sql)
  • the sample widget doesn't do anything in particular since you need to define your own .php template file.
  • queryonclick now supports single <featurepanel> option in addition of <featurepanel> inside <featurepanels> options.

comment:14 by adube, 14 years ago

r827 : geoextux_redlining widget added to sample (.sql)

comment:15 by adube, 14 years ago

r828, featuring :

  • mapfishrecenter widget now supported (added in sample). Uses the same option as the shortcut widget : zoomField.
  • mapfishrecenter "defaultZoom" option now optional (was mandatory in code, but not in doc)
  • multiple resource options are now accepted as 'mandatory' options, even if the final option name is different that the option in the widget. For example :

normal case of 1 option :

zoomField: name

in case there are 2 options of the same name, they are put in an array with the same name but with an extra 's' :

zoomFields: array( "name", "code" )

In the widget, you'll find (in the mandatory options array) 'zoomField' only and not zoomFields, but in the code it checks if the option + the extra 's' exists too.

  • mapfishrecenter was tested with multiple 'zoomField' options and it worked (not shown in sample).

remaining todo / issues :

  • 'displayfield' option currently can't be set to anything else but the 'zoomField' option (so it's currently not possible to have a 'displayfield' option different of the 'queryparam' option)
  • multiple 'zoomField' resource options is currently not supported by the shortcut widget

comment:16 by adube, 14 years ago

r829 : initialview added. Resources options are : initViewUrlField (mandatory), initViewField (optional)

comment:17 by adube, 14 years ago

r831, featuring :

  • pdfprint widget added :
    • The 'templates' option must be defined in json.
    • The 'templates' option is decoded in the .php file of the widget by the 'linkResource' method
  • widget not linked to resources now also call the 'linkResource' method as a way to customize

todo :

  • since widgets that are not linked to resources now call the 'linkResource' method as well, the method name has become irrelevant. We should change it.
  • 'json' is a quick workaround for the 'complex options' of widgets but should be replaced by a better solution in the future.

comment:18 by adube, 14 years ago

r832, featuring :

  • getAuthorizedResourcesCount method (used to count the total number of resources in a mapcontext and the number of resources the current logged role has access to)
  • common-with-acl.php file (to test the above method). 'geoprismademo' database is required (no included in svn).

comment:19 by adube, 14 years ago

r833, featuring :

  • new SettingImpl methods to set and get SessionId, MapContextId and ApplicationId (replaces the hardcoded values)
  • sample & driver now adjusted to use these methods

comment:20 by adube, 14 years ago

r834 & r835, featuring :

  • set and get 'current' Session, MapContext and Application ids from SettingImpl to the config driver file.
  • new 'getResourceNamesFromRequest' method used to check if the config is requested via a proxy (using 'osmresource' parameter(s)) in order to load just the resources requested instead of the whole config. This is the first thing checked by the config driver.

comment:21 by adube, 14 years ago

r836, featuring :

  • new methods for widgets (in .php file on ./client/widgets side) :
    • getServiceType : returns the service type string. Mandatory (original method is abstract)
    • needLayer : boolean, wether the widget needs to interact with specified service type layer in order to work (for example, editing widgets need the featureserver layer (vector), but the shortcut doesn't (even if it uses the featureserver service type as well)
  • new 'removeLeaf' method for MapFishLayerTree in core to remove specific a specific leaf by using the resource name and service type. The leaf doesn't necessary have 'no rights' that's why this method was added. It's used by the new config.
  • here are the new default behavior of "OpenLayers.Layer" object creation (depending on the service type) :
    • GYMO : always added
    • TileCache : always added
    • WMS : only added if there is no TileCache layer already added (of the same resource)
    • FeatureServer : only added if a widget (using the 'featureserver' servicetype) needs it OR if it's the only DataStore available, i.e. if no widget need a featureserver layer but it's the only DataStore available for the resource, a layer will be created.

todo :

  • adjust the 'removeNodesWithNoRights' in MapFishLayerTree core file to use 'references' to the nodes instead of returning them.
  • it was never mentioned anywhere in the ticket, but the vector layers created with the new config currently don't support any kind of 'styling'.

comment:22 by adube, 14 years ago

r838, featuring:

  • domain & key new fields for resources in pgsqlconfig schema. Used by config as title if set, else use 'name'.
  • new 'sample_gmap' language files used for sample demos using gmap data
  • queryonclick now supports i18n "resource titles" using gettext calls
  • MapFishLayerTree layer nodes (leaves) now support i18n textkey (domain & key)
  • MapFishLayerTree paths nodes support i18n as well by new config. The syntax to use is the following :
  • for a non i18n textkey, use : myTextKey
  • for i18n textkey, use : @mydomain:mykey@ (a string between '@' and separated by ':', on the left is the domain, on the right is the key)

Example with multiple paths :

@mydomain:mykey@/myTextKey/@mydomain:mykey2@

comment:23 by adube, 14 years ago

todo :

  • 'fields' could support i18n as well

comment:24 by adube, 14 years ago

todo :

  • have a new Resource options documentation page listing all possible resource options, which widget(s) use them, their syntax, etc.

comment:25 by adube, 14 years ago

Summary: Config in a databaseDatabase config

comment:26 by adube, 14 years ago

The remaining work to do has been separated in multiple tickets listed below.


DOCUMENTATION

  • Documentation of the new config driver, see #92
  • Documentation of some widget options that are different with the new config driver, see #93

WIDGETS

Here's the list of all widgets grouped by their "integration to the new config" status :

  • Fully supported widgets :
    • Map (automatically generated from mapcontext options and resource options)
    • MeasureTool
    • InitialView
    • ZoomSlider
    • MousePosition
    • GetMousePosition
    • Scale
    • FeaturePanelSelector
    • GeoExtToolbar
    • PDFPrint
  • Partially supported widgets (they have enough features to be considered done but have remaining minor issues/enhancements to be dealt with) :
    • MapFishRecenter, see #99
    • QueryOnClick, see #100
    • ResultExtGrid, see #101
    • Shortcut, see #102
    • MapFishLayerTree, see #104 and #105
    • !GeoExtUx_RedliningPanel, see #106
  • Currently not supported widgets :
    • !EditFeature_Create, see #107
    • !EditFeature_Update, see #108
    • !EditFeature_Delete, see #109
    • !FeaturePanel_Form, see #110
    • LegendPanel, see #111
    • Merge, see #112
    • Split, see #113
    • !GeoExtUx_GeoNamesSearchCombo, see #114
    • WMSLayerAdder, see #115
    • !GeoExtUx_ShortcutCombo, see #116
  • Deprecated widgets (won't be added at all) :
    • QuickZoom
    • Toolbar
    • Popup
    • DelegateFeature ?

OTHERS

Here are some remaining tasks to do :

  • Replace getAuthorizedResourcesCount method for getAuthorizedResources, see #94
  • Rename linkResource method, see #95
  • Alternative to JSON used for complex options, see #96
  • Vector feature styling support, see #97
  • Fields i18n support, see #98

comment:27 by adube, 14 years ago

The GeoPrisma Config Administration Interface is an other task needed to be done, see #117

comment:28 by adube, 14 years ago

A new task : make the table names configurable, see #118.

comment:29 by adube, 14 years ago

An potential enhancement : allow resource option overwriting inside a mapcontext, see #121.

comment:30 by adube, 14 years ago

We could want to be able to select MapContext, Application and Session using their names instead of their ids, see #126

comment:31 by adube, 14 years ago

#181, new ticket replacing #107, #108, #109 and #110 for the editing widgets.

comment:32 by adube, 13 years ago

Resolution: fixed
Status: newclosed

That task is completed and all "external" tasks have their own independent tickets, so I'm setting this one as "fixed".

Note: See TracTickets for help on using tickets.