Seems not work right if drupal is installed in document root

sebastiang - March 18, 2008 - 16:56
Project:AJAX Views
Version:5.x-1.3
Component:Code
Category:bug report
Priority:critical
Assigned:febbraro
Status:active
Description

An "AJAX paging block view"-block only prints the progress.gif and "Loading content for ..." if drupal is installed directly in document root. Using a second virtual host, where drupal resists in folder "/drupal", it works fine.

Firefox javascript error console:
Fehler: [Exception... "'Die Erlaubnis für den Aufruf der Methode XMLHttpRequest.open wurde verweigert' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "" data: no]

Translation is like:
Error: [Exception..."Permission for method call XMLHttpRequest.open denied when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "" data: no]

#1

febbraro - March 19, 2008 - 13:42
Priority:normal» critical
Assigned to:Anonymous» febbraro

Not sure I understand. It only works when in the docroot? or only when in a sub folder?

I will admit that I have not tested it installed in a sub-folder, but that will be next on the list I guess.

#2

jauzah - March 21, 2008 - 21:38

I am having the same problem just now. The error appears only with clean-urls on.

#3

sebastiang - March 26, 2008 - 13:46

It does not work if drupal is in docroot. In subfolder it works.

(with clean-urls enabled, if disabled anything is fine)

#4

febbraro - March 26, 2008 - 14:13

Can you show me the snippet of JavaScript that is in the head section of your page that loads it remotely?

#5

sebastiang - March 26, 2008 - 22:05

Do you mean this:

<script type="text/javascript">$(document).ready(function() {
$.get('//wein_nav/ajax', {page: 0}, function(data, status) {
$('.ajax-view-block-Wein-nav').html(data);
});
})</script>

#6

sebastiang - March 27, 2008 - 12:05

Getting above hint from febbraro, I found whats wrong. An patch is attached.

Please re-validate, because I am not sure if it works under any circumstances without trailing slah in _generate_ajax_url(). May this should be solved in common.php url()?

AttachmentSize
ajax_views.module.patch_235852.diff 61 bytes

#7

sebastiang - March 27, 2008 - 12:34
Status:active» needs review

#8

febbraro - March 27, 2008 - 13:25

Damn, I knew something was funky. I have had this fixed for a long time, turns out it is in the DRUPAL-5 branch of the code and somehow never made it into the "release". Sorry about that, i am still trying to figure out the best way to use CVS/Drupal.org for module release development. Now that this is largely resolved, I will work on getting a new build out that will include this (finally) and the translatable fix that you submitted.

Thanks, sorry for the issues.

#9

febbraro - March 27, 2008 - 13:40
Status:needs review» closed

Fixed in release 1.4 out on d.o now.

#10

palace - August 18, 2008 - 22:12
Status:closed» active

I'm having the same problem with the ajax views module, like sebastiang.

I've tried the patch you post here and it doesn't work.

my javascript code generated with the functiont _generate_ajax_url is this one:

<script type="text/javascript">$(document).ready(function() {
$.get('/mosquito//ajax', {page: 0}, function(data, status) {
$('.ajax-view-block-clubinfo-liveact-ajaxtest').html(data);
});
})</script>

and my original function code is this one:

function _generate_ajax_url($view) {
$url .= "$view->url";
  $i = 0;
  foreach ($view->argument as $argument) {
    if($argument['type'] == 'ajax_response') {
      $url .= "/ajax";
    }
    else if ($view->args[$i]){
      $url .= '/' . $view->args[$i];
    }
    else if ($argument['wildcard']) {
      $url .= '/' . $argument['wildcard'];
    }
    else {
      $url .= "/*";
    }
    $i++;
  }
  return url($url);
}

I don't know which is the correct url to get work ajax views module.

Also I have tried creating a virtualhost and putting the drupal into de DocRoot, or putting it in a subfolder, and any of those solutions work.

I hope someone find the solution.

thanks,

 
 

Drupal is a registered trademark of Dries Buytaert.