Hi John,

More pathing issues. When you save the location/filename of the flamingo client, it is erroneously enaccted later in drupal.

If you save the file here:

  • c:\www\drupaldir\sites\modules\mappingkit\flashclient\flamingo\flamingo.swf
    then drupal tries to use it erroneously like this:
  • c:\www\drupaldir\content\sites\modules\mappingkit\flashclient\flamingo\flamingo.swf
  • Comments

    jpulles’s picture

    Hi Franco,

    I can't see where the "/content/" part comes from. The swf path is determined as

    drupal_get_path('module', 'flashclient') . '/'. variable_get('flashclient_flamingo_path', DEFAULT_FLASHCLIENT_FLAMINGO_PATH);

    so it seems as if your flashclient module is located in c:\www\drupaldir\content\sites\modules\mappingkit\flashclient!? But it must have been a relative path like e.g. 'sites/all/modules/mappingkit/flashclient/flamingo/flamingo.swf' on http://aardbodem.nl/?q=node/21.

    spydmobile’s picture

    I have confirmed that this is a code problem. The config has flamingo/flamingo.swf in it. as the location of the mapping client. and the module itself is exactly where it is supposed to be. where is that line you are referring to, file and line number?

    jpulles’s picture

    The code to determine swf_path is in file flashclient.mapclient.inc at line 95.

    spydmobile’s picture

    Version: 6.x-1.x-dev » 6.x-1.2

    Ok, I have confirmed that this problem is related to swf_path in file flashclient.mapclient.inc at line 95. But is not from in there.

    I changed the line from :

    $swf_path = drupal_get_path('module', 'flashclient') . '/'. variable_get('flashclient_flamingo_path', DEFAULT_FLASHCLIENT_FLAMINGO_PATH);
    

    to:

    $swf_path = drupal_get_path('module', 'flashclient') . '/franco'. variable_get('flashclient_flamingo_path', DEFAULT_FLASHCLIENT_FLAMINGO_PATH);
    

    This should have broke the path by adding my name where it did not belong and it did, but it shows that the CONTENT part, which is not supposed to be there, comes from the drupal_get_path('module', 'flashclient') which means the function is broken.
    to prove this point,
    I then went: ADMINISTER> mapping kit> map client
    and changed the default client from open layers to flash.

    I then viewed one of my exisiting map contexts and saw a big grey rectangle (indicating the swf did not load)
    I then checked the drupal logs and found:

    	http://smapp02/cms/content/sites/all/modules/mappingkit/flashclient/francoflamingo/flamingo.swf?config=http://smapp02/cms/node/1/flash
    

    This proves the problem is the drupal_get_path('module', 'flashclient') part, so I tried changing the line to this:

    $swf_path = drupal_get_path('module', 'mappingkit') . '/flashclient/'. variable_get('flashclient_flamingo_path', DEFAULT_FLASHCLIENT_FLAMINGO_PATH);
    

    and got this path in the error error:

    http://smapp02/cms/content/sites/all/modules/mappingkit/flashclient/flamingo/flamingo.swf?config=http://smapp02/cms/node/1/flash
    

    this proves its not an issue with the submodule and the problem persisits even using mapclient module as the target for the function.

    So I read a bit in the API docs about this function and I thought this issue might be related to other modules that modify paths, so I looked at all modules enabled: and disqualified them as the issue.

    I have found that disabling clean URLS somehow makes on of my maps work and the other has issues.

    Digging deeper finds the problem is related to or caused by the function drupal_get_filename which apprears to be getting the incorrect value from the database or for some reason storing the wrong data in the database.

    I changed the code to read:

     $swf_path = dirname(drupal_get_filename('module', 'flashclient')). '/'. variable_get('flashclient_flamingo_path', DEFAULT_FLASHCLIENT_FLAMINGO_PATH);
    

    still getting wrong path.

    This would then appear to be a drupal problem that is manifesting in the flashclient module through the use of the drupal_get_path fuinction which actualy uses the function drupal_get_filename to do it.

    Sorry John, but I am now officially way over my head here, I want to help and I want mapping client to work for me and my project. Since drupal cant be trusted to give the right path, I will be changing the line to this:

    $swf_path = variable_get('flashclient_flamingo_path', DEFAULT_FLASHCLIENT_FLAMINGO_PATH);
    

    and setting the full path in the client config to:

    http://smapp02/cms/content/sites/all/modules/mappingkit/flashclient/flamingo/flamingo.swf
    

    and the client loads consistently. I hope some of my rambling here helps, but I really dont know what to do next....
    F

    jpulles’s picture

    If you enter the following code in a page with php format, what is the output?

    <?php
    $config_path = mapclient_get_url('node/13/flash', TRUE);
    $swf_path = drupal_get_path('module', 'flashclient') . '/'. variable_get('flashclient_flamingo_path', DEFAULT_FLASHCLIENT_FLAMINGO_PATH);
    drupal_set_message('swf config: ' . $config_path);
    drupal_set_message('swf path:  ' . $swf_path);
    ?>
    

    I'm surprised that you get an absolute path; the swf config should be an absolute path, the swf path should be relative.
    E.g.

    It seems that the flash mapping client is important for you. You probably know that it can only show map contexts with wms layers? The flamingo map client is more a proof of concept for non-openlayers mapping clients than something else.

    Regards,
    John.

    spydmobile’s picture

    ok I enabled the PHP filter module, then created a PAGE node with the code you requested.

    I hit save and the following was returned:

        * Page test for john has been created.
        * swf config: http://smapp02/cms/node/13/flash
        * swf path: sites/all/modules/mappingkit/flashclient/http://smapp02/cms/sites/all/modules/mappingkit/flashclient/flamingo/flamingo.swf
    

    But remember I have modified your module to allow me to hardcode the path correctly. I will now restore the original code and do it again.

        * swf config: http://smapp02/cms/node/13/flash
        * swf path: sites/all/modules/mappingkit/flashclient/flamingo/flamingo.swf
    

    Well holy crap, the problem is gone! I am so confused! ok, so let me reset the mapclient to use flash instead of openlayers and see if my map works....

    Nope. same issue. your test works but the module does not.

    Details
    Type	page not found
    Date	Monday, November 17, 2008 - 13:28
    User	root
    Location	http://smapp02/cms/content/sites/all/modules/mappingkit/flashclient/flamingo/flamingo.swf?config=http://smapp02/cms/node/1/flash
    Referrer	http://smapp02/cms/content/ember-map
    Message	content/sites/all/modules/mappingkit/flashclient/flamingo/flamingo.swf
    Severity	warning
    Hostname	216.108.146.48
    Operations	
    

    and yes, I understand the flash thing is a proof of concept, I am not too worried about it. I would rather help you get the rest of mapping kit going.

    jpulles’s picture

    What other modules are you using? You could try to disable most non-drupal modules except for the mapping kit modules. Could it be that one of the other modules is changing the current working directory?

    spydmobile’s picture

    I did that, I am using:
    color,comment,dblogging,help, menu,path, taxonomy, update status are the only core optional enabled

    contribbed mods include: SMTP, mapping kit (all), Admin_role, FCKEditor,pathauto, themekey, themekey-ui, token, and token actions, views and views UI
    so I disabled: FCKEditor,pathauto, themekey, themekey-ui, token, and token actions
    same problem

    jpulles’s picture

    I don't have much of a clue what goes wrong here, but you could also try to enable only the necessary mapping kit modules: mapping kit, map client, map context, openlayers, flashclient.

    jpulles’s picture

    Status: Active » Closed (won't fix)

    Flash client is only a proof-of-concept that map clients other than openlayers are possible.