Changeset 952

Show
Ignore:
Timestamp:
05/28/08 13:32:35 (6 months ago)
Author:
julieni
Message:

ticket #554: jForms : fixed bugs in jforms.js based on Martus' report

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0.x/lib/jelix-www/js/jforms.js

    r698 r952  
    11/** 
    2 * @package    jelix 
    3 * @subpackage forms 
    4 * @author     Laurent Jouanneau 
    5 * @contributor 
    6 * @copyright   2007 Laurent Jouanneau 
    7 * @link        http://www.jelix.org 
    8 * @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
     2* @package      jelix 
     3* @subpackage   forms 
     4* @author       Laurent Jouanneau 
     5* @contributor  Julien Issler 
     6* @copyright    2007 Laurent Jouanneau 
     7* @copyright    2008 Julien Issler 
     8* @link         http://www.jelix.org 
     9* @licence      GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    910*/ 
    1011 
     
    8788                        break; 
    8889                    case 'datetime' :  
    89                         var t = val.match(/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/); 
     90                        var t = val.match(/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    9091                        if(t == null){ ok=false; break; } 
    9192                        var yy = parseInt(t[1],10); 
     
    9495                        var th = parseInt(t[4],10); 
    9596                        var tm = parseInt(t[5],10); 
    96                         var ts = parseInt(t[6],10); 
    97                         var dt = new Date(yy,mm,dd,th,tn,ts); 
     97                        var ts = 0; 
     98                        if(t[7] != null) 
     99                            ts = parseInt(t[7],10); 
     100                        var dt = new Date(yy,mm,dd,th,tm,ts); 
    98101                        if(yy != dt.getFullYear() || mm != dt.getMonth() || dd != dt.getDate() || th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    99102                            ok = false; 
     
    115118                    case 'localetime' : 
    116119                    case 'time' : 
    117                         var t = val.match(/^(\d{2}):(\d{2}):(\d{2})$/); 
     120                        var t = val.match(/^(\d{2}):(\d{2})(:(\d{2}))?$/); 
    118121                        if(t == null){ ok=false; break; } 
    119                         var th = parseInt(t[4],10); 
    120                         var tm = parseInt(t[5],10); 
    121                         var ts = parseInt(t[6],10); 
    122                         var dt = new Date(2007,05,02,th,tn,ts); 
     122                        var th = parseInt(t[1],10); 
     123                        var tm = parseInt(t[2],10); 
     124                        var ts = 0; 
     125                        if(t[4] != null) 
     126                            ts = parseInt(t[4],10); 
     127                        var dt = new Date(2007,05,02,th,tm,ts); 
    123128                        if(th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    124129                            ok = false; 
     
    129134                        var yy, mm, dd, th, tm, ts; 
    130135                        if(c.lang.indexOf('fr_') == 0) { 
    131                             var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/); 
     136                            var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    132137                            if(t == null){ ok=false; break; } 
    133138                            yy = parseInt(t[3],10); 
     
    136141                            th = parseInt(t[4],10); 
    137142                            tm = parseInt(t[5],10); 
    138                             ts = parseInt(t[6],10); 
     143                            ts = 0; 
     144                            if(t[7] != null) 
     145                                ts = parseInt(t[7],10); 
    139146                        }else{ 
    140147                            //default is en_* format 
    141                             var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/); 
     148                            var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    142149                            if(t == null){ ok=false; break; } 
    143150                            yy = parseInt(t[3],10); 
     
    146153                            th = parseInt(t[4],10); 
    147154                            tm = parseInt(t[5],10); 
    148                             ts = parseInt(t[6],10); 
     155                            ts = 0; 
     156                            if(t[7] != null) 
     157                                ts = parseInt(t[7],10); 
    149158                        } 
    150                         var dt = new Date(yy,mm,dd,th,tn,ts); 
     159                        var dt = new Date(yy,mm,dd,th,tm,ts); 
    151160                        if(yy != dt.getFullYear() || mm != dt.getMonth() || dd != dt.getDate() || th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    152161                            ok = false; 
  • branches/1.0.x/lib/jelix-www/js/jforms.js

    r698 r952  
    11/** 
    2 * @package    jelix 
    3 * @subpackage forms 
    4 * @author     Laurent Jouanneau 
    5 * @contributor 
    6 * @copyright   2007 Laurent Jouanneau 
    7 * @link        http://www.jelix.org 
    8 * @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
     2* @package      jelix 
     3* @subpackage   forms 
     4* @author       Laurent Jouanneau 
     5* @contributor  Julien Issler 
     6* @copyright    2007 Laurent Jouanneau 
     7* @copyright    2008 Julien Issler 
     8* @link         http://www.jelix.org 
     9* @licence      GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    910*/ 
    1011 
     
    8788                        break; 
    8889                    case 'datetime' :  
    89                         var t = val.match(/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/); 
     90                        var t = val.match(/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    9091                        if(t == null){ ok=false; break; } 
    9192                        var yy = parseInt(t[1],10); 
     
    9495                        var th = parseInt(t[4],10); 
    9596                        var tm = parseInt(t[5],10); 
    96                         var ts = parseInt(t[6],10); 
    97                         var dt = new Date(yy,mm,dd,th,tn,ts); 
     97                        var ts = 0; 
     98                        if(t[7] != null) 
     99                            ts = parseInt(t[7],10); 
     100                        var dt = new Date(yy,mm,dd,th,tm,ts); 
    98101                        if(yy != dt.getFullYear() || mm != dt.getMonth() || dd != dt.getDate() || th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    99102                            ok = false; 
     
    115118                    case 'localetime' : 
    116119                    case 'time' : 
    117                         var t = val.match(/^(\d{2}):(\d{2}):(\d{2})$/); 
     120                        var t = val.match(/^(\d{2}):(\d{2})(:(\d{2}))?$/); 
    118121                        if(t == null){ ok=false; break; } 
    119                         var th = parseInt(t[4],10); 
    120                         var tm = parseInt(t[5],10); 
    121                         var ts = parseInt(t[6],10); 
    122                         var dt = new Date(2007,05,02,th,tn,ts); 
     122                        var th = parseInt(t[1],10); 
     123                        var tm = parseInt(t[2],10); 
     124                        var ts = 0; 
     125                        if(t[4] != null) 
     126                            ts = parseInt(t[4],10); 
     127                        var dt = new Date(2007,05,02,th,tm,ts); 
    123128                        if(th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    124129                            ok = false; 
     
    129134                        var yy, mm, dd, th, tm, ts; 
    130135                        if(c.lang.indexOf('fr_') == 0) { 
    131                             var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/); 
     136                            var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    132137                            if(t == null){ ok=false; break; } 
    133138                            yy = parseInt(t[3],10); 
     
    136141                            th = parseInt(t[4],10); 
    137142                            tm = parseInt(t[5],10); 
    138                             ts = parseInt(t[6],10); 
     143                            ts = 0; 
     144                            if(t[7] != null) 
     145                                ts = parseInt(t[7],10); 
    139146                        }else{ 
    140147                            //default is en_* format 
    141                             var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/); 
     148                            var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    142149                            if(t == null){ ok=false; break; } 
    143150                            yy = parseInt(t[3],10); 
     
    146153                            th = parseInt(t[4],10); 
    147154                            tm = parseInt(t[5],10); 
    148                             ts = parseInt(t[6],10); 
     155                            ts = 0; 
     156                            if(t[7] != null) 
     157                                ts = parseInt(t[7],10); 
    149158                        } 
    150                         var dt = new Date(yy,mm,dd,th,tn,ts); 
     159                        var dt = new Date(yy,mm,dd,th,tm,ts); 
    151160                        if(yy != dt.getFullYear() || mm != dt.getMonth() || dd != dt.getDate() || th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    152161                            ok = false; 
  • branches/1.0.x/lib/jelix-www/js/jforms.js

    r698 r952  
    11/** 
    2 * @package    jelix 
    3 * @subpackage forms 
    4 * @author     Laurent Jouanneau 
    5 * @contributor 
    6 * @copyright   2007 Laurent Jouanneau 
    7 * @link        http://www.jelix.org 
    8 * @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
     2* @package      jelix 
     3* @subpackage   forms 
     4* @author       Laurent Jouanneau 
     5* @contributor  Julien Issler 
     6* @copyright    2007 Laurent Jouanneau 
     7* @copyright    2008 Julien Issler 
     8* @link         http://www.jelix.org 
     9* @licence      GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    910*/ 
    1011 
     
    8788                        break; 
    8889                    case 'datetime' :  
    89                         var t = val.match(/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/); 
     90                        var t = val.match(/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    9091                        if(t == null){ ok=false; break; } 
    9192                        var yy = parseInt(t[1],10); 
     
    9495                        var th = parseInt(t[4],10); 
    9596                        var tm = parseInt(t[5],10); 
    96                         var ts = parseInt(t[6],10); 
    97                         var dt = new Date(yy,mm,dd,th,tn,ts); 
     97                        var ts = 0; 
     98                        if(t[7] != null) 
     99                            ts = parseInt(t[7],10); 
     100                        var dt = new Date(yy,mm,dd,th,tm,ts); 
    98101                        if(yy != dt.getFullYear() || mm != dt.getMonth() || dd != dt.getDate() || th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    99102                            ok = false; 
     
    115118                    case 'localetime' : 
    116119                    case 'time' : 
    117                         var t = val.match(/^(\d{2}):(\d{2}):(\d{2})$/); 
     120                        var t = val.match(/^(\d{2}):(\d{2})(:(\d{2}))?$/); 
    118121                        if(t == null){ ok=false; break; } 
    119                         var th = parseInt(t[4],10); 
    120                         var tm = parseInt(t[5],10); 
    121                         var ts = parseInt(t[6],10); 
    122                         var dt = new Date(2007,05,02,th,tn,ts); 
     122                        var th = parseInt(t[1],10); 
     123                        var tm = parseInt(t[2],10); 
     124                        var ts = 0; 
     125                        if(t[4] != null) 
     126                            ts = parseInt(t[4],10); 
     127                        var dt = new Date(2007,05,02,th,tm,ts); 
    123128                        if(th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    124129                            ok = false; 
     
    129134                        var yy, mm, dd, th, tm, ts; 
    130135                        if(c.lang.indexOf('fr_') == 0) { 
    131                             var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/); 
     136                            var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    132137                            if(t == null){ ok=false; break; } 
    133138                            yy = parseInt(t[3],10); 
     
    136141                            th = parseInt(t[4],10); 
    137142                            tm = parseInt(t[5],10); 
    138                             ts = parseInt(t[6],10); 
     143                            ts = 0; 
     144                            if(t[7] != null) 
     145                                ts = parseInt(t[7],10); 
    139146                        }else{ 
    140147                            //default is en_* format 
    141                             var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/); 
     148                            var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    142149                            if(t == null){ ok=false; break; } 
    143150                            yy = parseInt(t[3],10); 
     
    146153                            th = parseInt(t[4],10); 
    147154                            tm = parseInt(t[5],10); 
    148                             ts = parseInt(t[6],10); 
     155                            ts = 0; 
     156                            if(t[7] != null) 
     157                                ts = parseInt(t[7],10); 
    149158                        } 
    150                         var dt = new Date(yy,mm,dd,th,tn,ts); 
     159                        var dt = new Date(yy,mm,dd,th,tm,ts); 
    151160                        if(yy != dt.getFullYear() || mm != dt.getMonth() || dd != dt.getDate() || th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    152161                            ok = false; 
  • branches/1.0.x/lib/jelix-www/js/jforms.js

    r698 r952  
    11/** 
    2 * @package    jelix 
    3 * @subpackage forms 
    4 * @author     Laurent Jouanneau 
    5 * @contributor 
    6 * @copyright   2007 Laurent Jouanneau 
    7 * @link        http://www.jelix.org 
    8 * @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
     2* @package      jelix 
     3* @subpackage   forms 
     4* @author       Laurent Jouanneau 
     5* @contributor  Julien Issler 
     6* @copyright    2007 Laurent Jouanneau 
     7* @copyright    2008 Julien Issler 
     8* @link         http://www.jelix.org 
     9* @licence      GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    910*/ 
    1011 
     
    8788                        break; 
    8889                    case 'datetime' :  
    89                         var t = val.match(/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/); 
     90                        var t = val.match(/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    9091                        if(t == null){ ok=false; break; } 
    9192                        var yy = parseInt(t[1],10); 
     
    9495                        var th = parseInt(t[4],10); 
    9596                        var tm = parseInt(t[5],10); 
    96                         var ts = parseInt(t[6],10); 
    97                         var dt = new Date(yy,mm,dd,th,tn,ts); 
     97                        var ts = 0; 
     98                        if(t[7] != null) 
     99                            ts = parseInt(t[7],10); 
     100                        var dt = new Date(yy,mm,dd,th,tm,ts); 
    98101                        if(yy != dt.getFullYear() || mm != dt.getMonth() || dd != dt.getDate() || th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    99102                            ok = false; 
     
    115118                    case 'localetime' : 
    116119                    case 'time' : 
    117                         var t = val.match(/^(\d{2}):(\d{2}):(\d{2})$/); 
     120                        var t = val.match(/^(\d{2}):(\d{2})(:(\d{2}))?$/); 
    118121                        if(t == null){ ok=false; break; } 
    119                         var th = parseInt(t[4],10); 
    120                         var tm = parseInt(t[5],10); 
    121                         var ts = parseInt(t[6],10); 
    122                         var dt = new Date(2007,05,02,th,tn,ts); 
     122                        var th = parseInt(t[1],10); 
     123                        var tm = parseInt(t[2],10); 
     124                        var ts = 0; 
     125                        if(t[4] != null) 
     126                            ts = parseInt(t[4],10); 
     127                        var dt = new Date(2007,05,02,th,tm,ts); 
    123128                        if(th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    124129                            ok = false; 
     
    129134                        var yy, mm, dd, th, tm, ts; 
    130135                        if(c.lang.indexOf('fr_') == 0) { 
    131                             var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/); 
     136                            var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    132137                            if(t == null){ ok=false; break; } 
    133138                            yy = parseInt(t[3],10); 
     
    136141                            th = parseInt(t[4],10); 
    137142                            tm = parseInt(t[5],10); 
    138                             ts = parseInt(t[6],10); 
     143                            ts = 0; 
     144                            if(t[7] != null) 
     145                                ts = parseInt(t[7],10); 
    139146                        }else{ 
    140147                            //default is en_* format 
    141                             var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/); 
     148                            var t = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2})(:(\d{2}))?$/); 
    142149                            if(t == null){ ok=false; break; } 
    143150                            yy = parseInt(t[3],10); 
     
    146153                            th = parseInt(t[4],10); 
    147154                            tm = parseInt(t[5],10); 
    148                             ts = parseInt(t[6],10); 
     155                            ts = 0; 
     156                            if(t[7] != null) 
     157                                ts = parseInt(t[7],10); 
    149158                        } 
    150                         var dt = new Date(yy,mm,dd,th,tn,ts); 
     159                        var dt = new Date(yy,mm,dd,th,tm,ts); 
    151160                        if(yy != dt.getFullYear() || mm != dt.getMonth() || dd != dt.getDate() || th != dt.getHours() || tm != dt.getMinutes() || ts != dt.getSeconds()) 
    152161                            ok = false; 
  • branches/1.0.x/lib/jelix/CREDITS

    r950 r952  
    7575 - jDao : attribute groupby for method selectfirst (#447) 
    7676 - jZipCreator : empty dirs are not included in the archive (#570) 
     77 - jForms : fixed bugs in jforms.js based on Martus' report (#554) 
    7778 
    7879Bastien Jaillot (aka bastnic) 
  • branches/1.0.x/lib/jelix/CREDITS

    r950 r952  
    7575 - jDao : attribute groupby for method selectfirst (#447) 
    7676 - jZipCreator : empty dirs are not included in the archive (#570) 
     77 - jForms : fixed bugs in jforms.js based on Martus' report (#554) 
    7778 
    7879Bastien Jaillot (aka bastnic) 
  • branches/1.0.x/lib/jelix/CREDITS

    r950 r952  
    7575 - jDao : attribute groupby for method selectfirst (#447) 
    7676 - jZipCreator : empty dirs are not included in the archive (#570) 
     77 - jForms : fixed bugs in jforms.js based on Martus' report (#554) 
    7778 
    7879Bastien Jaillot (aka bastnic) 
  • branches/1.0.x/lib/jelix/CREDITS

    r950 r952  
    7575 - jDao : attribute groupby for method selectfirst (#447) 
    7676 - jZipCreator : empty dirs are not included in the archive (#570) 
     77 - jForms : fixed bugs in jforms.js based on Martus' report (#554) 
    7778 
    7879Bastien Jaillot (aka bastnic) 
Download in other formats: Unified Diff Zip Archive