Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-14687

ODF import with eZSectionDefenition styles missing namespaces

    XMLWordPrintable

Details

    Description

      The ODF import is missing some namespace definitions to work with sections defined using styled headers (which is the default in the 4.1 ODF export).

      Try import with the attached document and notice that the matching based on section definitions does not work.

      Remember to make sure that the caption, publishing and unpublishing attributes are defined correctly in the ODF settings to match the article class.

      The patch below fixes the issue.

      --- /www/ezpublish-4.1.0/extension/ezodf/modules/ezodf/ezooimport.php	2009-03-24 10:08:25.000000000 -0500
      +++ ezooimport.php	2009-03-27 15:08:51.000000000 -0500
      @@ -439,7 +439,7 @@ class eZOOImport
                   $eZSectionDefinitionStyleName = array();
                   foreach( $automaticStyleArray->item( 0 )->childNodes as $child )
                   {
      -                if( $child->nodeType === XML_ELEMENT_NODE && $child->getAttribute( 'parent-style-name' ) == 'eZSectionDefinition' )
      +                if ( $child->nodeType === XML_ELEMENT_NODE && $child->getAttributeNS( self::NAMESPACE_TEXT, 'parent-style-name' ) == 'eZSectionDefinition' )
                       {
                            $eZSectionDefinitionStyleName[] = $child->getAttribute('name');
                       }
      @@ -455,7 +455,7 @@ class eZOOImport
                       $firstChildFlag = true;
                       if ( $childNode->nodeType == XML_ELEMENT_NODE &&
                            ( in_array( $childNode->getAttribute( 'style-name' ), $eZSectionDefinitionStyleName ) ||
      -                       $childNode->getAttribute( 'style-name' ) == 'eZSectionDefinition' )
      +                       $childNode->getAttributeNS( self::NAMESPACE_TEXT, 'style-name' ) == 'eZSectionDefinition' )
                          )
                       {
                           $firstChildFlag = false;
      @@ -468,12 +468,13 @@ class eZOOImport
                       {
                           $paragraphSectionNodeArray[ $paragraphSectionName ][] = $childNode;
                       }
      +                
                   }
       
                   $sectionNodeArray = array();
                   foreach ( $paragraphSectionNodeArray as $key => $childNodes )
                   {
      -                $sectionNode = $dom->createElementNode( 'section' );
      +                $sectionNode = $dom->createElement( 'section' );
       
                       foreach ( $childNodes as $childNode )
                       {
      
      
      Steps to reproduce

      Import the attached document.
      Look at the imported article, all content is placed in the body.

      Attachments

        Activity

          People

            ls ls
            bf bf
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: