xlawrence    2005/07/29 18:34:17 CEST

  Modified files:
    core/src/java/org/jahia/engines/shared BigText_Field.java 
  Log:
  Added method to clean up the extra heading added by some html editors
  
  Revision  Changes    Path
  1.21      +25 -1     
jahia/core/src/java/org/jahia/engines/shared/BigText_Field.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/engines/shared/BigText_Field.java.diff?r1=1.20&r2=1.21&f=h
  
  
  
  Index: BigText_Field.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/engines/shared/BigText_Field.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- BigText_Field.java        25 Jul 2005 08:28:15 -0000      1.20
  +++ BigText_Field.java        29 Jul 2005 16:34:16 -0000      1.21
  @@ -172,6 +172,9 @@
                   buff.append("_").append(theField.getID()).toString());
           buff.delete(0, buff.length());
           
  +        fieldValue = cleanEditorShit(fieldValue);
  +        logger.debug("cleanEditorShit: " + fieldValue);
  +        
           final JahiaSite site = ServicesRegistry.getInstance().
                   getJahiaSitesService().getSite(jParams.getSiteID());
           
  @@ -231,7 +234,7 @@
               fieldValue = theField.getValue();
           }
           fieldValue = JahiaString.getProperStr(fieldValue, 
jParams.getLocale());
  -        
  + 
           final String values[] = ((JahiaBigTextField)theField).
                   cleanUpHardCodedLinks(fieldValue, jParams,
                   jParams.getLocale().toString());
  @@ -284,6 +287,27 @@
       } // end getFormData
       
       /**
  +     * 
  +     <HTML>
  +        <HEAD>
  +            <META http-equiv="Content-Type" content="text/html; 
charset=UTF-8">
  +                <html>tac</html>
  +        </HEAD>
  +        </HTML>
  +
  +     */
  +    protected String cleanEditorShit(final String fieldValue) {
  +        final String upper = fieldValue.toUpperCase();
  +        if (upper.indexOf("<HTML>") < upper.lastIndexOf("<HTML>")) {
  +            // The editor did it again...
  +            final int start = upper.lastIndexOf("<HTML>");
  +            final int end = upper.indexOf("</HTML>") + 7;
  +            return fieldValue.substring(start, end);
  +        }
  +        return fieldValue;
  +    }
  +    
  +    /**
        *
        */
       protected EngineMessages toEngineMessages(EngineValidationHelper evh) {
  

Reply via email to