Hi, I'm an admin of a intranet mediawiki (version 1.10.1) portal. As a policy, I've suggested all the users to have at least one category for the page that they create. Users can use the existing category OR they are free to create a new category wherever required.
But it seems users are still creating pages without any category. How can I forcefully apply this policy so that users cannot create a page without a category? Is there any way to impose this rule in mediawiki.
Has anyone tried this earlier? Kindly suggest a way to put this policy in there.
I'm a programmer too and manage to read/write php if this requires a code change.
Thanks in advance, Swapnil
On 16/01/2008, Swapnil swapsapar@gmail.com wrote:
I'm an admin of a intranet mediawiki (version 1.10.1) portal. As a policy, I've suggested all the users to have at least one category for the page that they create. Users can use the existing category OR they are free to create a new category wherever required. But it seems users are still creating pages without any category. How can I forcefully apply this policy so that users cannot create a page without a category? Is there any way to impose this rule in mediawiki. Has anyone tried this earlier? Kindly suggest a way to put this policy in there. I'm a programmer too and manage to read/write php if this requires a code change.
I don't know of a mechanism, but this may be useful in some cases. A drop-down with categories, and the option to make a new one? Sort of like LiveJournal's tagging system.
Mind you, the list would get very long very quickly. Our tiny intranet wiki has about 80 cats after a few weeks, all relevant.
- d.
David Gerard <dgerard@...> writes:
On 16/01/2008, Swapnil <swapsapar@...> wrote:
I'm an admin of a intranet mediawiki (version 1.10.1) portal. As a policy, I've suggested all the users to have at least one category for the page
that
they create. Users can use the existing category OR they are free to
create a
new category wherever required. But it seems users are still creating pages without any category. How can I forcefully apply this policy so that users cannot create a page without a category? Is there any way to impose this rule in mediawiki. Has anyone tried this earlier? Kindly suggest a way to put this policy in there. I'm a programmer too and manage to read/write php if this requires a code change.
I don't know of a mechanism, but this may be useful in some cases. A drop-down with categories, and the option to make a new one? Sort of like LiveJournal's tagging system.
Mind you, the list would get very long very quickly. Our tiny intranet wiki has about 80 cats after a few weeks, all relevant.
- d.
Thanks David for your inputs. I think the drop down idea also should worok here for me. Can you please send me some page URLs where you have seen such feature? I did some google but could not find any existing wiki which has such drop down list. If you dont mind, can you please also share the code for me? Thanks, Swapnil
Swapnil schreef:
But it seems users are still creating pages without any category. How can I forcefully apply this policy so that users cannot create a page without a category? Is there any way to impose this rule in mediawiki.
What you could do is look at the Special:Uncategorizedpages every once in a while. It lists pages that don't belong to a category.
Roan Kattouw (Catrope)
Swapnil schreef:
But it seems users are still creating pages without any category. How
can I
forcefully apply this policy so that users cannot create a page
without a
category? Is there any way to impose this rule in mediawiki.
Try http://www.mediawiki.org/wiki/Extension:Postloader
If you have a default category that articles can be saved to then you could add the [[Category:Default]] to every article. Or you could use something like this: http://www.mediawiki.org/wiki/Extension:CategorySuggest
I'm pretty sure you can also check to make sure a category has been selected and not allow a save to complete without it. Especially if your category entry spot is its own form element.
Good luck! -Courtney
It could be implemented inside of an extension using the ArticleSave hook. You can use $user->ifAllowed( '' ); to check if the saving user has the permissions to save without a category. And you can either do a regex on $text to see if there is a category tag in the page. Or you can parse $text using the parser, and use the ParserOutput to see if a category is inside the page or not. The method is your pick, the former is faster, but the latter will allow for use of templates with categories instead of only [[Category:]] tags.
~Daniel Friesen(Dantman) of: -The Gaiapedia (http://gaia.wikia.com) -Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG) -and Wiki-Tools.com (http://wiki-tools.com)
Christensen, Courtney wrote:
Swapnil schreef:
But it seems users are still creating pages without any category. How
can I
forcefully apply this policy so that users cannot create a page
without a
category? Is there any way to impose this rule in mediawiki.
Try http://www.mediawiki.org/wiki/Extension:Postloader
If you have a default category that articles can be saved to then you could add the [[Category:Default]] to every article. Or you could use something like this: http://www.mediawiki.org/wiki/Extension:CategorySuggest
I'm pretty sure you can also check to make sure a category has been selected and not allow a save to complete without it. Especially if your category entry spot is its own form element.
Good luck! -Courtney
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
DanTMan <dan_the_man@...> writes:
It could be implemented inside of an extension using the ArticleSave hook. You can use $user->ifAllowed( '' ); to check if the saving user has the permissions to save without a category. And you can either do a regex on $text to see if there is a category tag in the page. Or you can parse $text using the parser, and use the ParserOutput to see if a category is inside the page or not. The method is your pick, the former is faster, but the latter will allow for use of templates with categories instead of only [[Category:]] tags.
~Daniel Friesen(Dantman) of: -The Gaiapedia (http://gaia.wikia.com) -Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG) -and Wiki-Tools.com (http://wiki-tools.com)
Christensen, Courtney wrote:
Swapnil schreef:
But it seems users are still creating pages without any category. How
can I
forcefully apply this policy so that users cannot create a page
without a
category? Is there any way to impose this rule in mediawiki.
Try http://www.mediawiki.org/wiki/Extension:Postloader
If you have a default category that articles can be saved to then you could add the [[Category:Default]] to every article. Or you could use something like this: http://www.mediawiki.org/wiki/Extension:CategorySuggest
I'm pretty sure you can also check to make sure a category has been selected and not allow a save to complete without it. Especially if your category entry spot is its own form element.
Good luck! -Courtney
Wikitech-l mailing list Wikitech-l@... http://lists.wikimedia.org/mailman/listinfo/wikitech-l
Hey Thanks Dantman !!!! Your ArticleSave trick worked !!! I'm listening for this event and then checking for the existance of category in the $text of the page. If not found then add a message at the begining of the page for not having a category and then allow it to be saved. Upon saving the user cannot just miss the ugly message and will add a category to get rid of this message.
The ugly message is actually a template called {{MissingCategory}}.
<?php # - Author: Swapnil Sapar $wgHooks['ArticleSave'][] = 'wfCheckCategory';
function wfCheckCategory(&$article, &$user, &$text, &$summary, &$minoredit, &$watchthis, &$sectionanchor) { // remove the ugly message if its already presnt in $text $text = str_replace("{{MissingCategory}}", "",$text); // check if the category is present in the $text if(preg_match("/[[category:[\w~!@$%^&*()\s]+]]/i",$text)) { // let him go if he already has the category. return true; } else { //gotcha !!! you will get my ugly message with your page. $text = "{{MissingCategory}}".$text; return true; } } ?>
Now I dont have to go after 100+ users to add a category to their pages. Thanks a ton.
Swapnil
Swapnil <swapsapar@...> writes:
I'm an admin of a intranet mediawiki (version 1.10.1) portal. As a policy, I've suggested all the users to have at least one category for the page that they create.
Won't this discourage people from creating new pages? IIRC a gentle emailed reminder is much better than a software-enforced policy; it avoids biting newcomers. Even in an intranet. :)
wikitech-l@lists.wikimedia.org