Django

Code

Changeset 3121

Show
Ignore:
Timestamp:
06/12/06 09:52:51 (2 years ago)
Author:
hugo
Message:

fixed #2128: updated BiDi? support

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/admin/media/js/admin/DateTimeShortcuts.js

    r1530 r3121  
    7070        clock_box.style.display = 'none'; 
    7171        clock_box.style.position = 'absolute'; 
    72         clock_box.style.left = findPosX(clock_link) + 17 + 'px'; 
     72        if (getStyle(document.body,'direction')!='rtl') { 
     73            clock_box.style.left = findPosX(clock_link) + 17 + 'px'; 
     74        } 
     75        else { 
     76            // since style's width is in em, it'd be tough to calculate 
     77            // px value of it. let's use an estimated px for now 
     78            // TODO: IE returns wrong value for findPosX when in rtl mode 
     79            //       (it returns as it was left aligned), needs to be fixed. 
     80            clock_box.style.left = findPosX(clock_link) - 110 + 'px'; 
     81        } 
    7382        clock_box.style.top = findPosY(clock_link) - 30 + 'px'; 
    7483        clock_box.className = 'clockbox module'; 
     
    141150        cal_box.style.display = 'none'; 
    142151        cal_box.style.position = 'absolute'; 
    143         cal_box.style.left = findPosX(cal_link) + 17 + 'px'; 
     152        // is it left-to-right or right-to-left layout ? 
     153        if (getStyle(document.body,'direction')!='rtl') { 
     154            cal_box.style.left = findPosX(cal_link) + 17 + 'px'; 
     155        } 
     156        else { 
     157            // since style's width is in em, it'd be tough to calculate 
     158            // px value of it. let's use an estimated px for now 
     159            // TODO: IE returns wrong value for findPosX when in rtl mode 
     160            //       (it returns as it was left aligned), needs to be fixed. 
     161            cal_box.style.left = findPosX(cal_link) - 180 + 'px'; 
     162        } 
    144163        cal_box.style.top = findPosY(cal_link) - 75 + 'px'; 
    145164        cal_box.className = 'calendarbox module'; 
  • django/trunk/django/contrib/admin/media/js/core.js

    r2448 r3121  
    137137    return new_string; 
    138138} 
     139 
     140// ---------------------------------------------------------------------------- 
     141// Get the computed style for and element 
     142// ---------------------------------------------------------------------------- 
     143function getStyle(oElm, strCssRule){ 
     144    var strValue = ""; 
     145    if(document.defaultView && document.defaultView.getComputedStyle){ 
     146        strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule); 
     147    } 
     148    else if(oElm.currentStyle){ 
     149        strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){ 
     150            return p1.toUpperCase(); 
     151        }); 
     152        strValue = oElm.currentStyle[strCssRule]; 
     153    } 
     154    return strValue; 
     155} 
  • django/trunk/django/contrib/admin/templates/admin/base.html

    r3091 r3121  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}"
     2<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}
    33<head> 
    44<title>{% block title %}{% endblock %}</title> 
    5 <link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base{% if LANGUAGE_BIDI %}_rtl{% endif %}.css{% endblock %}" /> 
     5<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base.css{% endblock %}" /> 
     6{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% admin_media_prefix %}css/rtl.css{% endblock %}" />{% endif %} 
    67{% block extrastyle %}{% endblock %} 
    78{% block extrahead %}{% endblock %} 
  • django/trunk/django/contrib/admin/templates/admin/login.html

    r3091 r3121  
    22{% load i18n %} 
    33 
    4 {% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/login{% if LANGUAGE_BIDI %}_rtl{% endif %}.css{% endblock %} 
     4{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/login.css{% endblock %} 
    55{% block bodyclass %}login{% endblock %} 
    66{% block content_title %}{% endblock %}