Get Collaboration list completed.

This commit is contained in:
Paulo Gustavo Veiga
2012-06-09 22:49:54 -03:00
parent 6c8664ada4
commit aeb0ef0668
26 changed files with 268 additions and 555 deletions

View File

@@ -10,7 +10,6 @@
<definition name="mindmapList" page="/jsp/mindmapList.jsp"/>
<definition name="mindmapEmbedded" page="/jsp/mindmapEmbed.jsp"/>
<definition name="mindmapEditor" page="/jsp/mindmapEditor.jsp"/>
<definition name="mindmapCooker" page="/jsp/mindmapCooker.jsp"/>
<definition name="mindmapPrint" page="/jsp/mindmapPrint.jsp"/>
<!-- Template Declaration -->
@@ -85,12 +84,6 @@
<put name="body" value="/jsp/login.jsp"/>
</definition>
<definition name="mindmapPublicView" extends="pageTemplate">
<put name="title" value="PUBLIC_MAP_VIEW"/>
<put name="body" value="/jsp/mindmapPublicView.jsp"/>
</definition>
<!-- Dialog Forms -->
<definition name="mindmapDetail" extends="dialogTemplate">
@@ -152,12 +145,6 @@
<put name="body" value="/jsp/mindmapShare.jsp"/>
</definition>
<definition name="mindmapCollaborator" extends="dialogTemplate">
<put name="title" value=""/>
<put name="details" value=""/>
<put name="body" value="/jsp/mindmapCollaborator.jsp"/>
</definition>
<definition name="keyboard" extends="dialogTemplate">
<put name="title" value="KEYBOARD"/>
<put name="details" value="KEYBOARD_MSG"/>

View File

@@ -23,6 +23,7 @@
</property>
<property name="mappedNames">
<list>
<value>save*</value>
<value>update*</value>
<value>add*</value>
<value>remove*</value>

View File

@@ -26,7 +26,6 @@
</property>
</bean>
<bean id="loginController" class="com.wisemapping.controller.LoginController">
<property name="methodNameResolver" ref="paramResolverByAction"/>
<property name="mindmapService" ref="mindmapService"/>
@@ -34,13 +33,6 @@
<property name="driver" value="${database.driver}"/>
</bean>
<bean id="sharingController" class="com.wisemapping.controller.MindmapSharingController">
<property name="methodNameResolver" ref="paramResolverByAction2"/>
<property name="mindmapService" ref="mindmapService"/>
<property name="userService" ref="userService"/>
</bean>
<bean id="userValidator" class="com.wisemapping.validator.UserValidator">
<property name="userService" ref="userService"/>
<property name="captchaService" ref="reCaptcha"/>
@@ -136,7 +128,6 @@
<props>
<!-- Forms based -->
<prop key="userRegistration">userController</prop>
<prop key="sharing">sharingController</prop>
<prop key="login">loginController</prop>
<prop key="forgotPassword">forgotPasswordController</prop>
<prop key="activation">activationController</prop>

View File

