alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  
<td width="100%" nowrap> <a class="nav" href="<%=indexUrl%>"> »  <a class="nav" href="index">Admin CP »  <a class="nav" href="misctasks">Miscellaneous Tasks »  Import/Export Data </td> </tr> </table> <br/> <table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center"> <tr class="pagedesc"> <td> This page allows you to:<br/>   -- backup/export data from <b><%=MVNForumInfo.getProductDesc()%> and eventually download it to your computer (whether you choose to download it or not, the file will be left in the backup repository on the server)<br/>   -- restore data from previous backups<br/>   -- import data from some other source (for example, from another forum system).<br/> <span class="warning">WARNING: DURING THE IMPORT ALL EXISTING DATA WILL BE DESTROYED!</span> You may consider <a href="#exportbackup" class="command">backing up current data before replacing them with new ones.<br/> After completion of import, you will be automatically logged out and left with status and error messages that eventually rised during the process. If you want to continue your work, you will have to login again (you must login as one of <span class="warning">newly-imported users, and not with your current account, since it will be destroyed during the process).<br/> <%if ( permission.canAdminSystem() ) {%> <a href="#importrestore" class="command">Import/Restore Data
<a href="#importmigrate" class="command">Import/Migrate from Jive
<a href="#exportbackup" class="command">Export/Backup Data
<%}%> </td> </tr> </table> <br/> <%-- IMPORTANT: these three forms have a couple of same fields. Those fields MUST have same names in all forms, so a WebHandler can handle all of them at once. --%> <%-- ================================================================== ====== RESTORE (import from mvnForum XML, or mvnForum ZIP) ======= ================================================================== --%> <% Vector backupFilesOnServer = (Vector)request.getAttribute("BackupFilesOnServer"); %> <a name="importrestore"/> <form method="post" action="importprocess" enctype="multipart/form-data" name="restoreform"> <table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center"> <tr class="theader"> <td>Restore Data </tr> <tr class="trow1"> <td align="left" valign="top"> <table width="100%" cols="2" align="center" border="0" bordercolor="#000000"> <tr class="trow1"> <td width="50%" align="left">Choose backup file to restore from: <td width="50%" align="right">Refresh file list </tr> </table> <table width="95%" cols="3" align="center" border="0" bordercolor="#000000"> <% int i=0; if (backupFilesOnServer!=null) { for (i=0; i<backupFilesOnServer.size(); i++) { String serverFilename=(String)backupFilesOnServer.elementAt(i);%> <%--
--%> <tr class="trow2"> <td align="left"> <input type="radio" name="ServerImportFile" value="<%=serverFilename%>"> <b><%=serverFilename%> </td> <td align="center" width="100"> <a href="getexportprocess?filename=<%=serverFilename%>" class="command">Download </td> <td align="center" width="100"> <a href="deleteexportprocess?filename=<%=serverFilename%>" class="command">Delete </td> </tr> <%} //for } /*if (backupFilesOnServer!=null)*/%> <%-- --%> <tr class="trow1"> <td align="left" colspan="3"> <input type="radio" name="ServerImportFile" value="" checked> Other: <input type="file" value="Browse" name="ClientImportFile" size="52"/> </td> </tr> </table> </td> </tr> <tr class="trow2"> <td align="left"> Backup file type:<br/>    <input type="radio" name="ImportType" value="<%=MVNForumConfig.IMPORTEXPORT_TYPE_MVN_XML%>" checked> mvnForum XML (import only database info, no attachments, message folders, avatars, ...)<br/>    <input type="radio" name="ImportType" value="<%=MVNForumConfig.IMPORTEXPORT_TYPE_MVN_ZIP%>"> mvnForum ZIP (also import attachments, avatars, message folders)<br/> </td> </tr> <tr class="trow1"> <td align="left"> In case of error...<br/>    <input type="radio" name="ClearIfError" value="1" checked> clear the database and create default admin member (password will be "admin")<br/>    <input type="radio" name="ClearIfError" value="0"> do not clear the database and do not create default admin member <br/> We strongly suggest you to leave the previous option on (so you don't end up with an invalid forum state).<br/> If errors occur, try to correct them before retrying import. And for your security, remember to change your password after completition. </td> </tr> <tr class="trow2"> <td align="center"> <select name="MessageLevel" size="1"> <option value="<%=MVNForumConfig.MESSAGE_LEVEL_ALL_MESSAGES%>" selected>Output all messages during the process <option value="<%=MVNForumConfig.MESSAGE_LEVEL_IMPORTANT_MESSAGES%>">Output only errors and important messages <option value="<%=MVNForumConfig.MESSAGE_LEVEL_ONLY_ERRORS%>">Output only error messages </select> </td> </tr> <tr class="trowfinal"> <td align="center"> <input type="button" name="submitbutton" value="Import/Restore" onclick="javascript:Submit_RestoreForm();" class="mainoption"> <input type="reset" value="Reset" class="liteoption"> </td> </tr> </table> </form> <br/> <br/> <%-- =================================================================== ============== MIGRATE (import from Jive Forums XML) ============== =================================================================== --%> <a name="importmigrate"/> <form method="post" action="importprocess" enctype="multipart/form-data" name="migrateform"> <table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center"> <tr class="theader"> <td colspan="2">Migrate from other sources </tr> <tr class="trow1"> <td colspan="2" align="center" valign="top"> Input file to import from: <input type="file" value="Browse" name="ClientImportFile" size="52"> </td> </tr> <tr class="trow2"> <td colspan="2" align="left"> Import file type:<br/>    <input type="radio" name="ImportType" value="<%=MVNForumConfig.IMPORTEXPORT_TYPE_JIVE_XML%>" checked> Jive XML (xmlversion="1.0", http://www.jivesoftware.com/jive.dtd) </td> </tr> <tr class="trow1"> <td align="right" valign="top"> Enter Jive's admin username (will be created if it doesn't already exist): </td> <td width="35%" align="left" valign="top"> <input type="text" value="Admin" name="JiveAdmin" size="32"> </td> </tr> <tr class="trow2"> <td align="right" valign="top"> Enter mvnForum's virtual Guest username (will be created): </td> <td width="35%" align="left" valign="top"> <input type="text" value="<%=MVNForumConfig.getDefaultGuestName()%>" name="JiveGuest" size="32"> </td> </tr> <tr class="trow1"> <td align="right" valign="top"> Set all forum passwords to (not implemented - please leave empty): </td> <td width="35%" align="left" valign="top"> <input type="text" value="" name="ForumPasswords" size="32"/> </td> </tr> <tr class="trow2"> <td align="right" valign="top"> Put all Jive forums into the root category named: </td> <td width="35%" align="left" valign="top"> <input type="text" value="General" name="RootCategory" size="32"/> </td> </tr> <tr class="trow1"> <td align="right" valign="top"> Root category description: </td> <td width="35%" align="left" valign="top"> <input type="text" value="Forums imported from Jive" name="RootCategoryDesc" size="40"/> </td> </tr> <tr class="trow2"> <td colspan="2" align="left"> In case of error...<br/>    <input type="radio" name="ClearIfError" value="1" checked> clear the database and create default "admin" member (password will be also "admin")<br/>    <input type="radio" name="ClearIfError" value="0"> do not clear the database and do not create default "admin" member <br/> We strongly suggest you to leave the previous option on (so you don't end up with an invalid forum state).<br/> If errors occur, try to correct them before retrying import. And for your security, remember to change your password after completition. </td> </tr> <tr class="trow1"> <td colspan="2" align="center"> <select name="MessageLevel" size="1"> <option value="<%=MVNForumConfig.MESSAGE_LEVEL_ALL_MESSAGES%>" selected>Output all messages during the process <option value="<%=MVNForumConfig.MESSAGE_LEVEL_IMPORTANT_MESSAGES%>">Output only errors and important messages <option value="<%=MVNForumConfig.MESSAGE_LEVEL_ONLY_ERRORS%>">Output only error messages </select> </td> </tr> <tr class="trowfinal"> <td colspan="2" align="center"> <input type="button" name="submitbutton" value="Import/Migrate" onclick="javascript:Submit_MigrateForm();" class="mainoption"> <input type="reset" value="Reset" class="liteoption"> </td> </tr> </table> </form> <br/> <br/> <%-- ================================================================== ======= BACKUP (export to mvnForum XML, or mvnForum ZIP) ========= ================================================================== --%> <a name="exportbackup"/> <form method="post" action="exportprocess" name="backupform"> <table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center"> <tr class="theader"> <td>Export/Backup Data </tr> <tr class="trow1"> <td align="left"> Choose destination file type:<br/>    <input type="radio" name="ExportType" value="<%=MVNForumConfig.IMPORTEXPORT_TYPE_MVN_XML%>" checked> XML (export only database info, no attachments, message folders, avatars, ...)<br/>    <input type="radio" name="ExportType" value="<%=MVNForumConfig.IMPORTEXPORT_TYPE_MVN_ZIP%>"> ZIP (also export attachments, avatars, message folders) </td> </tr> <tr class="trowfinal"> <td align="center"> <input type="button" name="submitbutton" value="Export/Backup" onclick="javascript:Submit_BackupForm();" class="mainoption"> <input type="reset" value="Reset" class="liteoption"> </td> </tr> </table> </form> <br/> </fmt:bundle> <%@ include file="footer.jsp"%> </body> </html>

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

