added code to poll for new user's notifications

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/liferay62-plugins/social-dockbar-hook@126673 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-04-01 16:11:14 +00:00
parent c9ac1a8faa
commit d41a092064
1 changed files with 99 additions and 65 deletions

View File

@ -3,12 +3,31 @@
//themeDisplay.getUser().getScreenName();
String currentVirtualHost = request.getServerName();
String groupName = currentVirtualHost.split("\\.")[0];
String mySiteURL = "/"+groupName;
String mySiteURL = "/" + groupName;
%>
<script>
jQuery(document).ready(function() {
//check for notifications on load after 3 seconds
var username = "<%=themeDisplay.getUser().getScreenName()%>";
$.get('/notificationchecker/notificationchecker', {
userid : username
}, function(responseText) {
});
//then repeat every 1.5 minutes
setInterval(function() {
var username = "<%=themeDisplay.getUser().getScreenName()%>";
$.get('/notificationchecker/notificationchecker', {
userid : username
}, function(responseText) {
});
}, 90000);
//search box keyboard handlers
$('#searchbox').bind("enterKey",function(e){
if ($('#searchbox').val() != "") {
@ -115,80 +134,95 @@
var base64hashtag = btoa($('#searchbox-phone').val());
var base64attr = btoa("elasticSearchIdentificationParameter");
if (window.location.href.indexOf("<%=mySiteURL%>") >= 0) {
window.location.href = "/group<%=mySiteURL%>?"+base64attr+"="+ base64hashtag;
}
else {
//this is when you are in a VRE and you want to search in that VRE, count the slashes to get where to point
//you always want to point to /group/vrename
var newhref = window.location.href;
if (window.location.href.indexOf("?") >= 0) {
newhref = window.location.href.split("?")[0];
}
var count = newhref.split("/").length-1;
if (count > 4)
window.location.href = newhref + "/../?"+base64attr+"="+ base64hashtag;
else
window.location.href = newhref + "?"+base64attr+"="+ base64hashtag;
}
}
}
});
});
window.location.href = "/group<%=mySiteURL%>?"
+ base64attr
+ "="
+ base64hashtag;
} else {
//this is when you are in a VRE and you want to search in that VRE, count the slashes to get where to point
//you always want to point to /group/vrename
var newhref = window.location.href;
if (window.location.href
.indexOf("?") >= 0) {
newhref = window.location.href
.split("?")[0];
}
var count = newhref
.split("/").length - 1;
if (count > 4)
window.location.href = newhref
+ "/../?"
+ base64attr
+ "="
+ base64hashtag;
else
window.location.href = newhref
+ "?"
+ base64attr
+ "="
+ base64hashtag;
}
}
}
});
});
</script>
<!-- When desktop -->
<div class="collapse nav-collapse">
<ul class="nav nav-add-controls">
<li class="dockbar-item"><a class=""
href="<%="/group/" + groupName%>" id="homeIcon" title= "<%=groupName%> Infrastructure Gateway Home">
<i class="icon-home" style="font-size: 24px;"></i>
</a></li>
<li class="dockbar-item"><a class=""
href="<%="/group/" + groupName + "/workspace"%>" id="wsIcon"
alt='Workspace' title='Virtual Workspace'> <i
class="icon-folder-open" style="font-size: 24px;"></i>
</a></li>
<li class="dockbar-item"><a class=""
href="<%="/group/" + groupName + "/messages"%>" id="messagesIcon"
alt='See Messages' title='Messages'> <i class="icon-envelope"
style="font-size: 24px;"></i>
</a></li>
</ul>
<ul class="nav nav-add-controls">
<li class="dockbar-item"><a class=""
href="<%="/group/" + groupName%>" id="homeIcon"
title="<%=groupName%> Infrastructure Gateway Home"> <i
class="icon-home" style="font-size: 24px;"></i>
</a></li>
<li class="dockbar-item"><a class=""
href="<%="/group/" + groupName + "/workspace"%>" id="wsIcon"
alt='Workspace' title='Virtual Workspace'> <i
class="icon-folder-open" style="font-size: 24px;"></i>
</a></li>
<li class="dockbar-item"><a class=""
href="<%="/group/" + groupName + "/messages"%>" id="messagesIcon"
alt='See Messages' title='Messages'> <i class="icon-envelope"
style="font-size: 24px;"></i>
</a></li>
</ul>
</div>
<div class="collapse nav-collapse">
<ul class="nav nav-add-controls">
<li class="dockbar-item">
<input id="searchbox" type="text" placeholder="Search News Feed">
</li>
</ul>
<ul class="nav nav-add-controls">
<li class="dockbar-item"><input id="searchbox" type="text"
placeholder="Search News Feed"></li>
</ul>
</div>
<!-- When phone or tablet -->
<span>
<a class="btn btn-navbar" href="<%="/group/" + groupName + "/workspace"%>" id="wsIcon"
alt='Workspace' title='Virtual Workspace'> <i class="icon-folder-open" style="font-size: 24px;"></i>
</a>
<span> <a class="btn btn-navbar"
href="<%="/group/" + groupName + "/workspace"%>" id="wsIcon"
alt='Workspace' title='Virtual Workspace'> <i
class="icon-folder-open" style="font-size: 24px;"></i>
</a>
</span>
<span>
<a class="btn btn-navbar" href="<%="/group/" + groupName + "/messages"%>" id="messagesIcon"
alt='See Messages' title='Messages'> <i class="icon-envelope"
style="font-size: 24px;"></i>
</a>
<span> <a class="btn btn-navbar"
href="<%="/group/" + groupName + "/messages"%>" id="messagesIcon"
alt='See Messages' title='Messages'> <i class="icon-envelope"
style="font-size: 24px;"></i>
</a>
</span>
<span>
<a class="btn btn-navbar" href="<%="/group/" + groupName%>" id="homeIcon" title= "<%=groupName%> Infrastructure Gateway Home">
<i class="icon-home" style="font-size: 24px;"></i>
</a>
<span> <a class="btn btn-navbar"
href="<%="/group/" + groupName%>" id="homeIcon"
title="<%=groupName%> Infrastructure Gateway Home"> <i
class="icon-home" style="font-size: 24px;"></i>
</a>
</span>
<c:choose>
<c:when test="<%= themeDisplay.isShowControlPanelIcon() %>">
<span class="btn btn-navbar">
<input id="searchbox-phone" type="text" style="width: 70px;" placeholder="Search ...">
</span>
</c:when>
<c:when test="<%=themeDisplay.isShowControlPanelIcon()%>">
<span class="btn btn-navbar"> <input id="searchbox-phone"
type="text" style="width: 70px;" placeholder="Search ...">
</span>
</c:when>
<c:otherwise>
<span class="btn btn-navbar">
<input id="searchbox-phone" type="text" placeholder="Search News Feed">
</span>
</c:otherwise>
<span class="btn btn-navbar"> <input id="searchbox-phone"
type="text" placeholder="Search News Feed">
</span>
</c:otherwise>
</c:choose>
<!-- End When phone or tablet -->