Extension talk:Add Article to Category/Archive 1

From mediawiki.org

Thank you for the great extension!
http://www.taichiwiki.org--Kohyin 05:20, 3 February 2007 (UTC)Reply

What is the ENDFORM thingy in the code??


This is really a great extension and very helpfull.

I had a suggestion : based on this extension can it be possible your you to create an Add Category to Category extension? So when you have some nested categories, you can create a category inside another one (and so an article) the easiest way possible.

Thanks

--Romainpelissier 14:49, 12 March 2007 (UTC)Reply

HI, yes, it is actually not difficult, just add a checked box, when it is check, the title will be added the text :"Category:".
However, you can also just input: "Category:whatever" into the text field, and it will add a category to a category.
--BiGreat 14:42, 13 March 2007 (UTC)Reply



Thanks for the reply. You mention a 'checkbox', can you explain this a little please? It seems not to be an extension so I don't really know how to add a check box ...

Thanks

--Romainpelissier 20:08, 14 March 2007 (UTC)Reply

edit into

This looks like a useful extension; I've made a slight tweak to cleanup up the way Category: is displayed. I think it would also be useful to have an edit intro in the new page, like the input box extension does. -Steve Sanbeg 21:53, 28 March 2007 (UTC)Reply


I also noticed that it looks a little strange in the diff view; it may be better to supress that somehow. -Steve Sanbeg 22:28, 6 April 2007 (UTC)Reply

New Feature - boilerplate --Dtsig 17:38, 15 May 2007 (UTC)

The users really like this feature. We use this along with CategoryTree so the user can get to the correct category before creating a page. How hard would it be to modify to create the new page based on the category it is being created in. For example, category DOCUMENTATION-FUNCTIONAL would have a specific template created for it. Then on the create retrieve the article and place in instead of 'add your content here'

I have been trying to work this out but being really new to mediawiki it is a bit overwhelming. If you have any ideas i would appreciate them.

I'd guess it's not too hard; you can look at meta:inputbox for an example of preloaded text, then figure out from the title what template you want to preload, and load it if it exists. -Steve Sanbeg 22:29, 15 May 2007 (UTC)Reply

exist anyway for implements this extension for MediaWiki 1.7.x? Thanks!

cFcVwM sd89f984q34slf

minor bug

i'm using mediawiki version 1.10. i get the following notices:


Notice: Undefined index: category in F:\web\htdocs\wiki\extensions\articletocategory\articletocategory.php on line 26

Notice: Undefined index: new in F:\web\htdocs\wiki\extensions\articletocategory\articletocategory.php on line 27

when i do the following:

  1. create a new article and add a link to a category that doesn't exist yet.
  2. click on that category-link
  3. --> notices are shown

as soon as i save the category-page i don't get those messages anymore.

fixed solution

Change the code into:

$cname = @$_GET['category'];
$wnew = @$_GET['new'];

my problem with Add Article to Category

When I add a article to a Category, it will not let me add it if the same article name is used it another category.

e.g History I would like the article to be Call e.g HMS Victory History were HMS Vctory is the Category and History is what is typed in the box? This way I only have to type History each time I enter a new Ship

  • HMS Victory
    • History
    • Construction
  • USS Cario
    • History
    • Construction
A category is just a way of grouping related articles. What you want is probably closer to a subpage -Steve Sanbeg 16:22, 17 September 2007 (UTC)Reply

Parse error line 70

I am using MediaWiki 1.5.8 and when I install your extesnion I get the following error message:

Parse error: parse error, unexpected '(', expecting '}' in W:\www\writing\components\com_mambowiki\extensions\articletocategory.php on line 70

However if I remove line 70

<input type='hidden' name="category" value="{$catpage->mTitle->getText()}">

the extensions seems to work!? Is it OK to do that or will I have problems later on? It is a very nice user-friendly addition so I hope I can continue sing it minus the line 70? Thanks 79.66.177.10 15:44, 17 September 2007 (UTC)Reply

Probably, your mediawiki is too old, and is missing a function. It looks like that line tells it what category to put the article in, so it wouldn't get a category without it. -Steve Sanbeg 16:22, 17 September 2007 (UTC)Reply
Thanks. Yet it still works without the category output. I'll try to keep using it anyway, since the rest of the functionality is OK. I'm using MamboWiki which is a Joomla component and which uses Mediawiki 1.5.8. I'll try to upgrade Mediawiki and see what happens

Internalisation

Hi, nice but dirty hack. I am missing a i18n file. Now the 'system messages' are hard-coded and static.

Furthermore: the table tag messes up positioning of other div's that may reside in category pages (templates for clean-up, warnings etc.)

However: it works for me, and users like it. Nice job.

Css bug

Hi, works fine but I notice a Css bug with the monobook skin. If you colorize the content body section, you can see it displaces a rectangular section; i haven't quite worked out why this is.

Extra feature - add existing page to category

It would be good to be able to add existing pages to categories. I think this could be done with what you've already got:

  • IF PAGENAME doesn't exist, THEN edit PAGENAME with content="Add content here \n\n >[[Category:CATEGORYNAME]]
  • IF PAGENAME does exist AND PAGENAME is not in CATEGORYNAME, THEN edit PAGENAME, with content=content+"\n >[[Category:CATEGORYNAME]]
  • IF PAGENAME does exist AND PAGENAME is in CATEGORYNAME, THEN edit PAGENAME, with content=content

