Extension:EditPageMultipleInputTextAreas

New extension to get multiple input fields within the Editpage This extension is in 'progress', started from 19-9-2007. It currently works but needs lots of improvements to make it user friendly.

Please improve the script where possible. If so, include the changes in a change log somewhere in this article.



 'EditTextAreas', 'author' => 'Boudewijn Vahrmeijer', 'url' => 'http://www.leerwiki.nl', 'version' => '1.11,1.10.1/1.9.3/1.9.2/1.8.2', );

//####### Choose parameters ############## $BoxNames=array('Introduction','Core','Conclusion'); 	//choose names, minimum is ONE $Separator='-SPRTR-'; //Choose dummy separator for combining text input

//####### Used Hooks ###################### $wgHooks['EditPage::showEditForm:fields'][] = 'TextareaDisplay'; $wgHooks['EditPage::attemptSave'][] = 'CombineBeforeSave'; $wgHooks['EditPage::showEditForm:initial'][] = 'OptionSetting'; $wgHooks['OutputPageBeforeHTML'][] = 'LastMinuteStyleChange';

//####### Formula preparation ############## $TotalTB=count($BoxNames);

//######## Start Formulas ################# function TextareaDisplay(&$q,&$out) { global $TotalTB,$BoxNames,$Separator; if(TotalTB>1) return true; for($i=0;$i<$TotalTB-1;$i++){ $AllText=$q->textbox1; $ArrayTextTemp=explode($Separator,$AllText); $out->addHTML( "		textarea {			width: 550px;			padding: .1em;		}		//onKeyUp='resizeTextarea(this)'		 ".$BoxNames[$i]." ".$ArrayTextTemp[$i+1]." "); }			$out->addHTML( $BoxNames[$TotalTB-1]." "); $q->textbox1=$ArrayTextTemp[$TotalTB]; return true; }

function CombineBeforeSave(&$q) { global	$wgRequest, $TotalTB,$BoxNames,$Separator; $request=$wgRequest; for($i=0;$i<$TotalTB-1;$i++){ $temp=$BoxNames[$i]; $allextraTB.= $Separator.$q->safeUnicodeInput( $request, $temp ); }	   $q->textbox1 = $allextraTB.$Separator.$q->textbox1; return true; }

function OptionSetting(&$q) { global $wgUser; $wgUser->setOption('rows',10); $wgUser->setOption('showtoolbar',0); return true; }

function LastMinuteStyleChange(&$q,&$b) { global $Separator,$BoxNames; $k=explode($Separator,$b); for($i=1;$i