ktlili      2005/08/25 11:36:40 CEST

  Modified files:
    core/src/java/org/jahia/clipbuilder/html/struts 
                                                    BrowseAction.java 
                                                    
DescriptionClipperAction.java 
                                                    EditAction.java 
                                                    ManageAction.java 
                                                    SelectPartAction.java 
                                                    TestClipperAction.java 
    core/src/java/org/jahia/clipbuilder/html/struts/Util 
                                                         
AbstractWizardAction.java 
                                                         Constants.java 
  Log:
  - synchronize whith clipbuilder.jar lib
  
  Revision  Changes    Path
  1.2       +17 -16    
jahia/core/src/java/org/jahia/clipbuilder/html/struts/BrowseAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/clipbuilder/html/struts/BrowseAction.java.diff?r1=1.1&r2=1.2&f=h
  1.2       +1 -5      
jahia/core/src/java/org/jahia/clipbuilder/html/struts/DescriptionClipperAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/clipbuilder/html/struts/DescriptionClipperAction.java.diff?r1=1.1&r2=1.2&f=h
  1.2       +25 -19    
jahia/core/src/java/org/jahia/clipbuilder/html/struts/EditAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/clipbuilder/html/struts/EditAction.java.diff?r1=1.1&r2=1.2&f=h
  1.2       +32 -11    
jahia/core/src/java/org/jahia/clipbuilder/html/struts/ManageAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/clipbuilder/html/struts/ManageAction.java.diff?r1=1.1&r2=1.2&f=h
  1.2       +111 -76   
jahia/core/src/java/org/jahia/clipbuilder/html/struts/SelectPartAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/clipbuilder/html/struts/SelectPartAction.java.diff?r1=1.1&r2=1.2&f=h
  1.2       +4 -4      
jahia/core/src/java/org/jahia/clipbuilder/html/struts/TestClipperAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/clipbuilder/html/struts/TestClipperAction.java.diff?r1=1.1&r2=1.2&f=h
  1.2       +31 -28    
jahia/core/src/java/org/jahia/clipbuilder/html/struts/Util/AbstractWizardAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/clipbuilder/html/struts/Util/AbstractWizardAction.java.diff?r1=1.1&r2=1.2&f=h
  1.2       +1 -1      
