<%@ page contentType="text/html;charset=GBK" %>
<%
/**
 *	$RCSfile: index.jsp,v $
 *	$Revision: 1.1.1.1 $
 *	$Date: 2002/09/09 13:50:16 $
 */
%>

<%@ page import="java.io.*,
                 java.lang.reflect.*,
                 java.util.*"
%>

<%	// Jive installation check. Load the Jive classes by reflection because
    // the Jive classes may or may not be installed.

	boolean doSetup = false;
    boolean configurationError = false;
    // Try loading a Jive class:
    try {
        Class jiveGlobals = Class.forName("com.jivesoftware.forum.JiveGlobals");
        // authorization class used below
        Class authorization = Class.forName("com.jivesoftware.forum.Authorization");
        Class[] params = new Class[1];
        params[0] = "".getClass();
        Method getJiveProperty = jiveGlobals.getMethod("getJiveProperty", params);
        if (getJiveProperty == null) {
            doSetup = true;
        }
        else {
            // Call JiveGlobals.getJiveProperty("setup")
            String[] args = {"setup"};
            Object setupVal = getJiveProperty.invoke(null, args);
            if (setupVal == null) {
                doSetup = true;
            }
            else {
                String setup = (String)setupVal;
                if (!"true".equals(setup)) {
                    doSetup = true;
                }
            }
        }
    }
    catch (Exception e) {
        doSetup = true;
    }
    catch (Throwable t) {
        // catch run time errors, like class loader issues (usually happens
        // if the jiveHome path is configured incorrectly, etc)
        configurationError = true;
    }

	// If we need to run the Jive setup tool, give the user a link to the setup
    // tool.
	if (doSetup || configurationError) { %>
		<html>
		<head>
		<title>Jive 论坛管理</title>
		</head>
		<body>
        <font face="arial,helvetica,sans-serif" color="#333333">
        <b>Jive 论坛管理</b>
        </font>
        <ul>
            <font size="-1" face="arial,helvetica,sans-serif">
        <%  if (doSetup) { %>
		    Jive没有被恰当的配置或者是第一次运行。
            <p>
            <a href="setup/setup.jsp">进入安装工具</a>
        <%  } %>

        <%  if (configurationError) { %>
		    发生普通错误。这通常是因为Jive没有正确的安装，特殊情况下，Jive可能没有在<font color="#336600">jive_init.properties</font>文件中所指出的地方找到你的<font color="#336600">jiveHome</font> 目录。在你试图更正问题前请参考安装文档。请记住：如果你修改了<font color="#336600">jive_init.properties</font>文件你需要重新启动应用服务器以使修改生效。
        <%  } %>
            </font>
        </ul>
		</body>
		</html>
<%		// for some reason, we have to call flush.. some app servers won't
		// display the above html w/o flushing the stream
		out.flush();
		return;
	}

    // Check to see if we've already logged into this tool.
	com.jivesoftware.forum.Authorization authToken = (com.jivesoftware.forum.Authorization)session.getAttribute("jive.admin.authorization");
	if (authToken == null) {
		response.sendRedirect("login.jsp");
		return;
	}

    // logout if requested:
	if ("true".equals(request.getParameter("logout"))) {
		try {
			session.removeAttribute("jive.admin.authorization");
		}
		catch (IllegalStateException ignored) { // if session is already invalid
		}
		finally {
			response.sendRedirect("index.jsp");
			return;
		}
	}
%>

<html>
<head>
<title>Jive 论坛管理</title>
</head>

<frameset rows="90,*" bordercolor="#0099cc" border="0" frameborder="0" framespacing="0" style="background-color:#0099cc">
	<frame src="tabs.jsp" name="header" scrolling="no" marginheight="0" marginwidth="0" noresize>
	<frameset cols="175,*" bordercolor="#0099cc" border="0" frameborder="0" style="background-color:#0099cc">
		<frame src="sidebar.jsp" name="sidebar" scrolling="auto" marginheight="0" marginwidth="0" noresize>
		<frameset rows="*" bordercolor="#0099cc" border="0" frameborder="0" style="background-color:#0099cc">
			<frame src="main.jsp" name="main" scrolling="auto" noresize>
		</frameset>
	</frameset>
</frameset>

</html>


