From 5b3c1baca145d7c617af941b1f7a4948e8096eb7 Mon Sep 17 00:00:00 2001 From: OliverKrueger Date: Tue, 18 May 2010 01:48:25 +0000 Subject: [PATCH] Item1918: moved merge and rename into the TagDetailsDialog git-svn-id: http://svn.foswiki.org/trunk/TagsPlugin@7449 0b4bb1d4-4e5a-0410-9cc4-b2b747904278 --- data/System/TagsPluginTagDetailsDialog.txt | 29 +++++++++-- data/System/TagsPluginTagMerge.txt | 20 -------- data/System/TagsPluginTagRename.txt | 14 ------ pub/System/TagsPlugin/tagsplugin-base.js | 48 ++++++++++++++++++- .../TagsPlugin/tagsplugin-tagdetails.js | 43 +++++++++++++++++ 5 files changed, 115 insertions(+), 39 deletions(-) delete mode 100644 data/System/TagsPluginTagMerge.txt delete mode 100644 data/System/TagsPluginTagRename.txt diff --git a/data/System/TagsPluginTagDetailsDialog.txt b/data/System/TagsPluginTagDetailsDialog.txt index 33b2d56..6359f39 100644 --- a/data/System/TagsPluginTagDetailsDialog.txt +++ b/data/System/TagsPluginTagDetailsDialog.txt @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="BaseUserMapping_333" date="1263789345" format="1.1" reprev="1.54" version="1.54"}% +%META:TOPICINFO{author="OliverKrueger" date="1274088203" format="1.1" version="1.13"}% %META:TOPICPARENT{name="TagsPlugin"}% -
- - - Merge %ICON{"tag"}% %TAGNAME% into the resulting tag - -
- -%META:PREFERENCE{name="VIEW_TEMPLATE" title="VIEW_TEMPLATE" type="Local" value="System.TagsPluginNoHeaderViewTemplate"}% diff --git a/data/System/TagsPluginTagRename.txt b/data/System/TagsPluginTagRename.txt deleted file mode 100644 index 1472b3a..0000000 --- a/data/System/TagsPluginTagRename.txt +++ /dev/null @@ -1,14 +0,0 @@ -%META:TOPICINFO{author="BaseUserMapping_333" date="1263789574" format="1.1" reprev="1.11" version="1.11"}% -%META:TOPICPARENT{name="TagsPlugin"}% - -
- - - Rename %ICON{"tag"}% %TAGNAME% to .
- -
- -%META:PREFERENCE{name="VIEW_TEMPLATE" title="VIEW_TEMPLATE" type="Local" value="System.TagsPluginNoHeaderViewTemplate"}% diff --git a/pub/System/TagsPlugin/tagsplugin-base.js b/pub/System/TagsPlugin/tagsplugin-base.js index 8e5b4ee..79cd0e8 100644 --- a/pub/System/TagsPlugin/tagsplugin-base.js +++ b/pub/System/TagsPlugin/tagsplugin-base.js @@ -125,6 +125,52 @@ ); }; + jQuery.tagsplugin.rename = function(oldtag,newtag,options) { + var settings = $.extend({ + oldtag: oldtag, + newtag: newtag, + redirectto: "", + completed: function(){} + },options||{}); + + $.ajax( + { url: foswiki.scriptUrl+'/rest/TagsPlugin/rename', + type: "POST", + data: { oldtag : settings.oldtag, + newtag : settings.newtag, + redirectto : settings.redirectto + }, + complete: function(xhr, statusText) { + settings.completed(); + $(".tagsplugin_update_observer").trigger("tagsplugin_update"); + } + } + ); + }; + + jQuery.tagsplugin.merge = function(tag1,tag2,options) { + var settings = $.extend({ + tag1: tag1, + tag2: tag2, + redirectto: "", + completed: function(){} + },options||{}); + + $.ajax( + { url: foswiki.scriptUrl+'/rest/TagsPlugin/merge', + type: "POST", + data: { tag1 : settings.tag1, + tag2 : settings.tag2, + redirectto : settings.redirectto + }, + complete: function(xhr, statusText) { + settings.completed(); + $(".tagsplugin_update_observer").trigger("tagsplugin_update"); + } + } + ); + }; + jQuery.tagsplugin.changeOwner = function(tag,public,options) { var settings = $.extend({ tag: tag, @@ -189,7 +235,7 @@ $("
") .dialog( { autoOpen: false } ) .dialog('option', 'modal', true) - .dialog('option', 'width', 460) + .dialog('option', 'width', 600) .dialog('option', 'title', foswiki.tagsplugin.translation.TagDetailsOn+' '+tag+' @ '+topic) .bind( 'dialogclose', diff --git a/pub/System/TagsPlugin/tagsplugin-tagdetails.js b/pub/System/TagsPlugin/tagsplugin-tagdetails.js index c5035eb..911f810 100644 --- a/pub/System/TagsPlugin/tagsplugin-tagdetails.js +++ b/pub/System/TagsPlugin/tagsplugin-tagdetails.js @@ -67,5 +67,48 @@ ); } ); + + $("#foswikiTagsPluginRename_submit") + .bind( + "click", + function(event) { + event.preventDefault(); + + $("#tagsplugin_tagdetails_processing").show(); + + var oldtag = $("#foswikiTagsPluginRename>input[name=oldtag]").val(); + var newtag = $("#foswikiTagsPluginRename>input[name=newtag]").val(); + var redirectto = $("#foswikiTagsPluginRename>input[name=redirectto]").val(); + + jQuery.tagsplugin.rename(oldtag, newtag, { redirectto : redirectto, + completed : function() { + $("#tagsplugin_dialog_details").dialog("close"); + } + } + ); + } + ); + + $("#foswikiTagsPluginMerge_submit") + .bind( + "click", + function(event) { + event.preventDefault(); + + $("#tagsplugin_tagdetails_processing").show(); + + var tag2 = $("#foswikiTagsPluginMerge>input[name=tag2]").val(); + var tag1 = $("#foswikiTagsPluginMerge>select[name=tag1]").val(); + var redirectto = $("#foswikiTagsPluginMerge>input[name=redirectto]").val(); + + jQuery.tagsplugin.merge(tag1, tag2, { redirectto : redirectto, + completed : function() { + $("#tagsplugin_dialog_details").dialog("close"); + } + } + ); + } + ); + }); })(jQuery);