added buttons for recent and VRE Folders, still missing the server side impl.
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/workspace-widget-portlet@167375 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
212419b86b
commit
e439e1855a
|
@ -5,8 +5,11 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import javax.portlet.ResourceRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.portal.GCubePortalConstants;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.common.storagehub.client.proxies.WorkspaceManagerClient;
|
||||
|
@ -88,6 +91,27 @@ public class StorageHubServiceUtil {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static String getWorkspaceFolderURL(HttpServletRequest request) {
|
||||
String userName = Utils.getCurrentUser(request).getUsername();
|
||||
String scope = Utils.getCurrentContext(request);
|
||||
String authorizationToken = Utils.getCurrentUserToken(scope, userName);
|
||||
SecurityTokenProvider.instance.set(authorizationToken);
|
||||
String siteLandingPagePath = PortalContext.getConfiguration().getSiteLandingPagePath(request);
|
||||
String toReturn = siteLandingPagePath;
|
||||
|
||||
try {
|
||||
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
|
||||
String itemId = wsclient.getVreFolder("hl:accounting").getId();
|
||||
toReturn = new String(new StringBuffer(siteLandingPagePath)
|
||||
.append(GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL)
|
||||
.append("?itemid=")
|
||||
.append(itemId));
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,6 +40,11 @@ public class WorkspaceWidget extends MVCPortlet {
|
|||
private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(WorkspaceWidget.class);
|
||||
public static String BREADCRUMB_ATTR = "BREADCRUMB_ATTR_name";
|
||||
|
||||
/**
|
||||
* all the AJAX calls are served by this method, to discriminate the operation we use the parameters:
|
||||
* - when fileToDownloadId parameters is not empty the request is for a file download
|
||||
* - when
|
||||
*/
|
||||
@Override
|
||||
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, PortletException {
|
||||
String fileToDownloadId = ParamUtil.getString(resourceRequest, "fileToDownloadId", null);
|
||||
|
@ -57,7 +62,7 @@ public class WorkspaceWidget extends MVCPortlet {
|
|||
//the user is browsing the workspace
|
||||
else {
|
||||
String cmd = ParamUtil.getString(resourceRequest, "cmd", "");
|
||||
PortalUtil.getHttpServletRequest(resourceRequest);
|
||||
System.out.println("******** CMD="+cmd);
|
||||
String selectedItemId = "root";
|
||||
String selectedItemName = "";
|
||||
if (cmd != null && cmd.split("_selectedName").length > 1) {
|
||||
|
|
|
@ -1,3 +1,30 @@
|
|||
.workspace-widget-portlet h1.portlet-title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.workspace-widget-portlet div.ws-breadcrumb-container > ul.breadcrumb {
|
||||
padding-left: 0;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.workspace-widget-portlet .ws-recents {
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
.workspace-widget-portlet .ws-recents a {
|
||||
display: inline-flex;
|
||||
vertical-align: middle;
|
||||
align-items: center;
|
||||
border-radius: 4px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
.workspace-widget-portlet .ws-recents a:hover {
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
background-color: #f1f1f1;
|
||||
border: 1px solid #f1f1f1;
|
||||
}
|
||||
|
||||
.workspace-widget-portlet table thead {
|
||||
background: #f8f8f8;
|
||||
color: #0a0a0a;
|
||||
|
@ -43,6 +70,7 @@
|
|||
|
||||
.workspace-widget-portlet select, input[type="file"] {
|
||||
line-height: 15px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.workspace-widget-portlet table.dataTable tbody>tr.selected, table.dataTable tbody>tr>.selected
|
||||
|
|
|
@ -40,6 +40,12 @@
|
|||
<%@page import="com.liferay.portlet.dynamicdatamapping.model.DDMStructure"%>
|
||||
<%@page import="com.liferay.portal.security.permission.ActionKeys"%>
|
||||
<%@page import="javax.portlet.PortletSession"%>
|
||||
|
||||
<%@page import="com.liferay.portal.model.User"%>
|
||||
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>
|
||||
<%@page import="com.liferay.portal.service.GroupLocalServiceUtil"%>
|
||||
<%@page import="org.gcube.portlets.user.wswidget.StorageHubServiceUtil"%>
|
||||
|
||||
<portlet:defineObjects />
|
||||
<liferay-theme:defineObjects />
|
||||
|
||||
|
|
|
@ -1,18 +1,39 @@
|
|||
<%@page import="com.liferay.portal.model.User"%>
|
||||
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>
|
||||
|
||||
<%@include file="init.jsp"%>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
|
||||
<% pageContext.setAttribute("currentGroup", GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)));
|
||||
%>
|
||||
<script src="<%=renderRequest.getContextPath()%>/js/datatables.min.js"></script>
|
||||
|
||||
|
||||
<portlet:resourceURL var="usersCustomDataSourceURL">
|
||||
<portlet:param name="cmd" value="itemId=" />
|
||||
</portlet:resourceURL>
|
||||
<portlet:resourceURL var="downloadFileURL">
|
||||
<portlet:param name="fileToDownloadId" value="itemId=" />
|
||||
</portlet:resourceURL>
|
||||
<div class="ws-breadcrumb-container"></div>
|
||||
|
||||
<table width="100%" style="border: none; border-collapse: inherit;">
|
||||
<tr>
|
||||
<td><div class="ws-breadcrumb-container"></div></td>
|
||||
<c:choose>
|
||||
<c:when test="${currentGroup.getParentGroupId() > 0}">
|
||||
<td><div class="ws-recents">
|
||||
<a><i style="font-size: 1.2em;" class="material-icons">access_time</i>
|
||||
<span>Recent</span></a>
|
||||
</div></td>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<td><div class="ws-recents">
|
||||
<a><i class="material-icons">folder_special</i>
|
||||
<span>VRE Folders</span></a>
|
||||
</div></td>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table id="userTable" class="display" cellspacing="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -22,6 +43,14 @@
|
|||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<c:if test="${currentGroup.getParentGroupId() > 0}">
|
||||
<div class="ws-go">
|
||||
<a href="<%= StorageHubServiceUtil.getWorkspaceFolderURL(request) %>" target="_blank">
|
||||
<i class="icon-folder-open" style="font-size: 14px;"></i>
|
||||
<span>Go to shared workspace</span>
|
||||
</a>
|
||||
</div>
|
||||
</c:if>
|
||||
<script>
|
||||
function loadItemsListIntoTable(itemId, itemName) {
|
||||
var table = $('#userTable').DataTable();
|
||||
|
@ -36,7 +65,7 @@ function downloadItem(itemId) {
|
|||
function mainTable() {
|
||||
var table = $('#userTable').DataTable( {
|
||||
retrieve: true, // tell DataTables that you are aware that the initialisation options can't be changed after initialisation, and that should that occur, that you just want the DataTable instance to be returned.
|
||||
"lengthMenu": [ [6, 12, 25, 50, -1], [6, 12, 25, 50, "All"] ],
|
||||
"lengthMenu": [ [5, 12, 25, 50, -1], [5, 12, 25, 50, "All"] ],
|
||||
"dom": "<'row'<'small-6 columns'><'small-6 columns'>r>t<'row'<'mydt-pagination'p><'#mydtwrap'<'mydt-block'l><i>>'>",
|
||||
select: {
|
||||
style: 'single'
|
||||
|
|
Loading…
Reference in New Issue