Skip to content
Permalink
Browse files

Item14288: Merge master

  • Loading branch information...
MichaelDaum committed Dec 4, 2017
2 parents 121f6e3 + 5833e18 commit 6126dec8111cc617fd97d83dd0e3ce3c6c74881f
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1495606515" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1512407627" format="1.1" version="1"}%
---+!! Natural Edit Plugin
%FORMFIELD{"Description"}%

@@ -56,6 +56,9 @@ is sufficient.

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| Copyright ©: | 2007-2017 Michael Daum http://michaeldaumconsulting.com |
| Change History: | |
| 04 Dec 2017 | Foswikitask:Item13835: enable !TopicTitle field when feature available |
| 04 May 2017 | Foswikitask:Item14388: NatEditPlugin does not honor the ScriptSuffix setting, and doesn't accommodate short URLs.<br/>
Foswikitask:Item14404: NatEdit Save and Continue action fails on mod_perl systems. |
| 20 Jan 2017 | Foswikitask:Item14265: NatEdit plugin leaves UI blocked after some save errors<br/>\
@@ -182,4 +185,4 @@ is sufficient.
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/distro"}%
%META:FIELD{name="Support" title="Support" value="https://foswiki.org/Support/%25$ROOTMODULE%25"}%
%META:FIELD{name="Version" title="Version" value="%25$VERSION%25"}%
%META:FILEATTACHMENT{name="screenshot1.png" attr="h" comment="" date="1495606515" size="64487" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="screenshot1.png" attr="h" comment="" date="1512407627" size="64487" user="ProjectContributor" version="1"}%
@@ -30,12 +30,10 @@ BEGIN {
}
}

our $VERSION = '9.9';
our $RELEASE = '04 May 2017';
our $VERSION = '9.91';
our $RELEASE = '04 Dec 2017';
our $NO_PREFS_IN_TOPIC = 1;
our $SHORTDESCRIPTION = 'A Wikiwyg Editor';
our $baseWeb;
our $baseTopic;
our $doneNonce;

