Updates to Presence client-side components

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7294 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mike Hatfield
2007-11-05 15:19:34 +00:00
parent d1e3736bb6
commit eb36fef57a
12 changed files with 153 additions and 26 deletions

View File

@@ -1,20 +1,54 @@
<script type="text/javascript" src="${url.context}/scripts/ajax/presence.js"></script>
<div class="presenceTitle">Invited Users Presence Status</div>
<div class="presenceTitle">Colleague Status</div>
<div class="presenceKeyContainer">
<div class="presenceKeyTitle">Presence Status Key:</div>
<div class="presenceKey">
<img src="${url.context}/images/icons/presence_online.gif" width="16" height="16" alt="online" title="User is online">=online<br>
<img src="${url.context}/images/icons/presence_offline.gif" width="16" height="16" alt="offline" title="User is offline">=offline<br>
<img src="${url.context}/images/icons/presence_unknown.gif" width="16" height="16" alt="unknown" title="User status is unknown">=unknown
<img src="${url.context}/images/icons/presence_skype_online.png" width="16" height="16" alt="online" title="Skype online">=Skype online<br>
<img src="${url.context}/images/icons/presence_yahoo_online.png" width="16" height="16" alt="online" title="Yahoo online">=Yahoo online<br>
<img src="${url.context}/images/icons/presence_status_none.png" width="16" height="16" alt="offline" title="Not configured">=not configured
</div>
<div class="presenceKey">
<img src="${url.context}/images/icons/presence_skype_offline.png" width="16" height="16" alt="online" title="Skype offline">=offline<br>
<img src="${url.context}/images/icons/presence_yahoo_offline.png" width="16" height="16" alt="offline" title="Yahoo offline">=offline<br>
<img src="${url.context}/images/icons/presence_status_unknown.png" width="16" height="16" alt="online" title="Status possibly blocked due to privacy settings">=unknown
</div>
</div>
<div id="presenceContainer">
<#list presenceResults as pr>
<div class="presenceUser">
<div class="presenceStatus" rel="${pr[1]}" title=""></div>
<div class="presenceUsername">${pr[0]}</div>
<div class="presenceStatus ${pr[0]}" rel="${pr[2]}" title=""></div>
<div class="presenceUsername">${pr[1]}</div>
</div>
</#list>
</div>
<div id="recentDocsContainer">
<div class="presenceTitle">Documents created or modified in the last week</div>
<div id="recentDocsTable">
<table cellspacing="0" cellpadding="3" border="0">
<tr>
<td></td>
<td><b>Name</b></td>
<td><b>Created Date</b></td>
<td><b>Modified Date</b></td>
</tr>
<#assign rowNum=0>
<#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"] as child>
<#if (dateCompare(child.properties["cm:modified"], date, 1000*60*60*24*7) == 1) || (dateCompare(child.properties["cm:created"], date, 1000*60*60*24*7) == 1)>
<#assign rowNum = rowNum + 1>
<tr class="recentDoc ${(rowNum % 2 = 0)?string("even", "odd")}">
<td><a href="${url.context}${child.url}" target="new"><img src="${url.context}${child.icon16}" border=0></a></td>
<td><a href="${url.context}${child.url}" target="new">${child.properties.name}</a></td>
<td>${child.properties["cm:created"]?datetime}</td>
<td>${child.properties["cm:modified"]?datetime}</td>
</tr>
</#if>
</#list>
</table>
</div>
</div>
<style>
.presenceTitle
{
@@ -25,15 +59,30 @@
float: left;
}
.presenceKey
.presenceKeyContainer
{
float: right;
border: 1px dashed grey;
padding: 4px;
}
.presenceKeyTitle
{
padding: 0px 0px 4px 0px;
font-weight: bold;
}
.presenceKey
{
float: left;
margin: 0px 2px 0px 4px;
}
.presenceUser
{
float: left;
padding: 2px;
width: 150px;
}
#presenceContainer
@@ -41,7 +90,7 @@
clear: left;
}
.presenceStatus
.presenceProvider, .presenceStatus
{
background-image: url(${url.context}/images/icons/ajax_anim.gif);
height: 16px;
@@ -49,17 +98,30 @@
float: left;
margin: 0px 4px;
}
.presenceStatus.online
.presenceStatus.skype.online
{
background-image: url(${url.context}/images/icons/presence_online.gif) !important;
background-image: url(${url.context}/images/icons/presence_skype_online.png) !important;
}
.presenceStatus.offline
.presenceStatus.skype.offline
{
background-image: url(${url.context}/images/icons/presence_offline.gif) !important;
background-image: url(${url.context}/images/icons/presence_skype_offline.png) !important;
}
.presenceStatus.yahoo.online
{
background-image: url(${url.context}/images/icons/presence_yahoo_online.png) !important;
}
.presenceStatus.yahoo.offline
{
background-image: url(${url.context}/images/icons/presence_yahoo_offline.png) !important;
}
.presenceStatus.unknown
{
background-image: url(${url.context}/images/icons/presence_unknown.gif) !important;
background-image: url(${url.context}/images/icons/presence_status_unknown.png) !important;
}
.presenceStatus.null.unknown
{
background-image: url(${url.context}/images/icons/presence_status_none.png) !important;
}
.presenceUsername
@@ -67,4 +129,26 @@
float: left;
margin: 4px 0px 0px;
}
#recentDocsContainer
{
float: left;
clear: both;
margin-top: 8px;
}
#recentDocsTable
{
float: left;
clear: both;
}
.recentDoc.even
{
background-color: #ffffff;
}
.recentDoc.odd
{
background-color: #eeeeee;
}
</style>

