Hi,

today I updated from SF 1.9.1 to 2.0.8, and found my custom SFDateInput
enhancement extension to be no longer working.
Since the extension provides JavaScript to fill in Year/Month/Day with
one click, it requires the year/month/day fields to have IDs. The
attached patch to SF (r80431) re-introduces IDs to year/month/day fields.

I didn't add IDs to hh/mm/ss, but maybe that's also a good idea. Also,
maybe the $input_id parameter to monthDropdownHTML() should be moved to
the left, for consistency, but I didn't want to break any other
(possible) code that calls monthDropdownHTML().

Patrick.

-- 
Key ID: 0x86E346D4            http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
--- SemanticForms/includes/SF_FormInputs.php    2011-01-17 16:41:09.000000000 
+0800
+++ SemanticForms.modified/includes/SF_FormInputs.php   2011-01-17 
15:26:53.000000000 +0800
@@ -645,7 +645,7 @@
 }
 
 class SFDateInput extends SFFormInput {
-  static function monthDropdownHTML( $cur_month, $input_name, $is_disabled ) {
+  static function monthDropdownHTML( $cur_month, $input_name, $is_disabled, 
$input_id = 0 ) {
     global $sfgTabIndex, $wgAmericanDates;
 
     $optionsText = "";
@@ -660,6 +660,7 @@
       $optionsText .= Xml::element( 'option', $optionAttrs, $name );
     }
     $selectAttrs = array(
+      'id' => $input_id . '_month',
       'class' => 'monthInput',
       'name' => $input_name . '[month]',
       'tabindex' => $sfgTabIndex
@@ -703,14 +704,14 @@
     }
     $text = "";
     $disabled_text = ( $is_disabled ) ? "disabled" : "";
-    $monthInput = self::monthDropdownHTML( $month, $input_name, $is_disabled );
-    $dayInput = '  <input tabindex="' . $sfgTabIndex . '" class="dayInput" 
name="' . $input_name . '[day]" type="text" value="' . $day . '" size="2" ' . 
$disabled_text . '/>';
+    $monthInput = self::monthDropdownHTML( $month, $input_name, $is_disabled, 
$input_id );
+    $dayInput = '  <input id="' . $input_id . '_day" tabindex="' . 
$sfgTabIndex . '" class="dayInput" name="' . $input_name . '[day]" type="text" 
value="' . $day . '" size="2" ' . $disabled_text . '/>';
     if ( $wgAmericanDates ) {
       $text .= "$monthInput\n$dayInput\n";
     } else {
       $text .= "$dayInput\n$monthInput\n";
     }
-    $text .= '  <input tabindex="' . $sfgTabIndex . '" class="yearInput" 
name="' . $input_name . '[year]" type="text" value="' . $year . '" size="4" ' . 
$disabled_text . '/>' . "\n";
+    $text .= '  <input id="' . $input_id . '_year" tabindex="' . $sfgTabIndex 
. '" class="yearInput" name="' . $input_name . '[year]" type="text" value="' . 
$year . '" size="4" ' . $disabled_text . '/>' . "\n";
     return $text;
   }
   

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to