seems working

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/liferay62-plugins/social-dockbar-hook@124430 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-02-22 15:35:25 +00:00
parent a1db63718d
commit 9faaf71e3a
2 changed files with 89 additions and 9 deletions

View File

@ -6,7 +6,7 @@
<artifactId>social-dockbar-hook</artifactId>
<packaging>war</packaging>
<name>social-dockbar-hook Hook</name>
<version>1.0.0-SNAPSHOT</version>
<version>6.3.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>

View File

@ -1,15 +1,95 @@
<%
//themeDisplay.getUser().getScreenName();
String currentVirtualHost = request.getServerName();
String groupName = currentVirtualHost.split("\\.")[0];
String mySiteURL = "/"+groupName;
%>
<script>
jQuery(document).ready(function() {
//search box keyboard handlers
$('#searchbox').bind("enterKey",function(e){
if ($('#searchbox').val() != "") {
if ($('#searchbox').val().indexOf("#") == 0) {
if ($('#searchbox').val().indexOf(" ") >= 0) {
alert('Sorry, spaces not allowed when searching for topics!');
return;
}
var base64hashtag = btoa($('#searchbox').val());
var base64attr = btoa("hashtagIdentificationParameter");
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;
}
}
else {
var base64hashtag = btoa($('#searchbox').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;
}
}
}
});
$('#searchbox').keyup(function(e){
if(e.keyCode == 13)
{
$(this).trigger("enterKey");
}
});
});
</script>
<ul class="nav nav-add-controls">
<li class="dockbar-item"><a class="" href="javascript:;"
id="homeIcon" title="To be decided"> <i class="icon-home"
style="font-size: 24px;"></i>
<li class="dockbar-item"><a class=""
href="<%="/group/" + groupName%>" id="homeIcon" title="To be decided">
<i class="icon-home" style="font-size: 24px;"></i>
</a></li>
<li class="dockbar-item"><a class="" href="javascript:;"
id="wsIcon" alt='Workspace' title='Virtual Workspace'> <i
<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="javascript:;"
id="messagesIcon" alt='See Messages' title='Messages'> <i
class="icon-envelope" style="font-size: 24px;"></i>
<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">
<input id="searchbox" type="text" placeholder="Search in News Feed">
</li>
</ul>