Add support for modal dialog multiple request.

This commit is contained in:
Paulo Veiga 2011-10-17 10:12:27 -03:00
parent 0133f127b8
commit 8913b5f187
7 changed files with 131 additions and 121 deletions

View File

@ -15,17 +15,47 @@ MooDialog.Request = new Class({
initialize: function(url, requestOptions, options) { initialize: function(url, requestOptions, options) {
this.parent(options); this.parent(options);
this.requestOptions = requestOptions || {method:'get'}; this.requestOptions = requestOptions || {};
this.requestOptions.url = url;
this.requestOptions.update = this.content; this.requestOptions.update = this.content;
this.requestOptions.evalScripts = true; this.requestOptions.evalScripts = true;
this.requestOptions.noCache = true;
this.requestOptions.onFailure = function(xhr) {
// Intercept form requests ...
console.log("Failure:");
console.log(xhr);
}.bind(this);
this.requestOptions.onSuccess = function() {
// Intercept form requests ...
var forms = this.content.getElements('form');
forms.forEach(function(form) {
form.addEvent('submit', function(event) {
// Intercept form ...
this.requestOptions.url = form.action;
this.requestOptions.method = form.method ? form.method : 'post';
var request = new Request.HTML(this.requestOptions);
request.post(form);
event.stopPropagation();
return false;
}.bind(this))
}.bind(this));
}.bind(this);
this.addEvent('open', function() { this.addEvent('open', function() {
var request = new Request.HTML(this.requestOptions).send(); this.requestOptions.url = url;
this.requestOptions.method = 'get';
var request = new Request.HTML(this.requestOptions);
request.send();
MooDialog.Request.active = this; MooDialog.Request.active = this;
}.bind(this)); }.bind(this));
if (this.options.autoOpen) this.open(); this.addEvent('close', function() {
MooDialog.Request.active = null;
}.bind(this));
if (this.options.autoOpen) this.open();
}, },
setRequestOptions: function(options) { setRequestOptions: function(options) {

View File

@ -196,7 +196,7 @@
<div id="fontItalic" class="buttonOn" title="Italic Style"> <div id="fontItalic" class="buttonOn" title="Italic Style">
<img src="../nicons/font-italic.png"/> <img src="../nicons/font-italic.png"/>
</div> </div>
<div id="fontColor" class="buttonExtOn" title="Fond Color"> <div id="fontColor" class="buttonExtOn" title="Fond Color" style="padding-top:4px">
<img src="../nicons/font-color.png"/> <img src="../nicons/font-color.png"/>
</div> </div>

View File

@ -1,4 +1,16 @@
<iframe <!DOCTYPE HTML>
style="border:0;width:600px;height:400px;border: 1px solid black"
<%@ include file="/jsp/init.jsp" %>
<html>
<head>
</head>
<body>
<iframe style="width:600px;height:400px;border: 1px solid black"
src="http://localhost:8080/wise-webapp/c/embeddedView.htm?mapId=1"> src="http://localhost:8080/wise-webapp/c/embeddedView.htm?mapId=1">
</iframe> </iframe>
</body>
</html>

View File

@ -1,8 +1,3 @@
<script type="text/javascript"> <script type="text/javascript">
MOOdalBox.close(); MooDialog.Request.active.close();
if(MOOdalBox.reloadRequered)
{
window.location.reload( true );
}
</script> </script>

View File

@ -206,7 +206,7 @@
<div id="fontItalic" class="buttonOn" title="Italic Style"> <div id="fontItalic" class="buttonOn" title="Italic Style">
<img src="../nicons/font-italic.png"/> <img src="../nicons/font-italic.png"/>
</div> </div>
<div id="fontColor" class="buttonExtOn" title="Fond Color"> <div id="fontColor" class="buttonExtOn" title="Fond Color" style="padding-top:4px">
<img src="../nicons/font-color.png"/> <img src="../nicons/font-color.png"/>
</div> </div>
</div> </div>

View File

@ -14,23 +14,8 @@
<link rel="stylesheet" type="text/css" href="../css/mymaps.css"/> <link rel="stylesheet" type="text/css" href="../css/mymaps.css"/>
<link rel="icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/> <link rel="icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/mootools-core-1.3.2-full-compat.js"></script> <script type='text/javascript'
<script type="text/javascript" src="${pageContext.request.contextPath}/js/wiseListLibrary.js"></script> src='https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js'></script>
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="../css/mymapsOldIE.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/shadedborder.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/transcorners.js"></script>
<script type="text/javascript">
window.onload = function() {
var boxGenerator = RUZEE.ShadedBorder.create({ corner:16, border:1 });
boxGenerator.render('recentFiles');
boxGenerator.render('recentItems');
$('mydocs').makeRounded({radius: 16,borderColor: '#a7c6df',backgroundColor: '#c3def5'});
};
</script>
<![endif]-->
</head> </head>
<body> <body>
<div class="content"> <div class="content">
@ -99,17 +84,18 @@
<spring:message code="NEW_MINDMAP"/> <spring:message code="NEW_MINDMAP"/>
</a> </a>
</div> </div>
<div class="button menuLink" onclick="updateLinks($(this).getParent()); new Windoo.Confirm('<spring:message code="DELETE_SELECTED_CONFIRMATION"/>', <div class="button menuLink"
{ onclick="updateLinks($(this).getParent()); new Windoo.Confirm('<spring:message code="DELETE_SELECTED_CONFIRMATION"/>',
'window': {theme:Windoo.Themes.wise, {
title:'<spring:message code="DELETE_MAP"/>' 'window': {theme:Windoo.Themes.wise,
}, title:'<spring:message code="DELETE_MAP"/>'
'onConfirm':function(){ },
$(document.toolbarForm.mindmapIds).value=$('selectedMapIds').value; 'onConfirm':function(){
$(document.toolbarForm).action='<c:out value="${deleteSelectedMapUrl}" escapeXml="true"/>'; $(document.toolbarForm.mindmapIds).value=$('selectedMapIds').value;
$(document.toolbarForm).submit(); $(document.toolbarForm).action='<c:out value="${deleteSelectedMapUrl}" escapeXml="true"/>';
} $(document.toolbarForm).submit();
});"> }
});">
<spring:message code="DELETE_SELECTED"/> <spring:message code="DELETE_SELECTED"/>
</div> </div>
</div> </div>
@ -175,54 +161,63 @@
<c:forEach items="${wisemapsList}" var="mindmap"> <c:forEach items="${wisemapsList}" var="mindmap">
<tr> <tr>
<td> <td>
<div style="text-align:center;"><input type="checkbox" name="chk" id="chk${mindmap.id}" onclick="addToSelectedMapList(this);"></div> <div style="text-align:center;"><input type="checkbox" name="chk" id="chk${mindmap.id}"
onclick="addToSelectedMapList(this);"></div>
</td> </td>
<td> <td>
<div class="leftMenu"> <div class="leftMenu">
<img src="../images/icon_list.png" class="button" style="display:block;border:0;"> <img src="../images/icon_list.png" class="button" style="display:block;border:0;">
<div class="subMenu2"> <div class="subMenu2">
<a href="javascript:openMap('${mindmap.id}')" title="<spring:message code="OPEN_MSG"/>"> <a href="javascript:openMap('${mindmap.id}')" title="<spring:message code="OPEN_MSG"/>">
<spring:message code="OPEN"/> <spring:message code="OPEN"/>
</a> </a>
<c:if test="${mindmap.owner==requestScope.user}"> <c:if test="${mindmap.owner==requestScope.user}">
<a href="renameMap.htm?mapId=${mindmap.id}" rel="moodalbox 400px 180px wizard" title="<spring:message code="RENAME_DETAILS"/>"> <a href="renameMap.htm?mapId=${mindmap.id}" rel="moodalbox 400px 180px wizard"
title="<spring:message code="RENAME_DETAILS"/>">
<spring:message code="RENAME"/> <spring:message code="RENAME"/>
</a> </a>
</c:if> </c:if>
<a href="history.htm?action=list&amp;goToMindmapList&amp;mapId=${mindmap.id}" rel="moodalbox 600px 400px wizard" title="<spring:message code="HISTORY_INFO"/>"> <a href="history.htm?action=list&amp;goToMindmapList&amp;mapId=${mindmap.id}"
rel="moodalbox 600px 400px wizard" title="<spring:message code="HISTORY_INFO"/>">
<spring:message code="HISTORY"/> <spring:message code="HISTORY"/>
</a> </a>
<div class="menuButton menuLink subMenu2Sep" onclick="new Windoo.Confirm('<spring:message code="DELETE_CONFIRMATION"/>', <div class="menuButton menuLink subMenu2Sep"
{ onclick="new Windoo.Confirm('<spring:message code="DELETE_CONFIRMATION"/>',
window: {'theme':Windoo.Themes.wise, {
title:'<spring:message code="DELETE_MAP"/>' window: {'theme':Windoo.Themes.wise,
}, title:'<spring:message code="DELETE_MAP"/>'
'onConfirm':function(){ },
var form = new Element('form').setProperties({action: '<c:out value="${deleteMapUrl}" escapeXml="true"/>&amp;mapId=${mindmap.id}', method:'post'}).injectInside(document.body); 'onConfirm':function(){
form.submit(); var form = new Element('form').setProperties({action: '<c:out value="${deleteMapUrl}" escapeXml="true"/>&amp;mapId=${mindmap.id}', method:'post'}).injectInside(document.body);
} form.submit();
});"> }
});">
<spring:message code="DELETE"/> <spring:message code="DELETE"/>
</div> </div>
<a href="tags.htm?mapId=${mindmap.id}" rel="moodalbox 400px 200px wizard" title="<spring:message code="TAGS_DETAILS"/>"> <a href="tags.htm?mapId=${mindmap.id}" rel="moodalbox 400px 200px wizard"
title="<spring:message code="TAGS_DETAILS"/>">
<spring:message code="TAGS"/> <spring:message code="TAGS"/>
</a> </a>
<c:if test="${mindmap.owner==requestScope.user}"> <c:if test="${mindmap.owner==requestScope.user}">
<a href="<c:out value="${shareMap}" escapeXml="true"/>&amp;mapId=${mindmap.id}" rel="moodalbox 780px 530px wizard" title="<spring:message code="SHARE_DETAILS"/>"> <a href="<c:out value="${shareMap}" escapeXml="true"/>&amp;mapId=${mindmap.id}"
rel="moodalbox 780px 530px wizard"
title="<spring:message code="SHARE_DETAILS"/>">
<spring:message code="COLLABORATION"/> <spring:message code="COLLABORATION"/>
</a> </a>
<a class="subMenu2Sep" href="publish.htm?mapId=${mindmap.id}" rel="moodalbox 600px 400px wizard" title="<spring:message code="PUBLISH_MSG"/>"> <a class="subMenu2Sep" href="publish.htm?mapId=${mindmap.id}"
rel="moodalbox 600px 400px wizard" title="<spring:message code="PUBLISH_MSG"/>">
<spring:message code="PUBLISH"/> <spring:message code="PUBLISH"/>
</a> </a>
</c:if> </c:if>
<%--<a href="export.htm?mapId=${mindmap.id}" <%--<a href="export.htm?mapId=${mindmap.id}"
rel="moodalbox 600px 400px" title="<spring:message code="EXPORT_DETAILS"/>"> rel="moodalbox 600px 400px" title="<spring:message code="EXPORT_DETAILS"/>">
<spring:message code="EXPORT"/> <spring:message code="EXPORT"/>
</a>--%> </a>--%>
<%--<a href="javascript:printMap(${mindmap.id});"> <%--<a href="javascript:printMap(${mindmap.id});">
<spring:message code="PRINT"/> <spring:message code="PRINT"/>
</a>--%> </a>--%>
</div> </div>
</div> </div>
</td> </td>
@ -249,7 +244,9 @@
alt="<spring:message code="PRIVATE"/>"/> alt="<spring:message code="PRIVATE"/>"/>
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<img src="../images/world2.png" title="<spring:message code="PUBLIC"/>: <spring:message code="ALL_VIEW_PUBLIC"/>" alt="World" <img src="../images/world2.png"
title="<spring:message code="PUBLIC"/>: <spring:message code="ALL_VIEW_PUBLIC"/>"
alt="World"
<spring:message code="PUBLIC"/> <spring:message code="PUBLIC"/>
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
@ -275,11 +272,13 @@
</div> </div>
<div id="ds2" class="submenu" style="position:absolute; display:none;"> <div id="ds2" class="submenu" style="position:absolute; display:none;">
<a href="<c:out value="${shareMap}" escapeXml="true"/>&amp;mapId=" rel="moodalbox 780px 530px" title="Share WiseMap">Share</a> <a href="<c:out value="${shareMap}" escapeXml="true"/>&amp;mapId=" rel="moodalbox 780px 530px"
title="Share WiseMap">Share</a>
<a href="publish.htm?mapId=" rel="moodalbox 600px 400px wizard" title="<spring:message code="PUBLISH_DETAILS"/>"> <a href="publish.htm?mapId=" rel="moodalbox 600px 400px wizard" title="<spring:message code="PUBLISH_DETAILS"/>">
<spring:message code="PUBLISH"/> <spring:message code="PUBLISH"/>
</a> </a>
<a href="<c:out value="${deleteMapUrl}" escapeXml="true"/>&amp;mapId=" rel="moodalbox 300px 120px" title="Delete Confirmation"> <a href="<c:out value="${deleteMapUrl}" escapeXml="true"/>&amp;mapId=" rel="moodalbox 300px 120px"
title="Delete Confirmation">
Delete Delete
</a> </a>
<a href="export.htm?mapId=" rel="moodalbox 750px 400px" title="<spring:message code="EXPORT_DETAILS"/>"> <a href="export.htm?mapId=" rel="moodalbox 750px 400px" title="<spring:message code="EXPORT_DETAILS"/>">
@ -308,8 +307,7 @@
document.openForm.mapId.value = mapId; document.openForm.mapId.value = mapId;
document.openForm.submit(); document.openForm.submit();
} }
function deleteOkButton(url) function deleteOkButton(url) {
{
var form = document.createElement('form'); var form = document.createElement('form');
form.method = 'post'; form.method = 'post';
form.action = url; form.action = url;
@ -318,23 +316,19 @@
} }
Window.onDomReady(initDropDowns); Window.onDomReady(initDropDowns);
function initDropDowns() function initDropDowns() {
{
$ES('li[rel="submenu"]', $(document.body)).each(function(el) { $ES('li[rel="submenu"]', $(document.body)).each(function(el) {
var items = $E('ul', el); var items = $E('ul', el);
el.addEvent('click', showMenu.bind(items)); el.addEvent('click', showMenu.bind(items));
}, this); }, this);
} }
function showMenu(evt) function showMenu(evt) {
{ if ($(document).onclick) {
if ($(document).onclick)
{
$(document).fireEvent('click', 0); $(document).fireEvent('click', 0);
showMenu.delay(110, this, evt); showMenu.delay(110, this, evt);
} }
else else {
{
this.myEffect = $(this).effects({duration:100, transition: Fx.Transitions.linear}); this.myEffect = $(this).effects({duration:100, transition: Fx.Transitions.linear});
this.myEffect.start({'opacity':[0,1]}); this.myEffect.start({'opacity':[0,1]});
$(document).onclick = hide.bind(this); $(document).onclick = hide.bind(this);
@ -343,56 +337,46 @@
} }
} }
function hide() function hide() {
{
this.myEffect.start({'opacity':[1,0]}); this.myEffect.start({'opacity':[1,0]});
$(document).onclick = ''; $(document).onclick = '';
} }
function updateLinks(el) function updateLinks(el) {
{
$ES('a', el).each(function(link) { $ES('a', el).each(function(link) {
if (!link.ohref) if (!link.ohref) {
{
link.ohref = link.getProperty('ohref'); link.ohref = link.getProperty('ohref');
} }
link.href = link.ohref + $('selectedMapIds').value; link.href = link.ohref + $('selectedMapIds').value;
}); });
} }
function openWizard(href, title, rel) function openWizard(href, title, rel) {
{
href = href + $('selectedMapIds').value; href = href + $('selectedMapIds').value;
// MOOdalBox.open(href, title, rel); // MOOdalBox.open(href, title, rel);
} }
function addToSelectedMapList(el) function addToSelectedMapList(el) {
{
var ids = $('selectedMapIds'); var ids = $('selectedMapIds');
var id = el.id.replace(/[^\d]/g, ''); var id = el.id.replace(/[^\d]/g, '');
var value = ids.getProperty("value"); var value = ids.getProperty("value");
if (value != "") if (value != "") {
{
var allIds = $A(ids.value.split(',')); var allIds = $A(ids.value.split(','));
var changed = false; var changed = false;
if (allIds.contains(id) && !el.checked) if (allIds.contains(id) && !el.checked) {
{
allIds.remove(id); allIds.remove(id);
changed = true; changed = true;
} }
else if (!allIds.contains(id) && el.checked) else if (!allIds.contains(id) && el.checked) {
{
allIds.extend([id]); allIds.extend([id]);
changed = true; changed = true;
} }
if (changed) if (changed) {
{
var finalIds = ""; var finalIds = "";
$each(allIds, function(el) { $each(allIds, function(el) {
if (!finalIds == "") if (!finalIds == "") {
{
el = "," + el; el = "," + el;
} }
finalIds = finalIds + el; finalIds = finalIds + el;
@ -400,10 +384,8 @@
value = finalIds; value = finalIds;
} }
} }
else else {
{ if (el.checked) {
if (el.checked)
{
value = id; value = id;
} }
} }
@ -411,28 +393,23 @@
} }
function selectAllMaps(elem) function selectAllMaps(elem) {
{
var value = elem.checked; var value = elem.checked;
var ids = ""; var ids = "";
$ES('input[type="checkbox"]', $('docTable')).each(function(el) { $ES('input[type="checkbox"]', $('docTable')).each(function(el) {
if (el.name.contains('chk')) if (el.name.contains('chk')) {
{
el.checked = value; el.checked = value;
var id = el.id.replace(/[^\d]/g, ''); var id = el.id.replace(/[^\d]/g, '');
if (!ids == "") if (!ids == "") {
{
id = "," + id; id = "," + id;
} }
ids = ids + id; ids = ids + id;
} }
}); });
if (!value) if (!value) {
{
$('selectedMapIds').setProperty('value', ''); $('selectedMapIds').setProperty('value', '');
} }
else else {
{
$('selectedMapIds').setProperty('value', ids); $('selectedMapIds').setProperty('value', ids);
} }
/*var allElems = document.getElementsByName("chk"); /*var allElems = document.getElementsByName("chk");
@ -450,18 +427,15 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
function removeCollaborator(collaboratorEmail) function removeCollaborator(collaboratorEmail) {
{
document.removeCollaboratorForm.colaboratorId.value = collaboratorEmail; document.removeCollaboratorForm.colaboratorId.value = collaboratorEmail;
document.removeCollaboratorForm.submit(); document.removeCollaboratorForm.submit();
//submitDialog('removeCollaboratorForm'); //submitDialog('removeCollaboratorForm');
} }
function addFriendsEmails() function addFriendsEmails() {
{
var newUsers = ""; var newUsers = "";
var ob = $('friendList'); var ob = $('friendList');
while (ob.selectedIndex != -1) while (ob.selectedIndex != -1) {
{
newUsers = newUsers + ", " + ob.options[ob.selectedIndex].value; newUsers = newUsers + ", " + ob.options[ob.selectedIndex].value;
ob.options[ob.selectedIndex].selected = false; ob.options[ob.selectedIndex].selected = false;
} }
@ -470,8 +444,7 @@
newUsers = newUsers.substr(2, newUsers.length); newUsers = newUsers.substr(2, newUsers.length);
dest.value = dest.value + newUsers; dest.value = dest.value + newUsers;
} }
function changeStatus(collaboratorEmail) function changeStatus(collaboratorEmail) {
{
document.removeCollaboratorForm.userEmail.value = collaboratorEmail; document.removeCollaboratorForm.userEmail.value = collaboratorEmail;
submitDialog('removeCollaboratorForm'); submitDialog('removeCollaboratorForm');
} }

View File

@ -78,7 +78,7 @@
<td> <td>
<textarea style="width:400px;height:70px;overflow:hidden;" cols="55" rows="5" readonly="readonly"> <textarea style="width:400px;height:70px;overflow:hidden;" cols="55" rows="5" readonly="readonly">
&lt;iframe &lt;iframe
style="border:0;width:600px;height:400px;border: 1px solid black" style="width:600px;height:400px;border: 1px solid black"
src="http://www.wisemapping.com/c/embeddedView.htm?mapId=${mindmap.id}&zoom=1"&gt; src="http://www.wisemapping.com/c/embeddedView.htm?mapId=${mindmap.id}&zoom=1"&gt;
&lt;/iframe&gt; &lt;/iframe&gt;
</textarea> </textarea>