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
@@ -1,20 +1,54 @@
|
|||||||
<script type="text/javascript" src="${url.context}/scripts/ajax/presence.js"></script>
|
<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="presenceKey">
|
<div class="presenceKeyContainer">
|
||||||
<img src="${url.context}/images/icons/presence_online.gif" width="16" height="16" alt="online" title="User is online">=online<br>
|
<div class="presenceKeyTitle">Presence Status Key:</div>
|
||||||
<img src="${url.context}/images/icons/presence_offline.gif" width="16" height="16" alt="offline" title="User is offline">=offline<br>
|
<div class="presenceKey">
|
||||||
<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>
|
||||||
<div id="presenceContainer">
|
<div id="presenceContainer">
|
||||||
<#list presenceResults as pr>
|
<#list presenceResults as pr>
|
||||||
<div class="presenceUser">
|
<div class="presenceUser">
|
||||||
<div class="presenceStatus" rel="${pr[1]}" title=""></div>
|
<div class="presenceStatus ${pr[0]}" rel="${pr[2]}" title=""></div>
|
||||||
<div class="presenceUsername">${pr[0]}</div>
|
<div class="presenceUsername">${pr[1]}</div>
|
||||||
</div>
|
</div>
|
||||||
</#list>
|
</#list>
|
||||||
</div>
|
</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>
|
<style>
|
||||||
.presenceTitle
|
.presenceTitle
|
||||||
{
|
{
|
||||||
@@ -25,15 +59,30 @@
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.presenceKey
|
.presenceKeyContainer
|
||||||
{
|
{
|
||||||
float: right;
|
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
|
.presenceUser
|
||||||
{
|
{
|
||||||
float: left;
|
float: left;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
|
width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#presenceContainer
|
#presenceContainer
|
||||||
@@ -41,7 +90,7 @@
|
|||||||
clear: left;
|
clear: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.presenceStatus
|
.presenceProvider, .presenceStatus
|
||||||
{
|
{
|
||||||
background-image: url(${url.context}/images/icons/ajax_anim.gif);
|
background-image: url(${url.context}/images/icons/ajax_anim.gif);
|
||||||
height: 16px;
|
height: 16px;
|
||||||
@@ -49,17 +98,30 @@
|
|||||||
float: left;
|
float: left;
|
||||||
margin: 0px 4px;
|
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
|
.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
|
.presenceUsername
|
||||||
@@ -67,4 +129,26 @@
|
|||||||
float: left;
|
float: left;
|
||||||
margin: 4px 0px 0px;
|
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>
|
</style>
|
||||||
|
@@ -1,11 +1,26 @@
|
|||||||
|
var results = new Array();
|
||||||
main();
|
main();
|
||||||
|
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
var nodeRef = args["nodeRef"];
|
var nodeRef = args["nodeRef"];
|
||||||
var space = search.findNode(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 tokens, user, group;
|
||||||
var results = new Array();
|
|
||||||
|
|
||||||
for each(perm in space.permissions)
|
for each(perm in space.permissions)
|
||||||
{
|
{
|
||||||
@@ -33,21 +48,23 @@ function main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
model.space = space;
|
|
||||||
model.presenceResults = results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushUnique(results, user, details)
|
function pushUnique(results, user, details)
|
||||||
{
|
{
|
||||||
|
var provider = String(details).split("|")[0];
|
||||||
|
if (provider == "")
|
||||||
|
{
|
||||||
|
provider = "none";
|
||||||
|
}
|
||||||
var fullName = user.properties["firstName"] + " " + user.properties["lastName"];
|
var fullName = user.properties["firstName"] + " " + user.properties["lastName"];
|
||||||
|
|
||||||
for (i=0; i < results.length; i++)
|
for (i=0; i < results.length; i++)
|
||||||
{
|
{
|
||||||
if (results[i][0] == fullName)
|
if (results[i][1] == fullName)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
results.push(new Array(fullName, details));
|
results.push(new Array(provider, fullName, details));
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 591 B |
BIN
source/web/images/icons/presence_skype_offline.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
source/web/images/icons/presence_skype_online.png
Normal file
After Width: | Height: | Size: 697 B |
BIN
source/web/images/icons/presence_status_none.png
Normal file
After Width: | Height: | Size: 536 B |
BIN
source/web/images/icons/presence_status_unknown.png
Normal file
After Width: | Height: | Size: 552 B |
Before Width: | Height: | Size: 389 B |
BIN
source/web/images/icons/presence_yahoo_offline.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
source/web/images/icons/presence_yahoo_online.png
Normal file
After Width: | Height: | Size: 950 B |
@@ -7,30 +7,46 @@ var Presence =
|
|||||||
{
|
{
|
||||||
window.contextPath = Presence.getContextPath();
|
window.contextPath = Presence.getContextPath();
|
||||||
|
|
||||||
var users = $$("#presenceContainer .presenceStatus");
|
var statuses = $$("#presenceContainer .presenceStatus");
|
||||||
users.each(function(user, i)
|
var users = $$("#presenceContainer .presenceUsername");
|
||||||
|
|
||||||
|
statuses.each(function(status, i)
|
||||||
{
|
{
|
||||||
// ajax call to load online status
|
var user = users[i];
|
||||||
var userDetails = user.attributes["rel"].value.split("|");
|
|
||||||
|
var userDetails = status.attributes["rel"].value.split("|");
|
||||||
var proxyURL = window.contextPath + "/ajax/invoke/PresenceProxyBean.proxyRequest";
|
var proxyURL = window.contextPath + "/ajax/invoke/PresenceProxyBean.proxyRequest";
|
||||||
var statusURL = Presence.getStatusURL(userDetails);
|
var statusURL = Presence.getStatusURL(userDetails);
|
||||||
|
|
||||||
if (statusURL != "")
|
if (statusURL != "")
|
||||||
{
|
{
|
||||||
|
// ajax call to load online status
|
||||||
var myAjax = new Ajax(proxyURL, {
|
var myAjax = new Ajax(proxyURL, {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'},
|
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'},
|
||||||
onComplete: function(textResponse, xmlResponse)
|
onComplete: function(textResponse, xmlResponse)
|
||||||
{
|
{
|
||||||
var statusType = Presence.getStatusType(userDetails[0], textResponse);
|
var statusType = Presence.getStatusType(userDetails[0], textResponse);
|
||||||
|
status.addClass(statusType);
|
||||||
user.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));
|
myAjax.request("url=" + escape(statusURL));
|
||||||
}
|
}
|
||||||
else
|
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)
|
switch(provider)
|
||||||
{
|
{
|
||||||
case "skype":
|
case "skype":
|
||||||
statusType = (response == "Online") ? "online" : "offline";
|
switch (response)
|
||||||
|
{
|
||||||
|
case "Online":
|
||||||
|
statusType = "online";
|
||||||
|
break;
|
||||||
|
case "Offline":
|
||||||
|
statusType = "offline";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
statusType = "unknown";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "yahoo":
|
case "yahoo":
|
||||||
statusType = (response == "01") ? "online" : "offline";
|
statusType = (response == "01") ? "online" : "offline";
|
||||||
|