http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54857

Revision: 54857
Author:   yaron
Date:     2009-08-12 14:17:52 +0000 (Wed, 12 Aug 2009)

Log Message:
-----------
Added "None" value for 'category' input type

Modified Paths:
--------------
    trunk/extensions/SemanticForms/includes/SF_FormInputs.inc

Modified: trunk/extensions/SemanticForms/includes/SF_FormInputs.inc
===================================================================
--- trunk/extensions/SemanticForms/includes/SF_FormInputs.inc   2009-08-12 
14:14:38 UTC (rev 54856)
+++ trunk/extensions/SemanticForms/includes/SF_FormInputs.inc   2009-08-12 
14:17:52 UTC (rev 54857)
@@ -659,6 +659,22 @@
     $input_id = "input_$sfgFieldNum";
     $info_id = "info_$sfgFieldNum";
 
+    $text = '<div style="overflow: auto; padding: 5px; border: 1px #aaaaaa 
solid; max-height: ' . $height . 'px; width: ' . $width . 'px;">';
+
+    // start with an initial "None" value, unless this is a mandatory field
+    // and there's a current value in place (either through a default value
+    // or because we're editing an existing page)
+    if (! $is_mandatory || $cur_value == '') {
+      $input_id = "input_$sfgFieldNum";
+      $info_id = "info_$sfgFieldNum";
+      $text .= '       <input type="radio" id="' . $input_id . '" tabindex="' 
. $sfgTabIndex . '" name="' . $input_name . '" value=""';
+      if (! $cur_value) {
+        $text .= ' checked="checked"';
+        $check_set = true;
+      }
+      $text .= " $disabled_text/> <em>" . wfMsg('sf_editdata_none') . 
"</em>\n";
+    }
+
     global $wgCategoryTreeMaxDepth;
     $wgCategoryTreeMaxDepth = 10;
     $tree = efCategoryTreeParserHook($top_category, array('mode' => 
'categories', 'depth' => 10));
@@ -668,9 +684,10 @@
     if ($is_disabled) {
       $tree = str_replace('type="radio"', 'type="radio" disabled', $tree);
     }
-    $text = '<div style="overflow: auto; padding: 5px; border: 1px #aaaaaa 
solid; max-height: ' . $height . 'px; width: ' . $width . 'px;">' . $tree . 
'</div>';
+    $text .= $tree . '</div>';
 
     $text .=<<<END
+       <span id="$info_id" class="errorMessage"></span>
 
 END;
 



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to