r99692 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99691‎ | r99692 | r99693 >
Date:16:37, 13 October 2011
Author:yaron
Status:deferred
Tags:
Comment:
Added ability to set 'autocomplete on category' value for #forminput in automatially-created forms
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Form.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_Form.php
@@ -12,11 +12,13 @@
1313 private $mPageNameFormula;
1414 private $mCreateTitle;
1515 private $mEditTitle;
 16+ private $mAssociatedCategory;
1617
1718 static function create( $formName, $templates ) {
1819 $form = new SFForm();
1920 $form->mFormName = ucfirst( str_replace( '_', ' ', $formName ) );
2021 $form->mTemplates = $templates;
 22+ $form->mAssociatedCategory = null;
2123 return $form;
2224 }
2325
@@ -36,6 +38,10 @@
3739 $this->mEditTitle = $editTitle;
3840 }
3941
 42+ function setAssociatedCategory( $associatedCategory ) {
 43+ $this->mAssociatedCategory = $associatedCategory;
 44+ }
 45+
4046 function creationHTML() {
4147 $text = "";
4248 foreach ( $this->mTemplates as $i => $ft ) {
@@ -49,7 +55,11 @@
5056 $fs = SpecialPage::getPage( 'FormStart' );
5157 $form_start_url = SFUtils::titleURLString( $fs->getTitle() ) . "/" . $title->getPartialURL();
5258 $form_description = wfMsgForContent( 'sf_form_docu', $this->mFormName, $form_start_url );
53 - $form_input = "{{#forminput:form=" . $this->mFormName . "}}\n";
 59+ $form_input = "{{#forminput:form=" . $this->mFormName;
 60+ if ( !is_null( $this->mAssociatedCategory ) ) {
 61+ $form_input .= "|autocomplete on category=" . $this->mAssociatedCategory;
 62+ }
 63+ $form_input .= "}}\n";
5464 $text = <<<END
5565 <noinclude>
5666 $form_description