@@ -1,141 +0,0 @@
<%@ include file="/jsp/init.jsp" %>
<c:url value="maps/" var="shareMap">
<c:param name="action" value="removeCollaborator"/>
<c:param name="userEmail" value="${pageContext.request.userPrincipal.name}"/>
</c:url>
<c:url value="sharing" var="removeCollaborator">
<c:param name="actionId" value="removeCollaborator"/>
<c:param name="mapId" value="${mindmap.id}"/>
</c:url>
<h1>
<spring:message code="COLLABORATION"/>:<spring:message code="SHARING"/>
'${mindmap.title}'</h1>
<div id="addCollaboratorPanel">
<form method="post" name="sharingForm"
action="${pageContext.request.contextPath}/c/sharing?mapId=${mindmap.id}">
<div id="userEmails">
<h2>
<spring:message code="INVITE_USERS"/>
</h2>
<input type="button" id="collaboratorButton" value="<spring:message code="AS_COLLABORATOR"/>"
onclick="toogleUserType(this.value)"
style="border: 1px solid #39C;padding: 5px;margin:5px;background-color: #838383;color: white;font-weight: bold;"/>
<input type="button" id="viewerButton" value="<spring:message code="AS_VIEWER"/>"
onclick="toogleUserType(this.value)"
style="border: 1px solid black;padding: 5px;margin:5px;background-color: #838383;color: white;font-weight: bold;"/>
<br/>
<textarea name="userEmails" id="emailList" rows="7"></textarea>
<h5>
<spring:message code="COMMA_SEPARATED_EMAILS"/>
</h5>
<a href="#" onclick="return toogleInvitation()">
<spring:message code="CUSTOMIZE_INVITATION"/>
</a><br/>
<div id="invitation" style="display:none;">
<h2>
<spring:message code="INVITATION"/>
</h2>
<span><spring:message code="SUBJECT"/>: </span><input name="subject" type="text"
value="${principal.firstname} <spring:message code="SUBJECT_MESSAGE"/>"
style="width:80%;">
<br>
<span><spring:message code="MESSAGE"/>:</span>
<div>
<textarea name="message" rows="5" style="width:100%;"><spring:message code="INVITATION_MSG"/>
</textarea>
</div>
</div>
<br/>
<input id="invitationButton" type="submit" value="Invite Collaborators" class="btn-primary">
<input type="button" value="<spring:message code="CANCEL"/>" class="btn-secondary" id="cancelBtn"/>
</div>
<div id="currentUsers">
<h2>
<spring:message code="CURRENT_COLLABORATORS"/> (${mindmap.countColaborators})
</h2>
<table>
<colgroup>
<col width="95%"/>
</colgroup>
<c:forEach items="${mindmap.collaborators}" var="mindmapCollaborator">
<tr>
<td>
${mindmapCollaborator.username}
</td>
<td>
<a href="${removeCollaborator}&colaboratorId=${mindmapCollaborator.id}"><img
src="../images/close12_1.gif" alt="<spring:message code="DELETE"/>" border="0"/></a>
</td>
</tr>
</c:forEach>
</table>
<h2>
<spring:message code="CURRENT_VIEWERS"/> (${mindmap.countViewers})
</h2>
<table>
<colgroup>
<col width="95%"/>
</colgroup>
<c:forEach items="${mindmap.viewers}" var="mindmapViewer">
<tr>
<td>
${mindmapViewer.username}
</td>
<td>
<a href="${removeCollaborator}&colaboratorId=${mindmapViewer.id}"><img
src="../images/close12_1.gif" alt="<spring:message code="DELETE"/>" border="0"/></a>
</td>
</tr>
</c:forEach>
</table>
</div>
<input type="hidden" name="actionId" value="addCollaborator"/>
<input type="hidden" name="colaboratorId" value=""/>
</form>
</div>
</div>
<script type="text/javascript">
$('cancelBtn').addEvent('click', function(event) {
MooDialog.Request.active.close();
});
function toogleUserType(buttonValue) {
var collaboratorButton = $("collaboratorButton");
var viewerButton = $("viewerButton");
var newDisplay = "Invite Collaborators";
if (buttonValue == '<spring:message code="AS_VIEWER"/>') {
newDisplay = "Invite Viewers";
viewerButton.setStyle('border', '1px solid #39C');
collaboratorButton.setStyle('border', '1px solid black');
document.sharingForm.actionId.value = "addViewer";
} else {
viewerButton.setStyle('border', '1px solid black');
collaboratorButton.setStyle('border', '1px solid #39C');
document.sharingForm.actionId.value = "addCollaborator";
}
var invitationButton = document.getElementById("invitationButton");
invitationButton.value = newDisplay;
}
function toogleInvitation() {
var invitationContainer = $("invitation");
var newDisplay = "none";
if (invitationContainer.style.display == 'none') {
newDisplay = "";
}
invitationContainer.style.display = newDisplay;
return false;
}
</script>

View File

@@ -1,29 +0,0 @@
<%@ include file="/jsp/init.jsp" %>
<h1>Mindmap Cooker</h1>
<div>
<form action='<c:url value="/c/cooker"/>' method="post">
<input type="hidden" name="action" value="save"/>
<input type="hidden" name="mapId" value="${mindmap.id}"/>
<table>
<tbody>
<tr>
<td class="formLabel">
Native XML:
</td>
<td>
<textarea name="xml" id="xml" rows="20" cols="70">${mindmap.xml}</textarea>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="submit" value="<spring:message code="SUBMIT"/>" class="btn-primary"/>
<input type="button" value="<spring:message code="CANCEL"/>" class="btn-primary"/>
</td>
</tr>
</tbody>
</table>
</form>
</div>

View File

@@ -1,16 +0,0 @@
<%@ include file="/jsp/init.jsp" %>
<h1>
<spring:message code="PUBLIC_VIEW_TITLE" arguments="'${mindmap.title}'"/>
</h1>
<c:url value="embeddedView?mapId=${mindmap.id}&fullView=true"
var="embeddedUrl"/>
<div id="publicViewContent">
<iframe style="border:0;width:800px;height:420px;border: 1px solid black;" src="${embeddedUrl}">
</iframe>
</div>