jahia/core/src/java/org/jahia/clipbuilder/html/struts/Util/Constants.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/clipbuilder/html/struts/Util/Constants.java.diff?r1=1.1&r2=1.2&f=h
  
  
  
  Index: BrowseAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/clipbuilder/html/struts/BrowseAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BrowseAction.java 19 Aug 2005 13:42:49 -0000      1.1
  +++ BrowseAction.java 25 Aug 2005 09:36:39 -0000      1.2
  @@ -16,7 +16,6 @@
   import org.jahia.clipbuilder.html.web.http.*;
   
   
  -
   /**
    *  Description of the Class
    *
  @@ -96,11 +95,12 @@
                String hash = HashUtilities.buildManulUrlHash(newUrl);
                String from = WebConstants.FROM_MANUAL;
                URLWrapper wrapper = new URLWrapper(newUrl, from, "GET", null, 
hash);
  -                SessionManager.getURLMap(request).addSourceUrl(wrapper,hash);
  +             URLMap map = 
SessionManager.getHTMLDocumentBuilder(request).getUrlMap();
  +             map.addSourceUrl(wrapper, hash);
   
  -                //set webBrowser parama
  -                webForm.setFrom(from);
  -                webForm.setLinkHash(hash);
  +             //set webBrowser parama
  +             webForm.setFrom(from);
  +             webForm.setLinkHash(hash);
                webForm.setShow(Constants.WEB_BROWSER_SHOW_BROWSE);
   
                return actionMapping.getInputForward();
  @@ -113,30 +113,31 @@
         *
         [EMAIL PROTECTED]  actionMapping        Description of Parameter
         [EMAIL PROTECTED]  actionForm           Description of Parameter
  -      [EMAIL PROTECTED]  httpServletRequest   Description of Parameter
  -      [EMAIL PROTECTED]  httpServletResponse  Description of Parameter
  +      [EMAIL PROTECTED]  request              Description of Parameter
  +      [EMAIL PROTECTED]  response             Description of Parameter
         [EMAIL PROTECTED]                      Description of the Returned 
Value
         [EMAIL PROTECTED]  Exception        Description of Exception
         */
  -     public ActionForward goToNextStep(ActionMapping actionMapping, 
ActionForm actionForm, HttpServletRequest httpServletRequest, 
HttpServletResponse httpServletResponse) throws Exception {
  +     public ActionForward goToNextStep(ActionMapping actionMapping, 
ActionForm actionForm, HttpServletRequest request, HttpServletResponse 
response) throws Exception {
                BrowseForm browseForm = (BrowseForm) actionForm;
   
                //init bean from browse
  -             updateSessionAttributes(httpServletRequest, Constants.BROWSE);
  +             updateSessionAttributes(request, Constants.BROWSE);
                //Set the statut of the recording bean
  -             HttpSession session = httpServletRequest.getSession();
  -             RecordingBean rb = (RecordingBean) 
session.getAttribute(WebConstants.RECORDING);
  +             HttpSession session = request.getSession();
  +
  +             RecordingBean rb = SessionManager.getRecorderBean(request);
                rb.setStatut(RecordingBean.STOP);
  -             session.setAttribute(WebConstants.RECORDING, rb);
  +             SessionManager.setRecorderBean(request, rb);
   
                //init the selectPart and edit part
                session.setAttribute(Constants.SELECTPART_FORM, new 
SelectPartForm());
   
                //test if at leat one url has been recorded
  -             ClipperBean bean = 
SessionManager.getClipperBean(httpServletRequest);
  +             ClipperBean bean = SessionManager.getClipperBean(request);
                if (bean.isEmpty()) {
                        logger.warn("[ No url has been recorded]");
  -                     return browse(actionMapping, actionForm, 
httpServletRequest, httpServletResponse);
  +                     return browse(actionMapping, actionForm, request, 
response);
                }
                logger.debug("[go to select part]");
   
  @@ -461,11 +462,11 @@
         *  cssBool = false;
         *  }
         *  //set headers
  -      *  org.apache.commons.httpclient.Header[] headers = new 
org.apache.commons.httpclient.Header[1];
  +      *  org.org.apache.commons.httpclient.Header[] headers = new 
org.org.apache.commons.httpclient.Header[1];
         *  headers = null;
         *  String encodingValue = response.getCharacterEncoding();
         *  logger.debug("[ Encoding is " + encodingValue + " ]");
  -      *  //headers[0] = new 
org.apache.commons.httpclient.Header("Content-Type", "text/html; 
charset="+encodingValue);
  +      *  //headers[0] = new 
org.org.apache.commons.httpclient.Header("Content-Type", "text/html; 
charset="+encodingValue);
         *  //configure the builder
         *  builder.configure(clientType, 
parserType,browserJavascriptEvent,browserJavascriptCode, javascriptBool, 
cssBool, headers);
         *  // execute
  
  
  
  Index: DescriptionClipperAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/clipbuilder/html/struts/DescriptionClipperAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DescriptionClipperAction.java     19 Aug 2005 13:42:49 -0000      1.1
  +++ DescriptionClipperAction.java     25 Aug 2005 09:36:39 -0000      1.2
  @@ -67,11 +67,7 @@
                //init Wizard
                updateSessionAttributes(request, Constants.DESCRIPTION);
                logger.debug("add sourceUrl ");
  -             URLWrapper uw = new URLWrapper();
  -             uw.setSourceUrl(form.getWebClippingTargetUrl());
  -             uw.setMethod("GET");
  -             uw.setFrom(Constants.FIRST_URL_HASH);
  -             SessionManager.getURLMap(request).addSourceUrl(uw, 
Constants.FIRST_URL_HASH);
  +
   
                //request.getSession().setAttribute(Constants.BROWSE_FORM, new 
BrowseForm());
   
  
  
  
  Index: EditAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/clipbuilder/html/struts/EditAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EditAction.java   19 Aug 2005 13:42:49 -0000      1.1
  +++ EditAction.java   25 Aug 2005 09:36:39 -0000      1.2
  @@ -48,13 +48,23 @@
                return map;
        }
   
  -        public ActionForward view(ActionMapping actionMapping, ActionForm 
actionForm, HttpServletRequest httpServletRequest, HttpServletResponse 
httpServletResponse) {
  -           logger.debug("[ View ]");
  -           AbstractWizardForm form = (AbstractWizardForm) actionForm;
  -           
SessionManager.getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT);
   
  -           return actionMapping.getInputForward();
  -   }
  +     /**
  +      *  Description of the Method
  +      *
  +      [EMAIL PROTECTED]  actionMapping        Description of Parameter
  +      [EMAIL PROTECTED]  actionForm           Description of Parameter
  +      [EMAIL PROTECTED]  httpServletRequest   Description of Parameter
  +      [EMAIL PROTECTED]  httpServletResponse  Description of Parameter
  +      [EMAIL PROTECTED]                      Description of the Returned 
Value
  +      */
  +     public ActionForward view(ActionMapping actionMapping, ActionForm 
actionForm, HttpServletRequest httpServletRequest, HttpServletResponse 
httpServletResponse) {
  +             logger.debug("[ View ]");
  +             AbstractWizardForm form = (AbstractWizardForm) actionForm;
  +             
SessionManager.getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT);
  +
  +             return actionMapping.getInputForward();
  +     }
   
   
   
  @@ -203,10 +213,7 @@
         [EMAIL PROTECTED]  httpServletResponse  Description of Parameter
         [EMAIL PROTECTED]                      Description of the Returned 
