1

Re: Indicia and PHP novice - help

Hi Everyone

NOTE: at 17:16 on 15th Oct I may have solved this problem by downloading the client_helpers and replacing the folder supplied with the Indicia download with that of the independant download. This time it has got past the include

<?php   require 'client_helpers/data_entry_helper.php'; ?>

But I haven't got onto the next part yet so fingers crossed it will have solved this problem

Here is the original message: As a way of discovering the level of skill needed to put together an Indicia project I will be attempting to go through the tutorials with an outcome of having a data entry page linked up to the Indicia Warehouse at CEH.

So far I have set up a server on my PC using the WAMP stack which is working fine and I have put together a little website in PHP to put the data entry page into.

I have an account with the test warehouse and set up everything as per the instructions on this page http://code.google.com/p/indicia/wiki/TutorialBuildingBasicPage but when I get down to getting the authorisation tokens I get the following error:

Warning: require_once(helper_config.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\indicia\client_helpers\data_entry_helper.php on line 26

Fatal error: require_once() [function.require]: Failed opening required 'helper_config.php' (include_path='.;C:\php5\pear') in C:\wamp\www\indicia\client_helpers\data_entry_helper.php on line 26

When I take the code from the sample page at http://testwarehouse.indicia.org.uk/modules/demo/data_entry/basic_data_entry_tutorial.php and put it into my page it looks like it will do the job but isn't fully functional yet. It is only when I change the code to the one in the tutorial that I get this error.

I have the client help file copied over in the correct place and the files to which it refers are included, But the helper_config is not in the Client helper folder so is probably the cause. Any ideas why it isn't included? I haven't installed the Indicia data warehouse just unpacked it. Do I need to install this before I continue so all the files are in the correct place? Not got Postgrsql but mysql at the moment in the WAMP stack.

Any help to get me a little further advanced would be great.

I am logging all this and hope to have a useful report on how to improve the tutorial documentation - fresh eyes and all that!

Thanks

Jo

2

Re: Indicia and PHP novice - help

OK

The site I created re the message above was not using PostgreSQL which I have since installed on my PC (the other is on my laptop). I am now following the Postgresql installation guide but have come to a stop at
CREATE DATABASE indicia TEMPLATE=template_postgis; I have opened up the pgAdmin III tool but am unsure of how to create run the script. Is it a case of adding a new server?

Thanks

Jo

3

Re: Indicia and PHP novice - help

Hi Jo,
I'll answer the first post first since I think it is separate to the second. The client_helpers folder provided if you just unzip the install kit does indeed have the helper_config.php file missing, because that file is configured for you when you run the install kit. Actually, I'd better be clear - the file is configured for the demonstration pages included with the Indicia warehouse. To use it yourself properly, you would need to open the file and specify your own API keys for Google Maps and so forth.
So there is an action here - we need to clearly document where to get the client_helpers folder from, and how to configure it properly once you have got it.

I've got to admit I didn't write the installation guide to the same level of detail as the other tutorials, simply because the tools are "standard" and there are other tutorials around on how to install PostgreSQL and so forth so I didn't want to duplicate work. Anyway, I've just added some more detail to the install guide so hopefully this is a bit clearer now.

Best Wishes

John van Breda
Biodiverse IT

4

Re: Indicia and PHP novice - help

Thanks John

This morning's progress - I have created a basic data entry page using the tutorial and it looks like your example. But I need to test if it is communicating with the Warehouse. It would help if you would add some taxa into my pretend species list (ID 4) so I can see if the species select function is working.

There are syntax error in my page identified by my browser IE8 (not PHPcode error reporting), which are not very helpful as it says the error is on line 33million or so, code:0, Char1!. The date select works and the map controls work, but the Search for place on map doesn’t so is the error likely to be around that?

Thanks again

Jo

5

Re: Indicia and PHP novice - help

Hi Jo,

I've put a very small selection of species in the list for you just to get you going, but you should have the rights to do this if you want more. You can click on the Taxa tab when editing the list, then either add new taxa manually or upload csv data.

I've just tried the tutorial page (http://testwarehouse.indicia.org.uk/mod … torial.php) using IE8 and it doesn't show any errors. If you get stuck paste the code here and I can try it. Have you tried it on Firefox? The Firebug addon is a very handing debugging tool for JavaScript by the way.

Best wishes

John

John van Breda
Biodiverse IT

6

Re: Indicia and PHP novice - help

Hi John

I think there is something wrong with my coding? I have tested it in Firefox. There are no errors on the page when it is first loaded up but as soon as I try to use the Species Box or Search for place on map it says "transferring data from testwarehouse.indica.org.uk..". but gets no further

Perhaps I have got my authorisation wrong? I have used my admin password for the Indica Warehouse (the one you originally gave me which I then changed). Is this the correct one to use? The value for the website ID is 5 - hold on - is this a string or an integer? In the sample code you use 'website_id' - should I omit the ' ' ?

Thanks

Jo

7

Re: Indicia and PHP novice - help

Hi Jo

First thing I would suggest is installing FireFox and then adding the FireBug addon. With this installed, any JavaScript errors will be reported to you in a console so you can see the line of code which had the problems.

Could you send me your code please to give it a try?

Best Wishes

John van Breda
Biodiverse IT

8

Re: Indicia and PHP novice - help

Oh!

My website address I registered with the Warehouse is where I might wish to put if I went live, not where it actually resides which is on my laptop.

That would cause these issues yes?

Jo

9

Re: Indicia and PHP novice - help

No, that won't affect anything.

One more thing to try - please insert the following into your form:

echo data_entry_helper::system_check(true);

Save it and reload it to see if that gives you any warnings.

John van Breda
Biodiverse IT

10

Re: Indicia and PHP novice - help

ystem check

    * Success: PHP version is 5.3.0.
    * Success: The cUrl PHP library is installed.
    * Success: Indicia Warehouse URL responded to a POST request.
    * Warning: The following configuration entries are not specified in helper_config.php : $geoserver_url, $google_api_key, $flickr_api_key, $flickr_api_secret. This means the respective areas of functionality will not be available.

That is where the problem lies then I guess. How to solve it is my next task :) Will I need to create some accounts with google, flickr and geoserver? I did read that somewhere...

