Skip to content

Commit

Permalink
Item71: fixed form data being lost when hitting save in preview
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@776 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Nov 18, 2008
1 parent 9c69839 commit 3e74a66
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 27 deletions.
8 changes: 5 additions & 3 deletions NatEditPlugin/data/TWiki/NatEditPlugin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ Sponsored by [[http://www.trivadis.com][Trivadis AG]] & [[http://twiki.net][TWIK
| Author: | Michael Daum |
| Copyright ©: | 2007-2008 Michael Daum http://michaeldaumconsulting.com |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Version: | v3.10 |
| Version: | v3.20 |
| Change History: | |
| 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 |
| 12 Nov 2008 | fixing calculation of bottom bar, using new automaxexpand feature of tabpane widget |
| 11 Nov 2008 | usability improvements on topic forms |
Expand Down Expand Up @@ -125,8 +127,8 @@ Sponsored by [[http://www.trivadis.com][Trivadis AG]] & [[http://twiki.net][TWIK
| 31 Mar 2007 | Initial version |
| Dependencies: | %$DEPENDENCIES% |
| Perl Version: | - |
| Plugin Home: | http://nextwiki.org/Extensions/%TOPIC% |
| Feedback: | http://nextwiki.org/Extensions/%TOPIC%Dev |
| 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"}%
2 changes: 1 addition & 1 deletion NatEditPlugin/lib/TWiki/Plugins/NatEditPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use vars qw(
);

$VERSION = '$Rev$';
$RELEASE = 'v3.10';
$RELEASE = 'v3.20';

$NO_PREFS_IN_TOPIC = 1;
$SHORTDESCRIPTION = 'A Wikiwyg Editor';
Expand Down
38 changes: 29 additions & 9 deletions NatEditPlugin/pub/TWiki/NatEditPlugin/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,35 @@ function submitEditForm(script, action) {
if (typeof(beforeSubmitHandler) != 'undefined') {
beforeSubmitHandler(script, action);
}
var editForm = $("#EditForm");
if (action == 'add form') {
document.EditForm.elements['submitChangeForm'].value = action;
editForm.find("input[name='submitChangeForm']").val(action);
}
document.EditForm.elements['action_preview'].value = '';
document.EditForm.elements['action_save'].value = '';
document.EditForm.elements['action_checkpoint'].value = '';
document.EditForm.elements['action_addform'].value = '';
document.EditForm.elements['action_replaceform'].value = '';
document.EditForm.elements['action_cancel'].value = '';
document.EditForm.elements['action_' + action].value = 'foobar';
document.EditForm.submit();
editForm.find("input[name='action_preview']").val('');
editForm.find("input[name='action_save']").val('');
editForm.find("input[name='action_checkpoint']").val('');
editForm.find("input[name='action_addform']").val('');
editForm.find("input[name='action_replaceform']").val('');
editForm.find("input[name='action_cancel']").val('');
editForm.find("input[name='action_"+action+"']").val('foobar');
editForm.submit();
}

$(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);
});
4 changes: 2 additions & 2 deletions NatEditPlugin/templates/edit.natedit.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

%TMPL:DEF{"formstart"}%<!-- formstart -->
<div class="natEdit">
<form name="EditForm" action="%SCRIPTURLPATH{"save"}%/%WEB%/%TOPIC%" method="post">
<form id="EditForm" name="EditForm" action="%SCRIPTURLPATH{"save"}%/%WEB%/%TOPIC%" method="post">
<input type="hidden" name="action_addform" value="" />
<input type="hidden" name="action_cancel" value="" />
<input type="hidden" name="action_checkpoint" value="" />
Expand All @@ -43,7 +43,7 @@
<!-- //formstart -->%TMPL:END%

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


Expand Down
13 changes: 7 additions & 6 deletions NatEditPlugin/templates/preview.natedit.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
%TMPL:INCLUDE{"preview"}%<!-- template: prewview.natedit.tmpl -->
%TMPL:INCLUDE{"previewtoolbar"}%<!-- previewtoolbar// -->
%TMPL:INCLUDE{"editjavascript"}%<!-- editjavascript// -->
%TMPL:DEF{"content"}%<!-- content -->
%TMPL:DEF{"content"}%%TMPL:P{context="NatSkinPluginEnabled" then="content_natskin" else="content_default"}%%TMPL:END%
%TMPL:DEF{"content_default"}%<!-- content_default -->
%TMPL:P{"formstart"}%<!-- formstart// -->
%TMPL:P{"previewtoolbar"}%<!-- previewtoolbar// -->
<div class="patternPreviewArea">
Expand All @@ -12,12 +13,12 @@
%META{"form"}%
</div>
</div>
<input type="hidden" name="action_preview" value="" />
<input type="hidden" name="action_save" value="" />
<input type="hidden" name="action_checkpoint" value="" />
<input type="hidden" name="action_addform" value="" />
<input type="hidden" name="action_replaceform" value="" />
<input type="hidden" name="action_cancel" value="" />
<input type="hidden" name="action_checkpoint" value="" />
<input type="hidden" name="action_preview" value="" />
<input type="hidden" name="action_replaceform" value="" />
<input type="hidden" name="action_save" value="" />
%TMPL:P{"formend"}%<!-- formend// -->
%TMPL:P{"nojavascript_pagehelp"}%<!-- nojavascript_pagehelp// -->
<!-- //content -->%TMPL:END%
<!-- //content_default -->%TMPL:END%
12 changes: 6 additions & 6 deletions NatEditPlugin/templates/previewtoolbar.natedit.tmpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
%TMPL:DEF{"previewtoolbar"}%<!-- previewtoolbar.natedit.tmpl -->
<div class="natEditBottomBar" style="position:static;margin-bottom:25px;">
<ul>
%TMPL:P{"savebutton"}%<!-- -->
%TMPL:P{"checkpointbutton"}%
%TMPL:P{"editbutton"}%<!-- -->
%TMPL:P{"cancelbutton"}%<!-- -->
%TMPL:P{"forcenewrevision"}%<!-- -->
%TMPL:P{"savebutton"}%<!-- savebutton// -->
%TMPL:P{"checkpointbutton"}%<!-- checkpointbutton// -->
%TMPL:P{"editbutton"}%<!-- editbutton// -->
%TMPL:P{"cancelbutton"}%<!-- cancelbutton// -->
%TMPL:P{"forcenewrevision"}%<!-- forcenewrevision// -->
</ul>
</div>%TMPL:END%
%TMPL:DEF{"editbutton"}%<li class="natEditEditButton"><a accesskey="e" href="javascript:history.back()" title="%MAKETEXT{"Continue editing"}%"><span>%MAKETEXT{"Edit"}%</span></a></li>%TMPL:END%
%TMPL:DEF{"editbutton"}%<li class="natEditEditButton">%BUTTON{"%MAKETEXT{"Edit"}%" accesskey="e" icon="pencil" onclick="history.back()" title="%MAKETEXT{"Continue editing"}%"}%</li>%TMPL:END%

0 comments on commit 3e74a66

Please sign in to comment.