taylor 2005/01/13 17:55:47
Modified: applications/security/src/webapp/WEB-INF/security/sso
sites-view.vm
applications/security/src/java/org/apache/jetspeed/portlets/security/sso
SSOBrowser.java
Added: applications/security/src/webapp/scripts
jetspeed-security.js
Log:
implemented site deletion and confirmation modal dialog
Revision Changes Path
1.4 +8 -3
jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/sso/sites-view.vm
Index: sites-view.vm
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/sso/sites-view.vm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sites-view.vm 13 Jan 2005 23:30:08 -0000 1.3
+++ sites-view.vm 14 Jan 2005 01:55:47 -0000 1.4
@@ -21,6 +21,8 @@
*#
+<script language='JavaScript'
src='/security/scripts/jetspeed-security.js'></script>
+
#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
<table cellpadding=0 cellspacing=1 border=0 width='100%' >
@@ -57,7 +59,9 @@
<div align="center"><a href='$action'>$ssoName</a></div>
</td>
<td class="$rowstyle" nowrap width='24' align='center'>
- <img src="/security/images/waste_bin.gif" width="20" height="15"
border="0"/>
+ <a href="javascript:YesNoPopup('Confirm to Delete Site:','Confirm
Delete','ssoForm','ssoDelete','$ssoUrl','YesNoReturnMethod()');">
+ <img src="/security/images/waste_bin.gif" width="20" height="15"
border="0"/>
+ </a>
</td>
<td class=""> </td>
</tr>
@@ -71,7 +75,7 @@
</tr>
</table>
<br/>
-<form action="$renderResponse.createActionURL()" method="post">
+<form name='ssoForm' action="$renderResponse.createActionURL()"
method="post">
<table>
<tr colspan="2" align="right">
<td nowrap class="portlet-section-alternate" align="right">Site
Name: </td>
@@ -87,6 +91,7 @@
</tr>
</table>
<br/>
+<input name='ssoDelete' type='hidden' value=''/>
<input name='sso.save' type="submit" value="$MESSAGES.getString('save')"
class="portlet-form-button"/>
<input name='sso.refresh' class="portlet-form-button" type="submit"
value="$MESSAGES.getString('refresh')" />
<input name='sso.new' class="portlet-form-button" type="submit"
value="$MESSAGES.getString('new')" />
1.1
jakarta-jetspeed-2/applications/security/src/webapp/scripts/jetspeed-security.js
Index: jetspeed-security.js
===================================================================
var ModalDialogWindow;
var ModalDialogInterval;
var ModalDialog = new Object;
ModalDialog.value = '';
ModalDialog.eventhandler = '';
var ynFormName = '';
var ynInputName = '';
var ynTarget = '';
function ModalDialogMaintainFocus()
{
try
{
if (ModalDialogWindow.closed)
{
window.clearInterval(ModalDialogInterval);
eval(ModalDialog.eventhandler);
return;
}
ModalDialogWindow.focus();
}
catch (everything) { }
}
function ModalDialogRemoveWatch()
{
ModalDialog.value = '';
ModalDialog.eventhandler = '';
}
function ModalDialogShow(Target,BodyText,Title,Buttons,EventHandler)
{
ModalDialogRemoveWatch();
ModalDialog.eventhandler = EventHandler;
var args='width=350,height=125,left=325,top=300,toolbar=0,';
args+='location=0,status=0,menubar=0,scrollbars=1,resizable=0';
ModalDialogWindow=window.open("","",args);
ModalDialogWindow.document.open();
ModalDialogWindow.document.write('<html>');
ModalDialogWindow.document.write('<head>');
ModalDialogWindow.document.write('<title>' + Title + '</title>');
ModalDialogWindow.document.write('<script' + ' language=JavaScript>');
ModalDialogWindow.document.write('function CloseForm(Response) ');
ModalDialogWindow.document.write('{ ');
ModalDialogWindow.document.write(' window.opener.ModalDialog.value =
Response; ');
ModalDialogWindow.document.write(' window.close(); ');
ModalDialogWindow.document.write('} ');
ModalDialogWindow.document.write('</script' + '>');
ModalDialogWindow.document.write('</head>');
ModalDialogWindow.document.write('<body onblur="window.focus();">');
ModalDialogWindow.document.write('<table border=0 width="95%" align=center
cellspacing=0 cellpadding=2>');
ModalDialogWindow.document.write('<tr><td align=left><h2>' + BodyText +
'</h2></td></tr>');
ModalDialogWindow.document.write('<tr><td align=left><h3>' + Target +
'</h3></td></tr>');
ModalDialogWindow.document.write('<tr><td align=left><br></td></tr>');
ModalDialogWindow.document.write('<tr><td align=center>' + Buttons +
'</td></tr>');
ModalDialogWindow.document.write('</body>');
ModalDialogWindow.document.write('</html>');
ModalDialogWindow.document.close();
ModalDialogWindow.focus();
ModalDialogInterval = window.setInterval("ModalDialogMaintainFocus()",5);
}
function
YesNoPopup(message,title,formName,inputName,targetValue,EventHandler)
{
var Buttons='';
ynFormName = formName;
ynInputName = inputName;
ynTarget = targetValue;
Buttons = '<a href=javascript:CloseForm("Yes");>Yes</a> ';
Buttons += '<a href=javascript:CloseForm("No");>No</a> ';
ModalDialogShow(targetValue,message,title,Buttons,EventHandler);
}
function YesNoReturnMethod()
{
if (ModalDialog.value == 'Yes')
{
for (ix = 0; ix < document.forms.length; ix++)
{
var tform = document.forms[ix];
if (tform.name == ynFormName)
{
for (iy = 0; iy < tform.elements.length; iy++)
{
var el = tform.elements[iy];
if (el.name == ynInputName)
{
el.value = ynTarget;
tform.submit();
}
}
}
}
}
ModalDialogRemoveWatch();
}
1.6 +26 -1
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java
Index: SSOBrowser.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SSOBrowser.java 13 Jan 2005 23:44:06 -0000 1.5
+++ SSOBrowser.java 14 Jan 2005 01:55:47 -0000 1.6
@@ -139,6 +139,8 @@
String refresh = request.getParameter("sso.refresh");
String save = request.getParameter("sso.save");
String neue = request.getParameter("sso.new");
+ String delete = request.getParameter("ssoDelete");
+
if (refresh != null)
{
this.clearBrowserIterator(request);
@@ -147,6 +149,29 @@
{
PortletMessaging.cancel(request, "site", "selected");
PortletMessaging.cancel(request, "site", "selectedUrl");
+ }
+ else if (delete != null)
+ {
+ if (!(isEmpty(delete)))
+ {
+ try
+ {
+ SSOSite site = null;
+ site = sso.getSite(delete);
+ if (site != null)
+ {
+ sso.removeSite(site);
+ this.clearBrowserIterator(request);
+ PortletMessaging.cancel(request, "site",
"selected");
+ PortletMessaging.cancel(request, "site",
"selectedUrl");
+ }
+ }
+ catch (SSOException e)
+ {
+ // TODO: exception handling
+ System.err.println("Exception storing site: " + e);
+ }
+ }
}
else if (save != null)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]