I've found a problem using the calendar module to create a view which path has non ascii characters and setting ajax on, the problem is that when next or prev pager links are clicked, ajax call is made but if doesn't go to next or previous date.

I've read all the code envolved and I found what I think is a little javascript bug that makes the pager links fails so I think this is a views bug not a calendar one.

The code than manage the ajax pager links is in base.js in views module, on function

/**
 * Helper function to return a view's arguments based on a path.
 */
Drupal.Views.parseViewArgs = function (href, viewPath) {
  var returnObj = {};
  var path = Drupal.Views.getPath(href);
  // Ensure we have a correct path.
  if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') {
    var args = decodeURIComponent(path.substring(viewPath.length + 1, path.length));
    returnObj.view_args = args;
    returnObj.view_path = path;
  }
  return returnObj;
};

when comparing viewPath with path, i've seen that viewPath is urldecoded while path isn't and that makes the comparission to fail with non ascii sollution.

As a sollution for the problem, i think we can add just a line in the function that gets the path, also in base.js

/**
 * Return the Drupal path portion of an href.
 */
Drupal.Views.getPath = function (href) {
  href = Drupal.Views.pathPortion(href);
  href = href.substring(Drupal.settings.basePath.length, href.length);
  // 3 is the length of the '?q=' added to the url without clean urls.
  if (href.substring(0, 3) == '?q=') {
    href = href.substring(3, href.length);
  }
  var chars = ['#', '?', '&'];
  for (i in chars) {
    if (href.indexOf(chars[i]) > -1) {
      href = href.substr(0, href.indexOf(chars[i]));
    }
  }
  return href;
};

just by adding this to the last return line

return decodeURIComponent(href);

I'll try to add a patch.

Comments

MustangGB’s picture

Status: Active » Closed (outdated)

Closing this as outdated, feel free to re-open with updated details if it's still a problem in the latest release.