remove the class from the parent
[mkdru-moved-to-drupal.org.git] / mkdru.module
index ea00246..7ad7479 100644 (file)
@@ -20,13 +20,22 @@ function mkdru_node_info() {
 function mkdru_ting_search_tab($keys) {
   error_log("TING SEARCH TAB invoked");
    $path = drupal_get_path('module', 'mkdru');
-  // Include client library.
-  drupal_add_js(variable_get('pz2_js_path', 'pazpar2/js') 
-    . '/pz2.js', 'module', 'footer', TRUE, TRUE, FALSE);
-  drupal_add_js($path . '/jquery.ba-bbq.js', 'module', 'footer', TRUE, TRUE, FALSE);
-  drupal_add_js($path . '/recipe.js', 'module', 'footer', TRUE, TRUE, FALSE);
-  drupal_add_js($path . '/mkdru.theme.js', 'module', 'footer', TRUE, TRUE, FALSE);
-  drupal_add_js($path . '/mkdru.client.js', 'module', 'footer', TRUE, TRUE, FALSE);
+  // D6 is not to be able to handle external scripts and always
+  // prepends '/' (so we cannot keep pz2.js on remote host)
+  // we will try to be even smarter :)
+  $pz2_js_path = variable_get('pz2_js_path', 'pazpar2/js');
+  if (preg_match('/^\//', $pz2_js_path)) {
+     $pz2_js_path = trim($pz2_js_path, '/');
+     drupal_add_js($pz2_js_path.'/pz2.js', 'module', 'footer',
+       TRUE, TRUE, FALSE);
+     error_log("Pz2.js added as alias script '".$pz2_js_path);  
+  } else {
+    drupal_add_js($path.'/'.$pz2_js_path.'/pz2.js', 'module', 'footer');
+  }
+  drupal_add_js($path . '/jquery.ba-bbq.js', 'module', 'footer');
+  drupal_add_js($path . '/recipe.js', 'module', 'footer');
+  drupal_add_js($path . '/mkdru.theme.js', 'module', 'footer');
+  drupal_add_js($path . '/mkdru.client.js', 'module', 'footer');
   $html = theme('mkdru_results');
   drupal_add_js(array('mkdru' => 
     array(