Ticket #2128: django_bidi.diff

File django_bidi.diff, 5.1 KB (added by meir@…, 18 years ago)
  • django/contrib/admin/media/js/core.js

     
    135135        new_string = pad_string + new_string;
    136136    }
    137137    return new_string;
    138 }
    139  No newline at end of file
     138}
     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/contrib/admin/media/js/admin/DateTimeShortcuts.js

     
    6969        var clock_box = document.createElement('div');
    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';
    7584        clock_box.setAttribute('id', DateTimeShortcuts.clockDivName + num);
     
    140149        var cal_box = document.createElement('div');
    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';
    146165        cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num);
  • django/contrib/admin/templates/admin/login.html

     
    11{% extends "admin/base_site.html" %}
    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 %}
    77{% block breadcrumbs %}{% endblock %}
  • django/contrib/admin/templates/admin/base.html

     
    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 %}
    89</head>
Back to Top