diff --git a/de/functions/editing/datamanager.rst b/de/functions/editing/datamanager.rst index 93201146f..d4b959ca9 100644 --- a/de/functions/editing/datamanager.rst +++ b/de/functions/editing/datamanager.rst @@ -8,12 +8,15 @@ Der Data Manager ähnelt in seiner Funktionalität dem `Digitizer `_. +Konfigurationsbeispiel +---------------------- + Die Definition des Data Managers erfolgt im YAML-Syntax. Hier definieren Sie die Datenbankverbindung, die editierbaren Felder, den Formularaufbau. diff --git a/de/functions/editing/digitizer/digitizer_configuration.rst b/de/functions/editing/digitizer/digitizer_configuration.rst index 0f544a866..f5585227a 100644 --- a/de/functions/editing/digitizer/digitizer_configuration.rst +++ b/de/functions/editing/digitizer/digitizer_configuration.rst @@ -276,6 +276,7 @@ Die folgenden SQL-Befehle müssen in Ihrer Datenbank ausgeführt werden. Sie leg file_reference varchar, x float, y float, + city varchar, geom geometry(point,4326) ); @@ -302,6 +303,7 @@ Die folgenden SQL-Befehle müssen in Ihrer Datenbank ausgeführt werden. Sie leg file_reference varchar, x float, y float, + city varchar, geom geometry(linestring,4326) ); @@ -328,6 +330,7 @@ Die folgenden SQL-Befehle müssen in Ihrer Datenbank ausgeführt werden. Sie leg file_reference varchar, x float, y float, + city varchar, geom geometry(polygon,4326) ); diff --git a/de/functions/search/search_router.rst b/de/functions/search/search_router.rst index 900d244b5..39795f1dd 100644 --- a/de/functions/search/search_router.rst +++ b/de/functions/search/search_router.rst @@ -9,31 +9,91 @@ Dieses Element erzeugt ein Suchformular mit Trefferausgabe. Das Formular und die :scale: 80 -Element hinzufügen -================== - -Für die Einbindung des Search Routers müssen zwei Bedingungen erfüllt sein: +Konfiguration +============= -1. Die Datenbank muss in den Konfigurationsdateien definiert sein. -2. Das Element "Suchen" muss im Layout integriert sein. Das Element kann entweder in der Sidepane oder als Button in der Toolbar integriert werden. Zu der Konfiguration des Buttons besuchen Sie die Dokumentationsseite unter :ref:`button_de`. +.. note:: Die Suche greift auf Tabellen in einer Datenbank zu. Dafür muss die Datenbank in Mapbender bekannt gegeben werden. Informationen dazu finden sich unter :ref:`yaml_de`. +Das Element kann entweder in der Sidepane oder als Button in der Toolbar integriert werden. Zu der Konfiguration des Buttons besuchen Sie die Dokumentationsseite unter :ref:`button_de`. -Konfiguration -============= .. image:: ../../../figures/de/search_router_edit_de.png :scale: 80 -* **Title:** Titel des Elements. Dieser wird in der Layouts Liste angezeigt und wird neben dem Button angezeigt, wenn "Beschriftung anzeigen" aktiviert ist. +* **Title:** Titel des Elements. Dieser wird in der Layouts Liste angezeigt sowie als Titel in der Seitenleiste (Nutzung in der Sidepane) oder als Titel des Suchdialogs (Nutzung via Button). * **Width:** Breite des Dialogs (nur wenn das Element als Dialog eingebunden wurde) * **Height:** Höhe des Dialogs (nur wenn das Element als Dialog eingebunden wurde) + +Über den Button ``+`` bei Routes können mehrere Suchen erstellt werden. Jede Suche beinhaltet die Felder *Title* und *Configuration*. Der eingegebene Titel bei *Title* ist in der Suche in der Anwendung in einer Auswahlbox selektierbar. So können mehrere Suchen unterschieden und ausgewählt werden. + * **Routes:** Erstellung einer neuen Suche. * **Title**: Titel der Suche (erscheint erst, wenn über das + bei Routes eine Suche hinzugefügt wurde) * **Configuration**: Feld für die Konfiguration der Suche (erscheint erst, wenn über das + bei Routes eine Suche hinzugefügt wurde) -Über den Button ``+`` bei Routes können mehrere Suchen erstellt werden. Jede Suche beinhaltet die Felder *Title* und *Configuration*. Der eingegebene Titel bei *Title* ist in der Suche in der Anwendung in einer Auswahlbox selektierbar. So können mehrere Suchen unterschieden und ausgewählt werden. Die Definition der Suche erfolgt im YAML-Syntax im Textfeld *Configuration*. Hier werden die Suchtabelle bzw. Abfrage, die Datenbankverbindung, der Formularaufbau, die Trefferausgabe sowie das Styling der Treffer definiert. -.. note:: Die Suche greift auf Tabellen in einer Datenbank zu. Dafür muss die Datenbank in Mapbender bekannt gegeben werden. Informationen dazu finden sich unter :ref:`yaml_de`. +Konfiguration der einzelnen Suchen (Route Configuration) +-------------------------------------------------------- + +Die Definition der einzelnen Suchen erfolgt im YAML-Syntax im Textfeld **Configuration**. + +Hier erfolgt die Definition: + +* der Datenbankverbindung +* der Suchtabelle bzw. Abfrage +* des Formularaufbaus +* der Aufbau der Trefferausgabe +* sowie das Styling der Treffer in der Karte + + +.. code-block:: yaml + + class: Mapbender\CoreBundle\Component\SQLSearchEngine + class_options: + connection: geodata_db # database alias from config.yml + relation: polygons # search table + attributes: # columns that are used in the form and in the result table + - gid + - name + - type + - city + geometry_attribute: geom # reference to the geometry column + form: + name: + type: Symfony\Component\Form\Extension\Core\Type\TextType + options: + required: false + compare: exact + city: + type: Symfony\Component\Form\Extension\Core\Type\TextType + options: + required: false + label: Ort/Stadt + compare: ilike + results: + view: table + count: true + headers: + gid: ID + name: Name + city: City/Town + callback: + event: click + options: + buffer: 10 + minScale: null + maxScale: null + + +Class und Class Optionen +------------------------ +Die Konfiguration beginnt mit der Angabe der class (immer class: Mapbender\CoreBundle\Component\SQLSearchEngine) sowie Informationen zur Datenbankverbindung, der Suchtabelle, den verwendeten Spalten und der Angabe der Geometriespalte. + + +Formular +-------- +Im Bereich **form** können Textfelder und Auswahlboxen für das Suchformular definiert werden. + +Die jeweilige Tabellenspalte wird angegeben und mit Definitionen für type, options und compare versehen. Type @@ -53,10 +113,7 @@ Sie können außerdem den Vergleichsoperator definieren. Siehe 'comparison mode' Typ text ~~~~~~~~ -Type text -~~~~~~~~~ - -Über den Typ text können Textfelder in das Suchformular eingefügt werden. +Über den Typ **text** können Textfelder in das Suchformular eingefügt werden. Der Typ text unterstützt Autovervollständigung. Sofern sie diese nutzen möchten müssen Sie zusätzliche additional attr-Parameter hinzufügen. @@ -82,8 +139,9 @@ Unterstützte autocomplete-Paramter: label: Name required: true attr: - data-autocomplete: 'on' # aktiviere autocomplete - data-autocomplete-distinct: 'on' + data-autocomplete: 'on' # aktiviere Autovervollständigung + data-autocomplete-distinct: 'on' # gleiche Treffer nur einmal anzeigen + data-autocomplete-using: type, city # Liste von weiteren Spalten für die Autovervollständigung (kommasepariert) compare: exact @@ -109,24 +167,27 @@ Die Auswahlmöglichkeiten werden im Bereich choices definiert. Dabei werden ein .. code-block:: yaml - usertype: + type: type: Symfony\Component\Form\Extension\Core\Type\ChoiceType # box with selection options as dropdown list options: label: Nutzertyp required: false placeholder: 'Bitte auswählen...' choices: - Company: 1 - Administration: 2 - University: 3 - User: 4 + Company: A + Administration: B + University: C + User: D + Sonstiges: E compare: exact Vergleichsmodus --------------- -Für jedes Feld kann ein Vergleichsmodus (compare) bestimmt werden, welcher von der Engine verwendet werden soll, wenn die Suchanfrage gestellt wird. Die SQL Suche Engine hat die folgenden Modi: +Für jedes Feld kann ein Vergleichsmodus (compare mode) bestimmt werden. Dieser wird beim Senden der Suchanfrage verwendet. + +Folgende Vergleichsmodi werde unterstützt: * **exact:** genauer Vergleich, Schlüssel = Wert (key = val) * **iexact:** Vergleich, bei der Groß- / Kleinschreibung nicht unterschieden wird (case-insensitive) @@ -138,16 +199,50 @@ Für jedes Feld kann ein Vergleichsmodus (compare) bestimmt werden, welcher von * **ilike-right:** rechtsseitiges 'like', bei dem Groß- / Kleinschreibung nicht unterschieden wird (case-insensitive - searchstring\*) +Ergebnisausgabe +--------------- +Im Bereich **results** erfolgt die Definition zum Aufbau der Trefferliste und das Styling der Treffer in der Karte. + +.. code-block:: yaml + + results: + view: table + count: true + headers: + gid: ID + name: Name + city: City/Town + callback: + event: click + options: + buffer: 10 + minScale: null + maxScale: null + +* **view**: immer Angabe **table**. Derzeit keine weiteren Optionen +* **count**: true oder false. Anzeige der Anzahl der Ergebnisse +* **headers**: Definition der Ausgabespalten und Spaltenbeschriftung +* **callback**: Definition der Aktion beim Klick auf einzelne Treffer +* **event**: immer Angabe **click**. Derzeit keine weiteren Optionen +* **buffer**: Zoom zum Treffer mit einem definierten Puffer +* **minScale and maxScale**: Zoom zum Treffer in einem Maßstab zwischen minScale und maxScale + Styling der Ergebnisse ---------------------- -Standardmäßig werden die Ergebnisse in der Karte in dem default-OpenLayers Style angezeigt, d.h. orange für die Treffer und blau für selektierte Objekte. Das OpenLayer default Styling sieht wie folgt aus: +Standardmäßig werden die Ergebnisse in der Karte in dem default-OpenLayers Style angezeigt. .. image:: ../../../figures/de/search_router_example_colour_orangeblue.png :scale: 80 -Sie können diese Farbgebung überschreiben, indem Sie eine styleMap-Konfiguration übergeben, die wie folgt aussehen könnte: +Sie können diese Farbgebung überschreiben, indem Sie eine styleMap-Konfiguration definieren. + +Die Konfiguration beinhaltet drei Stilkonfigurationen: + +* **default**: Standardanzeige der Treffer +* **select**: Anzeige bei Auswahl +* **temporary**: Anzeige beim Mouseover .. code-block:: yaml @@ -156,10 +251,10 @@ Sie können diese Farbgebung überschreiben, indem Sie eine styleMap-Konfigurati styleMap: default: strokeColor: '#00ff00' # Umrandungsfarbe - strokeOpacity: 1 # 1 - opak (keine Transparenz) - strokeWidth: 3 # Umrandingsbreite + strokeOpacity: 1 # 1 - opak (keine Transparenz) 0 - voll transparent + strokeWidth: 3 # Umrandungsbreite fillColor: '#f0f0f0' # Füllfarbe - fillOpacity: 0 # Opazität Füllung, voll transparent, daher keine Füllung + fillOpacity: 0 # Opazität der Füllung, 0 - voll transparent pointRadius: 6 # Größe des Punktsymbols select: strokeColor: '#0000ff' @@ -173,21 +268,19 @@ Sie können diese Farbgebung überschreiben, indem Sie eine styleMap-Konfigurati fillColor: '#0000ff' fillOpacity: 1 -Drei verschiedene Styles wurden hier konfiguriert: +Wird Opacity auf 0 gesetzt (fillOpacity: 0), so wird die Fläche nicht gefüllt, sondern transparent dargestellt. In der default-Definition wird lediglich eine grüne Umrandung + dargestellt (strokeColor: '#00ff00'). -- **default**: Der Standard-Style für alle Ergebnisse -- **select**: Der Style, falls ein Ergebnis angeklickt worden ist. -- **temporary**: Der Style, falls man mit den Mauszeiger über ein Ergebnis in der Tabelle bewegt. +Die selektierten Objekte in diesem Beispiel werden mit der Farbe Lila gefüllt uns sind mit leichter Opazität versehen. +Sie verfügen über eine blaue Umrandung. +Die temporäre Darstellung beim Mouse-Hover über ein Ergebnis erfolgt in blau. -Diese Definition füllt die Kreissymbole nicht, da die Transparenz auf Null gesetzt wurde (fillOpacity: 0). Sie werden lediglich grün umrandet dargestellt. Die selektierten Objekte in diesem Beispiel werden mit der Farbe Lila gefüllt und sind transparent mit einem Faktor von 0.8. Umrandet sind die Objekte mit einer blauen Linie. Die temporären Symbole beim Mouse-Hover über ein Ergebnis sind ausgefüllte blaue Punkte. Diese Farbkonfiguration sieht so aus: .. image:: ../../../figures/de/search_router_example_colour_purplegreen.png :scale: 80 -Die default-Angaben überschreiben die OpenLayers-Standardangaben. Daher müssen Sie lediglich die Angaben setzen, die Sie überschreiben möchten. Wenn Sie die Angaben weglassen wird der OpenLayers default-Stil verwendet. - -Die gleiche Logik wird beim select-Stil verfolgt. Jede Angabe, die Sie machen überschreibt die Angaben des *finalen* default Stils. +Die styleMap-Angaben überschreiben Standardangaben. Daher müssen Sie lediglich die Angaben setzen, die Sie überschreiben möchten. Wenn Sie die Angaben weglassen wird der default-Stil verwendet. Beachten Sie, dass die hexadezimalen Farbwerte in Anführungszeichen angegeben werden müssen, da das #-Zeichen ansonsten als Kommentar interpretiert wird. @@ -215,7 +308,7 @@ Der Elementitel (*Title*) lautet Suchen. Dieser wird in der Sidepane als Titel a class: Mapbender\CoreBundle\Component\SQLSearchEngine class_options: - connection: demo # die Datenbank, auf die das Element zugreift + connection: geodata_db # die Datenbank, auf die das Element zugreift relation: mapbender_user # die Tabelle, auf die das Element zugreift attributes: # entspricht den Tabellenspalten in der Datenbank, die angesprochen werden sollen - gid @@ -225,7 +318,7 @@ Der Elementitel (*Title*) lautet Suchen. Dieser wird in der Sidepane als Titel a geometry_attribute: the_geom # Definition der Geometrie Spalte form: # ab hier beginnt die Konfiguration des Formulars orga: # Feld für die Suche nach dem Namen des Mapbender Users - type: text + type: Symfony\Component\Form\Extension\Core\Type\TextType options: required: false # kein Pflichtfeld label: 'Mapbender User' # Überschrift über dem Feld @@ -234,7 +327,7 @@ Der Elementitel (*Title*) lautet Suchen. Dieser wird in der Sidepane als Titel a data-autocomplete-distinct: 'on' compare: ilike # Vergleichsmodus town: # Feld für die Suche nach der Stadt - type: text + type: Symfony\Component\Form\Extension\Core\Type\TextType options: required: false # kein Pflichtfeld label: Stadt # Überschrift über dem Feld @@ -243,7 +336,7 @@ Der Elementitel (*Title*) lautet Suchen. Dieser wird in der Sidepane als Titel a data-autocomplete-distinct: 'on' compare: ilike usertype: # Feld für die Suche nach dem Nutzertyp - type: choice # Feld mit Auswahlmöglichkeiten als Dropdown + type: Symfony\Component\Form\Extension\Core\Type\ChoiceType options: placeholder: 'Bitte auswählen...' # Text, der angezeigt wird, bevor etwas ausgewählt wurde choices: # die Auswahlmöglichkeiten; werden wie folgt angegeben: "Eintrag in der Spalte der Datenbank": "Angezeiger Name in der Dropdown-Liste" @@ -325,7 +418,7 @@ Beispiel einer Suchkonfiguration in dem ``configuration`` Bereich: class: Mapbender\CoreBundle\Component\SQLSearchEngine class_options: - connection: gisdb + connection: geodata_db relation: gn250_p attributes: - id @@ -335,7 +428,7 @@ Beispiel einer Suchkonfiguration in dem ``configuration`` Bereich: geometry_attribute: geom form: name: - type: text + type: Symfony\Component\Form\Extension\Core\Type\TextType options: required: true compare: ilike @@ -371,16 +464,17 @@ In der mapbender.yml Datei: demo_polygon: # für Maschinen lesbarer Name class: Mapbender\CoreBundle\Component\SQLSearchEngine # Suchmaschine, die verwendet werden soll class_options: # Diese werden an die Suchmaschine weitergegeben - connection: digi_suche # search_db, DBAL Verbindungsname, der benutzt werden soll, benutzen Sie ~ für default + connection: geodata_db # search_db, DBAL Verbindungsname, der benutzt werden soll, benutzen Sie ~ für default relation: polygons # Verbindungsauswahl, Unterabfragen können verwendet werden attributes: - gid # Liste von Spalten auswählen, expressions are possible - name - type + - city geometry_attribute: geom # Name der Geometriesplate, die genutzt werden soll. Achtung: Projektion muss mit Projektion des map-Elements übereinstimmen form: # Einstellungen für das Suchformular name: # Feldname, Spaltenname der genutzt werden soll - type: text # Eingabefeld, normalerweise Text oder Zahlen + type: Symfony\Component\Form\Extension\Core\Type\TextType # Eingabefeld, normalerweise Text oder Zahlen options: # Einstellungen für das Eingabefeld required: false # HTML5 benötigte Attribute label: Name # benutzerdefinierte Beschriftung eingeben, sonst wird die Beschriftung von dem Feldnamen abgeleitet @@ -389,17 +483,23 @@ In der mapbender.yml Datei: data-autocomplete-distinct: on # Attribut, dass Autovervollständigung aktiviert aber unterscheiden lässt data-autocomplete-using: type # komma separierte Liste von anderen Eingabefeldern, in denen WHERE Angaben für die Autovervollständigung gemacht werden compare: ilike # Siehe unten für weitere Vergleichsformen + city: + type: Symfony\Component\Form\Extension\Core\Type\TextType + options: + required: false + label: Ort/Stadt + compare: ilike type: - type: choice + type: Symfony\Component\Form\Extension\Core\Type\ChoiceType options: - placeholder: Please select a type. + placeholder: 'Bitte auswählen...' required: false choices: - A: A - B: B - C: C - D: D - E: E + A Company: A + B Administration: B + C University: C + D User: D + E Somthing else: E results: view: table # Ansicht der Ergebnisse, Ausgabe z.B. als Tabelle count: true # Anzahl der Treffer anzeigen @@ -407,6 +507,7 @@ In der mapbender.yml Datei: gid: ID # Spaltenname -> Überschrift name: Name type: Type + city: Ort/Stadt callback: # Was beim Klick und Mauszeiger halten passiert event: click # Ergebnisliste (click oder mouseover) options: @@ -428,15 +529,4 @@ In der mapbender.yml Datei: fillOpacity: 1 -HTTP Callbacks -============== - -/autocomplete ------------------------ - -Automatisch vervollständigter Ajax Endpunkt für die vorgegebene Suchroute. Die Autovervollständigung wird unter Verwendung von Backbone.js eingesetzt. Das Autovervollständigung-Modul ist implementiert in mapbender.element.searchRouter.Search.js. - -/search ------------------ -Automatisch vervollständigter Ajax Endpunkt für die vorgegebene Suchroute. Die Suche wird unter Verwendung von Backbone.js eingesetzt. Das Such-Modul ist implementiert in mapbender.element.searchRouter.Search.js. diff --git a/en/functions/editing/datamanager.rst b/en/functions/editing/datamanager.rst index 545b67e21..5bf2f05eb 100644 --- a/en/functions/editing/datamanager.rst +++ b/en/functions/editing/datamanager.rst @@ -18,7 +18,7 @@ Read more about this at `database <../../../customization/yaml.html>`_. Configuration example --------------------- -The definition of the Data Manager is done in YAML syntax in the textarea configuration at schemes. Here you define the database connection, the editable table, the attribute form.. +The definition of the Data Manager is done in YAML syntax in the textarea configuration at schemes. Here you define the database connection, the editable table, the attribute form. .. hint:: If errors occur in the database, fields or form, various error messages appear. Via the normal call and app.php comes a general error message. If you want to see the exact error message, you should call the page via app_dev.php. In this case, detailed error messages about the error behavior appear. diff --git a/en/functions/editing/digitizer/digitizer_configuration.rst b/en/functions/editing/digitizer/digitizer_configuration.rst index e27099f0a..06bfda1a3 100644 --- a/en/functions/editing/digitizer/digitizer_configuration.rst +++ b/en/functions/editing/digitizer/digitizer_configuration.rst @@ -283,6 +283,7 @@ The following SQL commands must be executed in your database. You create three d file_reference varchar, x float, y float, + city varchar, geom geometry(point,4326) ); @@ -309,6 +310,7 @@ The following SQL commands must be executed in your database. You create three d file_reference varchar, x float, y float, + city varchar, geom geometry(linestring,4326) ); @@ -335,6 +337,7 @@ The following SQL commands must be executed in your database. You create three d file_reference varchar, x float, y float, + city varchar, geom geometry(polygon,4326) ); diff --git a/en/functions/search/search_router.rst b/en/functions/search/search_router.rst index 653406d9d..b9d47b2db 100644 --- a/en/functions/search/search_router.rst +++ b/en/functions/search/search_router.rst @@ -3,37 +3,95 @@ Search Router ************* -This element creates a configurable search formular with result output in which generic SQL search is supported. +This element creates a configurable search formular with a configurable result output in which generic SQL search is supported. .. image:: ../../../figures/search_router_en.png :scale: 80 -Add SearchRouter -================ +Configuration +============= -In order to use the SearchRouter, two requirements have to be met: +.. note:: The SearchRouter needs access to the database where the search tables are. You have to define a new database configuration to be able to connect with the geo database. Read more about this at :ref:`yaml`. -1. The database has to be defined in the configuration files. -2. The SearchRouter element has to be integrated in the Mapbender layout. The element may be integrated into the sidepane or as a button into the toolbar. To configure a button visit the documentation at :ref:`button`. +The element may be integrated into the sidepane or via a button into from the toolbar. To configure a button visit the documentation at :ref:`button`. -Configuration -============= - .. image:: ../../../figures/search_router_edit_en.png :scale: 80 -* **Title:** Title of the element. The title will be listed in "Layouts" and allows to distinguish between different buttons. It will be indicated if "Show label" is activated. +* **Title:** Title of the element. The title will be listed in the Layouts section in the backend. It is shown as sidepane tab/button title (usage in sidepane) or dialog title (usage via button). * **Width:** Width of the dialog (only for dialog, not sidepane) * **Height:** Height of the dialog (only for dialog, not sidepane) + +You can define Searches (Routes) with the ``+`` Button. Each Search has a ``title`` which will show up in the search form in a selectbox. The definition of the search is done in YAML syntax in the textarea configuration. + * **Routes:** Collection of search routes. * **Title**: Search Title (appears, when a search is added to Routes by using +) -* **Configuration**: Field to configure the search (ppears, when a search is added to Routes by using +) +* **Configuration**: Field to configure the search + (appears, when a search is added to Routes by using +) -You can define Searches (Routes) with the ``+`` Button. Each Search has a ``title`` which will show up in the search form in a selectbox. From there you can choose the search you want to use and a ``configuration``. The definition of the search is done in YAML syntax in the textarea configuration. Here you define the database connection, the Search tables/views, the design of the form and of the result table. -.. note:: The SearchRouter needs access to the database where the search tables are. You have to define a new database configuration to be able to connect with the geo database. Read more about this at :ref:`yaml`. +Route Configuration +------------------- +In the textarea configuration you define all important information for each search. + +* the database connection +* the search tables/views and columns +* the design of the form +* and the design of the result table +* the design of the results on the map + + +.. code-block:: yaml + + class: Mapbender\CoreBundle\Component\SQLSearchEngine + class_options: + connection: geodata_db # database alias from config.yml + relation: polygons # search table + attributes: # columns that are used in the form and in the result table + - gid + - name + - type + - city + geometry_attribute: geom # reference to the geometry column + form: + name: + type: Symfony\Component\Form\Extension\Core\Type\TextType + options: + required: true + compare: exact + city: + type: Symfony\Component\Form\Extension\Core\Type\TextType + options: + required: false + label: City/Town + compare: ilike + results: + view: table + count: true + headers: + gid: ID + name: Name + city: City/Town + callback: + event: click + options: + buffer: 10 + minScale: null + maxScale: null + + +Class and Class options +----------------------- +The configuration starts with the definition of the class (always class: Mapbender\CoreBundle\Component\SQLSearchEngine) followed by the information about the database connection, definition of the search table, the columns that are used and the geometry column. + + +Form +---- +In the form section you can define the setup of the form and define textfields and selectboxes. + +You refer to the table columns and define the type, options and compare. Type @@ -54,7 +112,7 @@ You also can define a compare mode. See section 'comparison mode'. Type text ~~~~~~~~~ -Type text allows you to provide text fields for your search formular. +Type **text** allows you to provide text fields for your search formular. Type text supports autocomplete. If you want to add autocomplete to the field you have to add the additional attr-parameters. @@ -81,7 +139,8 @@ Type text; example with autocomplete: required: true attr: data-autocomplete: 'on' # activate autocomplete - data-autocomplete-distinct: 'on' + data-autocomplete-distinct: 'on' # only show equal results once + data-autocomplete-using: type, city # autocomplete, list of input fields (with comma seperated), WHERE input compare: exact @@ -107,24 +166,27 @@ You have to define the choices for the selectbox. You define a value and a key. .. code-block:: yaml - usertype: + type: type: Symfony\Component\Form\Extension\Core\Type\ChoiceType # box with selection options as dropdown list options: label: User type required: false - placeholder: 'Please select...' + placeholder: 'Please select...' choices: - Company: 1 - Administration: 2 - University: 3 - User: 4 + Company: A + Administration: B + University: C + User: D + Something else: E compare: exact Comparison Mode --------------- -For every field a comparison mode can be set, which should be used by the engine when the query is sent. The SQL search engine has the following modes: +For every field a comparison mode can be set. This is used by the engine when the query is sent. + +The following comparison modes are supported: * **exact:** exact comparison (key = val) * **iexact:** comparison ignoring cases (case-insensitive) @@ -136,16 +198,51 @@ For every field a comparison mode can be set, which should be used by the engine * **ilike-right:** right-side 'like' (case-insensitive - searchstring\*) +Result +------ + +In the section **results** the definition for the result table and styling is none. + +.. code-block:: yaml + + results: + view: table + count: true + headers: + gid: ID + name: Name + city: City/Town + callback: + event: click + options: + buffer: 10 + minScale: null + maxScale: null + +* **view**: is always set to table. No more options are possible +* **count**: true or false to show the number of results +* **headers**: definition of the columns to display and the alternative labeling +* **callback**: define the action for the click event on a result item +* **event**: only click is supported +* **buffer**: zoom to the result item with a defined buffer +* **minScale and maxScale**: zoom to the result item in a scale between minScale and maxScale + Styling the Results ------------------- -By default the results are shown in the default-OpenLayers Style, orange for hits and blue for selected objects. The OpenLayer default Styling looks like this: +By default the results are shown in the default-OpenLayers Style. .. image:: ../../../figures/de/search_router_example_colour_orangeblue.png :scale: 80 -You can overwrite this by handing over a styleMap-Configuration, which could look like this: +You can overwrite this by handing over a styleMap-Configuration. + +Three different styles are configured: + +* **default**: default style +* **select**: style on select +* **temporary**: style on mouse-over .. code-block:: yaml @@ -170,25 +267,19 @@ You can overwrite this by handing over a styleMap-Configuration, which could loo strokeColor: '#0000ff' fillColor: '#0000ff' fillOpacity: 1 + +In the default style the point-symbol interior is transparent (fillOpacity: 0). Only their outlines will be drawn in green. +The selected features will be drawn with a purple fill and an opacity of 0.8. The outline of the symbol is blue. -Three different styles are configured: - - -- **default**: The standard-style for all results -- **select**: The style used if a result is clicked. -- **temporary**: The styles used if you hover with the mouse-pointer over a result. - -This will not draw the point-symbol interiors, since the transparency is set to zero (fillOpacity: 0). Only their outlines will be drawn in green. The selected features will be drawn in here with a purple fill and an opacity of 0.8. The stroke-Color is a blue line. The temporary symbols on mouse-hover are opaque blue points. The following screenshot shows this design: +The temporary symbols on mouse-hover are blue points. .. image:: ../../../figures/de/search_router_example_colour_purplegreen.png :scale: 80 -The default settings override the OpenLayers-Default Settings, so you only have to state the things you want to overwrite. If you state nothing, the default OpenLayer style will be used. - -The select-style works the same way: Any statement you make will overwrite the settings of the *final* default style. +The styleMap settings override the default settings, so you only have to define the sections you want to overwrite. No extra styleMap is set the default style will be used. -Note, that the hexadeximal color values have to be stated in quotation marks, because the #-Symbol would be interpreted as a comment instead. +Note, that the hexadeximal color values have to be stated in quotation marks, because # would be interpreted as a comment instead. @@ -214,7 +305,7 @@ The element title (*Title*) is Search. It is again displayed as a title in the s class: Mapbender\CoreBundle\Component\SQLSearchEngine class_options: - connection: demo # database (on which the element has access) + connection: geodata_db # database (on which the element has access) relation: mapbender_user # table (on which the element has access) attributes: # table columns (which the element addresses) - gid @@ -224,7 +315,7 @@ The element title (*Title*) is Search. It is again displayed as a title in the s geometry_attribute: the_geom # definition of the geometry column form: # configuration of the form orga: # search field (e.g. search for specific Mapbender User) - type: text + type: Symfony\Component\Form\Extension\Core\Type\TextType options: required: false # no mandatory field label: 'Mapbender User' # caption of the search field @@ -233,7 +324,7 @@ The element title (*Title*) is Search. It is again displayed as a title in the s data-autocomplete-distinct: 'on' compare: ilike # see section 'comparison mode' on this page town: # search field (e.g. search for specific city) - type: text + type: Symfony\Component\Form\Extension\Core\Type\TextType options: required: false # no mandatory field label: City # caption of the search field @@ -242,7 +333,7 @@ The element title (*Title*) is Search. It is again displayed as a title in the s data-autocomplete-distinct: 'on' compare: ilike usertype: # search field (search for specific User type) - type: choice # possible choices via drop down list + type: Symfony\Component\Form\Extension\Core\Type\ChoiceType options: placeholder: 'Please select...' # displayed text in field before entering a search choices: # choices need to have the following format: "entry in the database column": "displayed name in the drop down list" @@ -321,7 +412,7 @@ Example of a route-configuration in the ``configuration`` area: class: Mapbender\CoreBundle\Component\SQLSearchEngine class_options: - connection: gisdb + connection: geodata_db relation: gn250_p attributes: - id @@ -331,7 +422,7 @@ Example of a route-configuration in the ``configuration`` area: geometry_attribute: geom form: name: - type: text + type: Symfony\Component\Form\Extension\Core\Type\TextType options: required: true compare: ilike @@ -368,16 +459,17 @@ In the mapbender.yml file: demo_polygon: # machine-readable name class: Mapbender\CoreBundle\Component\SQLSearchEngine # path to used search engine class_options: # options passed to the search engine - connection: digi_suche # search_db, DBAL connection name, ~ for default + connection: geodata_db # search_db, DBAL connection name, ~ for default relation: polygons attributes: - gid # list of columns, expressions are possible - name - type + - city geometry_attribute: geom # name of the geometry column, attention: projection needs to match with the projection of the map element form: # declaration of the search form name: # field name, column name - type: text # input field, normally text or numbers + type: Symfony\Component\Form\Extension\Core\Type\TextType # input field, normally text or numbers options: # declaration of the input field required: false # HTML5, required attributes label: Name # custom label, otherwise field name used @@ -386,17 +478,23 @@ In the mapbender.yml file: data-autocomplete-distinct: on # attribute to activate distinct autocomplete data-autocomplete-using: type # autocomplete, list of input fields (with comma seperated), WHERE input compare: ilike # see section 'comparison mode' on this page + city: + type: Symfony\Component\Form\Extension\Core\Type\TextType + options: + required: false + label: City/Town + compare: ilike type: - type: choice + type: Symfony\Component\Form\Extension\Core\Type\ChoiceType options: placeholder: Please select a type. required: false choices: - A: A - B: B - C: C - D: D - E: E + A Company: A + B Administration: B + C University: C + D User: D + E Something else: E results: view: table # display results as table count: true # show number of results @@ -404,6 +502,7 @@ In the mapbender.yml file: gid: ID # column name -> header name: Name type: Type + city: City/Town callback: # click event event: click # click or mouseover event options: @@ -425,15 +524,4 @@ In the mapbender.yml file: fillOpacity: 1 -HTTP Callbacks -============== - -/autocomplete ------------------------ - -Auto-completed Ajax endpoint for the predefined search route. The auto-complete uses Backbone.js. The auto-complete is implemented in mapbender.element.searchRouter.Search.js. - -/search ------------------ -Auto-completed Ajax endpoint for the predefined search route. The search module uses Backbone.js. The auto-complete is implemented in mapbender.element.searchRouter.Search.js.