Value
         */
  -     public ActionForward validate(ActionMapping actionMapping,
  -                     ActionForm actionForm,
  -                     HttpServletRequest httpServletRequest,
  -                     HttpServletResponse httpServletResponse) {
  +     public ActionForward validate(ActionMapping actionMapping,ActionForm 
actionForm,HttpServletRequest httpServletRequest,HttpServletResponse 
httpServletResponse) {
                EditParamForm editParamForm = (EditParamForm) actionForm;
   
                //Retrieve the clipper
  @@ -224,17 +231,16 @@
                for (int i = 0; i < fBeanList.size(); i++) {
                        FormParamBean fBean = (FormParamBean) fBeanList.get(i);
                        String mapping = ((String[]) params.get("mapping"))[i];
  -                        String visibility = ((String[]) 
params.get("visibility"))[i];
  -                        String update = ((String[]) params.get("update"))[i];
  -                        String useAsDefaultValue = ((String[]) 
params.get("useAsDefaultValue"))[i];
  +                     String visibility = ((String[]) 
params.get("visibility"))[i];
  +                     String update = ((String[]) params.get("update"))[i];
  +                     String useAsDefaultValue = ((String[]) 
params.get("useAsDefaultValue"))[i];
                        //logger.debug("[ form param found: name," + name + " 
mapping " + mapping + "]");
                        fBean.setMapping(mapping);
  -                        fBean.setVisibility(visibility);
  -                        fBean.setUpdate(update);
  -                        fBean.setUseAsDefaultValue(useAsDefaultValue);
  +                     fBean.setVisibility(visibility);
  +                     fBean.setUpdate(update);
  +                     fBean.setUseAsDefaultValue(useAsDefaultValue);
                }
   
  -
                logger.debug("[ Validate action performed ]");
   
                return actionMapping.findForward("editParams");
  @@ -256,8 +262,8 @@
                int posUrl = Integer.parseInt(position);
   
                //Show the html document
  -                
SessionManager.getWebBrowserForm(httpServletRequest).setPositionUrl(posUrl);
  -                
SessionManager.getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_EDIPARAMS);
  +             
SessionManager.getWebBrowserForm(httpServletRequest).setPositionUrl(posUrl);
  +             
