Skip to content

Commit

Permalink
Item1918: moved merge and rename into the TagDetailsDialog
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/TagsPlugin@7449 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OliverKrueger authored and OliverKrueger committed May 18, 2010
1 parent 771163c commit 5b3c1ba
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 39 deletions.
29 changes: 25 additions & 4 deletions 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"}%
<!--
* Set TAGNAME = %URLPARAM{"tag" default="undef" encode="safe"}%
Expand All @@ -13,6 +13,7 @@

<div style="text-align:left;">
<noautolink>

<div class="tagsplugin_tagdetails_table">
%TAGSEARCH{
query="user"
Expand All @@ -28,8 +29,28 @@

<img src="%PUBURL%/%SYSTEMWEB%/DocumentGraphics/processing.gif" id="tagsplugin_tagdetails_processing" style="display:none;" />

%IF{ "'%ISTAGADMIN%'='1'" then="$percntSITETREE$percnt <a href='%SCRIPTURL{view}%/%SYSTEMWEB%.TagsPluginTagMerge?tag=%TAGNAMEURL%&redirectto=%TAGWEB%.%TAGTOPIC%'>Merge</a> this tag with another tag" }% %BR%
%IF{ "'%ISTAGADMIN%'='1'" then="$percntPENCIL$percnt <a href='%SCRIPTURL{view}%/%SYSTEMWEB%.TagsPluginTagRename?tag=%TAGNAMEURL%&redirectto=%TAGWEB%.%TAGTOPIC%'>Rename</a> this tag" }%
<div id="tagsplugin_tagdetails_rename" class="%IF{ "'%ISTAGADMIN%'='1'" then="tagsplugin_show" else="tagsplugin_hide"}%">
<form name="foswikiTagsPluginRename" id="foswikiTagsPluginRename" action="%SCRIPTURL{rest}%/TagsPlugin/rename" method="post">
<input type="hidden" name="redirectto" value="%TAGWEB%.%TAGTOPIC%" />
<input type="hidden" name="oldtag" value="%TAGNAME%" />
%MAKETEXT{"New name for this tag:"}% <input type="text" name="newtag" size="20" value="%TAGNAME%" /> <input type="submit" id="foswikiTagsPluginRename_submit" value="%MAKETEXT{"Rename"}%" class="foswikiSubmit" />
</form>
</div>

<div id="tagsplugin_tagdetails_merge" class="%IF{ "'%ISTAGADMIN%'='1'" then="tagsplugin_show" else="tagsplugin_hide"}%">
<form name="foswikiTagsPluginMerge" id="foswikiTagsPluginMerge" action="%SCRIPTURL{rest}%/TagsPlugin/merge" method="post">
<input type="hidden" name="redirectto" value="%TAGWEB%.%TAGTOPIC%" />
<input type="hidden" name="tag2" value="%TAGNAME%" />
%MAKETEXT{"Merge this tag into:"}% <select name="tag1">
%TAGSEARCH{
query="tag"
format=" <option value='$percntENCODE{\"$tag\" type=\"safe\"}$percnt'>$tag</option>"
sep="$n"
}%
</select>
<input type="submit" value="%MAKETEXT{"Merge"}%" id="foswikiTagsPluginMerge_submit" class="foswikiSubmit" />
</form>
</div>

%TAGCLOUD{
terms="$percntTAGSEARCH{ query=\"topic\" tag=\"$percntTAGNAME$percnt\" format=\"$item:1:$web:$topic:$user\" visibility=\"user\" }$percnt"
Expand All @@ -45,4 +66,4 @@
</noautolink>
</div>

<script type="text/javascript" src="%PUBURL%/%SYSTEMWEB%/TagsPlugin/tagsplugin-tagdetails.js"></script>
<script type="text/javascript" src="%PUBURL%/%SYSTEMWEB%/TagsPlugin/tagsplugin-tagdetails.js"></script>
20 changes: 0 additions & 20 deletions data/System/TagsPluginTagMerge.txt

This file was deleted.

14 changes: 0 additions & 14 deletions data/System/TagsPluginTagRename.txt

This file was deleted.

48 changes: 47 additions & 1 deletion pub/System/TagsPlugin/tagsplugin-base.js
Expand Up @@ -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,
Expand Down Expand Up @@ -189,7 +235,7 @@
$("<div id='tagsplugin_dialog_details' class='tagsplugin_update_observer' />")
.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',
Expand Down
43 changes: 43 additions & 0 deletions pub/System/TagsPlugin/tagsplugin-tagdetails.js
Expand Up @@ -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);

0 comments on commit 5b3c1ba

Please sign in to comment.