r79339 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79338‎ | r79339 | r79340 >
Date:14:51, 31 December 2010
Author:foxtrott
Status:deferred
Tags:
Comment:
Followup r79334. more bugfixes

* messages were not referenced by their correct name
* datepicker's date parser has a "feature" where 2-digit-years are recognised in spite of the format explicitly calling for a 4-digit year. inserted pre-check on date format
* eventhandler for input field removed again, event already handled by datepicker
Modified paths:
  • /trunk/extensions/SemanticFormsInputs/SFI_Inputs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticFormsInputs/SFI_Inputs.php
@@ -322,8 +322,8 @@
323323 . $wgLang->firstChar( wfMsg( 'fri' ) ) . "','"
324324 . $wgLang->firstChar( wfMsg( 'sat' ) ) . "'],\n"
325325 . " weekHeader: '',\n"
326 - . " dateFormat: '" . wfMsg( 'semanticformsinputs-dateformat' ) . "',\n"
327 - . " firstDay: '" . wfMsg( 'semanticformsinputs-firstday' ) . "',\n"
 326+ . " dateFormat: '" . wfMsg( 'semanticformsinputs-dateformatshort' ) . "',\n"
 327+ . " firstDay: '" . wfMsg( 'semanticformsinputs-firstdayofweek' ) . "',\n"
328328 . " isRTL: " . ( $wgLang->isRTL() ? "true":"false" ) . ",\n"
329329 . " showMonthAfterYear: false,\n"
330330 . " yearSuffix: ''};\n"
@@ -947,27 +947,20 @@
948948 JAVASCRIPT;
949949 }
950950
951 - // set value of datepicker, attach event listener for keyboard input
952 - // and wrap the JS code fragment in a function which can be called
953 - // by SF for deferred init
 951+ // set value of datepicker and wrap the JS code fragment in a
 952+ // function which can be called by SF for deferred init
954953 $jstext = <<<JAVASCRIPT
955954 function initInput$sfgFieldNum(inputId) {
956955 $jstext
957956 try {
 957+ re = /\d{4}\/\d{2}\/\d{2}/
 958+ if ( ! re.test("$cur_value") ) {throw "Wrong date format!";}
958959 jQuery("#" + inputId + "_show").datepicker( "setDate", jQuery.datepicker.parseDate("yy/mm/dd", "$cur_value", null) );
959960 } catch (e) {
960961 jQuery("#" + inputId + "_show").attr("value", "$cur_value");
961962 jQuery("#" + inputId).attr("value", "$cur_value");
962963 }
963964
964 - jQuery("#" + inputId + "_show").change(function() {
965 - try {
966 - jQuery("#" + inputId ).attr("value", jQuery.datepicker.parseDate(jQuery(this).datepicker( "option", "dateFormat"), jQuery(this).attr("value"), null));
967 - } catch (e) {
968 - jQuery("#" + inputId).attr("value", jQuery(this).attr("value"));
969 - }
970 - });
971 -
972965 }
973966
974967 addOnloadHook(function(){initInput$sfgFieldNum("input_$sfgFieldNum");});

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79334bugfix...foxtrott11:41, 31 December 2010

Status & tagging log