Skip to content

Commit

Permalink
Item8040:
Browse files Browse the repository at this point in the history
   * replace uggly universal edit button with a famfamfam pencil
   * minor foswiki/compat fixes



git-svn-id: http://svn.foswiki.org/trunk/EditChapterPlugin@1805 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Jan 7, 2009
1 parent 498b787 commit 968cd58
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 36 deletions.
29 changes: 15 additions & 14 deletions data/TWiki/EditChapterPlugin.txt
Expand Up @@ -9,7 +9,7 @@
<table style="float:right">
<tr>
<td><img src="%ATTACHURLPATH%/wikiringlogo40x40.png"></td>
<td><a href="http://wikiring.de" title="Make your Wiki ring!" style="text-decoration:none">
<td><a href="http://wikiring.com" title="Make your Wiki ring!" style="text-decoration:none">
Powered by <br /> <nop>WikiRing Consultants </a>
</td>
</tr>
Expand All @@ -18,11 +18,11 @@ This plugin implements a simple section editing feature comparable to
the one available for [[http://en.wikipedia.org/wiki/Help:Section#Section_editing][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 the "Universal Wiki Edit Button"
<img src="%PUBURLPATH%/%WEB%/%TOPIC%/uweb-g.gif" border="1" />.
with the mouse pointer over them and then displays an icon, defaulting to a pencil
<img src="%PUBURLPATH%/%WEB%/%TOPIC%/pencil.png" border="0" />.

Once installed, the plugin automatically enables sectional editing without any further
provisions. Note, that it will only detect headings created using TWiki-markup, that is
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 =&lt;h2>headings&lt;/h2>=.

Expand All @@ -33,13 +33,13 @@ then redirect back to the current topic it has been included to.

---++ Previous work
There are a couple of other plugins that try to implement a section editing feature, along with some
other more exotic features. The first plugin of that kind was Foswiki:Extensions/SectionalEditPlugin.
other more exotic features. The first plugin of that kind was TWiki:Plugins/SectionalEditPlugin.
Later on, its functionality was extended to process sections in a broader sense in the
Foswiki:Extensions/MultiEditPlugin. By the time of this writing both plugins were about to
be merged again into one Foswiki:Extensions/EditSectionPlugin. These three plugins all depend
on an extra package called Foswiki:Extensions/EditContrib which factors out common code. In addition
<nop>EditContrib contains a patch to the TWiki core engine, available for TWiki-4.0 and TWiki-4.1.x.
All these plugins are currently non-functional on TWiki-4.2.
TWiki:Plugins/MultiEditPlugin. By the time of this writing both plugins were about to
be merged again into one TWiki:Plugins/EditSectionPlugin. These three plugins all depend
on an extra package called TWiki:Plugins/EditContrib which factors out common code. In addition
<nop>EditContrib contains a patch to the core engine, available for TWiki-4.0 and TWiki-4.1.x only.
All these plugins are currently non-functional.

While first looking at the code of <nop>SectionalEditPlugin, it was clear very soon, that it
would be better to start from scratch and remove some features for the sake of a cleaner
Expand Down Expand Up @@ -118,9 +118,9 @@ For the purpose of simplicity a couple of shortcomings have to be accepted.
users can't specify any other section to be editable in isolation (e.g. using some
=&lt;section> ... &lt;/section>= markup) other than by giving the respective section
a heading.
1 jQuery: the <nop>EditChapterPlugin currently depends on the JQueryPlugin, used
1 jQuery: the <nop>EditChapterPlugin depends on the JQueryPlugin, used
to hook into the edit interface. You may be facing an increased javascript download overhead in
your TWiki html pages as you are already using Foswiki:Extensions/BehavourContrib, Foswiki:Extensions/TwistyContrib
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.
Expand All @@ -134,11 +134,12 @@ For the purpose of simplicity a couple of shortcomings have to be accepted.
Many thanks to the following sponsors for supporting this work:
* [[http://www.tecdoc.de][TecDoc Informations System <nop>GmbH]]

| Plugin Author(s): | TWiki:Main/MichaelDaum |
| Plugin Author(s): | Michael Daum |
| Copyright &copy;: | 2008, Michael Daum http://michaeldaumconsulting.com |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Plugin Version: | v1.15 |
| Plugin Version: | v1.20 |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 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 |
Expand Down
2 changes: 1 addition & 1 deletion lib/TWiki/Plugins/EditChapterPlugin.pm
Expand Up @@ -25,7 +25,7 @@ use vars qw(
);

$VERSION = '$Rev$';
$RELEASE = '1.14';
$RELEASE = '1.20';
$SHORTDESCRIPTION = 'An easy sectional edit facility';

$header = <<'HERE';
Expand Down
14 changes: 12 additions & 2 deletions lib/TWiki/Plugins/EditChapterPlugin/Core.pm
Expand Up @@ -36,7 +36,7 @@ sub new {
TWiki::Func::getPreferencesValue("EDITCHAPTERPLUGIN_MAXDEPTH") || 6;
my $editImg =
TWiki::Func::getPreferencesValue("EDITCHAPTERPLUGIN_EDITIMG") ||
'<img src="%PUBURLPATH%/%SYSTEMWEB%/EditChapterPlugin/ueb.png" height="16" width="16" border="0" />';
'<img src="%PUBURLPATH%/%SYSTEMWEB%/EditChapterPlugin/pencil.png" height="16" width="16" border="0" />';
my $editLabelFormat =
TWiki::Func::getPreferencesValue("EDITCHAPTERPLUGIN_EDITLABELFORMAT") ||
'<span class="ecpHeading">$anchor $heading <a class="ecpEdit" href="$url" title="Edit this chapter">$img</a></span>';
Expand Down Expand Up @@ -274,9 +274,19 @@ sub handleEXTRACTCHAPTER {

my $result = substr($text, $fromPos, $length);

$result = TWiki::entityEncode( $result, "\n" ) if $theEncode;
$result = entityEncode( $result, "\n" ) if $theEncode;
writeDebug("BEGIN RESULT\n$result\nEND RESULT");
return $result;
}

sub entityEncode {
my ( $text, $extra ) = @_;
$extra ||= '';

$text =~
s/([[\x01-\x09\x0b\x0c\x0e-\x1f"%&'*<=>@[_\|$extra])/'&#'.ord($1).';'/ge;

return $text;
}

1;
4 changes: 2 additions & 2 deletions lib/TWiki/Plugins/EditChapterPlugin/MANIFEST
@@ -1,10 +1,10 @@
data/TWiki/EditChapterPlugin.txt 0644
lib/TWiki/Plugins/EditChapterPlugin/Core.pm 0644
lib/TWiki/Plugins/EditChapterPlugin.pm 0644
lib/TWiki/Plugins/EditChapterPlugin/Core.pm 0644
pub/TWiki/EditChapterPlugin/ecpjavascript.js 0644
pub/TWiki/EditChapterPlugin/ecpstyles.css 0644
pub/TWiki/EditChapterPlugin/ueb.png 0644
pub/TWiki/EditChapterPlugin/uweb-g.gif 0644
pub/TWiki/EditChapterPlugin/ueb.png 0644
pub/TWiki/EditChapterPlugin/wikiringlogo40x40.png 0644
templates/edit.chapter.tmpl 0644
templates/edittoolbar.chapter.tmpl 0644
18 changes: 2 additions & 16 deletions lib/TWiki/Plugins/EditChapterPlugin/build.pl
Expand Up @@ -2,24 +2,10 @@
BEGIN {
unshift @INC, split( /:/, $ENV{FOSWIKI_LIBS} );
}
use TWiki::Contrib::Build;
use Foswiki::Contrib::Build;

# Create the build object
$build = new TWiki::Contrib::Build('EditChapterPlugin');

# (Optional) Set the details of the repository for uploads.
# This can be any web on any accessible TWiki installation.
# These defaults will be used when expanding tokens in .txt
# files, but be warned, they can be overridden at upload time!

# name of web to upload to
$build->{UPLOADTARGETWEB} = 'Extensions';
# Full URL of pub directory
$build->{UPLOADTARGETPUB} = 'http://foswiki.org/pub';
# Full URL of bin directory
$build->{UPLOADTARGETSCRIPT} = 'http://foswiki.org/bin';
# Script extension
$build->{UPLOADTARGETSUFFIX} = '';
$build = new Foswiki::Contrib::Build('EditChapterPlugin');

# Build the target on the command line, or the default target
$build->build($build->{target});
Expand Down
2 changes: 1 addition & 1 deletion pub/TWiki/EditChapterPlugin/ecpstyles.css
Expand Up @@ -10,7 +10,7 @@
border:0px !important;
}
.ecpEdit img {
vertical-align:middle;
vertical-align:baseline;
padding:0px;
border:0px;
}
Expand Down
Binary file added pub/TWiki/EditChapterPlugin/pencil.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 968cd58

Please sign in to comment.