Extension:Add Article to Category/fr

From MediaWiki.org

Jump to: navigation, search
MediaWiki Extension
Crystal Clear action run.png
Ajouter un article à une catégorie

Statut: stable

Add Article To Category Extension.jpg
Implémentation Page action
Hooks utilisé EditFormPreloadText

CategoryPageView

Description Ajoute la possibilité d'ajouter une inputbox(pour créer un article)dans une page de catégorie. La nouvelle page contiendra directement "[[category:]]".
Auteur(s) Liang Chen The BiGreat
Version 0.1.9 (2007-01-19)
MediaWiki 1.8 +
Télécharger ici ou Ici
Exemple DEMO

Ajoute la possibilité d'ajouter une inputbox(pour créer un article)dans une page de catégorie. La nouvelle page contiendra directement "[[category:]]".

Contents

[edit] Installation

  1. Télécharger l'extension dans cette section : ici.
  2. Upload articletocategory.php vers votre dossier extensions/ .
  3. Ajouter require_once("extensions/articletocategory.php"); à votre LocalSettings.php.
  4. Et voila.

[edit] Screenshots

Screenshot 1
Category Page
Screenshot 2
Edit Page

[edit] Code

<?php
/*--------------------------------------------
A Liang Chen's Extension for MediaWiki
Add Article to Category
Release Date: 2007/01/19
Update Date: 2007/03/09 to 0.1.9, fix a bug in zip file which may cause problem in style.
Contact: anything@liang-chen.com
Demo: kaoshi.wobuxihuan.org
Download: http://www.liang-chen.com/myworld/content/view/36/70/
--------------------------------------------*/
 
 
if( !defined( 'MEDIAWIKI' ) )
die();
 
$wgExtensionCredits['other'][] = array(
    'name' => 'Add Article to Category',
    'description' => 'Your MediaWiki will get an inputbox on each Category page, and you can create a new article directly to that category',
    'author' => 'Liang Chen The BiGreat',
     'url' => 'http://www.liang-chen.com/myworld/content/view/36/70/'
);
$wgHooks['EditFormPreloadText'][] = 'addcategory';
$wgHooks['CategoryPageView'][] = 'categorychange';
function addcategory(&$text)
{
	$cname = $_GET['category'];
	$wnew = $_GET['new']
 
;
	if ($wnew==1)
	{
		 $temp1 ="Ajouter votre texte ici \n\n [[Catégorie:".$cname."]]";
     $text=$temp1;
	}
	return true;
}
 
 
 
function categorychange($catpage)
{
 
	$boxtext  = "Créer un Article dans cette Catégorie"; 
	$btext = "Créer";
	global $wgOut;
	global $wgScript;	
	$Action = htmlspecialchars( $wgScript );		
 
 
 
//$wgOut->addWikiText( "Test");
$temp2=<<<ENDFORM
<!-- Add Article Extension Start - P by BiGreat-->
<script type="text/javascript">
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 
function addText(thefield){
	if (thefield.value=="")
	thefield.value = thefield.defaultValue 
}
</script>
<table border="0" align="right" width="423" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" align="right" bgcolor="">
<form name="createbox" action="{$Action}" method="get" class="createbox">
	<input type='hidden' name="action" value="edit">
	<input type='hidden' name="new" value="1">
	<input type='hidden' name="category" value="{$catpage->mTitle->getText()}">
 
	<input class="createboxInput" name="title" type="text" value="{$boxtext}" size="30" style="color:#666;" onfocus="clearText(this);" onblur="addText(this);"/>	
	<input type='submit' name="create" class="createboxButton" value="{$btext}"/>	
</form>
</td>
</tr>
</table>
<!-- Add Article Extension End - P by BiGreat-->
ENDFORM;
$wgOut->addHTML($temp2);
	return true;
}
?>

[edit] DEMO

I Don't Like Exams (MediaWiki 1.9.3)

[edit] Voir aussi