Changes between Initial Version and Version 1 of Ticket #9212


Ignore:
Timestamp:
Apr 28, 2009, 3:27:40 PM (10 years ago)
Author:
Adam Peller
Comment:

KuRoz?, thank you for your contribution but I must ask that you use proper IBM channels for code contributions. Also, you will need to provide your changes in diff or patch format against an UNBUILT source tree, preferably the development trunk or a recent release, like 1.3.

We are unlikely to add special cases for a calendaring system to the base widget. Have you explored the new national calendar support dojox.date package in 1.3?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9212

    • Property Owner set to Adam Peller
    • Property Component changed from Dijit to Dojox
  • Ticket #9212 – Description

    initial v1  
    22
    33I've modified part of _DateTimeTextBox.js to make it capable of Thai Buddhist calendar.
    4 (You have to add
    5 dojo.require("dojo.cldr.supplemental");
    6 to all of modified class)
    7 
    8 **************************************************************************************
    9 
    10 onValueSelected:function(_d){
    11 if(_b._tabbingAway){
    12 delete _b._tabbingAway;
    13 }else{
    14 _b.focus();
    15 }
    16 setTimeout(dojo.hitch(_b,"_close"),1);
    17 dijit.form._DateTimeTextBox.superclass._setValueAttr2.call(_b,_d,true);
    18 
    19 **************************************************************************************
    20 
    21 _getDisplayedValueAttr:function(){
    22 if(dojo.cldr.supplemental._region(this.lang)=="th"){
    23 var temp1=this.textbox.value;
    24 var temp2=this.textbox.value;
    25 temp1=parseInt(temp1.substring(temp1.lastIndexOf('/')+1))-543;
    26 temp2=temp2.substring(0,temp2.lastIndexOf('/')+1);
    27 return temp2+temp1;
    28 }
    29 return this.textbox.value;
    30 }
    31 
    32 **************************************************************************************
    33 
    34 And modified part of TextBox.js (add _setValueAttr2 function)
    35 
    36 **************************************************************************************
    37 
    38 _setValueAttr2:function(_1,_2,_3){
    39 var _4;
    40 if(_1!==undefined){
    41 _4=this.filter(_1);
    42 if(typeof _3!="string"){
    43 if(_4!==null&&((typeof _4!="number")||!isNaN(_4))){
    44 _3=this.filter(this.format(_4,this.constraints));
    45 if(dojo.cldr.supplemental._region(this.lang)=="th"){
    46 var temp1=_3;
    47 var temp2=_3;
    48 temp1=parseInt(temp1.substring(temp1.lastIndexOf('/')+1))+543;
    49 temp2=temp2.substring(0,temp2.lastIndexOf('/')+1);
    50 _3=temp2+temp1;
    51 }
    52 }else{
    53 _3="";
    54 }
    55 }
    56 }
    57 if(_3!=null&&_3!=undefined&&((typeof _3)!="number"||!isNaN(_3))&&this.textbox.value!=_3){
    58 this.textbox.value=_3;
    59 }
    60 this.inherited(arguments,[_4,_2]);
    61 }
    62 
    63 **************************************************************************************
    64 
    65 _setBlurValue:function(){
    66 this._setValueAttr2(this.attr("value"),true);
    67 }
    68 
    69 **************************************************************************************
    70 
    71 And modified part of _Calendar.js
    72 
    73 **************************************************************************************
    74 
    75 var _14=dojo.date.locale.getNames("months","wide","standAlone",this.lang);
    76 this._setText(this.monthLabelNode,_14[_5.getMonth()]);
    77 var y=_5.getFullYear()-1;
    78 if(dojo.cldr.supplemental._region(this.lang)=="th"){
    79 y+=543;}
    80 var d=new Date();
    81 dojo.forEach(["previous","current","next"],function(_17){
    82 d.setFullYear(y++);
    83 this._setText(this[_17+"YearLabelNode"],dojo.date.locale.format(d,{selector:"year",locale:this.lang}));
    84 },this);
    85 
    86 **************************************************************************************
    87 
    88 var _23=dojo.date.locale.getNames("days",this.dayWidth,"standAlone",this.lang);
    89 if(dojo.cldr.supplemental._region(this.lang)=="th"){
    90 _23=dojo.date.locale.getNames("days","abbr","standAlone",this.lang);
    91 }
    92 
    93 **************************************************************************************
    94 
    95 And modified part of supplemental.js of dojo
    96 
    97 **************************************************************************************
    98 
    99 dojo.cldr.supplemental._region=function(_5){
    100 _5=dojo.i18n.normalizeLocale(_5);
    101 var _6=_5.split("-");
    102 var _7=_6[1];
    103 if(!_7){
    104 _7={de:"de",en:"us",es:"es",fi:"fi",fr:"fr",he:"il",hu:"hu",it:"it",ja:"jp",ko:"kr",nl:"nl",pt:"br",sv:"se",zh:"cn",th:"th"}[_6[0]];
    105 }else{
    106 if(_7.length==4){
    107 _7=_6[2];
    108 }
    109 }
    110 return _7;
    111 };