View File

@@ -1,11 +1,26 @@
var results = new Array();
main();
function main()
{
var nodeRef = args["nodeRef"];
var space = search.findNode(nodeRef);
model.space = space;
parsePermissions(space);
while ((space.inheritsPermissions) && (space.parent != null))
{
space = space.parent;
parsePermissions(space);
}
model.presenceResults = results;
}
function parsePermissions(space)
{
var tokens, user, group;
var results = new Array();
for each(perm in space.permissions)
{
@@ -33,21 +48,23 @@ function main()
}
}
}
model.space = space;
model.presenceResults = results;
}
function pushUnique(results, user, details)
{
var provider = String(details).split("|")[0];
if (provider == "")
{
provider = "none";
}
var fullName = user.properties["firstName"] + " " + user.properties["lastName"];
for (i=0; i < results.length; i++)
{
if (results[i][0] == fullName)
if (results[i][1] == fullName)
{
return;
}
}
results.push(new Array(fullName, details));
results.push(new Array(provider, fullName, details));
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 950 B

View File

@@ -7,30 +7,46 @@ var Presence =
{
window.contextPath = Presence.getContextPath();
var users = $$("#presenceContainer .presenceStatus");
users.each(function(user, i)
var statuses = $$("#presenceContainer .presenceStatus");
var users = $$("#presenceContainer .presenceUsername");
statuses.each(function(status, i)
{
// ajax call to load online status
var userDetails = user.attributes["rel"].value.split("|");
var user = users[i];
var userDetails = status.attributes["rel"].value.split("|");
var proxyURL = window.contextPath + "/ajax/invoke/PresenceProxyBean.proxyRequest";
var statusURL = Presence.getStatusURL(userDetails);
if (statusURL != "")
{
// ajax call to load online status
var myAjax = new Ajax(proxyURL, {
method: 'get',
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'},
onComplete: function(textResponse, xmlResponse)
{
var statusType = Presence.getStatusType(userDetails[0], textResponse);
status.addClass(statusType);
user.addClass(statusType);
if (statusType == "unknown")
{
status.title = "User's status is unknown, possibly due to client privacy settings";
}
else
{
status.title = "User's status is " + statusType;
}
user.title = status.title;
}
});
myAjax.request("url=" + escape(statusURL));
}
else
{
user.addClass("unknown");
status.addClass("unknown");
status.title = "User's presence provider has not been configured by Alfresco admin";
user.title = status.title;
}
});
},
@@ -79,7 +95,17 @@ var Presence =
switch(provider)
{
case "skype":
statusType = (response == "Online") ? "online" : "offline";
switch (response)
{
case "Online":
statusType = "online";
break;
case "Offline":
statusType = "offline";
break;
default:
statusType = "unknown";
}
break;
case "yahoo":
statusType = (response == "01") ? "online" : "offline";