<%--
 - $Header: /cvsroot/mvnforum/mvnforum/srcweb/mvnplugin/mvnforum/admin/importexport.jsp,v 1.25 2005/01/18 11:01:37 minhnn Exp $
 - $Author: minhnn $
 - $Revision: 1.25 $
 - $Date: 2005/01/18 11:01:37 $
 -
 - ====================================================================
 -
 - Copyright (C) 2002-2005 by MyVietnam.net
 -
 - This program is free software; you can redistribute it and/or
 - modify it under the terms of the GNU General Public License
 - as published by the Free Software Foundation; either version 2
 - of the License, or any later version.
 -
 - All copyright notices regarding mvnForum MUST remain intact
 - in the scripts and in the outputted HTML.
 - The "powered by" text/logo with a link back to
 - http://www.mvnForum.com and http://www.MyVietnam.net in the
 - footer of the pages MUST remain visible when the pages
 - are viewed on the internet or intranet.
 -
 - This program is distributed in the hope that it will be useful,
 - but WITHOUT ANY WARRANTY; without even the implied warranty of
 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 - GNU General Public License for more details.
 -
 - You should have received a copy of the GNU General Public License
 - along with this program; if not, write to the Free Software
 - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 -
 - Support can be obtained from support forums at:
 - http://www.mvnForum.com/mvnforum/index
 -
 - Correspondence and Marketing Questions can be sent to:
 - info@MyVietnam.net
 -
 - @author: Igor Manic   imanic@users.sourceforge.net
 --%>
