/** * $RCSfile: importGateway.jsp,v $ * $Revision: 1.1.2.1 $ * $Date: 2003/02/05 21:28:52 $ */ %> java.text.*, com.jivesoftware.util.*, com.jivesoftware.forum.*, com.jivesoftware.forum.gateway.*, com.jivesoftware.forum.util.*" %> long forumID = ParamUtils.getLongParameter(request,"forum",-1L); boolean doRunOnce = ParamUtils.getBooleanParameter(request, "doRunOnce"); String exportAfter = ParamUtils.getParameter(request, "exportAfter", false); String installType = ParamUtils.getParameter(request, "installType"); int index = ParamUtils.getIntParameter(request, "index", -1); // Go back to the gateways page if "cancel" is clicked: String submitButton = ParamUtils.getParameter(request, "submitButton"); if ("Cancel".equals(submitButton)) { response.sendRedirect("gateways.jsp?forum="+forumID); return; } if (doRunOnce) { if (installType == null) { // no choice selected, redirect back to this page response.sendRedirect("gateways.jsp?forum="+forumID); return; } else { // redirect to the specific edit page if ("email".equals(installType)) { response.sendRedirect("editEmailGateway.jsp?forum="+forumID+"&add=true&importOnce=true"); } else if ("news".equals(installType)) { response.sendRedirect("editNewsgroupGateway.jsp?forum="+forumID+"&add=true&importOnce=true"); } else if ("mbox".equals(installType)) { response.sendRedirect("editMboxGateway.jsp?forum="+forumID+"&importOnce=true"); } else { response.sendRedirect("gateways.jsp?forum="+forumID); } return; } } // Get the Forum Forum forum = forumFactory.getForum(forumID); // Get a GatewayManager from the forum GatewayManager gatewayManager = forum.getGatewayManager(); // Check to see if any of the gateways are installed boolean isEmailGatewayInstalled = false; boolean isNewsGatewayInstalled = false; int gatewayCount = gatewayManager.getGatewayCount(); for (int i=0; i try { if (gatewayManager.getGateway(i) instanceof EmailGateway || gatewayManager.getGateway(i) instanceof ImapGateway) { isEmailGatewayInstalled = true; } else if (gatewayManager.getGateway(i) instanceof NewsgroupGateway) { isNewsGatewayInstalled = true; } } catch (Exception ignored) {} } %> String title = "Import Data"; String[][] breadcrumbs = { {"Main", "main.jsp"}, {"Forums", "forums.jsp"}, {"Edit Forum", "editForum.jsp?forum="+forumID}, {"Gateways", "gateways.jsp?forum="+forumID}, {"Import Data", "importGateway.jsp?forum="+forumID} }; %> // if there are gateways to display gatewayCount = gatewayManager.getGatewayCount(); %> Import all messages into this forum from 0) { %>an existing gateway or a new gateway. 0) { %> Installed Gateway Import all available messages from an existing gateway. SOURCE IMPORT for (int i=0; i Gateway gateway = gatewayManager.getGateway(i); boolean isEmailGateway = (gateway instanceof EmailGateway || gateway instanceof ImapGateway); boolean isNewsgroupGateway = (gateway instanceof NewsgroupGateway); %> String displayName = ""; if (isEmailGateway) { if (gateway instanceof EmailGateway) { EmailGateway emailGateway = (EmailGateway) gateway; Pop3Importer pop3Importer = (Pop3Importer) emailGateway.getGatewayImporter(); displayName = pop3Importer.getHost(); } else if (gateway instanceof ImapGateway) { ImapGateway imapGateway = (ImapGateway) gateway; ImapImporter imapImporter = (ImapImporter) imapGateway.getGatewayImporter(); displayName = imapImporter.getHost(); } %> Email: NewsgroupGateway newsgroupGateway = (NewsgroupGateway) gateway; NewsgroupImporter newsgroupImporter = (NewsgroupImporter) newsgroupGateway.getGatewayImporter(); displayName = newsgroupImporter.getNewsgroup(); if (displayName == null) { displayName = newsgroupImporter.getHost(); } %> News: > > > > 0 %> Import Once Import all available messages from a new gateway. Email Gateway -- Import all available messages from an email account or mailing list. Newsgroup Gateway -- Import all available messages from a NNTP newsgroup. Mbox Gateway -- Import all available message from a mbox file.