Jo

11

Re: Indicia and PHP novice - help

No, you are OK without those for now- you will need the API keys when you start looking at alternative configuration of the maps, or looking at the flickr API.

The problem in your code is in the call to the autocomplete for the species data entry:

echo data_entry_helper::autocomplete(array(    
          'label'=>'Species',    
          'fieldname'=>'occurrence:taxa_taxon_list_id',    
          'table'=>'taxa_taxon_list',    
          'captionField'=>'taxon',    
          'valueField'=>'id',    
          'extraParams'=>$readAuth + array('taxon_list_id' => '<4>')
        ));

The issue lies on the last bit where you filter the taxon list id to a value <4>. The problem is there should not be any <> signs - just a number. So it should read:

echo data_entry_helper::autocomplete(array(    
          'label'=>'Species',    
          'fieldname'=>'occurrence:taxa_taxon_list_id',    
          'table'=>'taxa_taxon_list',    
          'captionField'=>'taxon',    
          'valueField'=>'id',    
          'extraParams'=>$readAuth + array('taxon_list_id' => '4')
        ));

Having done that it seems to work fine for me (though I can't be sure there aren't errors in your header or footer since I don't have those pieces of code).

Do you know where you got the idea of including <> in the filter value? If it's our documentation then we obviously need to fix it.

Best Wishes

John van Breda
Biodiverse IT

12

Re: Indicia and PHP novice - help

Ah, I just spotted why you thought that - it's the wording in the tutorial being a little unclear. I will fix it...

Thanks

John van Breda
Biodiverse IT

13

Re: Indicia and PHP novice - help

I've updated the tutorial - hopefully as clear as mud now...

John van Breda
Biodiverse IT

14

Re: Indicia and PHP novice - help

I now have a drop down box to select a species from! Yay!

Still got a problem with the search for place on map bit. Do I need to put any of my id's into the array to make it work?

Ta

Jo

15

Re: Indicia and PHP novice - help

OK

The basic data entry tutorial page http://testwarehouse.indicia.org.uk/modules/demo/data_entry/basic_data_entry_tutorial.php was working fine yesterday on the mapping front. Today it isn't working on any browser (Firefox, IE or Chrome). The only difference from yesterday to today has been a huge windows update that happened this morning. Could that have stopped the page from working correctly? Both my laptop (XP) and my PC (Vista 64bit) were updated. I will try it on one of the other PCs here to see if they are affected too if only to rule the update out.

I have compared the source code for my page and the sample page and they are the same.

Jo

16

Re: Indicia and PHP novice - help

Hi Jo,
I don't think I've had any updates the last couple of days, running Vista 32 bit, but maybe I have that to look forward to :(.
Your sample code still works fine on my system. What are the symptoms you are experiencing?
Also I think your helper_config.php file has a value for the geoplanet_api_key so that should also work, and your code is correct because it works here.  Again, please let me know the exact symptoms. Have you managed to install Firebug yet?

Have a good weekend

John van Breda
Biodiverse IT

17

Re: Indicia and PHP novice - help

Jo, to make it really clear what needs to be done with the helper_config.php file, I have added a page to the Wiki at [http://code.google.com/p/indicia/wiki/SetupHelperConfig] as well as updated the basic data entry page tutorial to link to this. Hopefully that should make that area much clearer.

Best Wishes

John van Breda
Biodiverse IT

18

Re: Indicia and PHP novice - help

Hi John

OK I have tried the sample page again and hit enter this time and it has brought up a list for my query. I was using the search button to the right which does nothing! However once you have hit enter the search button starts to work.

Is this a little bug or just a peculiarity at my end?

I am moving on to the config_helper configuration as I think this might iron out some of my other questions and issues

Thanks

Jo

19

Re: Indicia and PHP novice - help

Hi Jo,
I've fixed the other bugs with the search place control not working, so can you test this button again on the test warehouse. It does work for me which is odd.

regards

John van Breda
Biodiverse IT

20

Re: Indicia and PHP novice - help

Hi John

I have updated the helper files and now when I hit search you can see it is doing something, but it doesn't locate the spot on the map nor does it put in the grid reference.

I have used the firebug to try and narrow down the problem. I have noticed that in the code for the sample basic data entry page tutorial there is an additional line which I don't get on my page

My code

<svg id="OpenLayers.Layer.Vector_43_svgRoot" width="470" height="600" viewBox="0 0 470 600">
<g id="OpenLayers.Layer.Vector_43_root" style="visibility: visible;" transform="translate(-12.0013, -594.001)">
<g id="OpenLayers.Layer.Vector_43_vroot"/>
<g id="OpenLayers.Layer.Vector_43_troot"/>

Sample code

<svg id="OpenLayers.Layer.Vector_43_svgRoot" width="600" height="470" viewBox="0 0 600 470">
<g id="OpenLayers.Layer.Vector_43_root" style="visibility: visible;" transform="">
<g id="OpenLayers.Layer.Vector_43_vroot">
<circle id="OpenLayers.Geometry.Point_63" cx="299.9999999997726" cy="234.99999999895226" r="6" fill="#ee9900" fill-opacity="0.4" stroke="#ee9900" stroke-opacity="1" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="none" pointer-events="visiblePainted" cursor="inherit"/>

So basically when I use the search location button it doesn't add in "transform="translate()" and consequently the path id. Can you help me narrow down why?

Thanks

Jo

21

Re: Indicia and PHP novice - help

Hi Jo

A few questions to help narrow this down:
1) Does it work for you on the test warehouse demo page? I think from what you say above it does, but just to be sure.
2) If you type in a name of a place that is duplicated several times in the UK, the place search should drop down a list of the suggestions for you to pick from. So, type in something like Upton and hit search to see what happens.
3) When you type in an exact place name with only one match (e.g. Cowes), what messages appear in FireBug's console when you run the search? Assuming you see something like "GET http://testwarehouse.indicia.org.uk/...", if you expand the message you should be able to check the response so could you let me know what it is please?
4) In your Indicia installation, look in the Application\Logs folder for todays log file and see if anything is posted when you try to run the search (i.e. you could empty the log file first, then run the search, and check the content afterwards). If not, then open your Application\Config\config.php file and set the $config['log_threshold'] setting to a value of 4 (for maximum logging) then try again.

Best Wishes

John

John van Breda
Biodiverse IT

22

Re: Indicia and PHP novice - help

My God it is working! Not sure what I did but I have action!

Thanks

Jo

23

Re: Indicia and PHP novice - help

Spoke too soon

Now have a problems with the survey select
Warning: array_key_exists() expects parameter 2 to be array, null given in C:\wamp\www\indicia\client_helpers\data_entry_helper.php on line 1084

Warning: Invalid argument supplied for foreach() in C:\wamp\www\indicia\client_helpers\data_entry_helper.php on line 1093

Jo

24

Re: Indicia and PHP novice - help

Now it is working again now and I have only refreshed the page. Have you done something at the warehouse end?

Jo

25

Re: Indicia and PHP novice - help

Hi Jo,

No, I've not changed anything today. I did an update yesterday which could have been cached in your browser but that probably wouldn't explain the survey control not working. Having said that, looking at the code in data_entry_helper it would be something wrong with the response from the warehouse to cause that sort of problem (e.g. an error message returned instead of data).

In your folder containing the PHP code, have you created a folder called upload (to be a sibling of the data_entry_helper folder)? If so then your responses from the server could have been cached locally.

Best Wishes

John van Breda
Biodiverse IT