setup-host-settings.jsp 4.59 KB
Newer Older
1
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
2
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
Matt Tucker's avatar
Matt Tucker committed
3 4 5 6 7 8 9 10 11 12 13 14
<%--
  -	$RCSfile$
  -	$Revision$
  -	$Date$
--%>

<%@ page import="org.jivesoftware.util.ParamUtils,
                 org.jivesoftware.messenger.JiveGlobals,
                 java.util.Map,
                 java.util.HashMap,
                 java.net.InetAddress" %>

Bill Lynch's avatar
Bill Lynch committed
15
<%@ include file="setup-global.jspf" %>
Matt Tucker's avatar
Matt Tucker committed
16 17 18 19

<%  // Get parameters
    String domain = ParamUtils.getParameter(request,"domain");
    int embeddedPort = ParamUtils.getIntParameter(request,"embeddedPort",-1);
Bill Lynch's avatar
Bill Lynch committed
20
    boolean sslEnabled = ParamUtils.getBooleanParameter(request,"sslEnabled",true);
Matt Tucker's avatar
Matt Tucker committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

    boolean doContinue = request.getParameter("continue") != null;

    // handle a continue request:
    Map errors = new HashMap();
    if (doContinue) {
        // Validate parameters
        if (domain == null) {
            errors.put("domain","domain");
        }
        if (embeddedPort < 0) {
            errors.put("embeddedPort","embeddedPort");
        }
        // Continue if there were no errors
        if (errors.size() == 0) {
36 37 38
            Map xmppSettings = new HashMap();

            xmppSettings.put("xmpp.domain",domain);
39
            xmppSettings.put("adminConsole.port",Integer.toString(embeddedPort));
40 41 42 43
            xmppSettings.put("xmpp.socket.ssl.active",""+sslEnabled);
            xmppSettings.put("xmpp.auth.anonymous", "true" );
            session.setAttribute("xmppSettings", xmppSettings);

Matt Tucker's avatar
Matt Tucker committed
44 45 46 47 48 49 50 51 52 53 54 55
            // update the sidebar status
            session.setAttribute("jive.setup.sidebar.2","done");
            session.setAttribute("jive.setup.sidebar.3","in_progress");

            // successful, so redirect
            response.sendRedirect("setup-datasource-settings.jsp");
            return;
        }
    }

    // Load the current values:
    if (!doContinue) {
56
        domain = JiveGlobals.getProperty("xmpp.domain");
57
        embeddedPort = JiveGlobals.getIntProperty("adminConsole.port", 9090);
Bill Lynch's avatar
Bill Lynch committed
58
        sslEnabled = JiveGlobals.getBooleanProperty("xmpp.socket.ssl.active", true);
Matt Tucker's avatar
Matt Tucker committed
59

60
        // If the domain is still blank, guess at the value:
Matt Tucker's avatar
Matt Tucker committed
61
        if (domain == null) {
Matt Tucker's avatar
Matt Tucker committed
62
            domain = InetAddress.getLocalHost().getHostName().toLowerCase();
Matt Tucker's avatar
Matt Tucker committed
63 64 65 66
        }
    }
%>

67
<%@ include file="setup-header.jspf" %>
Matt Tucker's avatar
Matt Tucker committed
68 69 70 71 72 73

<p class="jive-setup-page-header">
Server Settings
</p>

<p>
74
Below are host settings for this server. Note: the suggested value for the
Matt Tucker's avatar
Matt Tucker committed
75
domain is based on the network settings of this machine.
Matt Tucker's avatar
Matt Tucker committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
</p>

<style type="text/css">
LABEL { font-weight : normal; }
</style>

<form action="setup-host-settings.jsp" name="f" method="post">

<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr valign="top">
    <td width="1%" nowrap>
        Domain:
        <%  if (errors.get("domain") != null) { %>

            <span class="jive-error-text"><br>
            Invalid domain.
            </span>

        <%  } %>
    </td>
    <td width="99%">
        <input type="text" size="30" maxlength="150" name="domain"
         value="<%= ((domain != null) ? domain : "") %>">
        <span class="jive-description">
        <br>
101
        Hostname or IP address of this server.
Matt Tucker's avatar
Matt Tucker committed
102 103 104 105 106
        </span>
    </td>
</tr>
<tr valign="top">
    <td width="1%" nowrap>
Matt Tucker's avatar
Matt Tucker committed
107
        Admin Console Port:
Matt Tucker's avatar
Matt Tucker committed
108 109 110 111 112 113 114 115 116 117
        <%  if (errors.get("embeddedPort") != null) { %>

            <span class="jive-error-text"><br>
            Invalid port number.
            </span>

        <%  } %>
    </td>
    <td width="99%">
        <input type="text" size="6" maxlength="6" name="embeddedPort"
Matt Tucker's avatar
Matt Tucker committed
118
         value="<%= ((embeddedPort != -1) ? ""+embeddedPort : "9090") %>">
Matt Tucker's avatar
Matt Tucker committed
119 120
        <span class="jive-description">
        <br>
121
        Port number for the web-based admin console (default is 9090).
Matt Tucker's avatar
Matt Tucker committed
122 123 124
        </span>
    </td>
</tr>
125
<tr valign="middle">
Matt Tucker's avatar
Matt Tucker committed
126 127 128 129 130 131 132 133 134 135 136
    <td width="1%" nowrap>
        SSL Connections Enabled:
    </td>
    <td width="99%">
        <input type="radio" name="sslEnabled" value="true" id="rb01"
            <%= ((sslEnabled) ? " checked" : "") %>>
        <label for="rb01">Yes</label>
        &nbsp;
        <input type="radio" name="sslEnabled" value="false" id="rb02"
            <%= ((!sslEnabled) ? " checked" : "") %>>
        <label for="rb02">No</label>
Matt Tucker's avatar
Matt Tucker committed
137 138
        <span class="jive-description">
        <br>
Matt Tucker's avatar
Matt Tucker committed
139
        Enables or disables secure XMPP connections.
Matt Tucker's avatar
Matt Tucker committed
140
        </span>
Matt Tucker's avatar
Matt Tucker committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
    </td>
</tr>
</table>

<br><br>

<hr size="0">

<div align="right">
<input type="submit" name="continue" value=" Continue ">
</div>
</form>

<script language="JavaScript" type="text/javascript">
// give focus to domain field
document.f.domain.focus();
</script>

<%@ include file="setup-footer.jsp" %>