Skip to content

Commit

Permalink
Item4666:
Browse files Browse the repository at this point in the history
   * using Ps instead of DIVs for paragraph formats, same as TinyMCE
   * working on internationalization
   * fixed resetting the TopicTitle to the topic name 
   * fixed textarea layout and word wrapping for bloddy IE6
   * fixed clearing of toolbar float
   * using relative urls wherever possible
  


git-svn-id: http://svn.foswiki.org/trunk@4692 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Aug 20, 2009
1 parent 8e6b30f commit 1fdb5b6
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 53 deletions.
36 changes: 17 additions & 19 deletions NatEditPlugin/lib/Foswiki/Plugins/NatEditPlugin.pm
Expand Up @@ -110,6 +110,8 @@ sub handleFORMBUTTON {
} else {
return '';
}
$actionText =~ s/&&/\&/g;
$actionTitle =~ s/&&/\&/g;

my $theFormat = $params->{_DEFAULT} || $params->{format} || '$link';
$theFormat =~ s/\$link/<a href='\$url' accesskey='f' title='\$title'><span>\$acton<\/span><\/a>/g;
Expand All @@ -131,45 +133,42 @@ sub handleFORMBUTTON {
sub beforeSaveHandler {
my ($text, $topic, $web, $meta) = @_;

#writeDebug("called beforeSaveHandler");
writeDebug("called beforeSaveHandler");
# find out if we received a TopicTitle
my $request = Foswiki::Func::getCgiQuery();
my $topicTitle = $request->param('TopicTitle');

unless (defined $topicTitle) {
#writeDebug("didn't get a TopicTitle, nothing do here");
writeDebug("didn't get a TopicTitle, nothing do here");
return;
}

# is it different from the normal topic name? if not then there's no point
# in storing it here again
if ($topicTitle eq $topic) {
#writeDebug("same as topic name");
return;
}

#writeDebug("new TopicTitle: $topicTitle");

# find out if this topic can store the TopicTitle in its metadata
if (defined($meta->get('FIELD', 'TopicTitle'))) {
#writeDebug("can deal with TopicTitles by itself");
writeDebug("can deal with TopicTitles by itself");

# however, check if we've got a TOPICTITLE preference setting
# if so remove it. this happens if we stored a topic title but
# then added a form that now takes the topic title instead
if (defined $meta->get('PREFERENCE', 'TOPICTITLE')) {
#writeDebug("removing redundant TopicTitles in preferences");
writeDebug("removing redundant TopicTitles in preferences");
$meta->remove('PREFERENCE', 'TOPICTITLE');
}
return;
}

#writeDebug("we need to store the TopicTitle in the preferences");
writeDebug("we need to store the TopicTitle in the preferences");

if ($topicTitle eq $topic) {
writeDebug("same as topic name");
$topicTitle = '';
}


# if it is a topic setting, override it.
my $topicTitleHash = $meta->get('PREFERENCE', 'TOPICTITLE');
if (defined $topicTitleHash) {
#writeDebug("found old TopicTitle in preference settings: $topicTitleHash->{value}");
writeDebug("found old TopicTitle in preference settings: $topicTitleHash->{value}");
if ($topicTitle) {
# set the new value
$topicTitleHash->{value} = $topicTitle;
Expand All @@ -180,16 +179,16 @@ sub beforeSaveHandler {
return;
}

#writeDebug("no TopicTitle in preference settings");
writeDebug("no TopicTitle in preference settings");

# if it is a bullet setting, replace it.
if ($text =~ s/((?:^|[\n\r])(?:\t| )+\*\s+(?:Set|Local)\s+TOPICTITLE\s*=\s*)(.*)((?:$|[\r\n]))/$1$topicTitle$3/o) {
#writeDebug("found old TopicTitle defined as a bullet setting: $2");
writeDebug("found old TopicTitle defined as a bullet setting: $2");
$_[0] = $text;
return;
}

#writeDebug("no TopicTitle stored anywhere. creating a new preference setting");
writeDebug("no TopicTitle stored anywhere. creating a new preference setting");

if ($topicTitle) { # but only if we don't set it to the empty string
$meta->putKeyed('PREFERENCE', {
Expand All @@ -199,7 +198,6 @@ sub beforeSaveHandler {
value=>$topicTitle
});
}

}

###############################################################################
Expand Down
7 changes: 2 additions & 5 deletions NatEditPlugin/lib/Foswiki/Plugins/NatEditPlugin/NATEDIT.pm
Expand Up @@ -69,11 +69,8 @@ sub init {

return unless $this->SUPER::init();

Foswiki::Func::addToHEAD("JQUERYPLUGIN::NATEDIT::THEME", <<'HERE', 'JQUERYPLUGIN::NATEDIT');
<style type="text/css" media="all">
@import url("%PUBURLPATH%/%SYSTEMWEB%/NatEditPlugin/styles.css");
@import url("%PUBURLPATH%/%SYSTEMWEB%/NatEditPlugin/%IF{"defined NATEDIT_THEME" then="%NATEDIT_THEME%" else="default"}%/styles.css");
</style>
Foswiki::Func::addToHEAD("JQUERYPLUGIN::NATEDIT::THEME", <<"HERE", 'JQUERYPLUGIN::NATEDIT');
<link rel='stylesheet' href='%PUBURLPATH%/%SYSTEMWEB%/NatEditPlugin/%IF{\"defined NATEDIT_THEME\" then=\"%NATEDIT_THEME%\" else=\"default\"}%/styles.css?version=$this->{version}' type='text/css' media='all' />
HERE

}
Expand Down
Expand Up @@ -22,12 +22,12 @@
});

$("#natEditInsertAttachmentWeb").autocomplete(
foswiki.scriptUrl+"/view/"+foswiki.systemWebName+"/JQueryAjaxHelper?section=web;contenttype=text/plain;skin=text", {
foswiki.scriptUrlPath+"/view/"+foswiki.systemWebName+"/JQueryAjaxHelper?section=web;contenttype=text/plain;skin=text", {
matchCase: true
});

$("#natEditInsertAttachmentTopic").autocomplete(
foswiki.scriptUrl+"/view/"+foswiki.systemWebName+"/JQueryAjaxHelper?section=topic;contenttype=text/plain;skin=text", {
foswiki.scriptUrlPath+"/view/"+foswiki.systemWebName+"/JQueryAjaxHelper?section=topic;contenttype=text/plain;skin=text", {
matchCase: true,
extraParams: {
baseweb: function() {
Expand Down Expand Up @@ -94,7 +94,7 @@
nateditor._prevTopic = topic;
$("#natEditInsertAttachments").empty().append("<span class='jqAjaxLoader'>&nbsp;</span>").css({overflow:'auto'});
$("#natEditInsertAttachments").load(
foswiki.scriptUrl+"/rest/RenderPlugin/template?refresh=dbcache;name=editdialog;expand=insertattachment::loadattachments;baseweb="+web+";basetopic="+topic,
foswiki.scriptUrlPath+"/rest/RenderPlugin/template?refresh=dbcache;name=editdialog;expand=insertattachment::loadattachments;baseweb="+web+";basetopic="+topic,
function() {
//var found = 0;
$("#natEditInsertAttachment label").each(function() {
Expand All @@ -104,7 +104,7 @@
if (opts.fileName.match(/jpe?g|gif|png|bmp/i)) {
var src = opts.url;
if (foswiki.ImagePluginEnabled) {
src = foswiki.scriptUrl+"/rest/ImagePlugin/resize?"+
src = foswiki.scriptUrlPath+"/rest/ImagePlugin/resize?"+
"topic="+opts.web+"."+opts.topic+";"+
"file="+opts.fileName+";"+
"width=70";
Expand Down
Binary file not shown.
Expand Up @@ -6,12 +6,12 @@
$("#natEditInsertLink input[type=text]").not(".selection").val('');

$("#natEditInsertLinkWeb").autocomplete(
foswiki.scriptUrl+"/view/"+foswiki.systemWebName+"/JQueryAjaxHelper?section=web;contenttype=text/plain;skin=text", {
foswiki.scriptUrlPath+"/view/"+foswiki.systemWebName+"/JQueryAjaxHelper?section=web;contenttype=text/plain;skin=text", {
matchCase: true
});

$("#natEditInsertLinkTopic").autocomplete(
foswiki.scriptUrl+"/view/"+foswiki.systemWebName+"/JQueryAjaxHelper?section=topic;contenttype=text/plain;skin=text", {
foswiki.scriptUrlPath+"/view/"+foswiki.systemWebName+"/JQueryAjaxHelper?section=topic;contenttype=text/plain;skin=text", {
matchCase: true,
extraParams: {
baseweb: function() {
Expand Down
Binary file not shown.

0 comments on commit 1fdb5b6

Please sign in to comment.