SessionManager.getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_EDIPARAMS);
                if (editParamForm.getShowHTML() != null) {
                        // Show label is selected: Get the document whit label
                        if (editParamForm.getShowLabel() != null) {
  
  
  
  Index: ManageAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/clipbuilder/html/struts/ManageAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ManageAction.java 19 Aug 2005 13:42:49 -0000      1.1
  +++ ManageAction.java 25 Aug 2005 09:36:39 -0000      1.2
  @@ -11,16 +11,18 @@
   import org.apache.struts.action.*;
   import org.apache.struts.actions.*;
   import org.jahia.clipbuilder.html.util.*;
  -import org.jahia.bin.*;
  -import org.jahia.params.*;
  -import org.jahia.services.sites.*;
  +import org.jdom.*;
  +import org.jahia.clipbuilder.html.struts.Util.*;
  +import org.jahia.bin.Jahia;
  +import org.jahia.params.ProcessingContext;
  +import org.jahia.services.sites.JahiaSite;
   
   /**
    *  Description of the Class
    *
    [EMAIL PROTECTED]    Tlili Khaled
    */
  -public class ManageAction extends LookupDispatchAction {
  +public class ManageAction extends AbstractWizardAction {
        private static org.apache.log4j.Logger logger = 
org.apache.log4j.Logger.getLogger(ManageAction.class);
   
   
  @@ -42,6 +44,16 @@
        }
   
   
  +     /**
  +      *  Gets the FormId attribute of the ManageAction object
  +      *
  +      [EMAIL PROTECTED]    The FormId value
  +      */
  +     public int getFormId() {
  +             return org.jahia.clipbuilder.html.struts.Util.Constants.MANAGE;
  +     }
  +
  +
   
        /**
         *  Gets the ClippersDirectoryPath attribute of the ManageAction object
  @@ -54,6 +66,7 @@
        }
   
   
  +
        /**
         *  Gets the ClippersDirectoryPathDeploy attribute of the ManageAction 
object
         *
  @@ -62,10 +75,9 @@
         */
        public String getClippersDirectoryPathDeploy(HttpServletRequest 
request) {
                JahiaSite jSite = (JahiaSite) 
request.getSession().getAttribute(ProcessingContext.SESSION_SITE);
  -        String siteKey = jSite.getSiteKey();
  +             String siteKey = jSite.getSiteKey();
                String webAppsDir = siteKey;
  -        System.out.println("khaled"+webAppsDir);
  -             return 
Jahia.getSettings().getJahiaNewWebAppsDiskPath()+File.separator + webAppsDir;
  +             return Jahia.getSettings().getJahiaNewWebAppsDiskPath() + 
File.separator + webAppsDir;
                //return 
getResources(request).getMessage("clippers.repository.deploy.path");
        }
   
  @@ -118,7 +130,8 @@
                ClipperBean cBean = cmBean.getClipperBean(fileName);
                String path = getClippersDirectoryPath(httpServletRequest) + 
File.separator + fileName + ".xml";
   
  -             //load the clipper
  +             // init and load the clipper
  +             cBean = new ClipperBean();
                cBean.loadFromXml(path);
   
                //generate clipper.xml file
  @@ -190,6 +203,7 @@
                try {
                        logger.debug("[ load clipper ]");
                        ManageClippersForm form = (ManageClippersForm) 
actionForm;
  +
                        boolean templateView = form.isTemplateView();
                        if (templateView) {
                                logger.debug(" [ load from xml ] ");
  @@ -237,7 +251,8 @@
         [EMAIL PROTECTED]                      Description of the Returned 
Value
         */
        public ActionForward init(ActionMapping actionMapping, ActionForm 
actionForm, HttpServletRequest request, HttpServletResponse 
httpServletResponse) {
  -             //super.init(actionMapping, actionForm, httpServletRequest, 
httpServletResponse);
  +             super.init(actionMapping, actionForm, request, 
httpServletResponse);
  +
                ManageClippersForm form = (ManageClippersForm) actionForm;
                form.setTemplateView(false);
   
  @@ -255,7 +270,7 @@
                        SessionManager.initSessionAttributes(request);
   
                        //load clippers
  -                     //loadListNameClippersFromDatabase(httpServletRequest);
  +                     //loadListNameClippersFromDatabase(request);
                        loadListNameClippersFromXmlDirectory(request);
                }
                catch (Exception ex) {
  @@ -267,6 +282,7 @@
        }
   
   
  +
        /**
         *  Description of the Method
         *
  @@ -291,7 +307,6 @@
   
                //Init the clippers Manager
                SessionManager.initSessionAttributes(request);
  -             //initClippersManagerBean(request);
   
                //load clippers
                loadListNameClippersFromDatabase(request);
  @@ -344,8 +359,14 @@
                ClipperBean cBean = cmBean.getClipperBean(fileName);
                String path = getClippersDirectoryPath(httpServletRequest) + 
File.separator + fileName + ".xml";
                logger.debug("[ Selected clipper is " + path + "]");
  +
  +             // init clipper bean
  +             cBean = new ClipperBean();
                cBean.loadFromXml(path);
   
  +             logger.debug("[ Save Xml document in clipper]");
  +             org.jdom.Document jdomDoc = cBean.buildXmlDocument().getDoc();
  +
                //load the clipperBean
                SessionManager.setClipperBean(httpServletRequest, cBean);
   
  
  
  
  Index: SelectPartAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/clipbuilder/html/struts/SelectPartAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SelectPartAction.java     19 Aug 2005 13:42:49 -0000      1.1
  +++ SelectPartAction.java     25 Aug 2005 09:36:39 -0000      1.2
  @@ -11,6 +11,8 @@
   import org.jahia.clipbuilder.html.web.html.Impl.ExtractorFilter.*;
   import org.apache.struts.action.*;
   import org.jahia.clipbuilder.html.util.ClassUtilities;
  +import org.jahia.clipbuilder.html.web.Url.UrlEncoderIF;
  +import org.jahia.clipbuilder.html.web.Url.UrlEncoderFactory;
   
   /**
    *  Description of the Class
  @@ -81,10 +83,10 @@
         [EMAIL PROTECTED]  httpServletResponse  Description of Parameter
         [EMAIL PROTECTED]                      Description of the Returned 
Value
         */
  -     public ActionForward doExtract(ActionMapping actionMapping, ActionForm 
actionForm, HttpServletRequest httpServletRequest, HttpServletResponse 
httpServletResponse) {
  +     public ActionForward doExtract(ActionMapping actionMapping, ActionForm 
actionForm, HttpServletRequest request, HttpServletResponse response) {
                SelectPartForm selectPartForm = (SelectPartForm) actionForm;
                //Get the ClipperBean object
  -             ClipperBean bean = 
SessionManager.getClipperBean(httpServletRequest);
  +             ClipperBean bean = SessionManager.getClipperBean(request);
   
                //set the selected part
                String selectedContent = selectPartForm.getSelectedContent();
  @@ -95,48 +97,10 @@
                HTMLDocument doc = bean.getLastRecordedUrlBean().getDocument();
   
                //set the HTMLFilter
  -             ExtractorFilter filter = null;
  -             logger.debug("[ Selected filter is: " + 
selectPartForm.getWebClippingTypeContent() + "]");
  -             String typeFilter = selectPartForm.getClippingMethod();
  -             String typeContent = selectPartForm.getWebClippingTypeContent();
  -
  -             //Manula selection
  -             if (typeFilter.equalsIgnoreCase("0")) {
  -                     if (typeContent.equalsIgnoreCase("0")) {
  -                             //Dynamic
  -                             filter = new StringTreeExtractorFilter(doc, 
selectedContent);
  -                     }
  -                     else if (typeContent.equalsIgnoreCase("1")) {
  -                             //static
  -                             filter = new 
SimpleExtractorFilter(selectedContent);
  -                     }
  -             }
  -             //chew
  -             else if (typeFilter.equalsIgnoreCase("1")) {
  -                     filter = new SimpleExtractorFilter(selectedContent);
  -             }
  -             //form
  -             else if (typeFilter.equalsIgnoreCase("3")) {
  -                     filter = new FormExtractorFilter();
  -             }
  -             //xpath
  -             else if (typeFilter.equalsIgnoreCase("4")) {
  -                     filter = new XPathExtractorFilter();
  -                     String xPath = selectPartForm.getWebClippingXPath();
  -                     ((XPathExtractorFilter) filter).setXPahKey(xPath);
  -             }
  -             //full document
  -             else if (typeFilter.equalsIgnoreCase("5")) {
  -                     filter = new FullWebPageExtractorFilter();
  -             }
  -
  -             //link
  -             else {
  -                     logger.error("[Unexpected value " + 
selectPartForm.getWebClippingTypeContent() + " ]");
  -             }
  +             ExtractorFilter filter = buildFilter(request,selectPartForm, 
selectedContent, doc);
   
                logger.debug("[ Selected content is " + selectedContent + " ]");
  -             setFilterBean(httpServletRequest, selectPartForm, filter);
  +             setClipperFilterBean(request, filter);
   
                return actionMapping.findForward("preview");
        }
  @@ -152,10 +116,7 @@
         [EMAIL PROTECTED]  httpServletResponse  Description of Parameter
         [EMAIL PROTECTED]                      Description of the Returned 
Value
         */
  -     public ActionForward chewPreview(ActionMapping actionMapping,
  -                     ActionForm actionForm,
  -                     HttpServletRequest request,
  -                     HttpServletResponse httpServletResponse) {
  +     public ActionForward chewPreview(ActionMapping actionMapping, 
ActionForm actionForm, HttpServletRequest request, HttpServletResponse 
httpServletResponse) {
                SelectPartForm selectPartForm = (SelectPartForm) actionForm;
                HttpSession session = request.getSession();
                // set the default preview form
  @@ -166,17 +127,10 @@
                selectPartForm.setSelectedContent(selectedContent);
   
                //set the HTMLFilter
  -             String hashSelectedPart = 
request.getParameter(ChewExtractorFilter.NAME_INPUT_PARAM);
  -             logger.debug("Selected tab: " + hashSelectedPart);
  -             ChewExtractorFilter filter = new ChewExtractorFilter();
  -             //set the key of the filter
  -             String hashKey = hashSelectedPart;
  -             String tagName = selectPartForm.getWebClippingTagName();
  -             filter.setHashKey(hashKey);
  -             filter.setTagNameKey(tagName);
  +             ChewExtractorFilter filter = buildChewFilter(request, 
selectPartForm);
   
                // set the filter
  -             setFilterBean(request, selectPartForm, filter);
  +             setClipperFilterBean(request, filter);
   
                return actionMapping.findForward("preview");
        }
  @@ -185,23 +139,23 @@
        /**
         *  Description of the Method
         *
  -      [EMAIL PROTECTED]  mapping              Description of Parameter
  -      [EMAIL PROTECTED]  actionForm           Description of Parameter
  -      [EMAIL PROTECTED]  request              Description of Parameter
  -      [EMAIL PROTECTED]  httpServletResponse  Description of Parameter
  -      [EMAIL PROTECTED]                      Description of the Returned 
Value
  +      [EMAIL PROTECTED]  mapping     Description of Parameter
  +      [EMAIL PROTECTED]  actionForm  Description of Parameter
  +      [EMAIL PROTECTED]  request     Description of Parameter
  +      [EMAIL PROTECTED]  response    Description of Parameter
  +      [EMAIL PROTECTED]             Description of the Returned Value
         */
  -     public ActionForward chewCut(ActionMapping mapping, ActionForm 
actionForm, HttpServletRequest request, HttpServletResponse 
httpServletResponse) {
  +     public ActionForward chewCut(ActionMapping mapping, ActionForm 
actionForm, HttpServletRequest request, HttpServletResponse response) {
                logger.debug("[ Action = chew cut ]");
                SelectPartForm selectPartForm = (SelectPartForm) actionForm;
   
  -                // set filter bean
  +             // set filter bean
                ChewExtractorFilter filter = new ChewExtractorFilter();
  -                filter.setTagNameKey(selectPartForm.getWebClippingTagName());
  -             setFilterBean(request, selectPartForm, filter);
  +             filter.setTagNameKey(selectPartForm.getWebClippingTagName());
  +             setClipperFilterBean(request, filter);
   
                //init target url
  -             boolean success = initTargetUrl(mapping, actionForm,request);
  +             boolean success = initTargetUrl(mapping, actionForm, request);
                if (!success) {
                        return mapping.findForward("description");
                }
  @@ -304,23 +258,106 @@
         *  Sets the Filter attribute of the SelectPartAction object
         *
         [EMAIL PROTECTED]  request  The new Filter value
  -      [EMAIL PROTECTED]  form     The new Filter value
         [EMAIL PROTECTED]  filter   The new Filter value
         */
  -     private void setFilterBean(HttpServletRequest request, SelectPartForm 
form, ExtractorFilter filter) {
  -             String enableCss = form.getWebClippingShowCss();
  +     private void setClipperFilterBean(HttpServletRequest request, 
ExtractorFilter filter) {
  +
  +             // set filter bean
  +             FilterBean filterBean = new FilterBean();
  +             filterBean.setKeyMap(filter.getKeyMap());
  +             filterBean.setMode(filter.getMode());
  +             filterBean.setName(filter.getName());
  +             
SessionManager.getClipperBean(request).setFilterBean(filterBean);
  +     }
  +
  +
  +     /**
  +      *  Description of the Method
  +      *
  +      [EMAIL PROTECTED]  selectPartForm   Description of Parameter
  +      [EMAIL PROTECTED]  selectedContent  Description of Parameter
  +      [EMAIL PROTECTED]  doc              Description of Parameter
  +      [EMAIL PROTECTED]                  Description of the Returned Value
  +      */
  +     private ExtractorFilter buildFilter(HttpServletRequest 
request,SelectPartForm selectPartForm, String selectedContent, HTMLDocument 
doc) {
  +             ExtractorFilter filter = null;
  +             logger.debug("[ Selected filter is: " + 
selectPartForm.getWebClippingTypeContent() + "]");
  +             String typeFilter = selectPartForm.getClippingMethod();
  +             String typeContent = selectPartForm.getWebClippingTypeContent();
  +             String enableCss = selectPartForm.getWebClippingShowCss();
  +
  +
  +             //Manula selection
  +             if (typeFilter.equalsIgnoreCase("0")) {
  +                     if (typeContent.equalsIgnoreCase("0")) {
  +                             //Dynamic
  +                             filter = new StringTreeExtractorFilter(doc, 
selectedContent);
  +                     }
  +                     else if (typeContent.equalsIgnoreCase("1")) {
  +                             //static
  +                             filter = new 
SimpleExtractorFilter(selectedContent);
  +                     }
  +             }
  +             //chew
  +             else if (typeFilter.equalsIgnoreCase("1")) {
  +                     filter =this.buildChewFilter(request,selectPartForm);
  +             }
  +             //form
  +             else if (typeFilter.equalsIgnoreCase("3")) {
  +                     filter = new FormExtractorFilter();
  +             }
  +             //xpath
  +             else if (typeFilter.equalsIgnoreCase("4")) {
  +                     filter = new XPathExtractorFilter();
  +                     String xPath = selectPartForm.getWebClippingXPath();
  +                     ((XPathExtractorFilter) filter).setXPahKey(xPath);
  +             }
  +             //full document
  +             else if (typeFilter.equalsIgnoreCase("5")) {
  +                     filter = new FullWebPageExtractorFilter();
  +             }
  +
  +             //link
  +             else {
  +                     logger.error("[Unexpected value " + 
selectPartForm.getWebClippingTypeContent() + " ]");
  +             }
  +
  +             //set css mode
                if (enableCss == null) {
                        filter.setMode(ExtractorFilter.MODE_WHITOUT_CSS);
                }
                else {
                        filter.setMode(ExtractorFilter.MODE_CSS);
                }
  -             FilterBean filterBean = new FilterBean();
  -             filterBean.setKeyMap(filter.getKeyMap());
  -             filterBean.setMode(filter.getMode());
  -             filterBean.setName(filter.getName());
   
  -             
SessionManager.getClipperBean(request).setFilterBean(filterBean);
  +
  +             return filter;
  +     }
  +
  +
  +     /**
  +      *  Description of the Method
  +      *
  +      [EMAIL PROTECTED]  request         Description of Parameter
  +      [EMAIL PROTECTED]  selectPartForm  Description of Parameter
  +      [EMAIL PROTECTED]                 Description of the Returned Value
  +      */
  +     private ChewExtractorFilter buildChewFilter(HttpServletRequest request, 
SelectPartForm selectPartForm) {
  +             ChewExtractorFilter filter = new ChewExtractorFilter();
  +             //set the key of the filter
  +             String hashKey = 
request.getParameter(ChewExtractorFilter.NAME_INPUT_PARAM);
  +             String tagName = selectPartForm.getWebClippingTagName();
  +             String enableCss = selectPartForm.getWebClippingShowCss();
  +             if (enableCss == null) {
  +                     filter.setMode(ExtractorFilter.MODE_WHITOUT_CSS);
  +             }
  +             else {
  +                     filter.setMode(ExtractorFilter.MODE_CSS);
  +             }
  +             filter.setHashKey(hashKey);
  +             filter.setTagNameKey(tagName);
  +             logger.debug("Selected Element: " + hashKey);
  +             return filter;
        }
   
   
  @@ -333,9 +370,7 @@
         [EMAIL PROTECTED]  httpServletRequest  Description of Parameter
         [EMAIL PROTECTED]                     Description of the Returned Value
         */
  -     private boolean initTargetUrl(ActionMapping actionMapping,
  -                     ActionForm actionForm,
  -                     HttpServletRequest httpServletRequest) {
  +     private boolean initTargetUrl(ActionMapping actionMapping, ActionForm 
actionForm, HttpServletRequest httpServletRequest) {
                SelectPartForm selectPartForm = (SelectPartForm) actionForm;
   
                //Get the url from the ClipperBean object
  
  
  
  Index: TestClipperAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/clipbuilder/html/struts/TestClipperAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestClipperAction.java    19 Aug 2005 13:42:49 -0000      1.1
  +++ TestClipperAction.java    25 Aug 2005 09:36:39 -0000      1.2
  @@ -80,8 +80,8 @@
                        SessionManager.setWebBrowserForm(httpServletRequest, w);
   
                        //init the url map
  -                     URLMap map = new URLMap();
  -                     SessionManager.setURLMap(httpServletRequest, map);
  +                     /*URLMap map = new URLMap();
  +                     SessionManager.setURLMap(httpServletRequest, map);*/
   
                        // set the list of parameter to be show
                        activateParamsList(form, httpServletRequest);
  @@ -197,11 +197,11 @@
                                        UrlBean uBean = (UrlBean) 
cBean.getUrlBean(i);
                                        String urlMessage[] = {"URL: " + 
uBean.getPosition() + ":" + uBean.getAbsoluteURL()};
                                        ActionError urlActionMessage = new 
ActionError("test.param.urlMessage", urlMessage);
  -                                     errors.add(null, urlActionMessage);
  +                                     
errors.add("test.param.urlMessage",urlActionMessage);
   
                                        String[] queryParamMessage = 
{"Parameter :" + currentQueryBean.getName()};
                                        ActionError queryParamActionMessage = 
new ActionError("test.param.urlMessage", queryParamMessage);
  -                                     errors.add(null, 
queryParamActionMessage);
  +                                     errors.add("test.param.urlMessage", 
queryParamActionMessage);
   
                                        // update found Errors value
                                        foundErros = true;
  
  
  
  Index: AbstractWizardAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/clipbuilder/html/struts/Util/AbstractWizardAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractWizardAction.java 19 Aug 2005 13:42:50 -0000      1.1
  +++ AbstractWizardAction.java 25 Aug 2005 09:36:40 -0000      1.2
  @@ -42,16 +42,6 @@
        }
   
   
  -     /**
  -      *  Gets the Param attribute of the ClipperAction object
  -      *
  -      [EMAIL PROTECTED]  httpServletRequest  Description of Parameter
  -      [EMAIL PROTECTED]                     The Param value
  -      */
  -     public Map getParam(HttpServletRequest httpServletRequest) {
  -             return 
org.jahia.clipbuilder.html.web.html.Impl.JDom.JDomHTMLTransformer.getParam(httpServletRequest);
  -     }
  -
   
        /**
         *  Gets the KeyMethodMap attribute of the AbstractWizardAction object
  @@ -73,22 +63,24 @@
         */
        public abstract int getFormId();
   
  +
        /**
         *  Description of the Method
         *
  -      [EMAIL PROTECTED]  httpServletRequest  Description of Parameter
  -      [EMAIL PROTECTED]  formId              Description of Parameter
  +      [EMAIL PROTECTED]  request  Description of Parameter
  +      [EMAIL PROTECTED]  formId   Description of Parameter
         */
  -     public void updateSessionAttributes(HttpServletRequest 
httpServletRequest, int formId) {
  -             ClipperBean cBean = 
SessionManager.getClipperBean(httpServletRequest);
  -             HttpSession session = httpServletRequest.getSession();
  +     public void updateSessionAttributes(HttpServletRequest request, int 
formId) {
  +             ClipperBean cBean = SessionManager.getClipperBean(request);
  +             HttpSession session = request.getSession();
                switch (formId) {
   
                        case Constants.MANAGE:
                        {
                                session.removeAttribute(Constants.TEST_FORM);
                                
session.removeAttribute(Constants.WEB_BROWSER_SIMULATOR);
  -                             session.removeAttribute(Constants.URL_MAP);
  +                                
SessionManager.removeHTMLDocumentBuilder(request);
  +
                        }
                        case Constants.DESCRIPTION:
                        {
  @@ -98,12 +90,13 @@
                                logger.debug("[Init ClipperBean]");
                                DescriptionClipperForm form = 
(DescriptionClipperForm) session.getAttribute(Constants.DESCRIPTION_FORM);
                                cBean.buildFromDescriptionForm(form);
  -                             
SessionManager.setClipperBean(httpServletRequest, cBean);
  -
  -                             logger.debug("[Init URLMap]");
  -                             URLMap map = new URLMap();
  -                             SessionManager.setURLMap(httpServletRequest, 
map);
  +                             SessionManager.setClipperBean(request, cBean);
   
  +                             /*
  +                              *  logger.debug("[Init URLMap]");
  +                              *  URLMap map = new URLMap();
  +                              *  SessionManager.setURLMap(request, map);
  +                              */
                                logger.debug("[Init RecordingBean]");
                                RecordingBean rc = new 
RecordingBean(RecordingBean.STOP);
   
  @@ -119,18 +112,16 @@
   
                                // Clean the url parameters config
                                logger.debug("[ clear url param config ]");
  -                             cBean = 
SessionManager.getClipperBean(httpServletRequest);
  +                             cBean = SessionManager.getClipperBean(request);
   
  -                             logger.debug("[ clear url param config ]");
  +                             logger.debug("[ init webBrowserForm]");
                                WebBrowserForm w = new WebBrowserForm();
                                w.setShow(Constants.WEB_BROWSER_SHOW_BROWSE);
  -                             
SessionManager.setWebBrowserForm(httpServletRequest, w);
  +                             SessionManager.setWebBrowserForm(request, w);
   
  -                             logger.debug("[ Remove Web Client ]");
  -                             
SessionManager.removeWebClient(httpServletRequest);
  +                             logger.debug("[ HTMLDocuementBuilder Web Client 
]");
  +                             
SessionManager.removeHTMLDocumentBuilder(request);
   
  -                             logger.debug("[ removeHttpState ]");
  -                             
SessionManager.removeHttpState(httpServletRequest);
   
                        }
                        case Constants.SELECTPART:
  @@ -150,6 +141,7 @@
        }
   
   
  +
        /**
         *  Description of the Method
         *
  @@ -229,6 +221,17 @@
        }
   
   
  +     /**
  +      *  Gets the Param attribute of the AbstractWizardAction class
  +      *
  +      [EMAIL PROTECTED]  request  Description of Parameter
  +      [EMAIL PROTECTED]          The Param value
  +      */
  +     public static Map getParam(HttpServletRequest request) {
  +             return 
org.jahia.clipbuilder.html.struts.webBrowser.WebBrowserAction.getParam(request);
  +     }
  +
  +
   
   
        /**
  
  
  
  Index: Constants.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/clipbuilder/html/struts/Util/Constants.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Constants.java    19 Aug 2005 13:42:50 -0000      1.1
  +++ Constants.java    25 Aug 2005 09:36:40 -0000      1.2
  @@ -4,10 +4,10 @@
   
       public static final String CLIPPER_BEAN = "clipperBean";
       public static final String CLIPPER_BEAN_TEMPLATE = 
"clipperBean_template";
  -    public static final String URL_MAP = "urlMap";
       public static final String FIRST_URL_HASH = "userHash";
       public static final String FIRST_URL_FROM = "userFrom";
       public static final String LINK_HASH = "linkHash";
  +    public static final String NAME_SPACE = "nameSpace";
   
       /* Form constants*/
       public static final String WEB_BROWSER_SHOW_BROWSE = "browse";
  

Reply via email to