Hope that makes sense. I might try it, or feel free too yourself. Would make this extension invaluable. now I just gotta find a similar extension to add arbitrary categories to arbitrary pages, all at once. cheers. --210.14.103.108 11:33, 27 November 2007 (UTC)Reply

Patch: Permission Check

Using Extension:CategoryPermissions you'll get the inputbox even if you are not allowed to create articles into that category. So i've added a userCan Check:

--- orig/articletocategory.php  2008-01-10 15:39:48.000000000 +0100
+++ folke/articletocategory.php 2008-01-10 15:40:30.000000000 +0100
@@ -46,6 +46,10 @@
        global $wgScript;
        $Action = htmlspecialchars( $wgScript );

+       if (!$catpage->mTitle->quickUserCan( 'edit' ) || !$catpage->mTitle->quickUserCan( 'create')) {
+           return true;
+       }
+


 //$wgOut->addWikiText( "Test");

--Folke 14:47, 10 January 2008 (UTC)Reply

NameSpaces

Is there a way to add this feature to other namespaces? It currently only works for "category" I just created a new namespace called "Directory". Is there a way to included it in this field? (Ed March 27, 2008)

Can you disable the input box on selected categories?

I use your extension and it works great but I have three categories that I want sysops control over, not allow additional articles. Is there a way I can disable the input box for those 3 categories? Thank you! Nancy April 3, 2008

Yes, take a look at my additions here below. --Julien Devincre 17:13, 17 February 2009 (UTC)Reply

Control over which categories have this

Is there any way to control which categories have this displayed? I only want it on one top-level category page.

.S

Error with html?

I'm using Maxgluv skin, and have an additional blank white box next to inputbox. I don't know how to fix it?

See http://www.howard.cc/inputbox-error.png

Added functionality to exclude some categories

I like this extension but had the need to exclude some categories from it. With the modifications explained hereafter, the input box will not show up on category pages you have mentioned in a "special" page.

These additions have been tested with mediawiki version 1.13.4 only


Modifications :

  • Add the following function (above function "categorychange($catpage)").
// Function to get the excluded categories list 
// the list is retrieved from "Articletocategory excluded categories" page.
function GetExcludedCategories() {
  global $wgRequest;
  $ExcludedCategories = array();
  $specialcatpage='Articletocategory excluded categories';

  if ($wgRequest->getVal( 'action' ) == 'edit')
    return true;
 
  $rev = Revision::newFromTitle(Title::makeTitle(null, $specialcatpage));
  if ($rev) {
    $content = $rev->getText();
    if ($content != "") {
      $changed = false;

      $c = explode("\n", $content);
      foreach ($c as $entry) { 
       	if ($entry[0]==';') {
		$cat = trim(substr($entry, 1));
		$ExcludedCategories[] = $cat;
	}
      }

    }
  } else echo (" Page : \"".$specialcatpage."\" does not exist !");
  return $ExcludedCategories;
}
//-----------------------------------------------------------------------


  • Modify the beginning of function "categorychange($catpage)" as follow :
function categorychange($catpage)
{
// Added code to exclude categories ----------------
	$ExcludedCategories=GetExcludedCategories();
	foreach ($ExcludedCategories as $value) 
		if ($catpage->mTitle->getText() == $value)
			return true;
//---------------------------------------------------      
        $boxtext  = "Create an Article in this category";
        $btext = "Submit";


Usage :

  • Create a new page in your wiki called "Articletocategory excluded categories" and fill it as follow :
== Excluded Categories from Add to Article Extension ==

;My Excluded category 1
;My Excluded category 2

;Another one

Any text entered after a ";" at the beginning of a line will now be considered as a category to exclude. Then the input box will not show up on this category's page.


If you don't like the name of this page, you can replace it by changing the following line in the GetExcludedCategories() function :

     $specialcatpage='Articletocategory excluded categories';

- Don't forget to protect this page if you don't want it to be modified by users. - The concerned Category pages might be cached, don't forget to purge them to see the result.


--Julien Devincre 17:07, 17 February 2009 (UTC)Reply

Thks. It works nice with 1.13.4. But special exclusion page name should not contain : neither uppercase. almaghi 15:21, 9 April 2009 (UTC)
Why not ? Is there potential problems using them ? Anyway, some can change it easily. --Julien Devincre 16:01, 9 April 2009 (UTC)Reply
i've tested and it seems not working with those characters. I do not know what's wrong. almaghi 11:00, 19 April 2009 (UTC)

noinclude

you should put a <noinclude> tag on both side of the [[category:something]] so if the page you add to the category is already included... The page wich use the inclusion don't go to this category too. As me in my news page, I include some pages... But I don't want that the news page go to these categories. and it's simple to add... I did it on mine... Oh and that's because I put the function to add it at the end of an article if it's not a new one. --Kronoxt 20:02, 3 May 2009 (UTC)Reply

Internationalization file & Add Category to Category form field

I put the extended code under User:Cm#Updates_to_Add_Article_to_Category --Cm 11:34, 29 October 2009 (UTC)Reply

not working on 1.16.2

the mod isn't working on mediawiki 1.16.2 --Raid 11:54, 3 March 2011 (UTC)Reply

adding category to pre existing articles

i am using the extension add article to my wiki, is there any way to be able to add a PRE EXISTING article to a category, i my case when i open a PRE EXISTING article the extension doens't include the category at the end of the article. i would appreciate your help