Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item71:Item5159:Item5160:Item5599:Item77:
   * support for TinyMCEPlugin wysiwyg editor
   * removed non-maintained "word" style
   * fixes for foswiki/compat
   * added settings template
   * distinguishing _restore revision_ from a normal _edit_
   * made <nop>DBCachePlugin's topic title feature optional
   * added "Show on screen" settings to easily switch off form, attachment or meta:comments (forthcoming)
   * fixed action=text
   * removing <nop>TopicTitle formfield from the "Form" tab if it is already on the "Text" tab



git-svn-id: http://svn.foswiki.org/trunk@1819 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Jan 7, 2009
1 parent 0030450 commit eac0346
Show file tree
Hide file tree
Showing 93 changed files with 137 additions and 125 deletions.
18 changes: 13 additions & 5 deletions NatEditPlugin/data/TWiki/NatEditPlugin.txt
Expand Up @@ -76,13 +76,22 @@ from
Testing has been carried out using Safari, Firefox, Opera and Internet Explorer.

---++ Plugin Info
Sponsored by [[http://www.trivadis.com][Trivadis AG]] & [[http://twiki.net][TWIKI.NET]]
Sponsored by [[http://www.trivadis.com][Trivadis AG]]

| Author: | Michael Daum |
| Copyright &copy;: | 2007-2008 Michael Daum http://michaeldaumconsulting.com |
| Copyright &copy;: | 2007-2009 Michael Daum http://michaeldaumconsulting.com |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Version: | v3.20 |
| Version: | v3.30 |
| Change History: | |
| 07 Jan 2009 | support for <nop>TinyMCEPlugin wysiwyg editor; \
removed non-maintained "word" style; \
fixes for foswiki/compat; \
added settings template; \
distinguishing _restore revision_ from a normal _edit_; \
made <nop>DBCachePlugin's topic title feature optional; \
added "Show on screen" settings to easily switch off form, attachment or meta:comments (forthcoming); \
fixed action=text; \
removing <nop>TopicTitle formfield from the "Form" tab if it is already on the "Text" tab |
| 18 Nov 2008 | fixing form data being nulled on preview; \
using jquery to submit the data |
| 13 Nov 2008 | using new BUTTONs from <nop>JQueryPlugin |
Expand All @@ -107,7 +116,7 @@ Sponsored by [[http://www.trivadis.com][Trivadis AG]] & [[http://twiki.net][TWIK
| 04 Aug 2007 | added Word theme \
added bullet and numbered lists buttons & Javascript \
added create Table button and Javascript \
work done by Sveni Dowideit [[http://DistributedINFORMATION.com][DistributedINFORMATION]] for [[http://twiki.net][TWIKI.NET]] |
work done by Sven Dowideit [[http://DistributedINFORMATION.com][DistributedINFORMATION]] |
| 21 May 2007 | fixed display of toolbar buttons |
| 01 May 2007 | made natedit themable |
| 27 Apr 2007 | made all button output configurable; \
Expand All @@ -128,7 +137,6 @@ Sponsored by [[http://www.trivadis.com][Trivadis AG]] & [[http://twiki.net][TWIK
| Dependencies: | %$DEPENDENCIES% |
| Perl Version: | - |
| Plugin Home: | http://foswiki.org/Extensions/%TOPIC% |
| Feedback: | http://foswiki.org/Extensions/%TOPIC%Dev |

%META:FILEATTACHMENT{name="wikiringlogo40x40.png" attr="h" autoattached="1" comment="" date="1207667571" path="wikiringlogo40x40.png" size="2571" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="screenshot1.png" attr="" autoattached="1" comment="" date="1207667571" path="screenshot1.png" size="52124" user="ProjectContributor" version="1"}%
9 changes: 3 additions & 6 deletions NatEditPlugin/lib/TWiki/Plugins/NatEditPlugin.pm
@@ -1,7 +1,4 @@
# Copyright (C) 2007-2008 Michael Daum http://michaeldaumconsulting.com
#
# based on NatEditPlugin:
# Copyright (C) 2003-2008 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2007-2009 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -63,7 +60,8 @@ sub initPlugin {

unless ($skin =~ /\b(natedit)\b/) {
$skin = "natedit,$skin";
$TWiki::Plugins::SESSION->{prefs}->pushPreferenceValues('SESSION', { SKIN => $skin } );
my $prefs = $TWiki::Plugins::SESSION->{prefs} || $Foswiki::Plugins::SESSION->{prefs};
$prefs->pushPreferenceValues('SESSION', { SKIN => $skin } );
}

TWiki::Func::addToHEAD("natedit", $header);
Expand Down Expand Up @@ -288,5 +286,4 @@ sub escapeParameter {
return $found;
}


1;
7 changes: 5 additions & 2 deletions NatEditPlugin/lib/TWiki/Plugins/NatEditPlugin/MANIFEST
@@ -1,6 +1,6 @@
data/TWiki/NatEditHelpText.txt 0644
data/TWiki/NatEditPluginJSUnitTests.txt 0644
data/TWiki/NatEditPlugin.txt 0644
data/TWiki/NatEditPluginJSUnitTests.txt 0644
data/TWiki/NatEditHelpText.txt 0644
data/TWiki/NatEditWordHelpText.txt 0644
lib/TWiki/Plugins/NatEditPlugin.pm 0644
pub/TWiki/NatEditPlugin/default/btn_cyan_left.gif 0644
Expand Down Expand Up @@ -30,3 +30,6 @@ templates/edittoolbar.word.natedit.tmpl 0644
templates/form.natedit.tmpl 0644
templates/preview.natedit.tmpl 0644
templates/previewtoolbar.natedit.tmpl 0644
templates/settings.natedit.tmpl 0644
templates/edittext.natedit.tmpl 0644
templates/settingstoolbar.natedit.tmpl 0644
4 changes: 2 additions & 2 deletions NatEditPlugin/lib/TWiki/Plugins/NatEditPlugin/build.pl
Expand Up @@ -5,7 +5,7 @@ BEGIN
}
}

use TWiki::Contrib::Build;
$build = new TWiki::Contrib::Build( 'NatEditPlugin' );
use Foswiki::Contrib::Build;
$build = new Foswiki::Contrib::Build( 'NatEditPlugin' );
$build->build($build->{target});

41 changes: 21 additions & 20 deletions NatEditPlugin/pub/TWiki/NatEditPlugin/edit.js
Expand Up @@ -3,10 +3,8 @@ function initTextAreaHeight () { }
function handleKeyDown () { }

function submitEditForm(script, action) {
$("#savearea").val($("#topic").val());
$(".natEditBottomBar a").each(function () {
this.blur();
});
var topicText = $("#topic").val();
$("#savearea").val(topicText);
if (typeof(beforeSubmitHandler) != 'undefined') {
beforeSubmitHandler(script, action);
}
Expand All @@ -25,20 +23,23 @@ function submitEditForm(script, action) {
}

$(function() {
window.setTimeout(function() {
var foundMce = $(".mceEditor").length;
if (foundMce) {
$(".natEditToolBar").hide();
}
/*
if (TWikiTiny) {
TWikiTiny['switchToRaw'] = function (inst) {
alert("switch to raw");
TWikiTiny.switchToRaw(inst);
$(".natEditToolBar").show();
};
alert("switchtoraw="+TWikiTiny['switchToRaw']);
}
*/
}, 1);
window.setTimeout(function() {
if (typeof(TWikiTiny) != 'undefined' || typeof(FoswikiTiny) != 'undefined') {
$(".natEditToolBar").hide(); /* switch off natedit toolbar */

/*
var oldSwitchToRaw = TWikiTiny.switchToRaw;
TWikiTiny.switchToRaw = function(inst) {
$(".natEditToolBar").show();
oldSwitchToRaw(inst);
};
TWikiTiny['switchToRaw'] = function (inst) {
alert("switch to raw");
TWikiTiny.switchToRaw(inst);
$(".natEditToolBar").show();
};
*/
}
}, 1);
});
6 changes: 3 additions & 3 deletions NatEditPlugin/pub/TWiki/NatEditPlugin/jquery.natedit.js
@@ -1,7 +1,7 @@
/*
* jQuery NatEdit plugin 1.1
* jQuery NatEdit plugin 1.2
*
* Copyright (c) 2008 Michael Daum http://michaeldaumconsulting.com
* Copyright (c) 2008-2009 Michael Daum http://michaeldaumconsulting.com
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
Expand Down Expand Up @@ -641,7 +641,7 @@ $(function() {
});
if (foundNatEdit) {
var savetext = $("#savearea").val();
if (savetext) {
if (savetext.length) {
$("#topic").val(savetext);
}
}
Expand Down
6 changes: 5 additions & 1 deletion NatEditPlugin/pub/TWiki/NatEditPlugin/styles.css
Expand Up @@ -14,7 +14,7 @@
.natEdit textarea,
.natEditTextArea {
_width:99% !important; /* bloddy IE */
font-family:"Bitstream Vera Sans Mono", "Andale Mono", Courier, monospace;
font-family:"Bitstream Vera Sans Mono", "Andale Mono", monospace;
font-size:12px;
}
ul.natEditButtonBox {
Expand Down Expand Up @@ -72,6 +72,7 @@ ul.natEditHelpTools {
float:right;
}

.foswikiForm,
.twikiForm {
clear:both;
}
Expand All @@ -92,10 +93,13 @@ ul.natEditHelpTools {
}

/* pattern skin tweaks */
.patternPreviewPage .patternTopic,
.patternPreviewPage .foswikiTopic,
.patternEditPage .patternTopic,
.patternEditPage .foswikiTopic {
margin:0px;
}
.patternEditPage .foswikiForm,
.patternEditPage .twikiForm {
margin:0px;
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
75 changes: 0 additions & 75 deletions NatEditPlugin/pub/TWiki/NatEditPlugin/word/styles.css

This file was deleted.

35 changes: 29 additions & 6 deletions NatEditPlugin/templates/edit.natedit.tmpl
Expand Up @@ -3,9 +3,13 @@
%TMPL:INCLUDE{"edittoolbar"}%<!-- edittoolbar// -->
%TMPL:INCLUDE{"edithelp"}%<!-- edithelp// -->

%TMPL:DEF{"titleaction"}%%MAKETEXT{"(edit)"}% %TMPL:END%
%TMPL:DEF{"titleaction"}%(%IF{"defined 'rev'" then="%MAKETEXT{"restore"}%" else="%MAKETEXT{"edit"}%"}%)%TMPL:END%
%TMPL:DEF{"pagetitlestylewrapper"}%<!-- backwards compatibility -->%TMPL:END%
%TMPL:DEF{"contenttitle"}%<h1 class="patternTemplateTitle">%TMPL:P{"pagetitle"}%</h1>%TMPL:END%
%TMPL:DEF{"contenttitle"}%<h1 class="patternTemplateTitle">[[%WEB%.%TOPIC%][%TOPIC%]] (%IF{"defined 'rev'" then="%MAKETEXT{"restore"}%" else="%IF{"istopic '%WEB%.%TOPIC%'" then="%MAKETEXT{"edit"}%" else="%MAKETEXT{"new"}%"}%"}%)</h1>%TMPL:END%

%TMPL:DEF{"gettopictitle"}%%TMPL:P{context="DBCachePluginEnabled" then="gettopictitle_dbcache" else="gettopictitle_default"}%%TMPL:END%
%TMPL:DEF{"gettopictitle_default"}%%IF{"defined 'TOPICTITLE'" then="%TOPICTITLE%" else=""}%%TMPL:END%
%TMPL:DEF{"gettopictitle_dbcache"}%%GETTOPICTITLE{encode="entity" default=""}%%TMPL:END%

%TMPL:DEF{"content"}%<!-- content -->
%TMPL:P{"contenttitle"}%<!-- contenttitle// -->
Expand Down Expand Up @@ -43,7 +47,7 @@
<!-- //formstart -->%TMPL:END%

%TMPL:DEF{"textarea"}%<!-- textarea -->
<textarea id="topic" class="foswikiTextarea natEditTextArea natedit" name="text" style="width:99%" rows="22" cols="70">%TEXT%</textarea>
<textarea id="topic" class="twikiTextarea foswikiTextarea foswikiWysiwygEdit natEditTextArea natedit" name="text" style="width:99%" rows="22" cols="70">%TEXT%</textarea>
<!-- //textarea -->%TMPL:END%


Expand All @@ -70,7 +74,7 @@
<table>
<tr class="natEditTopicTitle">
<th>Title:</th>
<td><input class="twikiInputField" type="text" name="TopicTitle" size="80" value="%URLPARAM{"TopicTitle" default="%GETTOPICTITLE{encode="entity" default=""}%"}%" /></td>
<td><input class="twikiInputField" type="text" name="TopicTitle" size="80" value="%URLPARAM{"TopicTitle" default="%TMPL:P{"gettopictitle"}%"}%" /></td>
</tr>
</table>
</literal></div>
Expand All @@ -94,8 +98,27 @@
<!-- //helptab -->%TMPL:END%

%TMPL:DEF{"settings"}%<!-- settings -->
<b><label for="parent">%MAKETEXT{"Parent topic"}%:</b></label>
<input class="twikiInputField" type="text" id="parent" name="topicparent" size="40" value="%TOPICPARENT%" />
<div class="twikiFormSteps foswikiFormSteps">
<h2>Topic preferences:</h2>
<div class="twikiFormStep foswikiFormStep twikiFormLast">
<h3>%MAKETEXT{"Parent topic"}%:</h3>
<input class="twikiInputField" type="text" name="topicparent" size="40" value="%TOPICPARENT%" />
</div>
</div>
<div class="twikiFormSteps foswikiFormSteps">
<h2>Show on screen:</h2>
<div class="twikiFormStep foswikiFormStep twikiFormLast">
<label><input type="checkbox" class="twikiRadio foswikiRadio" name="Local+DISPLAYFORM" value="%IF{"'%VAR{"DISPLAYFORM"}%'='off'" then="on"}%" %IF{"$'DISPLAYFORM'='on' OR NOT defined 'DISPLAYFORM'" then="checked"}% />%MAKETEXT{"Data form"}%</label>
<input type="hidden" name="Local+DISPLAYFORM" value="%IF{"'%VAR{"DISPLAYFORM"}%'='off'" else="off"}%" />

<label><input type="checkbox" class="twikiRadio foswikiRadio" name="Local+DISPLAYATTACHMENTS" value="%IF{"'%VAR{"DISPLAYATTACHMENTS"}%'='off'" then="on"}%" %IF{"$'DISPLAYATTACHMENTS'='on' OR NOT defined 'DISPLAYATTACHMENTS'" then="checked"}% />%MAKETEXT{"Attachments"}%</label>
<input type="hidden" name="Local+DISPLAYATTACHMENTS" value="%IF{"'%VAR{"DISPLAYATTACHMENTS"}%'='off'" else="off"}%" />

<label><input type="checkbox" class="twikiRadio foswikiRadio" name="Local+DISPLAYCOMMENTS" value="%IF{"'%VAR{"DISPLAYCOMMENTS"}%'='off'" then="on"}%" %IF{"$'DISPLAYCOMMENTS'='on' OR NOT defined 'DISPLAYCOMMENTS'" then="checked"}% />%MAKETEXT{"Comments"}%</label>
<input type="hidden" name="Local+DISPLAYCOMMENTS" value="%IF{"'%VAR{"DISPLAYCOMMENTS"}%'='off'" else="off"}%" />
</div>
</div>

<!-- //settings -->%TMPL:END%

%TMPL:DEF{"revCommentPluginOptions"}%<!--revCommentPluginOptions -->
Expand Down
10 changes: 10 additions & 0 deletions NatEditPlugin/templates/editjavascript.natedit.tmpl
@@ -0,0 +1,10 @@
%TMPL:INCLUDE{"editjavascript"}%<!-- template: editjavascript.natedit.tmpl -->
%TMPL:DEF{"editjavascript"}%<!-- editjavascript -->
<script type="text/javascript">
$(function() {
/* remove the second TopicTitle */
$("[name='TopicTitle']:eq(1)").parents(".twikiFormStep").remove();
});
</script>
<!-- //editjavascript -->%TMPL:END%
%TMPL:DEF{"javascript"}%%TMPL:P{"defaultjavascript"}%%TMPL:P{"editjavascript"}%%TMPL:END%
2 changes: 2 additions & 0 deletions NatEditPlugin/templates/edittext.natedit.tmpl
@@ -0,0 +1,2 @@
%TMPL:INCLUDE{"edittext"}%
%TMPL:DEF{"formfields"}%%TMPL:END%
10 changes: 8 additions & 2 deletions NatEditPlugin/templates/edittoolbar.natedit.tmpl
Expand Up @@ -12,8 +12,14 @@
</ul>
</div>
<!-- //bottomtopicactions -->%TMPL:END%
%TMPL:DEF{"savebutton"}%<li class="natEditSaveButton">%BUTTON{"%MAKETEXT{"Save"}%" title="%MAKETEXT{"Save and exit"}%" icon="tick" id="save" accesskey="s" onclick="submitEditForm('save', 'save')"}%</li>%TMPL:END%
%TMPL:DEF{"checkpointbutton"}%<li class="natEditCheckpointButton">%BUTTON{"%MAKETEXT{"Save and Continue"}%" title="%MAKETEXT{"Save and continue editing"}%" icon="disk" id="checkpoint" accesskey="w" onclick="submitEditForm('save', 'checkpoint')"}%</li>%TMPL:END%
%TMPL:DEF{"savebutton"}%<li class="natEditSaveButton">%IF{"defined 'rev'"
then="$percntBUTTON{\"%MAKETEXT{"Restore"}%\" title=\"%MAKETEXT{"Restore and exit"}%\" icon=\"arrow_undo\" id=\"save\" accesskey=\"r\" onclick=\"submitEditForm('save', 'save')\"}$percnt"
else="$percntBUTTON{\"%MAKETEXT{"Save"}%\" title=\"%MAKETEXT{"Save and exit"}%\" icon=\"tick\" id=\"save\" accesskey=\"s\" onclick=\"submitEditForm('save', 'save')\"}$percnt"
}%</li>%TMPL:END%
%TMPL:DEF{"checkpointbutton"}%<li class="natEditCheckpointButton">%IF{"defined 'rev'"
then="$percntBUTTON{\"%MAKETEXT{"Restore and Continue"}%\" title=\"%MAKETEXT{"Restore and continue editing"}%\" icon=\"disk\" id=\"checkpoint\" accesskey=\"w\" onclick=\"submitEditForm('save', 'checkpoint')\"}$percnt"
else="$percntBUTTON{\"%MAKETEXT{"Save and Continue"}%\" title=\"%MAKETEXT{"Save and continue editing"}%\" icon=\"disk\" id=\"checkpoint\" accesskey=\"w\" onclick=\"submitEditForm('save', 'checkpoint')\"}$percnt"
}%</li>%TMPL:END%
%TMPL:DEF{"previewbutton"}%<li class="natEditPreviewButton">%BUTTON{"%MAKETEXT{"Preview"}%" title="%MAKETEXT{"Preview your changes"}%" icon="eye" id="preview" accesskey="p" onclick="submitEditForm('preview', 'preview')"}%</li>%TMPL:END%
%TMPL:DEF{"cancelbutton"}%<li class="natEditCancelButton">%BUTTON{"%MAKETEXT{"Cancel"}%" title="%MAKETEXT{"Abandon changes and exit"}%" icon="cross" id="cancel" accesskey="c" onclick="submitEditForm('save', 'cancel')"}% </li>%TMPL:END%
%TMPL:DEF{"forcenewrevision"}%<li class="natEditForceNewRevision"><label for="forcenewrevision"><input type="checkbox" title="Creates a new topic revision when saving" id="forcenewrevision" name="forcenewrevision" %FORCENEWREVISIONCHECKBOX% />%MAKETEXT{"Force new revision"}%</label></li>%TMPL:END%
Expand Down
2 changes: 1 addition & 1 deletion NatEditPlugin/templates/form.natedit.tmpl
@@ -1,7 +1,7 @@
<!-- template: form.natedit.tmpl -->
%TMPL:DEF{"titleaction"}%%MAKETEXT{"(edit)"}% %TMPL:END%

%TMPL:DEF{"mandatory"}%<div class='twikiFormLegend' id="twikiFormMandatory"><span class="twikiAlert">*</span> %MAKETEXT{"indicates mandatory fields"}% </div>%TMPL:END%
%TMPL:DEF{"mandatory"}%<div class='twikiFormLegend' id="twikiFormMandatory"><span class="foswikiAlert twikiAlert">*</span> %MAKETEXT{"indicates mandatory fields"}% </div>%TMPL:END%

%TMPL:DEF{"repeatedformrows"}% %REPEAT%
<div class="twikiFormStep">
Expand Down
2 changes: 1 addition & 1 deletion NatEditPlugin/templates/preview.natedit.tmpl
Expand Up @@ -7,7 +7,7 @@
%TMPL:P{"previewtoolbar"}%<!-- previewtoolbar// -->
<div class="patternPreviewArea">
<div class="patternContent">
<div class="foswikiTopic">
<div class="patternTopic foswikiTopic">
%TEXT%
</div>
%META{"form"}%
Expand Down

0 comments on commit eac0346

Please sign in to comment.