I noticed that the "more" link in the jCalendar popup doesn't point to the currently active language, but indead points to the default language. Later I noticed this is due to the ajax url that points to ?q=jcalendar/getnode/... instead of ?q=langcode/jcalendar/getnode/... where langcode would be en/fr/nl/de/...

when I briefly tested it by hardcoding the url to ?q=fr/jcalendar/getnode/... it seemed to work fine

I'm not sure if this is also the case in the latest dev versions. If not, I'll be glad to spit out a patch for it, just don't really know which version to patch against... HEAD doesn't seem to have jCalendar, so guess I'll patch against D6--2 branch

changed jcalendar_views_pre_view:

/**
* Override the calendar view to inject javascript.
* @param view Which view we are using.
* @return unknown as of yet.
*/
function jcalendar_views_pre_view(&$view, &$display_id) {
  foreach ($view->display as $display) {
    if ($display->display_plugin == 'calendar') {
      $path = drupal_get_path('module', 'jcalendar');
      drupal_add_js('var var_path = '. drupal_to_js(base_path() . $path) .";", 'inline');
      drupal_add_js('var var_base_path = '. drupal_to_js((base_path())) .";", 'inline');
      $getnode = '?q=';
      if (module_exists('i18n')) {
        $getnode .=  i18n_get_lang();
        $getnode .= '/';
      }
      $getnode .= 'jcalendar/getnode/';
      drupal_add_js('var var_getnode_url = '. drupal_to_js($getnode).';', 'inline');
      drupal_add_js($path .'/jcalendar.js');
      drupal_add_css($path .'/jcalendar.css');
    }
  }
}

and in jcalendar.js:

// obviously it's js and not php

      // fill the div with data
      $.ajax({
        type: "GET",
        url: var_base_path + var_getnode_url +nid+"/"+id,
        success: function(msg){
          domCallback(msg);
        }
      });

Comments

seutje’s picture

Status: Active » Needs review
seutje’s picture

Status: Needs review » Needs work

solution doesn't work for sites that use a domain-based i18n setting

seutje’s picture

Status: Needs work » Needs review

changed it to

/**
* Override the calendar view to inject javascript.
* @param view Which view we are using.
* @return unknown as of yet.
*/
function jcalendar_views_pre_view(&$view, &$display_id) {
  foreach ($view->display as $display) {
    if ($display->display_plugin == 'calendar') {
      $path = drupal_get_path('module', 'jcalendar');
      $js = 'var var_path = '. drupal_to_js(base_path() . $path) .";\n";
      $js .= 'var var_base_path = '. drupal_to_js((base_path())) .";\n";
      $getnode = '?q=';
      switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
        case "1":
        case "2":
				global $language;
        $getnode .=  $language->language;
        $getnode .= '/';
        break;
      }
      $getnode .= 'jcalendar/getnode/';
      $js .= 'var var_getnode_url = '. drupal_to_js($getnode).';';
      drupal_add_js($js, 'inline');
      drupal_add_js($path .'/jcalendar.js');
      drupal_add_css($path .'/jcalendar.css');
    }
  }
}

and now it seems to play nice with all locale settings, also I aggregated all the inline js into 1 variable and 1 drupal_add_js call

please review :)

seutje’s picture

StatusFileSize
new1.97 KB

converted tabs to spaces and fixed a typo

Remon’s picture

Status: Needs review » Reviewed & tested by the community

it works. thanks

jhedstrom’s picture

StatusFileSize
new1.14 KB

Why not simply use url()? The attached patch works for me with both localization issues and the purl module.

dddave’s picture

Status: Reviewed & tested by the community » Needs review
Remon’s picture

Status: Needs review » Reviewed & tested by the community
karens’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

@Remon, are you saying you reviewed and tested the patch at #6 or the earlier patch? @dddave, did you test the patch at #6? That patch is much simpler and is the latest patch in this issue, so marking it reviewed and tested should mean that patch was reviewed and tested, but by just changing the status without making any comment about why you did it, I can't tell *what* was tested.

arlinsandbulte’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Lack of feedback for over 4 months.
Marking "won't fix"

jhedstrom’s picture

Status: Closed (won't fix) » Needs review

This should not be closed. It's a relatively simple fix, and is very easy to reproduce the bug.

seutje’s picture

Status: Needs review » Reviewed & tested by the community

@jhedstrom: dang, way to make me feel silly :P

tested with multiple different settings, and I can't seem to break it anymore, senks!

jhedstrom’s picture

Status: Reviewed & tested by the community » Fixed

This appears fixed in the latest dev release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.