ScriptUploader.jsp revision 9d774da534d2ed33a21bf0680f04d6e587eb9bfc
2ronwalf<%--
2ronwalf ~ The contents of this file are subject to the terms of the Common Development and
2ronwalf ~ Distribution License (the License). You may not use this file except in compliance with the
2ronwalf ~ License.
2ronwalf ~
2ronwalf ~ You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
2ronwalf ~ specific language governing permission and limitations under the License.
2ronwalf ~
2ronwalf ~ When distributing Covered Software, include this CDDL Header Notice in each file and include
2ronwalf ~ the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
2ronwalf ~ Header, with the fields enclosed by brackets [] replaced by your own identifying
2ronwalf ~ information: "Portions copyright [year] [name of copyright owner]".
2ronwalf ~
2ronwalf ~ Copyright 2014 ForgeRock AS.
2ronwalf --%>
2ronwalf
2ronwalf<%-- Portions copyright 2008 Sun Microsystems Inc. --%>
2ronwalf<%-- Based on/simplified from federation/FileUploader.jsp --%>
2ronwalf
2ronwalf<%@ page info="ScriptUploader" language="java" %>
2ronwalf<%@taglib uri="/WEB-INF/jato.tld" prefix="jato" %>
2ronwalf<%@taglib uri="/WEB-INF/cc.tld" prefix="cc" %>
2ronwalf
2ronwalf
2ronwalf<jato:useViewBean
2ronwalf className="com.sun.identity.console.authentication.ScriptUploaderViewBean"
22daenzerorama fireChildDisplayEvents="true" >
2ronwalf
2ronwalf <cc:i18nbundle baseName="amConsole" id="amConsole"
2ronwalf locale="<%=((com.sun.identity.console.base.AMViewBeanBase) viewBean).getUserLocale()%>"/>
2ronwalf
2ronwalf <cc:header name="hdrCommon" pageTitle="webconsole.title" bundleID="amConsole" copyrightYear="2014" fireDisplayEvents="false">
2ronwalf
2ronwalf <link rel="stylesheet" type="text/css" href="../console/css/openam.css" />
2ronwalf <script language="javascript" src="../console/js/am.js">
2ronwalf </script>
2ronwalf
2ronwalf <script language="javascript">
2ronwalf var filename = '';
2ronwalf var failUpload = "<cc:text name="txtConfigured" defaultValue="ajax.upload.file.failed" bundleID="amConsole" escape="false" />";
2ronwalf var errorUpload = "<cc:text name="txtConfigured" defaultValue="{0}" escape="false" />";
2ronwalf 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>';
2ronwalf function selectFile(data) {
2ronwalf var idoc = document.getElementById('fileupload');
2ronwalf var dataDiv = idoc.contentWindow.document.getElementById('data');
2ronwalf if (dataDiv) {
2ronwalf data = dataDiv.innerHTML;
2ronwalf data = data.replace(/^\s+/, '');
2ronwalf data = data.replace(/\s+$/, '');
2ronwalf data = data.replace(/&amp;/g, '&');
2ronwalf data = data.replace(/&lt;/g, '<');
2ronwalf data = data.replace(/&gt;/g, '>');
2ronwalf if (data.length == 0) {
2ronwalf fade();
2ronwalf document.getElementById('dlg').innerHTML = '<center>' +
failUpload + '<p>&nbsp;</p>' + closeBtn + '</center>';
} else if(data.search("Error:") == 0){
var msg = data.substring(7);
msg = errorUpload.replace("{0}", msg);
fade();
document.getElementById('dlg').innerHTML = '<center>' +
msg + '<p>&nbsp;</p>' + closeBtn + '</center>';
} else {
var fldName = window.name;
var parent = opener.document.forms[0];
var field = parent.elements[parent.name + '.' + fldName];
field.value = data;
self.close();
}
}
}
</script>
<div id="main" style="position: absolute; margin: 0; border: none; padding: 0; width:auto; height:101%;">
<cc:secondarymasthead name="secondaryMasthead" />
<form name="FileUploader" action="../console/ajax/FileUpload.jsp"
enctype="multipart/form-data" method="post" target="fileupload" onSubmit="filename=this.elements['fileX'].value;">
<cc:pagetitle name="pgtitle"
bundleID="amConsole"
pageTitleText="file.uploader.title"
showPageTitleSeparator="true"
viewMenuLabel=""
pageTitleHelpMessage=""
showPageButtonsTop="false"
showPageButtonsBottom="true" >
</cc:pagetitle>
<p>&nbsp;</p>
<table border=0 cellpadding=10>
<tr><td>
<input type="file" name="fileX" />
</td></tr>
</table>
</form>
<iframe style="display:none" src="about:blank" id="fileupload" name="fileupload" onload="selectFile(this.contentWindow.document);"></iframe>
</cc:header>
</div>
<div id="dlg" class="dvs"></div>
</jato:useViewBean>