Extension:Add Article to Category/fr

From MediaWiki.org

Jump to: navigation, search
MediaWiki Extension
Ajouter un article à une catégorie

Statut: stable

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

  1. <?php
  2. /*--------------------------------------------
  3. A Liang Chen's Extension for MediaWiki
  4. Add Article to Category
  5. Release Date: 2007/01/19
  6. Update Date: 2007/03/09 to 0.1.9, fix a bug in zip file which may cause problem in style.
  7. Contact: anything@liang-chen.com
  8. Demo: kaoshi.wobuxihuan.org
  9. Download: http://www.liang-chen.com/myworld/content/view/36/70/
  10. --------------------------------------------*/
  11.  
  12.  
  13. if( !defined( 'MEDIAWIKI' ) )
  14. die();
  15.  
  16. $wgExtensionCredits['other'][] = array(
  17.     'name' => 'Add Article to Category',
  18.     'description' => 'Your MediaWiki will get an inputbox on each Category page, and you can create a new article directly to that category',
  19.     'author' => 'Liang Chen The BiGreat',
  20.      'url' => 'http://www.liang-chen.com/myworld/content/view/36/70/'
  21. );
  22. $wgHooks['EditFormPreloadText'][] = 'addcategory';
  23. $wgHooks['CategoryPageView'][] = 'categorychange';
  24. function addcategory(&$text)
  25. {
  26.         $cname = $_GET['category'];
  27.         $wnew = $_GET['new']
  28.  
  29. ;
  30.         if ($wnew==1)
  31.         {
  32.                  $temp1 ="Add Your Content Here \n\n [[category:".$cname."]]";
  33.      $text=$temp1;
  34.         }
  35.         return true;
  36. }
  37.  
  38.  
  39.  
  40. function categorychange($catpage)
  41. {
  42.                
  43.         $boxtext  = "Create an Article to this category";
  44.         $btext = "Submit";
  45.         global $wgOut;
  46.         global $wgScript;       
  47.         $Action = htmlspecialchars( $wgScript );               
  48.        
  49.  
  50.  
  51. //$wgOut->addWikiText( "Test");
  52. $temp2=<<<ENDFORM
  53. <!-- Add Article Extension Start - P by BiGreat-->
  54. <script type="text/javascript">
  55. function clearText(thefield){
  56. if (thefield.defaultValue==thefield.value)
  57. thefield.value = ""
  58. }
  59. function addText(thefield){
  60.         if (thefield.value=="")
  61.         thefield.value = thefield.defaultValue
  62. }
  63. </script>
  64. <table border="0" align="right" width="423" cellspacing="0" cellpadding="0">
  65. <tr>
  66. <td width="100%" align="right" bgcolor="">
  67. <form name="createbox" action="{$Action}" method="get" class="createbox">
  68.         <input type='hidden' name="action" value="edit">
  69.         <input type='hidden' name="new" value="1">
  70.         <input type='hidden' name="category" value="{$catpage->mTitle->getText()}">
  71.  
  72.         <input class="createboxInput" name="title" type="text" value="{$boxtext}" size="30" style="color:#666;" onfocus="clearText(this);" onblur="addText(this);"/>   
  73.         <input type='submit' name="create" class="createboxButton" value="{$btext}"/>   
  74. </form>
  75. </td>
  76. </tr>
  77. </table>
  78. <!-- Add Article Extension End - P by BiGreat-->
  79. ENDFORM;
  80. $wgOut->addHTML($temp2);
  81.         return true;
  82. }
  83. ?>

[edit] DEMO

I Don't Like Exams (MediaWiki 1.9.3)

[edit] Voir aussi


Personal tools