View File

@@ -61,7 +61,7 @@
return role;
}
function addCollaborator(email, role) {
function addCollaboration(email, role) {
// Add row to the table ...
var tableElem = $("#collabsTable");
var rowTemplate = '\
@@ -106,17 +106,24 @@
};
$(function() {
var loadedCollabs = [
{email:'paulo1@pveiga.com.ar',role:'viewer'},
{email:'paulo2@pveiga.com.ar',role:'editor'},
{email:'paulo3@pveiga.com.ar',role:'editor'}
];
jQuery.ajax("service/maps/${mindmap.id}/collabs", {
async:false,
dataType: 'json',
type: 'GET',
contentType:"text/plain",
success : function(data, textStatus, jqXHR) {
// Init table will all values ...
var collabs = data.collaborations;
for (var i = 0; i < collabs.length; i++) {
var collab = collabs[i];
addCollaboration(collab.email, collab.role);
}
// Init table will all values ...
for (var i = 0; i < loadedCollabs.length; i++) {
var collab = loadedCollabs[i];
addCollaborator(collab.email, collab.role);
}
},
error:function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
}
});
});
$("#addBtn").click(function(event) {
@@ -164,7 +171,7 @@
$("#collabEmails").val("");
for (i = 0; i < emails.length; i++) {
email = emails[i];
addCollaborator(email, role);
addCollaboration(email, role);
}
} else {
@@ -190,20 +197,38 @@
}
function buildCollabModel() {
return $('#collabsTable tr').map(function() {
var collabs = $('#collabsTable tr').map(function() {
return {
email: $(this).attr('data-collab'),
role: $(this).attr('data-role')
};
});
collabs = jQuery.makeArray(collabs);
return {
count:collabs.length,
collaborations:collabs
};
}
// Hook for interaction with the main parent window ...
var submitDialogForm = function() {
console.log(buildCollabModel());
jQuery.ajax("service/maps/${mindmap.id}/collabs", {
async:false,
dataType: 'json',
type: 'PUT',
data: JSON.stringify(buildCollabModel()),
contentType:"application/json",
success : function(data, textStatus, jqXHR) {
},
error: function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
}
});
}
</script>

View File

@@ -1,87 +0,0 @@
<%@ include file="/jsp/init.jsp" %>
<html>
<head>
<title>
<spring:message code="SITE.TITLE"/>
-</title>
!--[if lt IE 9]>
<![endif]-->
<script type="text/javascript">
function removeViewer(viewerEmail)
{
document.removeViewerForm.userEmail.value = viewerEmail;
document.removeViewerForm.submit();
}
</script>
</head>
<body>
<jsp:include page="header.jsp"/>
<h1>${mindmap.title}</h1>
<div>${mindmap.description}</div>
<div>${mindmap.userRole}</div>
<form method="post" action="<c:url value="sharing"/>">
<input type="hidden" name="action" value="addViewer"/>
<input type="hidden" name="mapId" value="${mindmap.id}"/>
<div id="sharing1">
<fieldset id="sharing">
<legend>
<spring:message code="VIEWERS"/>
</legend>
<table>
<tr>
<td>
<div id="addSharing">
<label for="viewers" accesskey="a">
<spring:message code="ADD_VIEWERS"/>
:</label>
<textarea name="userEmails" id="viewers" tabindex="1" cols="50" rows="5"></textarea><br/>
<input type="submit" value="<spring:message code="ADD"/>">
<input type="button" value="<spring:message code="CANCEL"/>"
onclick="window.location='<c:url value="maps/"/>'">
</div>
</td>
<td>
<div id="currentSharing">
<label for="viewers" accesskey="v">
<spring:message code="CURRENT_VIEWERS"/>
:</label><br/>
<table>
<c:forEach items="${mindmap.viewers}" var="mindmapViewer">
<tr>
<td>
${mindmapViewer}
</td>
<td>
<a href="javascript:removeViewer('${mindmapViewer}')"><img
src="../images/removeUser.jpeg" border="0"
title="<spring:message code="REMOVE"/>"
alt="<spring:message code="REMOVE"/>"/></a>
</td>
</tr>
</c:forEach>
</table>
</div>
</td>
</tr>
</table>
</fieldset>
</div>
</form>
<form name="removeViewerForm" action="<c:url value="sharing"/>">
<input type="hidden" name="action" value="removeViewer"/>
<input type="hidden" name="mapId" value="${mindmap.id}"/>
<input type="hidden" name="userEmail" value=""/>
</form>
</body>
</html>