26

Re: Data submit, login user, how?

Hi Jim,
you are right, it's better use words like Drupal and Warehouse so not to get confused.
I asked about how password are stored because when an user from mobile app enters his username & password, our app checks in Drupal tables if exists an user with those credentials and returns the ID. So i needed to know the method so to do in the right way the query in table. I have done something in this way, i have to test better if all is ok.

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

27

Re: Data submit, login user, how?

Hi John, my goal was to find the warehouse user id reading directly with an SQL query. Yes in app i know which is website ID and its password and then i can go with creation of nonce and auth token. I hope to be able to send all in the right way using client_helper...

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

28

Re: Data submit, login user, how?

Hi Carlo,

Is the Drupal user_authenticate function helpful?

Jim Bacon

29

Re: Data submit, login user, how?

Hi Jim,
so so, even if i saw only now your suggestion. I tried to use so:

<?php
include 'instant_indicia/modules/user/user.module';

$account = user_load(array('name' => "carlo", 'pass' => "12345678", 'status' => 1));
echo $account;
?>

but i receive this error:


Fatal error: Call to undefined function db_query() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\instant_indicia\modules\user\user.module on line 179

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

30 (edited by Jim Bacon 01-02-2013 15:12:27)

Re: Data submit, login user, how?

Hi Carlo

You can search the Drupal API for the missing function.

Alternatively, enable the PHP Filter module, Create a new page and paste your code in there, select the PHP input filter and save. No need for the include statement if you do it this way.

Jim Bacon.

31

Re: Data submit, login user, how?

Return to my question on submit, I'm trying to use the client_helper API to submit values from mobile app, making my own API functions to call on middle layer site. I have a big double related how say to client helper functions that i what to submit a particolar taxon_list_id and an particolar taxon_id. Is it right to set these things so:

$params['occurrence:taxon_list_id'] = $taxon_list_id;
$params['occurrence:taxa_taxon_list_id'] = $taxon_id;

and passing this array of params to data_entry_helper::build_sample_occurrence_submission($params); ?

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

32

Re: Data submit, login user, how?

Hi Carlo

What you require is something like

$params['occurrence:taxa_taxon_list_id'] = $taxa_taxon_list_id;

An easy way to see what the parameters should be is to use something like Firebug for Firefox to observe the parameters posted by a working web form such as you created with the TutorialBuildingBasicPage.

Jim Bacon.

33

Re: Data submit, login user, how?

Ok, i just asked if someone else tried to set directly by PHP these infos...

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

34

Re: Data submit, login user, how?

I'm configuring client helper to send data, i need to know if i have to set these params, i mean geoserver_url or i can leave blank? or i put the url i see in the drupal setting page? upload_path is the local path, right?

<?php
 
class helper_config {
  static $base_url='http://localhost/indicia_warehouse/';
  static $upload_path = './upload/';
  static $geoserver_url = '';
  static $geoplanet_api_key='';
  static $bing_api_key='';
  static $flickr_api_key='';
  static $flickr_api_secret='';
}
?>

Other thing, related what write in params to send. I have seen with Firebug i have this. Is important to set or i can leave blank in HTTP POST?

OpenLayers.Control.LayerSwitcher_25_baseLayers=Google+Hybrid

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

35

Re: Data submit, login user, how?

Hi Carlo

You can leave geoserver_url blank. This is the path to a WMS service that allows you to display records and it is not needed for sending records.

You are correct that upload_path is the local path. Typically the upload folder is a subdirectory of the client_helpers folder. You can see in your example that a relative path is given. I notice that, in the repository there is a value of  './sites/all/modules/iform/upload/' so the correct relative path may depend upon your application.

There is no need to post the OpenLayers parameter. I am not sure what it is but the Warehouse does not need it.

Jim Bacon.

36

Re: Data submit, login user, how?

..and... is it possible to upload more than 1 file with client helper?

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

37

Re: Data submit, login user, how?

Yes, you can upload more than one file in the same post.

You could add two image_upload controls or a file_box control to your TutorialBuildingBasicPage to see how it works

If you use image_upload, call it with $options['fieldname'] = 'occurrence:image:0' and for the first control and 'occurrence:image:1' for the second. I am not sure if that is documented anywhere but I can see that is what I did on an old form created before the file_box control was written.

Jim Bacon.

38

Re: Data submit, login user, how?

yesterday night i had success to submit multiple files from app with a single submit (i tried with 7 files). the limit for single file, if i don't remember bad, is forced by PHP variable upload_max_filesize and the max i can send with http POST (so i consider the sum of all files) by post_max_size? i have seen with phpinfo() call these variables (in my case) are 2MB and 8MB, so i can set these as limit in my app? and other thing, the first index of occurrence:image is always 0 or i can start from 1?

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

39

Re: Data submit, login user, how?

Hi Carlo,

There is a wiki page that attempts to list all the settings that can affect file upload.

About the first index of occurrence:image, I don't know the answer. You can read the code at submission_builder::wrap_with_images and data_entry_helper::extract_image_data. A quick look makes me think that it does not matter but, to be sure, I would do a test and use a debugger to step through the code and understand what it is doing.

Jim Bacon.

40

Re: Data submit, login user, how?

okk thanks, i have checked submission_builder.php and it seems $_FILES starts from 0

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit