Office add-in tagging: bug fixes and UI clean-up

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7522 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mike Hatfield
2007-12-04 12:13:30 +00:00
parent acb05d7043
commit 468c151488
9 changed files with 158 additions and 150 deletions

View File

@@ -765,12 +765,12 @@ ul.autocompleter-choices li.autocompleter-selected span.autocompleter-queried
padding: 0px 4px;
}
.tagDelete {
.tagListDelete {
color: #ccc;
font-size: 11px;
}
.tagName {
.tagListName {
}
/* Tag cloud */
@@ -786,6 +786,11 @@ ul.autocompleter-choices li.autocompleter-selected span.autocompleter-queried
#tagCloud a {
cursor: pointer;
padding: 1px;
}
#tagCloud a.tagSelected {
background-color: #ffff90;
}
#tagCloud .tagName0 {

View File

@@ -70,38 +70,14 @@ var OfficeDocDetails =
addTag: function(nodeId, tagName)
{
OfficeAddin.postAction(window.serviceContextPath + "/collaboration/tagActions", "add", nodeId, null, "&t=" + tagName);
OfficeAddin.postAction(window.serviceContextPath + "/collaboration/tagActions", "add", nodeId, null, "t=" + tagName);
return false;
},
tagAction: function(action, nodeId, tagName, msg)
removeTag: function(nodeId, tagName)
{
if (msg != "" && !confirm(msg))
{
return;
}
OfficeAddin.showStatusText("Processing...", "ajax_anim.gif", false);
var actionURL = window.serviceContextPath + "/collaboration/tagActions?a=" + action + "&n=" + nodeId + "&t=" + tagName;
var myAjax = new Ajax(actionURL, {
method: 'post',
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'},
onComplete: function(textResponse, xmlResponse)
{
// Optionally add a status string
if (textResponse != "")
{
var objResponse = Json.evaluate(textResponse);
var imgSuccess = (objResponse.statusCode ? "action_successful.gif" : "action_failed.gif");
var colBackground = (objResponse.statusCode ? "#50ff50" : "#ff5050");
OfficeAddin.showStatusText(objResponse.statusString, imgSuccess, true, colBackground);
}
},
onFailure: function()
{
OfficeAddin.showStatusText("Action failed", "action_failed.gif", true);
}
}).request();
OfficeAddin.postAction(window.serviceContextPath + "/collaboration/tagActions", "remove", nodeId , null, "t=" + tagName);
return false;
}
};

View File

@@ -155,22 +155,22 @@ var OfficeNavigation =
submitCreateSpace: function(commandURL, nodeId)
{
var spcName = $('spaceName').value,
spcTitle = $('spaceTitle').value,
spcDescription = $('spaceDescription').value;
var spaceName = $('spaceName').value,
spaceTitle = $('spaceTitle').value,
spaceDescription = $('spaceDescription').value;
var spcTemplate;
var spaceTemplate;
if ($('spaceTemplate'))
{
spcTemplate = $('spaceTemplate').value;
spaceTemplate = $('spaceTemplate').value;
}
OfficeAddin.showStatusText("Creating space...", "ajax_anim.gif", false);
var actionURL = commandURL + "?a=newspace&n=" + nodeId;
actionURL += "&sn=" + encodeURI(spcName);
actionURL += "&st=" + encodeURI(spcTitle);
actionURL += "&sd=" + encodeURI(spcDescription);
actionURL += "&t=" + encodeURI(spcTemplate);
var actionURL = commandURL + "?a=newspace&p=" + nodeId;
actionURL += "&sn=" + encodeURI(spaceName);
actionURL += "&st=" + encodeURI(spaceTitle);
actionURL += "&sd=" + encodeURI(spaceDescription);
actionURL += "&t=" + encodeURI(spaceTemplate);
var myAjax = new Ajax(actionURL, {
method: 'get',
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'},

View File

@@ -123,7 +123,7 @@ var OfficeAddin =
// Remove any trailing hash
var href = window.location.href.replace("#", "")
// Remove any previous "st" parameters
href = OfficeAddin.removeParameters(href, "st");
href = OfficeAddin.removeParameters(href, "st|version");
// Optionally add a status string
if (textResponse != "")
{

View File

@@ -10,6 +10,9 @@ var OfficeTags =
/* Manadatory params for searchResults component */
searchParams: "",
/* Set to preselect a tag after the tag cloud populated */
preselectedTag: "",
init: function()
{
OfficeTags.getTagCloud();
@@ -48,8 +51,12 @@ var OfficeTags =
tagCloud.empty();
tagQuery.tags.each(function(tag, i)
{
tagNameClass = "tagName" + Math.round((tag.count - tagQuery.countMin) / scale);
tagName = new Element("a", {"class": tagNameClass});
tagNameClass = "tagName" + Math.round((tag.count - tagQuery.countMin) / scale);
if (OfficeTags.preselectedTag == tag.name)
{
tagNameClass += " tagSelected";
}
tagName = new Element("a", {"class": tagNameClass, "rel": tag.name});
tagName.appendText(tag.name);
tagName.injectInside(tagCloud);
tagName.addEvent('click', function(e)
@@ -62,8 +69,6 @@ var OfficeTags =
tagCount.appendText("(" + tag.count + ")");
tagCount.injectInside(tagName);
});
// $("tagCloud").innerHTML = Json.toString(tagQuery);
},
/* AJAX call to perform server-side tag search */
@@ -87,6 +92,25 @@ var OfficeTags =
$('taggedHeader').innerHTML = "Tagged with \"" + tagName + "\"";
}
}).request();
var tags = $$("#tagCloud a");
tags.each(function(tag, i)
{
if (tag.rel == tagName)
{
tag.addClass("tagSelected");
}
else
{
tag.removeClass("tagSelected");
}
});
},
preselectTag: function(tagName)
{
OfficeTags.preselectedTag = tagName;
OfficeTags.selectTag(tagName);
}
};