ConfigureGoogleApps.jsp revision e8721886dbfd32e88cc7077cbee4b6bb1b44b443
523N/A<%--
523N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
523N/A
523N/A Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
523N/A
523N/A The contents of this file are subject to the terms
523N/A of the Common Development and Distribution License
523N/A (the License). You may not use this file except in
523N/A compliance with the License.
523N/A
523N/A You can obtain a copy of the License at
523N/A https://opensso.dev.java.net/public/CDDLv1.0.html or
523N/A opensso/legal/CDDLv1.0.txt
523N/A See the License for the specific language governing
523N/A permission and limitations under the License.
523N/A
523N/A When distributing Covered Code, include this CDDL
523N/A Header Notice in each file and include the License file
523N/A at opensso/legal/CDDLv1.0.txt.
523N/A If applicable, add the following below the CDDL Header,
523N/A with the fields enclosed by brackets [] replaced by
523N/A your own identifying information:
523N/A "Portions Copyrighted [year] [name of copyright owner]"
523N/A
523N/A $Id: ConfigureGoogleApps.jsp,v 1.8 2009/08/14 18:32:46 asyhuang Exp $
523N/A
523N/A--%>
523N/A
523N/A<%@ page info="CreateFedlet" language="java" %>
523N/A<%@taglib uri="/WEB-INF/jato.tld" prefix="jato" %>
523N/A<%@taglib uri="/WEB-INF/cc.tld" prefix="cc" %>
523N/A<%
523N/A request.setCharacterEncoding("UTF-8");
523N/A%>
523N/A
523N/A<jato:useViewBean
523N/A className="com.sun.identity.console.task.ConfigureGoogleAppsViewBean"
523N/A fireChildDisplayEvents="true" >
523N/A
523N/A<cc:i18nbundle baseName="amConsole" id="amConsole"
523N/A locale="<%=((com.sun.identity.console.base.AMViewBeanBase)viewBean).getUserLocale()%>"/>
523N/A
523N/A<cc:header name="hdrCommon" pageTitle="webconsole.title" bundleID="amConsole" copyrightYear="2009" fireDisplayEvents="true">
523N/A
523N/A<link rel="stylesheet" type="text/css" href="../console/css/openam.css" />
523N/A<script language="javascript" src="../console/js/am.js"></script>
523N/A<script language="javascript" src="../console/js/tasksPage.js"></script>
523N/A<script language="javascript" src="../com_sun_web_ui/js/dynamic.js"></script>
523N/A
523N/A<div id="main" style="position: absolute; margin: 0; border: none; padding: 0; width:auto; height:101%;">
523N/A<div id="divhelp" style="display: none; position:absolute; margin: 0; border: 1px solid #AABCC8; padding: 0; width:400px; height:200px; background:#FCFCFC">
523N/A<table border=0 cellpadding=2 cellspacing=0 width="100%">
523N/A<tr><td width=99%><span id="divHelpmsg" /></td>
523N/A<td width="1%" valign="top">
523N/A<img src="../console/images/tasks/close.gif" width="16" height="16" onClick="hideHelp()" />
523N/A</td>
523N/A</tr>
523N/A</table>
523N/A</div>
523N/A
523N/A<cc:form name="ConfigureGoogleApps" method="post">
523N/A<jato:hidden name="szCache" />
523N/A<script language="javascript">
523N/A function confirmLogout() {
523N/A return confirm("<cc:text name="txtLogout" defaultValue="masthead.logoutMessage" bundleID="amConsole"/>");
523N/A }
523N/A
523N/A function cancelOp() {
523N/A document.location.replace("../task/Home");
523N/A return false;
523N/A }
523N/A
523N/A function realmSelect(radio) {
523N/A hideCOTObjs();
523N/A hideIDPObjs();
523N/A getCircleOfTrust(radio.value);
523N/A var choiceCOT = frm.elements['ConfigureGoogleApps.choiceCOT'];
523N/A if(choiceCOT.length>0) {
523N/A cotSelect(choiceCOT.options[0]);
523N/A }
523N/A }
523N/A
523N/A function cotSelect(radio) {
523N/A getIDP(radio.value);
523N/A var idpobj = frm.elements['ConfigureGoogleApps.choiceIDP'];
523N/A if (idpobj.options.length > 1) {
523N/A showIDPObjs();
523N/A }
523N/A }
523N/A
523N/A function hideRealm() {
523N/A var frm = document.forms['ConfigureGoogleApps'];
523N/A var realmobj = frm.elements['ConfigureGoogleApps.tfRealm'];
523N/A if (realmobj.options.length < 2) {
523N/A hideRealmObjs();
523N/A }
523N/A var cotobj = frm.elements['ConfigureGoogleApps.choiceCOT'];
523N/A if (cotobj.options.length < 2) {
523N/A document.getElementById('cotfld').style.display = 'none';
523N/A document.getElementById('cottxt').innerHTML = cotobj.value;
523N/A }
523N/A var idpobj = frm.elements['ConfigureGoogleApps.choiceIDP'];
523N/A if (idpobj.options.length < 2) {
523N/A document.getElementById('idpfld').style.display = 'none';
523N/A document.getElementById('idptxt').innerHTML = idpobj.value;
523N/A }
523N/A }
523N/A
523N/A function hideRealmObjs() {
523N/A document.getElementById('realmlbl').style.display = 'none';
523N/A document.getElementById('realmfld').style.display = 'none';
523N/A }
523N/A
523N/A function showCOTObjs() {
523N/A document.getElementById('cotlbl').style.display = '';
523N/A document.getElementById('cotfld').style.display = '';
523N/A }
523N/A
523N/A function hideCOTObjs() {
523N/A document.getElementById('cotlbl').style.display = 'none';
523N/A document.getElementById('cotfld').style.display = 'none';
523N/A }
523N/A
523N/A function showIDPObjs() {
523N/A document.getElementById('idplbl').style.display = '';
523N/A document.getElementById('idpfld').style.display = '';
523N/A }
523N/A
523N/A function hideIDPObjs() {
523N/A document.getElementById('idplbl').style.display = 'none';
523N/A document.getElementById('idpfld').style.display = 'none';
523N/A }
523N/A
523N/A</script>
523N/A
523N/A<cc:primarymasthead name="mhCommon" bundleID="amConsole" logoutOnClick="return confirmLogout();" locale="<%=((com.sun.identity.console.base.AMViewBeanBase)viewBean).getUserLocale()%>"/>
523N/A<table border="0" cellpadding="10" cellspacing="0" width="100%">
523N/A <tr>
523N/A <td>
523N/A <cc:alertinline name="ialertCommon" bundleID="amConsole" />
523N/A </td>
523N/A </tr>
523N/A</table>
523N/A
523N/A<%-- PAGE CONTENT --------------------------------------------------------- --%>
523N/A<cc:pagetitle name="pgtitle" bundleID="amConsole" pageTitleText="page.title.configure.google.apps" showPageTitleSeparator="true" viewMenuLabel="" pageTitleHelpMessage="" showPageButtonsTop="true" showPageButtonsBottom="false" />
523N/A
523N/A<table border="0" cellpadding="20" cellspacing="0">
523N/A<tr><td>
523N/A <cc:text name="txtDesc" defaultValue="page.desc.configure.google.apps" bundleID="amConsole" />
523N/A</td></tr>
523N/A</table>
523N/A
523N/A
523N/A<cc:propertysheet name="propertyAttributes" bundleID="amConsole" showJumpLinks="false"/>
523N/A</cc:form>
523N/A</cc:header>
523N/A</div>
523N/A<div id="dlg" class="dvs" style="width:600px; height: 225px; margin-left:-300px"></div>
523N/A
523N/A<script language="javascript">
523N/A var frm = document.forms['ConfigureGoogleApps'];
523N/A var idpNew = frm.elements['ConfigureGoogleApps.choiceIDP'].value;
523N/A var realmNew = frm.elements['ConfigureGoogleApps.tfRealm'].value;
523N/A var domainIdNew ;
523N/A
523N/A var msgCreating = "<p><img src=\"../console/images/processing.gif\" width=\"66\" height\"66\"/></p><cc:text name="txtConfiguring" defaultValue="configuring.google.apps.waiting" bundleID="amConsole" escape="false" />";
523N/A var msgCreated = "<p>&nbsp;</p><input name=\"btnOK\" type=\"submit\" class=\"Btn1\" value=\"<cc:text name="txtOKBtn" defaultValue="ajax.ok.button" bundleID="amConsole" />\" onClick=\"document.location.replace(\'../task/ConfigureGoogleAppsComplete?idp=\' + idpNew + \'&realm=\' + realmNew + \'&domainId=\' + domainIdNew);return false;\" /></div></p>";
523N/A var ttlCreated = "<h3><cc:text name="txtTtlCreated" defaultValue="google.apps.configured.msg" escape="false" bundleID="amConsole" /></h3>";
523N/A var closeBtn = "<p>&nbsp;</p><p><div class=\"TtlBtnDiv\"><input name=\"btnClose\" type=\"submit\" class=\"Btn1\" value=\"<cc:text name="txtCloseBtn" defaultValue="ajax.close.button" bundleID="amConsole" />\" onClick=\"focusMain();return false;\" /></div></p>";
523N/A
523N/A var btn1 = frm.elements['ConfigureGoogleApps.button1'];
523N/A btn1.onclick = submitPage;
523N/A var btn2 = frm.elements['ConfigureGoogleApps.button2'];
523N/A btn2.onclick = cancelOp;
523N/A var ajaxObj = getXmlHttpRequestObject();
523N/A var selectOptionCache;
523N/A var userLocale = "<%= viewBean.getUserLocale().toString() %>";
523N/A
523N/A function submitPage() {
523N/A document.getElementById('dlg').style.top = '300px';
523N/A fade();
523N/A document.getElementById('dlg').innerHTML = '<center>' +
523N/A msgCreating + '</center>';
523N/A var url = "../console/ajax/AjaxProxy.jsp";
523N/A var params = 'locale=' + userLocale +
523N/A '&class=com.sun.identity.workflow.ConfigureGoogleApps' + getData();
523N/A frm = document.forms['ConfigureGoogleApps'];
523N/A idpNew = frm.elements['ConfigureGoogleApps.choiceIDP'].value;
523N/A realmNew = frm.elements['ConfigureGoogleApps.tfRealm'].value;
523N/A var size = frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].length ;
523N/A i=0;
523N/A domainIdNew="";
523N/A for (i=0;i<size-1;i++)
523N/A {
523N/A domainIdNew += frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].options[i].value + "," ;
523N/A }
523N/A ajaxPost(ajaxObj, url, params, configured);
523N/A return false;
523N/A }
523N/A
523N/A function getData() {
523N/A var cot = frm.elements['ConfigureGoogleApps.choiceCOT'].value;
523N/A var idp = frm.elements['ConfigureGoogleApps.choiceIDP'].value;
523N/A var realm = frm.elements['ConfigureGoogleApps.tfRealm'].value;
523N/A var size = frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].length ;
523N/A i=0;
523N/A domainIdNew="";
523N/A for (i=0;i<size-1;i++)
523N/A {
523N/A domainIdNew += frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].options[i].value + "," ;
523N/A }
523N/A
523N/A return "&realm=" + escapeEx(realm) +
523N/A "&cot=" + escapeEx(cot) +
523N/A "&idp=" + escapeEx(idp) +
523N/A "&domainId=" + escapeEx(domainIdNew);
523N/A }
523N/A
523N/A function configured() {
523N/A if (ajaxObj.readyState == 4) {
523N/A var result = hexToString(ajaxObj.responseText);
523N/A var status = result.substring(0, result.indexOf('|'));
523N/A var result = result.substring(result.indexOf('|') +1);
523N/A var msg = '<center><p>' + result + '</p></center>';
523N/A if (status == 0) {
523N/A msg = '<center>' + ttlCreated + msgCreated + '</center>';
523N/A } else {
523N/A msg = msg + '<center>' + closeBtn + '</center>';
523N/A }
523N/A frm = document.forms['ConfigureGoogleApps'];
523N/A idpNew = frm.elements['ConfigureGoogleApps.choiceIDP'].value;
523N/A realmNew = frm.elements['ConfigureGoogleApps.tfRealm'].value;
523N/A var size = frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].length ;
523N/A i=0; domainIdNew="";
523N/A for (i=0;i<size-1;i++)
523N/A {
523N/A domainIdNew += frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].options[i].value + "," ;
523N/A }
523N/A
523N/A document.getElementById('dlg').innerHTML = msg;
523N/A }
523N/A }
523N/A
523N/A function getCircleOfTrust(realm) {
523N/A var url = "../console/ajax/AjaxProxy.jsp";
523N/A var params = 'locale=' + userLocale +
523N/A '&class=com.sun.identity.workflow.GetCircleOfTrusts' +
523N/A '&realm=' + escapeEx(realm);
523N/A ajaxPost(ajaxObj, url, params, circleOfTrust);
523N/A }
523N/A
523N/A function getIDP(cot) {
523N/A clearOptions(frm, 'ConfigureGoogleApps.choiceIDP');
523N/A var url = "../console/ajax/AjaxProxy.jsp";
523N/A var realm = frm.elements['ConfigureGoogleApps.tfRealm'].value;
523N/A var params = 'locale=' + userLocale +
523N/A '&class=com.sun.identity.workflow.GetHostedIDPs' +
523N/A '&realm=' + escapeEx(realm) +
523N/A '&cot=' + escapeEx(cot);
523N/A ajaxPost(ajaxObj, url, params, gotIDPs);
523N/A }
523N/A
523N/A function circleOfTrust() {
523N/A if (ajaxObj.readyState == 4) {
523N/A var result = hexToString(ajaxObj.responseText);
523N/A var status = result.substring(0, result.indexOf('|'));
523N/A var result = result.substring(result.indexOf('|') +1);
523N/A var msg = '';
523N/A if (status == 0) {
523N/A result = result.replace(/^\s+/, '');
523N/A result = result.replace(/\s+$/, '');
523N/A if (result.length == 0) {
523N/A } else {
523N/A var cots = result.split('|');
523N/A var choiceCOT = frm.elements['ConfigureGoogleApps.choiceCOT'];
523N/A for (var i = choiceCOT.length - 1; i>=0; i--) {
523N/A choiceCOT.remove(i);
523N/A }
523N/A for (var i = 0; i < cots.length; i++) {
523N/A choiceCOT.options[i] = new Option(cots[i], cots[i]);
523N/A }
523N/A showCOTObjs();
523N/A }
523N/A if (presetcot) {
523N/A selectOption(frm, 'ConfigureGoogleApps.choiceCOT', presetcot);
523N/A presetcot = null;
523N/A }
523N/A } else {
523N/A msg = '<center><p>' + result + '</p></center>';
523N/A msg = msg + '<center>' + closeBtn + '</center>';
523N/A document.getElementById('dlg').innerHTML = msg;
523N/A ajaxObj = getXmlHttpRequestObject();
523N/A }
523N/A }
523N/A }
523N/A
523N/A function gotIDPs() {
523N/A if (ajaxObj.readyState == 4) {
523N/A var result = hexToString(ajaxObj.responseText);
523N/A var status = result.substring(0, result.indexOf('|'));
523N/A var result = result.substring(result.indexOf('|') +1);
523N/A var msg = '';
523N/A if (status == 0) {
523N/A result = result.replace(/^\s+/, '');
523N/A result = result.replace(/\s+$/, '');
523N/A if (result.length == 0) {
523N/A } else {
523N/A var idps = result.split('|');
523N/A var choiceIDP = frm.elements['ConfigureGoogleApps.choiceIDP'];
523N/A for (var i = 0; i < idps.length; i++) {
523N/A choiceIDP.options[i] = new Option(idps[i], idps[i]);
523N/A }
523N/A showIDPObjs();
523N/A }
523N/A } else {
523N/A msg = '<center><p>' + result + '</p></center>';
523N/A msg = msg + '<center>' + closeBtn + '</center>';
523N/A document.getElementById('dlg').innerHTML = msg;
523N/A ajaxObj = getXmlHttpRequestObject();
523N/A }
523N/A }
523N/A }
523N/A function getActionTable() {
523N/A var nodes = document.getElementsByTagName("table");
523N/A var len = nodes.length;
523N/A for (var i = 0; i < len; i++) {
523N/A if (nodes[i].className == 'Tbl') {
523N/A return nodes[i];
523N/A }
523N/A }
523N/A }
523N/A
523N/A var presetcot = null;
523N/A
523N/A<%
523N/A String cot = request.getParameter("cot");
523N/A String idp = request.getParameter("entityId");
523N/A if ((cot != null) && (cot.trim().length() > 0)) {
523N/A out.println("hideRealmObjs();");
523N/A out.println("hideIDPObjs();");
523N/A out.println("presetcot = \"" + cot + "\";");
523N/A out.println("document.getElementById('cotfld').style.display = 'none';");
523N/A out.println("document.getElementById('cottxt').innerHTML = \"" +
523N/A cot + "\";");
523N/A out.println("document.getElementById('idpfld').style.display = 'none';");
523N/A out.println("document.getElementById('idplbl').style.display = '';");
523N/A out.println("document.getElementById('idptxt').innerHTML = \"" +
523N/A idp + "\";");
523N/A } else {
523N/A out.println("hideRealm();");
523N/A }
523N/A
523N/A%>
523N/A
523N/A function unescapeQuote(str) {
523N/A str = str.replace(/&quot;/g, '"');
523N/A str = str.replace(/&lt;/g, '<');
523N/A str = str.replace(/&gt;/g, '>');
523N/A return str;
523N/A }
523N/A
523N/A var infoRealm = unescapeQuote("<cc:text name="txtInfoRealm" defaultValue="configure.google.apps.help.realm" bundleID="amConsole" />");
527N/A var infoEntityId = unescapeQuote("<cc:text name="txtInfoEntityId" defaultValue="configure.google.apps.help.entity.id" bundleID="amConsole" />");
523N/A
523N/A</script>
523N/A
527N/A</jato:useViewBean>
523N/A