Skip to content

Commit

Permalink
Item13208: Nat Edit should support setting parent.
Browse files Browse the repository at this point in the history
1)  Document the edit script "topicparent" url param handline as
implemented in Foswiki::UI::Edit and Foswiki::UI::Save.

2) Add the topicparent field to the save POST on NatEdit, default it to
urlparam topicparent from the edit script.

3) Remove the natedit javascript 'trick' that changed empty topicparent to
become 'none',  removing parent settings whenever the topicparent was
provided and empty.
  • Loading branch information
gac410 committed Jan 13, 2015
1 parent 6757450 commit 83ae561
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Expand Up @@ -808,10 +808,6 @@ $.NatEditor.prototype.beforeSubmit = function(editAction) {
topicParentField = self.form.find("input[name=topicparent]");
actionValue = 'foobar';

if (topicParentField.val() === "") {
topicParentField.val("none"); // trick in unsetting the topic parent
}

if (editAction === 'addform') {
self.form.find("input[name='submitChangeForm']").val(editAction);
}
Expand Down
1 change: 1 addition & 0 deletions NatEditPlugin/templates/edit.natedit.tmpl
Expand Up @@ -56,6 +56,7 @@
<input type="hidden" name="submitChangeForm" value="" />
<input type="hidden" name="formtemplate" value="%FORMTEMPLATE%" />
<input type="hidden" name="templatetopic" value="%TEMPLATETOPIC%" />
<input type="hidden" name="topicparent" value="%URLPARAM{"topicparent"}%" />
<input type="hidden" name="template" value="%URLPARAM{"template"}%" />%TMPL:END%

%TMPL:DEF{"textarea"}%<textarea id="topic" class="foswikiTextarea foswikiWysiwygEdit natedit" data-rest-params="?%NONCE%" data-auto-max-expand="true" data-min-height="230" data-min-height="300" %TMPL:P{"natedit::options"}% name="text">%TEXT%</textarea>%TMPL:END%
Expand Down
6 changes: 3 additions & 3 deletions core/data/System/CommandAndCGIScripts.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1420733674" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1421115862" format="1.1" version="1"}%
%META:TOPICPARENT{name="DeveloperDocumentationCategory"}%
%STARTINCLUDE%
---+ CGI and Command Line Scripts
Expand Down Expand Up @@ -132,7 +132,7 @@ A major role of the =edit= script is new topic creation. Parameters that are mai
| =template= | Allows you to specify a different skin template. Overrides any setting of =[[SkinTemplates#TemplatePreferences][EDIT_TEMPLATE]]=. | |
| =templatetopic= | %ICON{"wip"}% The name of the template topic, copied to get the initial content for a new topic. (see [[#NewTopicCreation][New topic creation]] below) | |
| =text= | %ICON{"wip"}% Set the text to be edited. If this parameter is not given, the text is taken from the existing topic (if it exists) | |
| =topicparent= | Sets the parent topic. | |
| =topicparent= | Sets the parent topic. Set to =none= to remove parent. Set to topic name to change parent, leave empty to keep existing parent. | _keep existing parent_ |
| _&lt;any name&gt;_ | This can be used in two ways; first, if the topic has a form with a field called _&lt;any name&gt;_, it will set the value of that field. %ICON{"wip"}% Second, it can be expanded in the topic text during topic creation - see [[#NewTopicCreation][New topic creation]] below | |

The following options are *only* available to the site Administrator. They can "rewrite history" and should be used with caution only when absolutely necessary.
Expand Down Expand Up @@ -503,7 +503,7 @@ The =save= script performs a range of save-related functions.
| =template= | The template to use to re-edit the topic when action is =checkpoint= | |
| =templatetopic= | Name of a topic to use as a template for the text and form (new topic _only_) (see [[#NewTopicCreation][New topic creation]] above) | |
| =text= | New text of the topic | |
| =topicparent= | If 'none' remove any current topic parent. If the name of a topic, set the topic parent to this. | |
| =topicparent= | Sets the parent topic. Set to =none= to remove parent. Set to topic name to change parent, leave empty to keep existing parent. | _keep existing parent_ |
| =Local+name= | create/set a local META:PREFERENCE called =name= | |
| =Set+name= | create/set a normal topic META:PREFERENCE called =name= | |
| =Unset+name= | remove a META:PREFERENCE call =name= | |
Expand Down

0 comments on commit 83ae561

Please sign in to comment.