setup-finished.jsp 4.16 KB
Newer Older
1 2 3 4 5
<%--
  -	$Revision: 1644 $
  -	$Date: 2005-07-19 09:05:10 -0700 (Tue, 19 Jul 2005) $
--%>

6 7 8 9
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>

<%@ page import="org.jivesoftware.util.JiveGlobals,
10
                 java.util.Map,
11
                 org.jivesoftware.openfire.XMPPServer"
12
%>
13
<%@ page import="org.jivesoftware.util.LocaleUtils"%>
14 15 16
<%@ page import="org.jivesoftware.openfire.admin.AdminManager" %>
<%@ page import="org.xmpp.packet.JID" %>
<%@ page import="java.util.List" %>
17 18 19 20 21 22 23 24

<%
	// Redirect if we've already run setup:
	if (!XMPPServer.getInstance().isSetupMode()) {
        response.sendRedirect("setup-completed.jsp");
        return;
    }
%>
25 26

<%
27 28 29 30 31
    if (session == null || session.getAttribute("xmppSettings") == null || session.getAttribute("xmlSettings") == null) {
        // Session appears to have timed out, send back to first page.
        response.sendRedirect("index.jsp");
    }
    
32
    // First, update with XMPPSettings
33 34 35
    Map<String,String> xmppSettings = (Map<String,String>)session.getAttribute("xmppSettings");
    for (String name : xmppSettings.keySet()) {
        String value = xmppSettings.get(name);
36 37
        JiveGlobals.setProperty(name, value);
    }
38 39 40
    Map<String,String> xmlSettings = (Map<String,String>)session.getAttribute("xmlSettings");
    for (String name : xmlSettings.keySet()) {
        String value = xmlSettings.get(name);
41 42
        JiveGlobals.setXMLProperty(name, value);
    }
43 44
    // Notify that the XMPP server that setup is finished.
    XMPPServer.getInstance().finishSetup();
45 46
%>

47 48 49
<html>
    <head>
        <title><fmt:message key="setup.finished.title" /></title>
50
        <meta name="currentStep" content="5"/>
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
        <script type="text/javascript">

        function showhide(id){
            var obj = document.getElementById(id);
            if (obj.style.display == "none"){
                obj.style.display = "";
            } else {
                obj.style.display = "none";
            }
        }

        function toggleDivs() {
            showhide('loginlink');
            showhide('logintext');
        }
        </script>
67
    </head>
68
<body onload="setTimeout('toggleDivs()', 1500);">
69

70 71 72 73 74 75 76 77 78
	<h1>
	<fmt:message key="setup.finished.title" />
	</h1>

	<p>
	<fmt:message key="setup.finished.info">
	    <fmt:param value="<%= LocaleUtils.getLocalizedString("title") %>" />
	</fmt:message>
	</p>
79

80
<%
81 82 83 84 85 86 87 88
    boolean useAdmin = false;
    try {
        List<JID> authorizedJIDS = AdminManager.getInstance().getAdminAccounts();
        useAdmin = authorizedJIDS == null || authorizedJIDS.isEmpty();
    }
    catch (Exception e) {
        // We were not able to load the list of admins right now, so move on.
    }
89 90
    String parameters = useAdmin ? "?username=admin" : "";

91 92 93 94 95 96 97 98 99
    // Figure out the URL that the user can use to login to the admin console.
    String url;
    if (XMPPServer.getInstance().isStandAlone()) {
        String server = request.getServerName();
        int plainPort = JiveGlobals.getXMLProperty("adminConsole.port", 9090);
        int securePort = JiveGlobals.getXMLProperty("adminConsole.securePort", 9091);
        // Use secure login if we're currently secure (and the secure port isn't disabled)
        // or if the user disabled the plain port.
        if ((request.isSecure() && securePort > 0) || plainPort < 0) {
100
            url = "https://" + server + ":" + securePort + "/login.jsp"+parameters;
101 102
        }
        else {
103
            url = "http://" + server + ":" + plainPort + "/login.jsp"+parameters;
104 105 106 107
        }
    }
    else {
        url = request.getRequestURL().toString();
108
        url = url.replace("setup/setup-finished.jsp", "login.jsp"+parameters);
109 110
    }
%>
111 112

<br><br>
113
	<div id="loginlink" style="display:none;" class="jive_setup_launchAdmin">
114 115
		<a href="<%= url %>"><fmt:message key="setup.finished.login" /></a>
	</div>
116

117 118 119
	<div id="logintext" class="jive_setup_launchAdmin">
		<fmt:message key="setup.finished.wait" /> <img src="../images/working-16x16.gif" alt="<fmt:message key="setup.finished.wait" />" width="16" height="16">
	</div>
120

121 122
</body>
</html>