Extension:EditPageMultipleInputTextAreas

New extension to get multiple input fields within the Editpage This extension is in 'progress', started from 19-9-2007. See for support: http://www.leerwiki.nl/EditPageInputBox_Mediawiki

What can it do
The Editforms extension is developed to enable different types of input for a Wiki. In this way a Wiki could be build up much faster, but also with more quality and clearer structure.

features
 * Choice between tradional or custom structure
 * Unlimited inputfields
 * Automatic enlargement textarea when typing

Desired features

 * Custom structure per page

Progress report / current status:
Latest version 04-11-2007
 * 0.5 WORKING CODE!!
 * fixed errors with button display
 * fixed initial presentation
 * fixed random errors with spaces within header names
 * fixed errors with bullets (added "\n")

Previous working versions
 * 0.4 Issues fixed with importing page without structure
 * 0.3 Choice added to use template or not 21-09-2007
 * 0.2 Including textarea expanding javascript 20-09-2007
 * 0.1 Improved customization 19-09-2007
 * 0.0.1 Combining and separating textareas working fine

Who's using it?
Please add your working-wiki here!
 * http://www.Promotionwiki.com
 * http://www.leerwiki.nl
 * http://www.competentie.org

Example


<?php if ( ! defined( 'MEDIAWIKI' ) ) die; //-- Note Author--- 11-2007--- // The Editforms extension is developed to enable // different types of input for a Wiki. In this way // a Wiki could be build up much faster, but also // with more quality and clearer structure. // // See http://www.leerwiki.nl for either updates // or other extensions such as the Ajax Rating Script-, // Image shadow- or EditpageMultipleInputboxes extension. // good luck with your Wiki! // B.Vahrmeijer // $wgExtensionCredits['parserhook'][] = array( 'name' => 'V0.5 EditTextAreas', 'author' => 'Boudewijn Vahrmeijer', 'url' => 'http://www.leerwiki.nl/EditPageInputBox_Mediawiki', 'version' => 'MW: 1.11,1.10.1/1.9.3/1.9.2/1.8.2', 'description' => 'Extension to fasten article making and improve structure', ); //####### Choose parameters ############## $BoxNames=array('Introduction','Core','Conclusion'); 	//choose titles, minimum is ONE $Separator='.//.'; //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); function TextareaDisplay(&$q,&$out) { global $TotalTB,$BoxNames,$Separator,$wgTitle; $title=$wgTitle; $out->addHTML(<<               function CUSTOM                {                document.getElementById("div1").style.display = 'block';                document.getElementById("yes").style.display = 'none';                document.getElementById("no").style.display = 'block';                document.getElementById("wpStructure").value = 'CUSTOM';                }                function TRADITIONAL                {                document.getElementById("div1").style.display = 'none';                document.getElementById("yes").style.display = 'block';                document.getElementById("no").style.display = 'none';                document.getElementById("wpStructure").value = 'TRADITIONAL';                }                                                                                                         function resizeTextarea(t) { n = navigator; nua = n.userAgent.toLowerCase; a = t.value.split('\\n'); b=1; for (x=0;x < a.length; x++) { if (a[x].length >= t.cols) b+= Math.floor(a[x].length/t.cols); }         b+= a.length; if (b > t.rows && nua.indexOf('opera') == -1) t.rows = b;        } textarea {       width: 550px;   padding: .1em;  }'
 * 1) Hook 1 #################
 * 1) HTML 1 #######

END ); if(TotalTB>1) return true; $AllText=$q->textbox1; $ArrayTextTemp=explode($Separator,$AllText);       $title=$wgTitle;        $titleKey=$title;        $titleS = Title::newFromDBkey($titleKey);        $titleS->mNamespace = $titleNS - ($titleNS % 2);        $article = new Article($titleS);        $aid = $article->mTitle->getArticleID( GAID_FOR_UPDATE ); if(count($ArrayTextTemp)>1&&$aid==0){        $out->addHTML("    "); } else {         $out->addHTML("    "); } for($i=0;$i<$TotalTB-1;$i++){ $out->addHTML($BoxNames[$i]." ".$ArrayTextTemp[$i+1]." "); } $out->addHTML( $BoxNames[$TotalTB-1]." "); if(count($ArrayTextTemp)>1){ $q->textbox1= $ArrayTextTemp[$TotalTB]; }       return true; } function CombineBeforeSave(&$q) { global $wgRequest, $TotalTB,$BoxNames,$Separator; $request=$wgRequest; $q->Structure = $request->getVal( 'wpStructure' ); if($q->Structure=='CUSTOM'){ for($i=0;$i<$TotalTB-1;$i++){ $temp='Box'.$i; $allextraTB.= $Separator."\n".$q->safeUnicodeInput( $request, $temp )."\n"; }           	    $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, $wgTitle; $title=$wgTitle; if ($_GET['action'] != "") return true; //not the edit areas $k=explode($Separator,$b);
 * 1) CUT TEXT AND PUT IN BOXES #############
 * 1) Hook 2 #################
 * 1) Hook 3 #################
 * 1) Hook 4 #################

if(count($k)<2) return true; 		//if no separator existing, no structure wanted $b='';								//clear dummy top ie. 11.//.22 for($i=1;$i