NewGroupWarning

Summary: Display a warning when a user is creating a page in a non-existing wiki group.
Version: 2008-01-29
Prerequisites:
Status:
Maintainer: Petko
License: PD

Questions answered by this recipe

Can PmWiki warn editors when they are creating new pages in non-existent wiki groups?

Description

Less experienced editors sometimes create links that, if followed, will lead to the inadvertent creation of pages in non-existent wiki groups.

Example: by placing dots (".") or slashes ("/") in links. A link like [[Mr.Nobody]] is expected to link to a new page in the current group, and not to a page "Nobody" in a "Mr" group.
Example: by including formatting markup inside link-forming brackets. A link like [[%red%Main/Archives%%]] is expected to link to the page Archives in the Main group, not to a page Archives in a "RedMain" group.

This recipe displays a warning in with a thick red border when a new page in a new group is edited.

Additionally, the warning message contains a list of the wiki pages that link to the currently edited page, making it easy for the user to find and correct bad links.

This recipe will not stop the user from creating a new page, if he wishes to.

1. Site.NewGroupWarning

Create on your wiki a page "Site.NewGroupWarning" containing something like:

>>border="2px solid red" bgcolor="#ffeeee" padding=1em<< 
[+%red%'''Warning''':%% You are editing a page named "'''{*$Namespaced}'''" in a non-existent wiki group named "'''{*$Groupspaced}/'''".+] 

'''''If''''' that is not what you expected, please do not save this page, but go back and correct the link that led you here. 

[-'''What might have happened:''' Inadvertent creation of a new [[PmWiki/wiki group | wiki groups]] is often the result of using a dot (".") or a slash ("/") inside a link.  In a link, these characters operate as separators between the name of the wiki group and name of the page. To display them, you can create links of this form:-]\\
&nbsp;[-@@[=[[=]{*$Group}{*$Name} | {*$Groupspaced}. {*$Namespaced}]]@@-]\\
[-or-]\\
&nbsp;[-@@[=[[=]Main.{*$Group}{*$Name} | {*$Groupspaced}. {*$Namespaced}]]@@-]

Here is a list of pages that link to here; if you did not intend to create this new group, you may want to correct them: \\
(:pagelist link={*$FullName} fmt=#simple:)
>><<

Warning: You are editing a page named "New Group Warning" in a non-existent wiki group named "Cookbook/".

If that is not what you expected, please do not save this page, but go back and correct the link that led you here.

What might have happened: Inadvertent creation of a new wiki groups is often the result of using a dot (".") or a slash ("/") inside a link. In a link, these characters operate as separators between the name of the wiki group and name of the page. To display them, you can create links of this form:
 [[CookbookNewGroupWarning | Cookbook. New Group Warning]]
or
 [[Main.CookbookNewGroupWarning | Cookbook. New Group Warning]]

Here is a list of pages that link to here; if you did not intend to create this new group, you may want to correct them:

2. Site.EditForm

Place the following code in the beginning of the page Site.EditForm on your wiki:

(:if !exists $[{*$Group}/RecentChanges]:)
(:include $[{$SiteGroup}/NewGroupWarning]:)
(:if:)

Notes

The recipe works this way: the page Site.EditForm (with the text area where the pages are edited) checks whether there is a page RecentChanges in the current group. If not, it includes the Site.NewGroupWarning.

Since the warning will display when editing a page in any group that lacks a RecentChanges page, you should make sure you do have a Group.RecentChanges page for every Group that exists when this recipe is put into place.

Once users have created pages in a wrong group, then even after deleting the pages there is the special page WrongGroup.RecentChanges that persists and usually cannot be deleted. See the recipe RecentChanges Deletion on how authors can delete this page.

Release Notes

See Also

Contributors

  • The recipe is written and maintained by Petko (5ko [snail] 5ko [period] fr).
  • If this recipe helps you or saves you time, you can help support its continued development by .

Comments

See discussion at NewGroupWarning-Talk?

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.