When Teleport is active, the update.php page doesn't show anymore the list of the installed modules because the fieldset Select versions is not collapsible and cannot be expanded anymore.

I checked the HTML code produced by the PHP, and it's all correct (the fieldset is marked with the classes collapsible and collapsed; the rest of the page is correct apart the fact that teleport.js is included in the page).
I would guess the problem in in the code of teleport.js, but I am not able to understand what is wrong, or why teleport.js is the only third party JavaScript file included in the HTML code generated from update.php.

Comments

incidentist’s picture

Assigned: Unassigned » incidentist
avpaderno’s picture

Component: User interface » Code

Checking better at the module, I noticed the following definition for the init hook:

function teleport_init() {
  // Don't add js if we're autocompleting, to avoid conflicts with devel_themer.
  if (function_exists('user_access') && user_access("use teleport") && !(arg(0) == 'teleport' && arg(1) == 'autocomplete_title')) {
    drupal_add_css(drupal_get_path('module', 'teleport') . '/teleport.css');
    drupal_add_js(drupal_get_path('module', 'teleport') . '/teleport.js');
  }
}

This function causes the teleport.js to be included in the update.php (which is not the desired thing).
I would rather put the code in the menu hook, where such code is usually put.

function teleport_menu($may_cache) {
  [...]
  // Don't add js if we're autocompleting, to avoid conflicts with devel_themer.
  if (!$may_cache) {
    if (!(arg(0) == 'teleport' && arg(1) == 'autocomplete_title') && user_access('use teleport')) {
      drupal_add_css(drupal_get_path('module', 'teleport') .'/teleport.css');
      drupal_add_js(drupal_get_path('module', 'teleport') .'/teleport.js');
    }
  }
}

The use of hook_init() is different between the versions of Drupal. In Drupal 5.x, it's called in all the pages served by Drupal (including such pages like update.php), and it would be used to include() PHP code files basing on the active modules. It seems that teleport.module has been written for Drupal 6.x, and then ported back for Drupal 5.x.

It's not still clear why teleport.js creates some conflicts with others JavaScript files, and that is something that needs to be investigated more.

avpaderno’s picture

Version: 5.x-1.0-beta1 » 5.x-1.0

The issue is still valid with the version 5.x-1.0 dated May 16th.

avpaderno’s picture

I reinstalled the module, and I don't see the issue anymore. Maybe it was some conflict with another module.

Still, I would move the code from hook_init() to hook_menu() (that is the way it should be done with Drupal 5.x).

avpaderno’s picture

Status: Active » Closed (fixed)
stevethewebguy’s picture

Status: Closed (fixed) » Patch (to be ported)

This fix worked in Drupal 6.16 (with Jquery 1.3 & UI 1.7):
You can add the ampersand to the matches var this line (in modules/teleport/teleport.module) to make it into a reference for use on PHP 5. So replace this line:
$matches = call_user_func('_teleport_matches_'. $type, $query, $matches, $aliases);
With this:
$matches = call_user_func('_teleport_matches_'. $type, $query, &$matches, $aliases);
And that should make work, it did the trick for me.

Love the module dude, thanks.

avpaderno’s picture

Version: 5.x-1.0 » 5.x-1.x-dev
Assigned: incidentist » Unassigned
Issue summary: View changes
Status: Patch (to be ported) » Closed (outdated)

I am closing this issue, which is for a not supported Drupal version.