Extension:Add Article to Category/fr

From MediaWiki.org
Jump to: navigation, search
Langue : English  • français • 中文
Manuel des extensions MediaWiki - liste
Crystal Clear action run.png
Ajouter un article à une catégorie

État de la version : stable

Add Article To Category Extension.jpg
Implémentation Page action
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
Dernière version 0.1.9 (2007-01-19)
MediaWiki 1.8 +
Licence No license specified
Téléchargement ici ou Ici
Exemple DEMO
Hooks utilisés
EditFormPreloadText

CategoryPageView


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

Installation [edit]

  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.

Screenshots [edit]

Screenshot 1
Category Page
Screenshot 2
Edit Page

Code [edit]

<?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;
}
?>

DEMO [edit]

I Don't Like Exams (MediaWiki 1.9.3)

Voir aussi [edit]