Log In | Users | Register
Welcome, Registration, and other StartingPoints; Foswiki history & Wiki style; All the docs...
spacer
Edit | Attach | New | Raw | Delete | History | Diff | Print | Pdf | Subscribe | Tools
You are here: System » EditChapterPlugin

EditChapterPlugin

An easy section editing facility

Description

Powered by
WikiRing Consultants
This plugin implements a simple section editing feature comparable to the one available for MediaWiki. It adds link urls to headings so that users can edit the section below. Edit links are enabeld only for those users that have edit access. Edit links are hidden unless you hover with the mouse pointer over them and then displays an icon, defaulting to a pencil .

Once installed, the plugin automatically enables sectional editing without any further provisions. Note, that it will only detect headings created using TML (topic markup language), that is writing ---++ heading and the like. It is not sensitive to normal HTML-markup, so it does not add an edit link to normal <h2>headings</h2>.

Sections might be included into the current topic using INCLUDE. The edit link will be adjusted approriately, allowing to edit the correct target topic and then redirect back to the current topic it has been included to.

Configuration

There are a couple of preference variables to influence how and which headings are processed:
Name Description Default
EDITCHAPTERPLUGIN_MINDEPTH min depth of heading to edit the sections, 1=h1, 2=h2, 3=... 1
EDITCHAPTERPLUGIN_MAXDEPTH max depth of headings to edit 6
EDITCHAPTERPLUGIN_EDITIMG icon to be used in the edit link <img src="%$nopPUBURLPATH%/%SYSTEMWEB%/EditChapterPlugin/uweb-g.gif" height="16" width="16" border="0" />
EDITCHAPTERPLUGIN_EDITLABELFORMAT full format string to render the detected heading of a chapter <span class="ecpHeading">$anchor</a>$heading<a class="ecpEdit" href="$url" title="Edit this chapter">$img</a></span>
EDITCHAPTERPLUGIN_ENABLED variable to enable/disable the EditChapterPlugin on

Syntax

ENABLEEDITCHAPTER, DISABLEEDITCHAPTER

In addition to enable/disable the plugin using the EDITCHAPTERPLUGIN_ENABLE preference variable, it can also be enabled disabled using the %ENABLEEDITCHAPTER% / %DISABLEEDITCHAPTER% tags.

EXTRACTCHAPTER

Dedicated chapters of a topic can be extracted using the %EXTRACTCHAPTER{}% tag. it takes the following parameters:

Name Description Default
topic target topic name to extract the chapter from %BASETOPIC%
web target web name %BASEWEB%
nr specify a single chapter to be extracted  
from specify first chapter to be extracted, use to to specify the last chapter 0
to specify last chapter to be extracted, mostly used together with from 9999999
before specify to extract all chapters before the given one  
after specify to extract all chapters after the given one  
encode enable/disable entity encoding, used when embeding into an HTML input element on

Example:

<textarea style="display:none">
  %EXTRACTCHAPTER{before="1"}%
</textarea>
<textarea>
  %EXTRACTCHAPTER{nr="1" encode="on"}%
</textarea>
<textarea style="display:none">
  %EXTRACTCHAPTER{after="1}%
</textarea>

See the edit.chapter.tmpl for a real-world example, used as a cover to the standard edit templates, thus hooking in section editing into the standard editing process.

Limitations

For the purpose of simplicity a couple of shortcomings have to be accepted.

  1. parametrized includes: the plugin does not know anything about parametrized includes, that is it won't work as expected if a topic includes text from a named section of another topic using %INCLUDE{"TargetTopic" section="onlythis"}%.
  2. wysiwyg editor: it currently does not work work together with Foswiki:Extensions/WysiwygPlugin
  3. explicit sectioning: users can't specify any other section to be editable in isolation (e.g. using some <section> ... </section> markup) other than by giving the respective section a heading.
  4. jQuery: the EditChapterPlugin depends on the JQueryPlugin, used to hook into the edit interface. You may be facing an increased javascript download overhead in your html pages as you are already using Foswiki:Extensions/BehavourContrib, Foswiki:Extensions/TwistyContrib and Foswiki:Extensions/TwistyPlugin. Consider uninstalling these three and replace them with Foswiki:Extensions/JQueryTwistyPlugin. You should have installed JQueryPlugin anyway already. Last not least you get less javascript but more features.

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Plugin Info

Many thanks to the following sponsors for supporting this work:

Plugin Author(s): Michael Daum
Copyright ©: 2008-2010, Michael Daum http://michaeldaumconsulting.com
License: GPL (GNU General Public License)
Release: 2.12
Version: 6337 (2010-02-15)
Change History:  
15 Feb 2010: fixing breakage with latest Foswiki:Extensions/JQueryPlugin
12 Feb 2010: minify and compress css and js; forward compatibility for newer foswikis
16 Nov 2009: disabling wysiwyg during sectional edits
02 Jul 2009: fixing javascript order and TOC links
17 Apr 2009: working towards a pure foswiki plugin
08 Jan 2009: certified for foswiki/compat
26 Nov 2008: replaced the uggly universal edit button with a nice pencil
26 Jun 2008: new universal edit button
29 Apr 2008: removed "literal" hack again; removed check for body_text context; only the icon is clickable - was all of the heading before
13 Mar 2008: add <literal> ... </literal> for TWiki engines before 4.2
14 Feb 2008: have a little space in the default heading format to let TopicMarkup do its job; added support for legacy heading markup like --------#####
05 Feb 2008: compatibility with old PatternSkin versions
03 Jan 2008: initial release
Dependencies:
NameVersionDescription
Foswiki::Plugins::JQueryPlugin>=0.4Required.
Foswiki::Plugins::ZonePlugin>=1.0Required.
Plugin Home: Foswiki:Extensions/EditChapterPlugin
Support: Foswiki:Support/EditChapterPlugin
spacer
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback
Syndicate this site RSS ATOM