Extension:Semantic Forms/The "edit with form" tab

From MediaWiki.org
Jump to: navigation, search
Semantic Forms - navigation (viewTemplate:Semantic Forms navigation)
Basics Main pageExtension:Semantic Forms (talk) · Download and installationExtension:Semantic Forms/Download and installation · Quick start guideExtension:Semantic Forms/Quick start guide · HostingExtension:Semantic Forms/Hosting · Special pagesExtension:Semantic Forms/Special pages
Using Semantic Forms SF and templatesExtension:Semantic Forms/Semantic Forms and templates · Defining formsExtension:Semantic Forms/Defining forms (Input typesExtension:Semantic Forms/Input types) · The "Edit with form" tabExtension:Semantic Forms/The "edit with form" tab · Linking to formsExtension:Semantic Forms/Linking to forms · Creating query formsExtension:Semantic Forms/Creating query forms
Resources for help Common problemsExtension:Semantic Forms/Common problems · Known bugs and planned featuresExtension:Semantic Forms/Known bugs and planned features · Getting supportExtension:Semantic Forms/Getting support · Developers' documentationExtension:Semantic Forms/Developers' documentation · TestingExtension:Semantic Forms/Testing
About Semantic Forms Authors and creditsExtension:Semantic Forms/Authors and credits · Version historyExtension:Semantic Forms/Version history · Sites that use Semantic FormsExtension:Semantic Forms/Sites that use Semantic Forms · Related extensionsExtension:Semantic Forms/Related extensions

Getting "Edit with form" to appear[edit]

Starting with version 3.0, the recommended way to make the "Edit with form" tab appear on the page is to use the parser function #default_form. This approach always takes the form {{#default_form:form-name}}, where form-name is the name of the form without the namespace prefix "Form:". The previous approach involves Semantic MediaWiki's special properties, and is still supported. Both approaches are listed here.

If a user is not allowed to edit a page that is form-editable, the tab will show up for them as "view form" instead; clicking on the tab will show the disabled form.

Based on category[edit]

The recommended approach is to use categories. To enable a page to have a tab in this way, you must first define that page as belonging to a specific category. The best way to match pages with a category is to place a 'Category' tag inside the main template that defines this page type; that way, every page that uses this template will become part of this category.

Then, place a call to the parser function #default_form in the page for that category; the call should look like {{#default_form:form-name}}. You can do this automatically if you create the category using the 'CreateCategory' page.

SF versions before 3.0[edit]

Instead of #default_form, place the semantic property 'Has default form' in the page for that category; the tag should look like [[Has default form::form-name]].

Based on namespace[edit]

The second possible way is to match the pages' namespace to a form. First, locate the page defining that namespace. For instance, if the namespace you want to associate with a form is 'User', the page in which you need to add the property can be found by navigating to 'Project:User' (you may need to create this page). If the namespace you want a default form for is the main one (i.e., the one with no name), you will need to create and add this property to the page called 'Project:Main', or whatever the main namespace is called in the language of this wiki (to see the name of the main namespace in your wiki, go to MediaWiki:Blanknamespace).

Then, add either the #default_form parser function or the "Has default form" special property to this page; see above for an explanation of both.

Once you've added this call, every page within that namespace will have that form associated with it, unless it already belongs to a category that has an associated form (categories take precedence over namespaces).

Within the page[edit]

You can also associate a form directly to a page. This is especially useful when the category and namespace options aren't possible, such as when pages belong to multiple categories that have different default forms; or for editing category pages themselves.

To do this, simply add a call to #default_form directly to the page, or to a template that the page calls (see above for how to call #default_form).

SF versions before 3.0[edit]

This can be done with the special property "Page has default form". To apply it, place this property either directly within the page, or in a template that the page calls, using syntax like this:

 [[Page has default form::form-name]]

Configuring the editing tabs[edit]

For pages that have an "Edit with form" tab, you may want the regular "edit" tab to be renamed or even removed altogether. There are flags you can set in "LocalSettings.php" to change the appearance of the editing tabs:

  • $sfgRenameEditTabs = true; - renames the "Edit with form" tab to "edit", and the "edit" tab to "edit source" (in whatever language the wiki is being viewed in)
  • $sfgRenameMainEditTab = true; - renames only the "edit" tab to "edit source" (in whatever language the wiki is being viewed in)
  • $wgGroupPermissions[...]['viewedittab'] - can be set, for different types of viewers, to toggle whether each type will see the regular edit tab. One common modification is to set it to false normally (i.e. for viewer type '*'), and to true for 'sysop' viewers:
    • $wgGroupPermissions['*']['viewedittab'] = false;
    • $wgGroupPermissions['sysop']['viewedittab'] = true;

If these settings are added to LocalSettings.php, they should be placed in the file after the include of Semantic Forms.

Note that some of the early MediaWiki skins, like Cologne Blue, contain hard-coded links to "Edit this page", that can't be removed or renamed by the Semantic Forms code.

Further tab customization[edit]

Tabs contain CSS ID's that can be further customized on a site-wide basis using CSS or javascript in your site's MediaWiki:Common.css or MediaWiki:Common.js. Tabs can be customized on an individual page using Extension:NewPageCSS or Extension:CSS. For example, you can hide the edit and view tabs with something like this in your MediaWiki:Common.css:

#ca-view, #ca-edit { display: none !important; }