<%@ page session="false" %><%@ page import="com.opencms.flex.jsp.*,java.lang.*,java.util.*,org.opencms.modules.htmlimport.*,com.opencms.flex.util.*;" %><% // initialise Cms Action Element com.opencms.flex.jsp.CmsJspActionElement cms = new com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response); // Collect the objects required to access the OpenCms VFS from the request com.opencms.file.CmsObject cmsObject = cms.getCmsObject(); String uri = cmsObject.getRequestContext().getUri(); String locale = com.opencms.workplace.CmsXmlLanguageFile.getCurrentUserLanguage(cmsObject); CmsMessages messages = new CmsMessages("org/opencms/modules/htmlimport/workplace", locale); // get all request parameters String action = (String)request.getParameter("action"); String inputDir=(String)request.getParameter("inputDir"); String destinationDir=(String)request.getParameter("destinationDir"); String imageGallery=(String)request.getParameter("imageGallery"); String linkGallery=(String)request.getParameter("linkGallery"); String downloadGallery=(String)request.getParameter("downloadGallery"); String template=(String)request.getParameter("template"); String mode=(String)request.getParameter("mode"); String encoding=(String)request.getParameter("encoding"); if (inputDir==null) inputDir=""; if (destinationDir==null) destinationDir=""; if (imageGallery==null) imageGallery=""; if (linkGallery==null) linkGallery=""; if (downloadGallery==null) downloadGallery=""; if (template==null) template=""; if (encoding==null) encoding=""; if (mode==null) mode=""; // STEP 1 show the imput form if (action==null || action.equals("")) { %> Extended HTML-Import ';">

<%=messages.key("htmlimport.title") %>

File System Folder:
Destination in OpenCms:
Image Gallery:
External Link Gallery:
Download Gallery:
Template: <% out.println(org.opencms.modules.htmlimport.HtmlImportBackoffice.getTemplates(cmsObject,template)); %>
Mode:
Encoding:
">
<% // STEP 2 do the validation and show error output if nescessary } else if (action.equals("check")) { %> Extended HTML-Import ';"> <% // get the HtmlImport // do some validation checks boolean importMode; if (mode.equals("true")) { importMode=true; } else { importMode=false; } if ((encoding==null) || (encoding.length()==0)) { encoding="ISO-8859-1"; } HtmlImport imp = new HtmlImport(cmsObject,inputDir,destinationDir,imageGallery,linkGallery,downloadGallery,template,encoding,importMode); try { // check the parameters imp.checkParameters(); out.println("

"+messages.key("htmlimport.importing.title")+"

"); out.println("

"+messages.key("htmlimport.importing.message")+"

"); // no errors, so start the import imp.doImport(); %>
<% // there were some errors during parameter validation } catch (CmsParameterValidationException ex) { out.println("

"+messages.key("htmlimport.error.title")+"

"); out.println(messages.key("htmlimport.error.message")+"

"); out.println(ex); %>
">
<% } // catch %> <% // STEP3 make some log output during import, refresh every two seconds } else if (action.equals("process")) { %> Extended HTML-Import ';init();"> <% // make the output out.println("

"+messages.key("htmlimport.importing.title")+"

"); out.println("

"+messages.key("htmlimport.importing.message")+"

"); out.println("
"); out.println(HtmlImport.getThreadOutput()); //check if the import thread is alive, if not, go to the end screen if (!HtmlImport.threadAlive()) {%>
<%}%> <% // STEP 4 The last screen with the report summary } else { %> Extended HTML-Import ';"> <% out.println("

"+messages.key("htmlimport.completed.title")+"

"); out.println("

"+messages.key("htmlimport.completed.message")+"

"); out.println("
"); out.println(HtmlImport.getThreadOutput()); %> <%}%>