<%@ page contentType="text/html;charset=utf-8" %>
<%@ page errorPage="fatalerror.jsp" %>
<%@ page import="java.util.Vector" %>
<%@ page import="com.mvnforum.MVNForumConfig" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ include file="inc_common.jsp"%>
<fmt:bundle basename="mvnForum_i18n">
<html>
<head>
  <title> - Import/Export Data
<%@ include file="/mvnplugin/mvnforum/meta.jsp"%>
<link href="<%=onlineUser.getCssPath()%>" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<%@ include file="inc_js_checkvalid_myvietnamlib.jsp"%>
<script type="text/javascript">
function Submit_RestoreForm() {
  if (Validate_RestoreForm() == true ) {
    document.restoreform.submitbutton.disabled=true;
    document.restoreform.submit();
  }
}
function Submit_MigrateForm() {
  if (Validate_MigrateForm() == true ) {
    document.migrateform.submitbutton.disabled=true;
    document.migrateform.submit();
  }
}
function Submit_BackupForm() {
  if (Validate_BackupForm() == true ) {
    document.backupform.submitbutton.disabled=true;
    document.backupform.submit();
  }
}

function Validate_RestoreForm() {
  //@todo: if value of restoreform.ServerImportFile is empty, then
  //       value of field restoreform.ClientImportFile should be non-empty
  //return true;
  if (isBlank(document.restoreform.ClientImportFile, "Import input file"))
    return false;
  else
    return true;
}

function Validate_MigrateForm() {
  if (isBlank(document.migrateform.ClientImportFile, "Import input file")) return false;
  if (isBlank(document.migrateform.JiveAdmin, "Admin username")) return false;
  if (isBlank(document.migrateform.JiveGuest, "Guest username")) return false;
  if (isBlank(document.migrateform.RootCategory, "Root category name")) return false;
  return true;
}

function Validate_BackupForm() {
  return true;
}
</script>

<%@ include file="header.jsp"%>
<br/>

<table width="95%" align="center">
  <tr class="nav">
    <td>
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.