1

Re: Changing submit sightings label

Hi there,

I hope everyone is keeping well :)

I am just finalising my first Indicia site ready for launch this Monday.  I have one final change that I would like to make to my submit sightings page however and am having a couple of issues with it.  I would like to change the titles 'Search for place on map' and 'Spatial ref:'  to more user freindly text.  I managed to find a reference to this text in iform - client helpers - lang - default.php, however changing that value and uploading the file again does not seem to make any difference.

Is there some other location that this text is being taken from?

Thanks in advance for your help.

Mark

2

Re: Changing submit sightings label

Hi Mark
Yes, if you have created the Submit Sightings page using Instant Indicia (or the MNHNL Dynamic 1 form which is the form used by Instant Indicia), then click on the Edit tab when viewing the form. Now, look down the page for a section called User Interface. In this section there is a box called Form Structure which lets you flexibly define how the form will be output.

Look through the content of this box for the line which reads [spatial reference] - that's the spatial reference control. You can put overrides to the default behaviour on subsequent lines, so to change the label you could add something like @label=Grid ref. Do the same for the [place search] to change its label. Your code should now look something like:

...
[spatial reference]
@label=Grid ref.
[place search]
@label=Search map
...

Now just save the form and the labels should be updated as appropriate.

John van Breda
Biodiverse IT

3

Re: Changing submit sightings label

Hi John,

Thank you for your quick response.  I would have taken a while to work that one out myself :)

Thanks again

Mark

4

Re: Changing submit sightings label

You'll note in the comments under the Form Structure text area it says "The options available depend on the control." There are a range of options for advanced users which are best documented in the code at present.

A couple of interest to Mark for the [map] control are clickedSrefPrecisionMin and clickedSrefPrecisionMax. These allow you to specify the minimum and maximum precision allowed when clicking on the map to get a grid square. If not set then the grid square selected will decrease to its minimum size as the map is zoomed in. With the Ordnance Survey grid, values of 2, 4, 6, 8 or 10 signify squares of 10km, 1km, 100m, 10m and 1m respectively.

Jim Bacon

5

Re: Changing submit sightings label

Hi Jim,

Thank you for your comments.


Could you be a little clearer about the use of the [map] control?  For example, if I were to want a user to zoom in to the smallest 100m distance before submitting there sighting, then how would I define this?  Also, would this definition also be made in the edit wizard within that drupal page?

Thank you

Best regards,

Mark

6

Re: Changing submit sightings label

Hi

These are options that you can specify in the Form Structure text area when you are editing the Drupal page in exactly the same way that John described the label option.

To force all grid references to be 6 figure precision (i.e. 100m square) you would have the following:

...
[map]
@clickedSrefPrecisionMin=6
@clickedSrefPrecisionMax=6
...

This does not impose any restriction on the way the user zooms in so they could click on a map that is zoomed out a long way and they will mark a point but it will be so small they won't even know they have done it.

I could easily amend the code so that an alert appeared saying "You must zoom in before recording your location" to counter this problem.

Jim Bacon

7

Re: Changing submit sightings label

Hi Jim,

Thanks for that code.  Also, thanks again to both you and to John for all of your help keeping the blacksquirrelproject.org site live last night when the hit rate was so high.  It would have been such a shame if we had missed all of that data.

I'll get the code in place now as there is a Look East show this eve that will once again mention the site.  Although thats just regional so shouldn't create such a high load.

Mark

8

Re: Changing submit sightings label

Hi Mark
It's not something I have done for this purpose, but you can supply configuration options to the OpenLayers map in the Advanced Base Layers section of the form editor. With some experimentation and a bit of luck it should be possible to supply a configuration to limit the number of zoom levels available on the map. Whether this helps or not I am not sure, because users will probably want to start zoomed out and then zoom in to their area of interest.
Another thought, also something that would take a bit of fiddling to get right - you can attach your own Javascript to the form by creating a file called node.n.js in the iform module's client_helpers/prebuilt_forms/js folder. If you create a function and push it onto the mapInitialisationHooks array, this function will be called with the mapDiv as a parameter when the map is initialised. Then you can attach a zoomend event handler to the map. When the event is called, check the map scale and if it is inappropriate replace the spatial ref box with a label "Please zoom in before clicking to set the grid reference" or similar.

See http://code.google.com/p/indicia/wiki/DrupalIFormOverrides for how to add custom JS to the form.

John van Breda
Biodiverse IT

9

Re: Changing submit sightings label

Hi John,

Thats very useful advice.  I will have a play around and see how I get on.

I may have some more practice soon as although the main publicity drive for the squirrel site is now past its peak, I have been asked to investigate the possibility of putting together another site involving frog populations.

Mark

10

Re: Changing submit sightings label

Hi John,

I don't think limiting the number of zoom levels would make for the best user experience. I also think that we get a number of unintentional 10km scale records because people don't read the instructions and don't zoom in to the map. I also have heard the likes of the environment agency saying that, for some of their applications, 100m resolution is the minimum useful resolution.

Because I think it is of general application, not to mention being easier than Mark trying to attach his own event handler, I propose that I patch jquery.indiciaMapPanel.js so that, if clickedSrefPrecisionMin is set, then a click is not accepted until the map is adequately zoomed in for it to be visible.

An alternative would be to zoom automatically to the click point but I think that would be really confusing to someone who is not very savvy about using the maps in the first place.

Jim Bacon.