1 (edited by SOLL-ak 10-01-2012 17:20:59)

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi John / Jim

The 'My Map' reporting all appears as on P78 of the tutorial workbook.  I can select my survey (damselflies) and then I choose a polygon tool and draw over the map area where I'm pretty certain I've posted some sightings (I've checked the warehouse survey report for my damselflies and it definitely shows some records).  A suitable section of the map is shaded 'orange' - all appears to be working.

I press 'run report' and it always comes up with a white box saying:-
'please supply search area for the report’.

Any advice please?
Anne

2

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

I can't reproduce this - Jim are you able to try? Also it might be worth looking in the test warehouse logs around the time that Anne tries the report to see what parameters are posted.

John van Breda
Biodiverse IT

3

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi John

I think I have recreated the problem. What I am seeing is the Ajax request in the bufferFeature function of spatialReports.js failing. With no buffer layer present the run-report event handler outputs the error message. The Ajax request is failing because it is not going via the proxy.

I'm not sure if this would be the preferred way to fix this but I was able to solve it by adding a proxy option prior to calling the map_helper::map_panel function in the get_form function of the report_map.php prebuilt form:

    if (defined('DRUPAL_BOOTSTRAP_CONFIGURATION') && module_exists('iform_proxy')) {
      global $base_url;
      $options['proxy'] = $base_url . '?q=' . variable_get('iform_proxy_path', 'proxy') . '&url=';
    }

Then, in spatialReports.js, changing the url of the Ajax call to

mapDiv.settings.proxy + mapDiv.settings.indiciaSvc + 'index.php/services/spatial/buffer'
          +'&wkt='+feature.geometry.toString()+'&buffer='+$('#geom_buffer').val()

I guess this url might want wrapping in a conditional statement in case the proxy is not in use.

Jim

4

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi John / Jim
Not sure if this is of relevance/help.
There were error messages reported during the My Maps report creation –but the primary link seemed to work and produce the 'map report' page as in the tutorial - after clearing Cache and log-off/on again.  I copied the warnings into a document - they were:-
•    warning: Invalid argument supplied for foreach() in D:\xampp\htdocs\indicia\includes\common.inc on line 927.
•    warning: strtr() [function.strtr]: The second argument is not an array in D:\xampp\htdocs\indicia\includes\common.inc on line 944.
•    warning: Invalid argument supplied for foreach() in D:\xampp\htdocs\indicia\includes\common.inc on line 927.
•    warning: strtr() [function.strtr]: The second argument is not an array in D:\xampp\htdocs\indicia\includes\common.inc on line 944.

Anne

5

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Thanks, Anne, but I don't think that is related. It is a cross-site scripting problem that may not be apparent if both client and warehouse are on localhost. It needs an update to the code and I'd like it to be in a way that is consistent with what John has done elsewhere but I couldn't find a suitable bit of javascript to copy.

Jim.

6

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Is there an update to a module that I can upload to fix it perhaps - once John or yourself have included the javascript to the appropriate place.   

Or please provide me with the script and tell me what file I should place it into.
Thanks
Anne

7

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Post #3 contains all the information required for an interim fix if you want to try it - both files to be modified can be found in the iform module. Once that has been reviewed we will commit a fix to the repository. You may have to wait while we fulfil other obligations, though.

Jim Bacon

8 (edited by SOLL-ak 08-01-2012 11:40:19)

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Jim
I've found the two files to which you refer.

I found the word  'ajax' in the spatialReports.js and substituted the code you suggest.  But I do not understand what you mean by "I guess this url might want wrapping in a conditional statement in case the proxy is not in use. "
At the moment I have just made a 'copy' of the changed spatialR file  because I await charlification of 'wrapping in a conditional statement'.  Also I can't change the Report_map.php file because I don't know 'where' within the file to put the new code that you suggested. 

Please clarify if you have time and then I can change both the files in the way you suggest and see if the map reporting polygon works.

Anne

9

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Anne,

You can ignore my note about the conditional statement. That is an improvement we might want to incorporate to cover all eventualities but is not necessary in the temporary workaround you are trying to effect.
The code snippet to be incorporated in the report_map.php needs to go in the function called get_form, just before the call to map_panel.
I'll email you my copy of the two files because, if you are not familiar with program code and don't have a helpful editor it will be difficult to get right.

Jim Bacon.

10

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Jim
Perhaps you could email the other file too just so I can check the code I substituted is correct.

I'm just opening the code in Notepad currently.

Thanks
Anne

11

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi

For those following this thread the resolution to this was as follows:

While using a warehouse at version 0.7.1 or below, apply the patch in #3 to spatialReports.js. The change to report_map.php is superfluous as it is already incorporated by a call to iform_map_get_map_options. In addition, ensure the Drupal IForm Ajax Proxy module is enabled.

Meanwhile a fix has been committed to the repository and will be released in version 0.8 which uses JSONP and circumvents the need for the proxy.

Jim Bacon.

12

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

When I run the report is not showing any results even though in the warehouse I do have data. Firebug says there's a JS error in line 107 which is the last line here:

mapInitialisationHooks.push(function(div) {
  refreshLayers_map_legend(div);
  div.map.events.register('addlayer', div.map, function(object, element) {
    refreshLayers_map_legend(div);
  });

It is also giving a lot of warnings (see attached file).

I'm not sure if these are relevant, or if I've done something wrong...!

I'm using warehouse 0.8.1

Thanks, Alice

Post's attachments

errors.txt 19.38 kb, 8 downloads since 2013-02-27 

You don't have the permssions to download the attachments of this post.

13

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Alice,

Well, I haven't seen anything like that before. Perhaps a total red herring but all those redeclaration errors would have me viewing the html source and looking to see if scripts are being included multiple times. I can't see why they would be but you have to start somewhere.

If you set the warehouse log_threshold to 4 (debug) in application/config/config.php you can see the queries being run when you ask for the report. I observe that there is a filter

 AND st_intersects(s.geom, st_geomfromtext('POINT(0 0)',900913))

if I have not selected any area on the map. A filter like that means you will get no results.

Jim Bacon.

14

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Jim,

Thanks for your reply. Looking at the html it seems like the problem is probably the link to the report_map.css file which is as follows. I don't know where the path is set or where to fix this. I suspect the map is actually there but I just can't see it due to the wrong styles being applied.

<link type="text/css" rel="stylesheet" media="all" href="/Indicia/./sites/all/libraries/iform/client_helpers//prebuilt_forms/css/report_map.css?T" />

I'll attach the whole file, in case you see anything else funny.

Thanks, Alice

Post's attachments

html_source.txt 27.76 kb, 1 downloads since 2013-02-27 

You don't have the permssions to download the attachments of this post.

15

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Alice,

Is it the case that you view this page and see a Map Parameters box where you can select your survey with a blank map below? You then select a survey, draw a polygon on the map and click run report, after which the map vanishes? I can see an indication in your html that you have drawn a polygon.

Can you use Firebug to select the area where the map should be and find an empty div? That would take us back to JavaScript problems rather than CSS I think.

Jim Bacon.

16

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Jim,

Yes, this is the case...

The map div is empty: <div id="map" style="width: 75%; height: 600px;"></div>
And the legend div is too: <div class="layer_list" id="map-legend"><ul></ul></div>

So, JavaScript?

Thanks, Alice

17

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Alice,

I think you are using Instant Indicia 0.8.2.
Try the following
Find the file sites/all/libraries/iform/client_helpers/report_helper.php and make a backup copy.
Now open the original file and goto line 1547.
Does it read as follows?

$addFeaturesJs.= "div.addPt(features, ".json_encode($record).", '$wktCol', $opts".(empty($rowId) ? '' : ", '".$record[$options['rowId']]."'").", $locationId);\n";

If so, change it to the following and save.

$addFeaturesJs.= "div.addPt(features, ".json_encode($record).", '$wktCol', $opts" . (empty($rowId) ? '' : ", '" . $record[$options['rowId']] . "'") . (empty($locationId) ? '' : ", $locationId") . ");\n";

Now visit your troublesome web page and try again.
This fixes a problem which caused invalid JavaScript to be injected in to the page.
With luck, the error messages you saw were a side effect of this.


Jim Bacon.

18

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Bingo! Thanks, Jim, that fixed it. Great!

As an aside, I still don't get how the link to this css can work with a dot and an extra slash in the path: <link type="text/css" rel="stylesheet" media="all" href="/Indicia/./sites/all/libraries/iform/client_helpers//prebuilt_forms/css/report_map.css?T" />

19

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Alice

Well, I guess it works because, as the operating system traverses the directory structure, when it sees a dot it knows to stay in the current directory (which might not be common knowledge to anyone who has grown up with only a graphical user interface) and I guess it just ignores the double slash.

The double / looks like a typo at line 671 of sites/all/modules/iform/iform.module which I will correct in the repository.
The . comes from line 1015 of the same file. It does appear superfluous but perhaps there are circumstances where it matters so I'll leave it alone. Someone put it there for a reason.

Jim Bacon

20

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Jim,

Sorry to be bugging you again...

I've set up another report (following this tutorial: http://indicia-docs.readthedocs.org/en/ … orts.html) and it too returns no results even though there are data in the warehouse. Is this likely to be a similar problem?

I'll attach the html source.

thanks, Alice

Post's attachments

html_source_dynamic_report.txt 33.57 kb, 1 downloads since 2013-03-01 

You don't have the permssions to download the attachments of this post.

21

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Alice

Can you confirm that the records you have entered have made it in to the cache_occurrences table?

Jim Bacon.

22

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi,

In http://localhost/Indicia_warehouse/indicia/index.php/occurrence it is showing I have 16 records. Is there where you mean?

thanks, Alice

23

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Alice

That web page is a presentation of information taken from the occurrences table in the database. In order to speed up reporting from the database a cache_occurrences table is built which joins information from various other tables. The cache_occurrences table is built when the scheduled_tasks runs (as mentioned in the tip on the doc page you are working through).

Even though you have occurrences, the cache_occurrences table could still be empty and hence you would get no results showing.

You can only see the contents of the cache_occurrences table by logging in to the database itself. Have you found pgAdmin on your warehouse and explored the database yet?

Jim Bacon

24

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Thanks for your patience. Yes, you are right that the cache_occurrences table is empty... I went back to the indicia site and entered new records and it was still empty though they showed up on the other map report you helped me with yesterday. I ran the scheduled_tasks and it gave the message below. The cache_occurrences table is still empty.

Checking triggers
termlists_terms populated
Updating termlists_terms with 0 changes, 0 delete(s), 0 update(s), 0 insert(s)
taxa_taxon_lists population completed
Updating taxa_taxon_lists with 0 changes, 0 delete(s), 0 update(s), 0 insert(s)
taxon_searchterms population in progress - 100% done

Checking notifications
No notifications found
Ok!

Thanks, Alice

25

Re: Re Instant Indicia Tutorial section 5.7.3 p77 - Adding a new form

Hi Alice,

Have a read of cache builder documentation and try the force_cache_rebuild option.

Check all four of the cache tables. I would expect them all to contain records. What do you find?

You'll may also be interested in the scheduled tasks documentation.

You'll realise that the other map report is not using the cache table which is why it is working.

Jim Bacon.