use constant TRACE => 0; # toggle me
@@ -50,7 +48,6 @@ sub writeDebug {

###############################################################################
sub initPlugin {
( $baseTopic, $baseWeb ) = @_;

Foswiki::Func::registerTagHandler(
'NATFORMBUTTON',
@@ -100,43 +97,20 @@ sub initPlugin {

###############################################################################
# This function will store the TopicTitle in a preference variable if it isn't
# part of the DataForm of this topic. In a way, we do the reverse of
# WebDB::onReload() where the TopicTitle is extracted and put into the cache.
# part of the DataForm of this topic.
sub beforeSaveHandler {
my ( $text, $topic, $web, $meta ) = @_;

writeDebug("called beforeSaveHandler($web, $topic)");

my $session = $Foswiki::Plugins::SESSION;
my $baseWeb = $session->{webName};
my $baseTopic = $session->{topicName};

if ( $web ne $baseWeb || $topic ne $baseTopic ) {
writeDebug("not operating on the base topic");
return;
}

# find out if we received a TopicTitle
my $request = Foswiki::Func::getCgiQuery();
my $topicTitleField =
Foswiki::Func::getPreferencesValue("TOPICTITLE_FIELD") || "TopicTitle";

my $newTopic = $request->param('newtopic');
$newTopic = Foswiki::Sandbox::untaint( $newTopic,
\&Foswiki::Sandbox::validateTopicName );

my $topicTitle = $request->param('TopicTitle');
my $topicTitle = $request->param($topicTitleField);
$topicTitle = Foswiki::Sandbox::untaintUnchecked($topicTitle);

# the "newtopic" urlparam either holds a new topic name in case of a rename action,
# or a boolean flag indicating that the topic being created is a new topic
if ( defined($newTopic)
&& $newTopic ne ''
&& $newTopic ne '1'
&& $newTopic ne $topic )
{
writeDebug("not saving the topic being rename ... no action");
return;
}

unless ( defined $topicTitle ) {
writeDebug("didn't get a TopicTitle, nothing do here");
return;
@@ -147,12 +121,12 @@ sub beforeSaveHandler {
return;
}

my $fieldTopicTitle = $meta->get( 'FIELD', 'TopicTitle' );
my $fieldTopicTitle = $meta->get( 'FIELD', $topicTitleField );
writeDebug("topic=$web.$topic, topicTitle=$topicTitle");

if ( $topicTitle eq $topic ) {
writeDebug("same as topic name ... nulling");
$request->param( "TopicTitle", "" );
$request->param( $topicTitleField, "" );
$topicTitle = '';
if ( defined $fieldTopicTitle ) {
$fieldTopicTitle->{value} = "";
@@ -14,14 +14,14 @@
%TMPL:DEF{"contenttitle"}%<h1 class="natEditTitle">%IF{
"istopic '%WEB%.%TOPIC%'"
then="[[%WEB%.%TOPIC%][%URLPARAM{"%TMPL:P{"topictitle_field"}%" default="$percntTMPL:P{\\"topictitle\\" hideautoinc=\\"off\\"}$percnt"}%]]"
else="<nop>%URLPARAM{"%TMPL:P{"topictitle_field"}%" default="%TMPL:P{"topictitle" hideautoinc="off"}%"}%"
}% (%TMPL:P{"titleaction"}%)</h1>%TMPL:END%
else="<nop>%URLPARAM{"%TMPL:P{"topictitle_field"}%" default="%TMPL:P{"topictitle" hideautoinc="off"}%"}% <span class='natEditTitleStatus'>(%TMPL:P{"titleaction"}%)</span>"
}%</h1>%TMPL:END%
%TMPL:DEF{"windowtitle"}%<title>(%TMPL:P{"titleaction"}%) <nop>%BASETOPIC%%TMPL:P{"titlesep"}%%BASEWEB%%TMPL:P{"titlesep"}%<nop>%WIKITOOLNAME%</title>%TMPL:END%

%TMPL:DEF{"topictitle_field"}%%TOPICTITLE_FIELD{default="TopicTitle"}%%TMPL:END%
%TMPL:DEF{"topictitle"}%%TMPL:P{context="DBCachePluginEnabled" then="topictitle_dbcache" else="topictitle_default" hideautoinc="%hideautoinc%"}%%TMPL:END%
%TMPL:DEF{"topictitle_default"}%%TOPICTITLE{default="%FORMFIELD{"%TMPL:P{"topictitle_field"}%" alttext="%BASETOPIC%" default="%BASETOPIC%"}%"}%%TMPL:END%
%TMPL:DEF{"topictitle_dbcache"}%%GETTOPICTITLE{"%WEB%.%TOPIC%" encode="entity" hideautoinc="%hideautoinc%"}%%TMPL:END%
%TMPL:DEF{"topictitle_dbcache"}%%GETTOPICTITLE{"%WEB%.%TOPIC%" hideautoinc="%hideautoinc%"}%%TMPL:END%
%TMPL:DEF{"sig_textareabuttons"}%%TMPL:END%

%TMPL:DEF{"natedit::options"}%%NATEDIT_OPTIONS{default=""}%%TMPL:END%
@@ -51,7 +51,7 @@
<input type="hidden" name="editaction" value="%IF{"$'action'='form'" then="form" else=""}%" />
<input type="hidden" name="action_save" value="" />%TMPL:END%

%TMPL:DEF{"textarea"}%<textarea id="topic" rows="25" style="width:100%" class="foswikiTextarea foswikiWysiwygEdit natedit" data-rest-params="?%NONCE%" data-auto-max-expand="true" data-show-fullscreen="true" %TMPL:P{"natedit::options"}% name="text">%TEXT%</textarea>%TMPL:END%
%TMPL:DEF{"textarea"}%<textarea id="topic" rows="25" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" style="width:100%" class="foswikiTextarea foswikiWysiwygEdit natedit" data-rest-params="?%NONCE%" data-auto-max-expand="true" data-show-fullscreen="true" %TMPL:P{"natedit::options"}% name="text">%TEXT%</textarea>%TMPL:END%

%TMPL:DEF{"formend"}%</form></div>%TMPL:END%

@@ -85,7 +85,7 @@
</div>"}%%TMPL:END%

%TMPL:DEF{"firsttab"}%%TAB{"%MAKETEXT{"Text"}%" id="text"}%
%TMPL:P{"topicmeta"}%%TMPL:P{"textarea"}%%ENDTAB%%TMPL:END%
%TMPL:P{context="TopicTitleEnabled" then="topicmeta"}%%TMPL:P{"textarea"}%%ENDTAB%%TMPL:END%

%TMPL:DEF{"helptab"}%%TAB{"%MAKETEXT{"Help"}%"
id="help"
@@ -97,7 +97,6 @@

%TMPL:DEF{"permissionstab"}%%TAB{"%MAKETEXT{"Permissions"}%" id="permissions"}%
<noautolink>
<h2>%MAKETEXT{"Permissions"}%</h2>
<div class="foswikiFormSteps ui-natedit-permissions-form jqUITooltip" data-theme="info" data-arrow="true" data-position="right">
<input type="hidden" name="Set+ALLOWTOPICVIEW" value="undefined" class="permset_view allow_view" />
<input type="hidden" name="Set+DENYTOPICVIEW" value="undefined" class="permset_view deny_view" />

0 comments on commit 6126dec

Please sign in to comment.
You can’t perform that action at this time.