You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(43) |
Apr
(20) |
May
(20) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(20) |
Feb
(28) |
Mar
(28) |
Apr
(1) |
May
(5) |
Jun
(27) |
Jul
(55) |
Aug
(30) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: <nma...@us...> - 2006-04-13 10:18:24
|
Revision: 57 Author: nmarkgraf Date: 2006-04-13 03:17:54 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=57&view=rev Log Message: ----------- done. Now all source files should match Alex codings guidelines... Modified Paths: -------------- poc/src/content/Body.php poc/src/content/BodyTable.php poc/src/content/BodyText.php poc/src/content/Content.php poc/src/content/Scripts.php poc/src/manifest/Manifest.php poc/src/manifest/ManifestTest.php poc/src/meta/Meta.php poc/src/meta/MetaTest.php poc/src/samples/TestOutput.php poc/src/settings/Settings.php poc/src/settings/SettingsTest.php poc/src/styles/AutomaticStyles.php poc/src/styles/AutomaticStylesInterface.php poc/src/styles/AutomaticStylesSplitter.php poc/src/styles/FontFaceDeclInterface.php poc/src/styles/FontFaceDeclSplitter.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/MasterStyles.php poc/src/styles/Style.php poc/src/styles/Styles.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-04-13 08:31:43
|
Revision: 56 Author: nmarkgraf Date: 2006-04-13 01:31:08 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=56&view=rev Log Message: ----------- Some more of this new code guideline changes ... Modified Paths: -------------- poc/etc/ReleaseInformation.tpl poc/src/OpenDocumentPackageTest.php poc/src/OpenDocumentSingleTest.php poc/src/content/Body.php poc/src/content/BodyTable.php poc/src/content/BodyText.php poc/src/content/Content.php poc/src/content/Scripts.php poc/src/manifest/Manifest.php poc/src/manifest/ManifestTest.php poc/src/meta/Meta.php poc/src/meta/MetaTest.php poc/src/settings/Settings.php poc/src/settings/SettingsTest.php poc/src/styles/AutomaticStyles.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/MasterStyles.php poc/src/styles/Style.php poc/src/styles/Styles.php poc/src/util/AbstractDocument.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-04-12 15:50:44
|
Revision: 55 Author: nmarkgraf Date: 2006-04-12 08:50:11 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=55&view=rev Log Message: ----------- Thanks to PHPEclipse we can make more out of our little project. So I startet to match more classes Alex coding guidelines. I hope this is correct, isn't it Alex? Modified Paths: -------------- poc/etc/ReleaseInformation.tpl poc/src/OpenDocumentPackageTest.php poc/src/OpenDocumentSingleTest.php poc/src/meta/Meta.php poc/src/settings/SettingsTest.php poc/src/util/AbstractDocument.php poc/src/util/AbstractDocumentTest.php poc/src/util/MimeTypes.php poc/src/util/NameSpaces.php poc/src/util/NameSpacesTest.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-04-12 09:24:41
|
Revision: 54 Author: nmarkgraf Date: 2006-04-12 02:24:23 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=54&view=rev Log Message: ----------- Mostly cosmetic changes, for Alex ..., to meet some kind of coding guidelines. Modified Paths: -------------- poc/src/OpenDocument.php poc/src/OpenDocumentFactory.php poc/src/OpenDocumentFactoryTest.php poc/src/OpenDocumentPackageTest.php poc/src/OpenDocumentSingle.php poc/src/manifest/Manifest.php poc/src/meta/Meta.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-04-10 09:13:50
|
Revision: 53 Author: nmarkgraf Date: 2006-04-10 02:13:20 -0700 (Mon, 10 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=53&view=rev Log Message: ----------- FINAL 0.4.7 commit! This is the 0.4.7 release. Only some tiny bug fixes... Modified Paths: -------------- poc/src/OpenDocumentPackage.php poc/src/OpenDocumentPackageTest.php poc/src/OpenDocumentSingle.php poc/src/content/BodyText.php poc/src/content/Content.php poc/src/meta/Meta.php poc/src/styles/AutomaticStyles.php poc/src/styles/Styles.php poc/src/util/AbstractDocument.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-04-07 13:58:15
|
Revision: 52 Author: nmarkgraf Date: 2006-04-07 06:57:30 -0700 (Fri, 07 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=52&view=rev Log Message: ----------- More refactoring work: - Added new OpenDocumentPackageTest class. - Some bug fixes of some minor bugs found by the new test case. We now have 83% of the code covered by unit tests. Modified Paths: -------------- poc/src/OpenDocumentPackage.php poc/src/OpenDocumentSingleTest.php poc/src/content/Content.php poc/src/manifest/Manifest.php poc/src/styles/AutomaticStyles.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/MasterStyles.php poc/src/styles/Styles.php poc/src/util/NameSpaces.php Added Paths: ----------- poc/src/OpenDocumentPackageTest.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-04-07 09:14:38
|
Revision: 51 Author: nmarkgraf Date: 2006-04-07 02:14:14 -0700 (Fri, 07 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=51&view=rev Log Message: ----------- Another refactoring session: - Added a new test case SettingsTest. - Added some new tests in OpenDocumentSingleTest so we cover now approx. 65% of our code. Modified Paths: -------------- poc/src/OpenDocument.php poc/src/OpenDocumentPackage.php poc/src/OpenDocumentSingle.php poc/src/OpenDocumentSingleTest.php poc/src/content/Scripts.php poc/src/meta/Meta.php poc/src/meta/MetaTest.php poc/src/settings/Settings.php poc/src/styles/FontFaceDeclaration.php Added Paths: ----------- poc/src/settings/SettingsTest.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-04-06 10:20:49
|
Revision: 50 Author: nmarkgraf Date: 2006-04-06 03:20:28 -0700 (Thu, 06 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=50&view=rev Log Message: ----------- Some more refactoring. Removed some unused and untested old work from some of the class files. Modified Paths: -------------- poc/src/OpenDocumentFactory.php poc/src/OpenDocumentSingle.php poc/src/content/Scripts.php poc/src/meta/Meta.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/Style.php poc/src/util/AbstractDocument.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-04-06 09:20:48
|
Revision: 49 Author: nmarkgraf Date: 2006-04-06 02:20:10 -0700 (Thu, 06 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=49&view=rev Log Message: ----------- Mostly refactoring to support more phpDocumentor features. But also: - Added test case for AbstractDocument - Added test case for ReleaseInformation Modified Paths: -------------- poc/etc/ReleaseInformation.tpl poc/src/OpenDocument.php poc/src/OpenDocumentFactory.php poc/src/OpenDocumentPackage.php poc/src/OpenDocumentSingle.php poc/src/content/Body.php poc/src/content/BodyText.php poc/src/manifest/Manifest.php poc/src/samples/TestInput.php poc/src/samples/TestOutput.php poc/src/settings/Settings.php poc/src/styles/AutomaticStyles.php poc/src/styles/AutomaticStylesInterface.php poc/src/styles/AutomaticStylesSplitter.php poc/src/styles/FontFaceDeclInterface.php poc/src/styles/FontFaceDeclSplitter.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/MasterStyles.php poc/src/styles/Style.php poc/src/styles/Styles.php poc/src/util/AbstractDocument.php poc/src/util/NameSpacesTest.php Added Paths: ----------- poc/src/util/AbstractDocumentTest.php poc/src/util/ReleaseInformationTest.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-04-05 19:48:08
|
Revision: 48 Author: nmarkgraf Date: 2006-04-05 12:47:43 -0700 (Wed, 05 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=48&view=rev Log Message: ----------- More refactoring: - Deleted AllInclude.inc, OpenDocumentObjectAbstract and OpenDocumentAbstract. They are no longer needed. - Added a new test case for the MimeTypes class. Modified Paths: -------------- poc/src/OpenDocumentFactory.php poc/src/OpenDocumentFactoryTest.php poc/src/OpenDocumentPackage.php poc/src/content/Content.php poc/src/util/AbstractDocument.php poc/src/util/MimeTypes.php Added Paths: ----------- poc/src/util/MimeTypesTest.php Removed Paths: ------------- poc/src/AllInclude.inc poc/src/OpenDocumentAbstract.php poc/src/OpenDocumentObjectAbstract.php Deleted: poc/src/AllInclude.inc =================================================================== --- poc/src/AllInclude.inc 2006-04-05 15:52:08 UTC (rev 47) +++ poc/src/AllInclude.inc 2006-04-05 19:47:43 UTC (rev 48) @@ -1,38 +0,0 @@ -<?php -/** - * AllInclude include file - * - * I hope this is a temporay solution to the massiv require_once problem, - * but Axel is working on this, I hope. - * - * $Id$ - * - * @license GNU General Public License - * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument - * - * @since 0.4.3 - */ - -// Our own stuff: -require_once( "OpenDocument.php" ); -require_once( "OpenDocumentAbstract.php" ); -require_once( "OpenDocumentObjectAbstract.php" ); -require_once( "OpenDocumentSingle.php" ); -require_once( "OpenDocumentPackage.php" ); -require_once( "styles/Style.php" ); -require_once( "styles/Styles.php" ); -require_once( "content/Content.php" ); -require_once( "meta/Meta.php" ); -require_once( "manifest/Manifest.php" ); -require_once( "content/Body.php" ); -require_once( "content/BodyText.php" ); -require_once( "content/BodyTable.php" ); -require_once( "styles/FontFaceDeclaration.php" ); -// Non-PEAR and not our stuff: -require_once( "others/ZipFile.php" ); -// PEAR stuff: -require_once( "Log.php" ); -?> \ No newline at end of file Deleted: poc/src/OpenDocumentAbstract.php =================================================================== --- poc/src/OpenDocumentAbstract.php 2006-04-05 15:52:08 UTC (rev 47) +++ poc/src/OpenDocumentAbstract.php 2006-04-05 19:47:43 UTC (rev 48) @@ -1,156 +0,0 @@ -<?php -/** - * OpenDocumentAbstract Class - * (C) by Norman Markgraf in 2006 - * - * OpenDocumentAbstract is the basic class for all OpenDocument classes - * - * $Id$ - * - * @license GNU General Public License - * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument - * - * @since 0.3.0 - */ - -require_once( "util/ReleaseInformation.php" ); - -class OpenDocumentAbstract { - - /** - * Copyright notice for this package. - */ - const Copyright = "(C) in 2006 by Norman Markgraf, Alex Latchford, et al."; - - /** - * Name of this package. - */ - const PackageName = "OpenDocumentPHP"; - - /** - * Default mime type is set to a text document. - */ - const defaultMimeType = "application/vnd.oasis.opendocument.text"; - - /** - * The PEAR::Log logger - * - * @access protected - * @since 0.4.0 - */ - protected $logger; - - /** - * The mime type of the document - * - * @access protected - * @since 0.4.0 - */ - protected $mimetype; - - /** - * This is the storage for all OpenDocument objects - * - * @access protected - * @since 0.3.0 - */ - protected $DocumentObjects; - - /** - * This construtor will set the mimetype of this document and start logging. - * - * Therefor this line is included in this constructor: - * <code> - * $this->logger = &Log::factory( "null", "", "OpenDocument" ); - * </code> - * - * @param string $mimetype The mime type of this document. - * @access public - * @since 0.3.0 - */ - public function __construct( $mimetype = 0 ) { - $this->logger = &Log::factory( "null", "", "OpenDocument" ); - $this->logger->debug( "Constructing OpenDocumentAbstract." ); - - // make an array for all the Document Objects. - $this->DocumentObjects = array(); - - if (!empty($mimetype)) { - $this->mimetype = $mimetype; - } - } - - /** - * - * @access public - * @since 0.3.0 - */ - public function __destruct() { - $this->logger->debug( "OpenDocumentAbstract destructed." ); - $this->logger->close(); - } - - /** - * Returns revision information - * - * @return string Revision information. - * @access public - * @final - * @since 0.4.0 - */ - final public function getRevision() { - $Revision = ""; - return "(".substr("$Revision$",-2).")".ReleaseInformation::Revision; - } - - /** - * Returns release and revision information. - * - * @return string Release and revision information. - * @access public - * @final - * @since 0.4.0 - */ - final public function getRelease() { - return ReleaseInformation::Release.".".ReleaseInformation::Revision; - } - - /** - * Returns some informations about this package, release and copyright. - * - * @return string Package name, release and copyright. - * @access public - * @final - * @since 0.4.0 - */ - final public function getPackageInformation() { - return self::PackageName . " " . $this->getRelease() . " " . self::Copyright; - } - - /** - * - * @access public - * @final - * @since 0.4.0 - */ - final public function attachObserverToLogger( $observer ) { - $this->logger->attach( $observer ); - } - - /** - * Returns the setted mime type of this document. - * - * @return string Current mime type of this document. - * @access public - * @final - * @since 0.4.0 - */ - final public function getMimeType() { - return $this->mimetype; - } - -} -?> \ No newline at end of file Modified: poc/src/OpenDocumentFactory.php =================================================================== --- poc/src/OpenDocumentFactory.php 2006-04-05 15:52:08 UTC (rev 47) +++ poc/src/OpenDocumentFactory.php 2006-04-05 19:47:43 UTC (rev 48) @@ -13,36 +13,18 @@ * @since 0.4.0 */ -include_once ( "AllInclude.inc" ); - +require_once( "OpenDocument.php" ); +require_once( "OpenDocumentSingle.php" ); +require_once( "OpenDocumentPackage.php" ); +require_once( "util/MimeTypes.php" ); /** - * - * @author Alex Latchford <yaw...@us...> - * - * @since 0.4.1 - */ - /* -function __autoload($class_name) { - // There is no "void" class, so we must ignore it - if ($class_name != "void" ) { - // Classes in subdirectories have '_' instead of '/' or '\\' in their names. - require_once( strtr ( $class_name, "_", "/" ) . ".php" ); - } -} -*/ - -/** * The main factory class of OpenDocumentPHP * * This is the main factory class for OpenDocumentPHP. You can use like this: * <code> * <?php - * $SingleDoc = OpenDocumentFactory::createOpenDocument( - * "test.odc", "", true, "application/vnd.oasis.opendocument.calc" - * ); - * $PackageDoc = OpenDocumentFactory::createOpenDocument( - * "test.odt", "", false - * ); + * $SingleDoc = OpenDocumentFactory::createOpenDocument( true, "application/vnd.oasis.opendocument.image" ); + * $PackageDoc = OpenDocumentFactory::createOpenDocument( false ); * ?> * </code> * @@ -52,7 +34,6 @@ * @since 0.4.0 */ final class OpenDocumentFactory { - const defaultMimeType = "application/vnd.oasis.opendocument.text"; /** * Creates an OpenDocument. * @@ -68,11 +49,11 @@ * * @since 0.4.0 */ - static public function createOpenDocument( $documentName, $documentPath=0, $singleDocument = TRUE, $mimeType=self::defaultMimeType ) { + static public function createOpenDocument( $singleDocument = TRUE, $mimeType=MimeTypes::defaultMimeType ) { if ( $singleDocument ) { return new OpenDocumentSingle( $mimeType ); } else { - return new OpenDocumentPackage( $documentName, $documentPath, $mimeType ); + return new OpenDocumentPackage( $mimeType ); } } Modified: poc/src/OpenDocumentFactoryTest.php =================================================================== --- poc/src/OpenDocumentFactoryTest.php 2006-04-05 15:52:08 UTC (rev 47) +++ poc/src/OpenDocumentFactoryTest.php 2006-04-05 19:47:43 UTC (rev 48) @@ -20,7 +20,7 @@ class OpenDocumentFactoryTest extends PHPUnit2_Framework_TestCase { function testFactoryForSingleDocument() { - $OD = OpenDocumentFactory::createOpenDocument( "test.odf", "", true ); + $OD = OpenDocumentFactory::createOpenDocument( true ); $this->assertNotNull( $OD ); $this->assertType( "OpenDocumentSingle", $OD ); @@ -28,20 +28,21 @@ unset( $OD ); } + function testFactoryForMimetypeInSingleDocumentDefault() { + $OD = OpenDocumentFactory::createOpenDocument( true ); + $mimetype = $OD->getMimeType(); + $this->assertEquals( "application/vnd.oasis.opendocument.text", $OD->getMimeType(), "Default mimetype not set correctly (was:".$mimetype.")." ); + } + function testFactoryForMimetypeInSingleDocument() { - $OD = OpenDocumentFactory::createOpenDocument( "test.odf", "", true ); + $ODA = OpenDocumentFactory::createOpenDocument( true, "TestMimeType" ); + $mimetype = $ODA->getMimeType(); + $this->assertEquals( "TestMimeType", $ODA->getMimeType(), "Default mimetype not set correctly (was:".$mimetype.")." ); - $this->assertEquals( "application/vnd.oasis.opendocument.text", $OD->getMimeType(), "Default mimetype not set correctly." ); - - $ODA = OpenDocumentFactory::createOpenDocument( "test.odf", "", true, "TestMimeType" ); - $this->assertEquals( "TestMimeType", $ODA->getMimeType(), "Default mimetype not set correctly." ); - - unset( $OD ); - unset( $ODA ); } function testFactoryForPackageDocument() { - $OD = OpenDocumentFactory::createOpenDocument( "test.odf", "", false ); + $OD = OpenDocumentFactory::createOpenDocument( false ); $this->assertNotNull( $OD ); $this->assertType( "OpenDocumentPackage", $OD ); @@ -49,16 +50,16 @@ unset( $OD ); } + function testFactoryForMimetypeInPackageDocumentDefault() { + $OD = OpenDocumentFactory::createOpenDocument( false ); + $mimetype = $OD->getMimeType(); + $this->assertEquals( "application/vnd.oasis.opendocument.text", $OD->getMimeType(), "Default mimetype not set correctly (was:".$mimetype.")." ); + } + function testFactoryForMimetypeInPackageDocument() { - $OD = OpenDocumentFactory::createOpenDocument( "test.odf", "", false ); - - $this->assertEquals( "application/vnd.oasis.opendocument.text", $OD->getMimeType(), "Default mimetype not set correctly." ); - - $ODA = OpenDocumentFactory::createOpenDocument( "test.odf", "", false, "TestMimeType" ); - $this->assertEquals( "TestMimeType", $ODA->getMimeType(), "Default mimetype not set correctly." ); - - unset( $OD ); - unset( $ODA ); + $ODA = OpenDocumentFactory::createOpenDocument( false, "TestMimeType" ); + $mimetype = $ODA->getMimeType(); + $this->assertEquals( "TestMimeType", $ODA->getMimeType(), "Default mimetype not set correctly (was:".$mimetype.")." ); } Deleted: poc/src/OpenDocumentObjectAbstract.php =================================================================== --- poc/src/OpenDocumentObjectAbstract.php 2006-04-05 15:52:08 UTC (rev 47) +++ poc/src/OpenDocumentObjectAbstract.php 2006-04-05 19:47:43 UTC (rev 48) @@ -1,74 +0,0 @@ -<?php -/** - * OpenDocumentObjectAbstract Class - * - * $Id$ - * - * @license GNU General Public License - * @copyright Copyright © 2006, Norman Markgraf, et al. - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument - * @since 0.4.0 - */ - -require_once( "OpenDocumentAbstract.php" ); - -class OpenDocumentObjectAbstract extends OpenDocumentAbstract { - - /** - * @access protected - */ - protected $dom; - - /** - * @access protected - */ - protected $isCommited; - - /** - * - * @access public - * - * @since 0.4.0 - */ - public function __construct( $mimetype = 0 ) { - parent::__construct( $mimetype ); - $this->logger->debug( "Constructing OpenDocumentObjectAbstract." ); - $this->isCommited = false; - } - - /** - * - * @access public - * - * @since 0.4.0 - */ - public function __destruct() { - $this->logger->debug( "OpenDocumentObjectAbstract destructed." ); - parent::__destruct(); - } - /** - * - * @return DOMDocument - * @access public - * - * @since 0.4.0 - */ - public function get() { - return $this->dom; - } - - /** - * - * @access public - * - * @since 0.4.0 - */ - public function save( $filename ) { - $tmp =& $this->dom; - - $tmp->save( $filename ); - } -} -?> \ No newline at end of file Modified: poc/src/OpenDocumentPackage.php =================================================================== --- poc/src/OpenDocumentPackage.php 2006-04-05 15:52:08 UTC (rev 47) +++ poc/src/OpenDocumentPackage.php 2006-04-05 19:47:43 UTC (rev 48) @@ -17,16 +17,18 @@ */ require_once( "meta/Meta.php" ); require_once( "settings/Settings.php" ); +require_once( "content/Content.php" ); +require_once( "styles/Styles.php" ); +require_once( "content/Body.php" ); require_once( "content/Scripts.php" ); +require_once( "styles/AutomaticStyles.php" ); +require_once( "styles/AutomaticStylesSplitter.php" ); require_once( "styles/FontFaceDeclaration.php" ); require_once( "styles/FontFaceDeclSplitter.php" ); require_once( "styles/Style.php" ); -require_once( "styles/AutomaticStyles.php" ); require_once( "styles/MasterStyles.php" ); -require_once( "content/Body.php" ); -require_once( "OpenDocumentAbstract.php" ); require_once( "util/AbstractDocument.php" ); - +require_once( "util/MimeTypes.php" ); require_once( "others/ZipFile.php" ); class OpenDocumentPackage extends AbstractDocument implements OpenDocument { @@ -35,28 +37,19 @@ private $packagetmp; private $zip; private $isCommited; - // - public $tmp = "c:/TEMP/"; - public $path = ""; /** * * @access public * @since 0.4.0 */ - public function __construct( $documentName=0, $documentPath=0, $mimetype="application/vnd.oasis.opendocument.text" ) { + public function __construct( $mimetype=MimeTypes::Text ) { parent::__construct( $mimetype ); $this->isCommited = false; $this->zip = new ZipFile(); - if ( !empty( $documentName ) ) { - $this->setPackageName( $documentName ); - if ( !empty( $documentPath ) ) { - $this->path = $documentPath; - } - } $this->Manifest = new Manifest( $this->getMimeType() ); $this->Meta = new Meta(); Modified: poc/src/content/Content.php =================================================================== --- poc/src/content/Content.php 2006-04-05 15:52:08 UTC (rev 47) +++ poc/src/content/Content.php 2006-04-05 19:47:43 UTC (rev 48) @@ -17,7 +17,6 @@ require_once( "styles/FontFaceDeclaration.php" ); require_once( "styles/AutomaticStyles.php" ); require_once( "content/Body.php" ); -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); class Content { Modified: poc/src/util/AbstractDocument.php =================================================================== --- poc/src/util/AbstractDocument.php 2006-04-05 15:52:08 UTC (rev 47) +++ poc/src/util/AbstractDocument.php 2006-04-05 19:47:43 UTC (rev 48) @@ -89,9 +89,6 @@ * @since 0.4.7 */ public function __construct( $mimetype = 0 ) { - $this->logger = &Log::factory( "null", "", "OpenDocument" ); - $this->logger->debug( "Constructing AbstractDocument." ); - $this->mimetype = $mimetype; } @@ -101,8 +98,6 @@ * @since 0.3.0 */ public function __destruct() { - $this->logger->debug( "AbstractDocument destructed." ); - $this->logger->close(); } Modified: poc/src/util/MimeTypes.php =================================================================== --- poc/src/util/MimeTypes.php 2006-04-05 15:52:08 UTC (rev 47) +++ poc/src/util/MimeTypes.php 2006-04-05 19:47:43 UTC (rev 48) @@ -1,7 +1,25 @@ <?php /** - * NameSpaces Class + * MimeTypes Class * + * <b>Mimtype -> file suffix</b> + * vnd.oasis.opendocument.text -> .odt + * vnd.oasis.opendocument.text-template -> .ott + * vnd.oasis.opendocument.text-master -> .otm + * vnd.oasis.opendocument.text-web -> .oth + * vnd.oasis.opendocument.spreadsheet -> .ods + * vnd.oasis.opendocument.spreadsheet-template -> .ots + * vnd.oasis.opendocument.graphics -> .odg + * vnd.oasis.opendocument.graphics-template -> .otg + * vnd.oasis.opendocument.presentation -> .odp + * vnd.oasis.opendocument.presentation-template -> .otp + * vnd.oasis.opendocument.image -> .odi + * vnd.oasis.opendocument.image-template -> .oti + * vnd.oasis.opendocument.formula -> .odf + * vnd.oasis.opendocument.formula-template -> .otf + * vnd.oasis.opendocument.chart -> .odc + * vnd.oasis.opendocument.chart-template -> .otc + * * $Id$ * * @license GNU General Public License @@ -13,10 +31,108 @@ * @since 0.4.7 */ -class MimeTypes { - const Text = "application/vnd.oasis.opendocument.text"; - const Calc = "application/vnd.oasis.opendocument.calc"; - const defaultMimeType = "application/vnd.oasis.opendocument.text"; +class MimeTypes { + /** + * Mime type for texts + * @since 0.4.7 + */ + const Text = "application/vnd.oasis.opendocument.text"; + + /** + * Mime type for text templates + * @since 0.4.7 + */ + const TextTemplate = "application/vnd.oasis.opendocument.text-template"; + + /** + * Mime type for text master files + * @since 0.4.7 + */ + const TextMaster = "application/vnd.oasis.opendocument.text-master"; + + /** + * Mime type for text web + * @since 0.4.7 + */ + const TextWeb = "application/vnd.oasis.opendocument.text-web"; + + /** + * Mime type for spreadsheets + * @since 0.4.7 + */ + const Spreadsheet = "application/vnd.oasis.opendocument.spreadsheet"; + + /** + * Mime type for spreadsheets templates + * @since 0.4.7 + */ + const SpreadsheetTemplate = "application/vnd.oasis.opendocument.spreadsheet-template"; + + /** + * Mime type for graphics + * @since 0.4.7 + */ + const Graphics = "application/vnd.oasis.opendocument.graphics"; + + /** + * Mime type for graphics templates + * @since 0.4.7 + */ + const GraphicsTemplate = "application/vnd.oasis.opendocument.graphics-template"; + + /** + * Mime type for presentations + * @since 0.4.7 + */ + const Presentation = "application/vnd.oasis.opendocument.presentation"; + + /** + * Mime type for presentation templates + * @since 0.4.7 + */ + const PresentationTemplate = "application/vnd.oasis.opendocument.presentation-template"; + + /** + * Mime type for images + * @since 0.4.7 + */ + const Image = "application/vnd.oasis.opendocument.image"; + + /** + * Mime type for images templates + * @since 0.4.7 + */ + const ImageTemplate = "application/vnd.oasis.opendocument.image-template"; + + /** + * Mime type for formulars + * @since 0.4.7 + */ + const Formula = "application/vnd.oasis.opendocument.formula"; + + /** + * Mime type for formular templates + * @since 0.4.7 + */ + const FormulaTemplate = "application/vnd.oasis.opendocument.formula-template"; + + /** + * Mime type for charts + * @since 0.4.7 + */ + const Chart = "application/vnd.oasis.opendocument.chart"; + + /** + * Mime type for chart templates + * @since 0.4.7 + */ + const ChartTemplate = "application/vnd.oasis.opendocument.chart-template"; + + /** + * Default mime type is set to text + * @since 0.4.7 + */ + const defaultMimeType = "application/vnd.oasis.opendocument.text"; } ?> \ No newline at end of file Added: poc/src/util/MimeTypesTest.php =================================================================== --- poc/src/util/MimeTypesTest.php (rev 0) +++ poc/src/util/MimeTypesTest.php 2006-04-05 19:47:43 UTC (rev 48) @@ -0,0 +1,62 @@ +<?php +/** + * TestCase for MimeTypes class + * + * $Id$ + * + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @license GNU General Public License + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage UnitTest + * @since 0.4.7 + */ + +require_once "PHPUnit2/Framework/TestCase.php"; +require_once "util/MimeTypes.php"; + +class MimeTypesTest extends PHPUnit2_Framework_TestCase { + const Text = "application/vnd.oasis.opendocument.text"; + const TextTemplate = "application/vnd.oasis.opendocument.text-template"; + const TextMaster = "application/vnd.oasis.opendocument.text-master"; + const TextWeb = "application/vnd.oasis.opendocument.text-web"; + const Spreadsheet = "application/vnd.oasis.opendocument.spreadsheet"; + const SpreadsheetTemplate = "application/vnd.oasis.opendocument.spreadsheet-template"; + const Graphics = "application/vnd.oasis.opendocument.graphics"; + const GraphicsTemplate = "application/vnd.oasis.opendocument.graphics-template"; + const Presentation = "application/vnd.oasis.opendocument.presentation"; + const PresentationTemplate = "application/vnd.oasis.opendocument.presentation-template"; + const Image = "application/vnd.oasis.opendocument.image"; + const ImageTemplate = "application/vnd.oasis.opendocument.image-template"; + const Formula = "application/vnd.oasis.opendocument.formula"; + const FormulaTemplate = "application/vnd.oasis.opendocument.formula-template"; + const Chart = "application/vnd.oasis.opendocument.chart"; + const ChartTemplate = "application/vnd.oasis.opendocument.chart-template"; + const defaultMimeType = "application/vnd.oasis.opendocument.text"; + + /** + * This test will check all mime types. + * @since 0.4.7 + */ + function testMimeTypes() { + $this->assertEquals( MimeTypes::Text, self::Text ); + $this->assertEquals( MimeTypes::TextTemplate, self::TextTemplate ); + $this->assertEquals( MimeTypes::TextMaster, self::TextMaster ); + $this->assertEquals( MimeTypes::TextWeb, self::TextWeb ); + $this->assertEquals( MimeTypes::Spreadsheet, self::Spreadsheet ); + $this->assertEquals( MimeTypes::SpreadsheetTemplate, self::SpreadsheetTemplate ); + $this->assertEquals( MimeTypes::Graphics, self::Graphics ); + $this->assertEquals( MimeTypes::GraphicsTemplate, self::GraphicsTemplate ); + $this->assertEquals( MimeTypes::Presentation, self::Presentation ); + $this->assertEquals( MimeTypes::PresentationTemplate, self::PresentationTemplate ); + $this->assertEquals( MimeTypes::Image, self::Image ); + $this->assertEquals( MimeTypes::ImageTemplate, self::ImageTemplate ); + $this->assertEquals( MimeTypes::Formula, self::Formula ); + $this->assertEquals( MimeTypes::FormulaTemplate, self::FormulaTemplate ); + $this->assertEquals( MimeTypes::Chart, self::Chart ); + $this->assertEquals( MimeTypes::ChartTemplate, self::ChartTemplate ); + $this->assertEquals( MimeTypes::defaultMimeType, self::defaultMimeType ); + } +} +?> \ No newline at end of file Property changes on: poc/src/util/MimeTypesTest.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-04-05 15:52:56
|
Revision: 47 Author: nmarkgraf Date: 2006-04-05 08:52:08 -0700 (Wed, 05 Apr 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=47&view=rev Log Message: ----------- A lot of refactoring work: - Added some new classes: AbstractDocument (which will replace OpenDocumentAbstract), MimeTypes, AutomaticStylesSplitter (this is a kind of FontFaceDeclSplitter for AutomaticStyles). - Added some interfaces (FontFaceDeclInterface and AutomaticStylesInterface) to keep track of changes in *Splitter and the unsplited classes. - Moved some Stuff from OpenDocumentAbstract to ReleaseInformation(.tpl). Modified Paths: -------------- poc/build.properties poc/build.xml poc/etc/ReleaseInformation.tpl poc/src/OpenDocumentPackage.php poc/src/OpenDocumentSingle.php poc/src/content/Body.php poc/src/content/BodyTable.php poc/src/content/BodyText.php poc/src/content/Content.php poc/src/content/Scripts.php poc/src/manifest/Manifest.php poc/src/meta/Meta.php poc/src/settings/Settings.php poc/src/styles/AutomaticStyles.php poc/src/styles/FontFaceDeclSplitter.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/MasterStyles.php poc/src/styles/Style.php poc/src/styles/Styles.php poc/src/util/NameSpaces.php Added Paths: ----------- poc/src/styles/AutomaticStylesInterface.php poc/src/styles/AutomaticStylesSplitter.php poc/src/styles/FontFaceDeclInterface.php poc/src/util/AbstractDocument.php poc/src/util/MimeTypes.php Property Changed: ---------------- poc/etc/ReleaseInformation.tpl Modified: poc/build.properties =================================================================== --- poc/build.properties 2006-03-30 14:12:08 UTC (rev 46) +++ poc/build.properties 2006-04-05 15:52:08 UTC (rev 47) @@ -5,7 +5,7 @@ # Last edited by $Author$ # # $Id$ -release=0.4.6 -releaseDos=0_4_6 +release=0.4.7 +releaseDos=0_4_7 # This could be ALPHA, BETA or STABLE revision=ALPHA \ No newline at end of file Modified: poc/build.xml =================================================================== --- poc/build.xml 2006-03-30 14:12:08 UTC (rev 46) +++ poc/build.xml 2006-04-05 15:52:08 UTC (rev 47) @@ -194,4 +194,12 @@ <delete file="${OpenDocumentPHPSolid}"/> <delete dir="docs"/> </target> + + <target name="clue"> + <php function="ini_set"> + <param value="'include_path'" /> + <param value="${php.classpath};C:\" /> + </php> + <echo msg="${php.classpath}" /> + </target> </project> Modified: poc/etc/ReleaseInformation.tpl =================================================================== --- poc/etc/ReleaseInformation.tpl 2006-03-30 14:12:08 UTC (rev 46) +++ poc/etc/ReleaseInformation.tpl 2006-04-05 15:52:08 UTC (rev 47) @@ -7,7 +7,7 @@ * @license GNU General Public License * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. * @author Norman Markgraf <nma...@us...> - * @version $Revision: 39 $ + * @version $Revision$ * @package OpenDocument * @subpackage util * @@ -26,5 +26,44 @@ * X = 1 : "stage 1" code */ const Release = "##release##"; + + /** + * Returns revision information + * + * @return string Revision information. + * @access public + * @final + * @since 0.4.0 + */ + final static public function getRevision() { + $Revision = ""; + return "(".substr("$Revision$",-2).")".self::Revision; + } + + /** + * Returns release and revision information. + * + * @return string Release and revision information. + * @access public + * @final + * @since 0.4.0 + */ + final static public function getRelease() { + return ReleaseInformation::Release.".".self::Revision; + } + + /** + * Returns some informations about this package, release and copyright. + * + * @return string Package name, release and copyright. + * @access public + * @final + * @since 0.4.0 + */ + final static public function getPackageInformation() { + return self::PackageName . " " . $this->getRelease() . " " . self::Copyright; + } + + } ?> \ No newline at end of file Property changes on: poc/etc/ReleaseInformation.tpl ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Modified: poc/src/OpenDocumentPackage.php =================================================================== --- poc/src/OpenDocumentPackage.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/OpenDocumentPackage.php 2006-04-05 15:52:08 UTC (rev 47) @@ -25,10 +25,11 @@ require_once( "styles/MasterStyles.php" ); require_once( "content/Body.php" ); require_once( "OpenDocumentAbstract.php" ); +require_once( "util/AbstractDocument.php" ); require_once( "others/ZipFile.php" ); -class OpenDocumentPackage extends OpenDocumentAbstract implements OpenDocument { +class OpenDocumentPackage extends AbstractDocument implements OpenDocument { private $packagename; private $packagetmp; @@ -45,12 +46,9 @@ */ public function __construct( $documentName=0, $documentPath=0, $mimetype="application/vnd.oasis.opendocument.text" ) { parent::__construct( $mimetype ); - - $this->logger->debug( "Constructing OpenDocumentPackage." ); $this->isCommited = false; - $this->logger->debug( "Generating ZipFile object." ); $this->zip = new ZipFile(); if ( !empty( $documentName ) ) { @@ -59,24 +57,23 @@ $this->path = $documentPath; } } - $this->logger->debug( "Generating Manifest with mimetype \"".$this->getMimeType()."\"." ); - $this->DocumentObjects[ "manifest" ] = new Manifest( $this->getMimeType() ); - $this->DocumentObjects[ "meta" ] = new Meta( ); -// $this->DocumentObjects[ "settings" ] = new Settings( ); - - $this->DocumentObjects[ "content" ] = new Content();; + $this->Manifest = new Manifest( $this->getMimeType() ); + $this->Meta = new Meta(); - $this->DocumentObjects[ "styles" ] = new Styles(); + $this->Content = new Content(); + $this->Styles = new Styles(); - $this->DocumentObjects[ "body" ] = $this->DocumentObjects["content"]->getBody(); - - $this->DocumentObjects[ "style" ] = $this->DocumentObjects["styles"]->getStyle(); - $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclSplitter( - $this->DocumentObjects[ "content" ]->getFontFaceDecl(), - $this->DocumentObjects[ "styles" ]->getFontFaceDecl() + $this->Body = $this->Content->getBody(); + $this->Style = $this->Styles->getStyle(); + $this->FontFaceDeclaration = new FontFaceDeclSplitter( + $this->Content->getFontFaceDecl(), + $this->Styles->getFontFaceDecl() ); // Because all other parts will be inserted on demand, there is no need to initialise them here! - + $this->Settings = NULL; + $this->AutomaticStyles = NULL; + $this->MasterStyles = NULL; + $this->Scripts = NULL; } /** @@ -85,17 +82,6 @@ * @since 0.4.0 */ public function __destruct() { - $this->logger->debug( "Destructing OpenDocumentPackage." ); - $this->removeTmpPackage(); - - unset( $this->manifest ); - unset( $this->packagename ); - unset( $this->packagetmp ); - unset( $this->tmp ); - unset( $this->path ); - - $this->logger->debug( "OpenDocumentPackage destructed." ); - parent::__destruct(); } @@ -114,10 +100,7 @@ * @since 0.4.0 */ private function writeDOMToPackage( $fullpath, $dom ) { - //$dom->save( str_replace( "\\", "/", $this->packagetmp . $fullpath) ); $tmp = str_replace( "\\", "/", $fullpath ); - - $this->logger->debug( "Write DOM to package, use fullpath \"" . $tmp . "\"." ); $this->zip->addFile( $dom->saveXML(), $tmp ); unset( $tmp ); @@ -134,12 +117,10 @@ } else { $tmp = $alt; } + clearstatcache(); - $this->logger->debug( "OpenDocumentPackage->writeZIPFile: Write zip file to \"". $tmp ."\"" ); - if ( file_exists( $tmp ) ) { - $this->logger->warning( "OpenDocumentPackage->writeZIPFile: Found old file \"". $tmp ."\", so I remove it first!" ); unlink( $tmp ); } $handle = fopen( $tmp, "wb" ); @@ -147,39 +128,16 @@ fclose( $handle ); unset( $tmp ); } - + /** * - * @access private - * @depricated - * @since 0.4.0 - */ - private function removeTmpPackage() { - // $this->compartibility->removeDir( $this->packagetmp ); - } - - /** - * - * @access private - * @depricated - * @since 0.4.0 - */ - private function makeSubDir( $path ) { - //$this->compartibility->makeDir( $this->packagetmp . $this->compartibility->sep . $path ); - } - - /** - * * @access public * @since 0.4.0 */ public function setPackageName( $filename ) { global $logger; - $this->logger->debug( "OpenDocumentPackage->setPackageName(" . $filename . ")." ); $this->packagename = $filename; - //$this->packagetmp = $this->tmp . $filename . ".tmp" . $this->compartibility->sep; $this->packagetmp = $this->tmp . $filename . ".tmp/"; - $this->logger->debug( "OpenDocumentPackage->set packagetmp to \"" . $this->packagetmp . "\" ..." ); } /** @@ -197,8 +155,7 @@ * @since 0.4.0 */ public function addManifest( $manifest ) { - $this->logger->debug( "OpenDocumentPackage->addManifest(...)." ); - $this->manifest = $manifest; + $this->Manifest = $manifest; } @@ -219,9 +176,7 @@ * @since 0.4.0 */ public function addXMLDocument( $fullpath, $dom, $mimetype="text/xml" ) { - $this->logger->info( "OpenDocumentPackage->addXMLDocument(" . $fullpath . ") with mimetype '" . $mimetype . "' to package '". $this->packagetmp . "'" ); - - $this->DocumentObjects[ "manifest" ]->addEntryToManifest( $fullpath, $mimetype ); + $this->Manifest->addEntryToManifest( $fullpath, $mimetype ); $this->writeDOMToPackage( $fullpath, $dom ); } @@ -231,30 +186,14 @@ * @since 0.4.0 */ private function commit() { - $this->logger->debug( "OpenDocumentPackage->commit()." ); - foreach($this->DocumentObjects as $key => $docObj) { - $this->logger->debug( "OpenDocumentPackage->commit: found \"" . $key . "\" in DocumentObjects array." ); - switch ($key) { - case "meta" : - $this->addXMLDocument( "meta.xml", $docObj->get() ); - break; - case "styles" : - $this->addXMLDocument( "styles.xml", $docObj->get() ); - break; - case "content" : - $this->addXMLDocument( "content.xml", $docObj->get() ); - break; - case "settings" : - $this->addXMLDocument( "settings.xml", $domObj->get() ); - break; - } - } - - $this->writeDOMToPackage( "META-INF/manifest.xml" , $this->DocumentObjects[ "manifest" ]->get() ); - $this->logger->debug( "OpenDocumentPackage->commit: Write mimetype \"". $this->getMimeType()."\" to file \"mimetype\"..." ); + $this->addXMLDocument( "meta.xml", $this->Meta->get() ); + $this->addXMLDocument( "styles.xml", $this->Styles->get() ); + $this->addXMLDocument( "content.xml", $this->Styles->get() ); + if (!empty($this->Settings)) { + $this->addXMLDocument( "settings.xml", $this->Settings->get() ); + } + $this->writeDOMToPackage( "META-INF/manifest.xml" , $this->Manifest->get() ); $this->zip->addFile( $this->getMimeType(), "mimetype" ); - $this->logger->debug( "OpenDocumentPackage->commit: Commited package named \"" . $this->packagename . "\"..." ); - $this->isCommited = true; } @@ -267,7 +206,6 @@ if (!($this->isCommited)) { $this->commit(); } - $this->logger->debug( "OpenDocumentPackage->get()" ); return $this->zip->file(); } @@ -279,29 +217,17 @@ public function save( $altFilename=0 ) { $this->writeZIPFile( $this->get() ); } - + /** * * @access public * @since 0.4.0 */ - public function getMeta() { - if (!array_key_exists ( "meta", $this->DocumentObjects) ) { - $this->DocumentObjects[ "meta" ] = new Meta(); - } - return $this->DocumentObjects[ "meta" ]; - } - - /** - * - * @access public - * @since 0.4.0 - */ public function getContent() { - if (!array_key_exists ( "content", $this->DocumentObjects) ) { - $this->DocumentObjects[ "content" ] = new Content(); + if (empty($this->Content) ) { + $this->Content = new Content(); } - return $this->DocumentObjects[ "content" ]; + return $this->Content; } /** @@ -309,11 +235,11 @@ * @access public * @since 0.4.0 */ - public function getStyle() { - if (!array_key_exists ( "style", $this->DocumentObjects) ) { - $this->DocumentObjects[ "style" ] = $this->DocumentObjects[ "styles" ]->getStyle(); + public function getStyles() { + if (empty($this->Styles) ) { + $this->Styles = new Styles(); } - return $this->DocumentObjects[ "style" ]; + return $this->Styles; } /** @@ -321,10 +247,9 @@ * @access public * @since 0.4.0 */ - public function getStyles() { - return getStyle(); + public function getStyle() { + return $this->Style; } - /** * @@ -333,46 +258,22 @@ * @since 0.4.4 */ public function getFontFaceDeclaration(){ - return $this->DocumentObjects[ "fontfacedecl" ]; + return $this->FontFaceDeclaration; } - - /** - * - * @access public - * - * @since 0.4.4 - */ - public function getSettings(){ - if (!array_key_exists ( "settings", $this->DocumentObjects) ) { - $this->DocumentObjects[ "settings" ] = new Settings(); - } - return $this->DocumentObjects[ "settings" ]; - } /** * * @access public * - * @since 0.4.0 - */ - public function getBody() { - return $this->DocumentObjects[ "body" ]; - } - - /** - * - * @access public - * * @since 0.4.4 */ public function getScripts(){ - if ( !array_key_exists( "scripts", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "scripts" ] = $this->DocumentObjects[ "content" ]->getScripts(); + if ( empty($this->Scripts) ) { + $this->Scripts = $this->Content->getScripts(); } - return $this->DocumentObjects[ "scripts" ]; + return $this->Scripts; } - /** * * @access public @@ -380,18 +281,13 @@ * @since 0.4.4 */ public function getAutomaticStyles(){ - if ( !array_key_exists( "automaticstyles", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "automaticstyles" ] = 0; -/* -// This should be something like: - $this->DocumentObjects[ "automaticstyles" ] = new AutmaticStylesSplitter( - $this->DocumentObjects[ "content" ]->getAutmaticStyles(), - $this->DocumentObjects[ "styles" ]->getAutomaticStyles() - ); - -*/ + if (empty($this->AutomaticStyles)) { + $this->AutomaticStyles= new AutmaticStylesSplitter( + $this->Content->getAutmaticStyles(), + $this->Styles->getAutomaticStyles() + ); } - return $this->DocumentObjects[ "automaticstyles" ]; + return $this->AutomaticStyles; } /** @@ -401,10 +297,10 @@ * @since 0.4.4 */ public function getMasterStyles(){ - if ( !array_key_exists( "masterstyles", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "masterstyles" ] = $this->DocumentObjects[ "styles" ]->getMasterStyles(); + if ( empty($this->MasterStyles) ) { + $this->MasterStyles = $this->Styles->getMasterStyles(); } - return $this->DocumentObjects[ "masterstyles" ]; + return $this->MasterStyles; } } Modified: poc/src/OpenDocumentSingle.php =================================================================== --- poc/src/OpenDocumentSingle.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/OpenDocumentSingle.php 2006-04-05 15:52:08 UTC (rev 47) @@ -24,10 +24,11 @@ require_once( "styles/AutomaticStyles.php" ); require_once( "styles/MasterStyles.php" ); require_once( "content/Body.php" ); -require_once( "OpenDocumentAbstract.php" ); require_once( "util/NameSpaces.php" ); +require_once( "util/MimeTypes.php" ); +require_once( "util/AbstractDocument.php" ); -class OpenDocumentSingle extends OpenDocumentAbstract implements OpenDocument { +class OpenDocumentSingle extends AbstractDocument implements OpenDocument { /** * * @access private @@ -49,28 +50,31 @@ */ private $root; - /** + /** * * @access public * * @since 0.3.0 */ - public function __construct( $mimetype = self::defaultMimeType ) { + public function __construct( $mimetype = MimeTypes::defaultMimeType ) { parent::__construct( $mimetype ); - $this->logger->debug( "Constructing OpenDocumentSingle." ); - $this->isCommited = false; $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->root = $this->dom->createElementNS( NS::OFFICE, "office:document" ); $this->root->setAttributeNS( NS::OFFICE, "office:mimetype", $mimetype ); - - $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); - $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclaration( $this->dom, $this->root ); - $this->DocumentObjects[ "style" ] = new Style( $this->dom, $this->root ); - $this->DocumentObjects[ "body" ] = new Body( $this->dom, $this->root ); - // Because all other parts will be inserted on demand, there is no need to initialise them here! + + $this->Meta = new Meta( $this->dom, $this->root ); + $this->FontFaceDeclaration = new FontFaceDeclaration( $this->dom, $this->root ); + $this->Style = new Style( $this->dom, $this->root ); + $this->Body = new Body( $this->dom, $this->root ); + + $this->Settings = NULL; + $this->AutomaticStyles = NULL; + $this->MasterStyles = NULL; + $this->Scripts = NULL; + } /** @@ -80,8 +84,6 @@ * @since 0.3.0 */ public function __destruct() { - $this->logger->debug( "OpenDocumentSingle destructed." ); - parent::__destruct(); } @@ -104,7 +106,6 @@ * @since 0.3.0 */ public function addXMLDocument( $fullpath, $domFrag, $mimetype="text/xml" ) { - $this->logger->info( "OpenDocumentSingle->addXMLDocument(" . $fullpath . ") with mimetype '" . $mimetype . "' to package '". $this->packagetmp . "'" ); $this->dom->appendChild( $domFrag ); } @@ -115,31 +116,30 @@ * @since 0.3.0 */ private function commit() { - $this->logger->debug( "OpenDocumentSingle->commit()" ); // Add Meta data - $this->DocumentObjects[ "meta" ]->commit(); + $this->Meta->commit(); // Add settings, if needed - if ( array_key_exists( "settings", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "settings" ]->commit(); + if ( !empty( $this->Settings ) ){ + $this->Settings->commit(); } // Add scripts, if needed - if ( array_key_exists( "scripts", $this->DocumentObjects ) ) { - $this->root->appendChild( $this->DocumentObjects[ "scripts" ]->get() ); + if ( !empty( $this->Script ) ) { + $this->root->appendChild( $this->Script->get() ); } // Add FontFaceDeclarations - $this->root->appendChild( $this->DocumentObjects[ "fontfacedecl" ]->get() ); + $this->root->appendChild( $this->FontFaceDeclaration->get() ); // Add Style - $this->root->appendChild( $this->DocumentObjects[ "style" ]->get() ); + $this->root->appendChild( $this->Style->get() ); // Add AutomaticSytles, if needed - if ( array_key_exists( "automaticstyles", $this->DocumentObjects ) ) { - $this->root->appendChild( $this->DocumentObjects[ "automaticstyles" ]->get() ); + if ( !empty( $this->AutomaticStyles ) ) { + $this->root->appendChild( $this->AutomaticStyles->get() ); } // Add MasterStyles, if needed - if ( array_key_exists( "masterstyles", $this->DocumentObjects ) ) { - $this->root->appendChild( $this->DocumentObjects[ "masterstyles" ]->get() ); + if ( !empty( $this->MasterStyles ) ) { + $this->root->appendChild( $this->MasterStyles->get() ); } // Add Body - $this->root->appendChild( $this->DocumentObjects[ "body" ]->get() ); + $this->root->appendChild( $this->Body->get() ); // Add all to DOM document $this->dom->appendChild( $this->root ); // Normalzise DOM document @@ -155,7 +155,6 @@ * @since 0.3.0 */ public function get() { - $this->logger->debug( "OpenDocumentSingle->get()" ); return $this->getAsDOM()->saveXML(); } @@ -169,7 +168,6 @@ if (!($this->isCommited)) { $this->commit(); } - $this->logger->debug( "OpenDocumentSingle->getAsDOM()" ); return $this->dom; } @@ -191,10 +189,10 @@ * @since 0.3.0 */ public function getMeta() { - if ( !array_key_exists( "meta", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); + if ( empty($this->Meta)) { + $this->Meta = new Meta( $this->dom, $this->root ); } - return $this->DocumentObjects[ "meta" ]; + return $this->Meta; } /** @@ -216,7 +214,7 @@ * @since 0.3.0 */ public function getStyles() { - return $this->getStyle(); + return 0; } /** @@ -226,10 +224,10 @@ * @since 0.3.0 */ public function getStyle() { - if ( !array_key_exists( "style", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "style" ] = new Style( $this->dom, $this->root ); + if ( empty($this->Style)) { + $this->Style = new Style( $this->dom, $this->root ); } - return $this->DocumentObjects[ "style" ]; + return $this->Style; } /** @@ -239,7 +237,10 @@ * @since 0.4.0 */ public function getBody() { - return $this->DocumentObjects[ "body" ]; + if ( empty($this->Body)) { + $this->Body = new Body( $this->dom, $this->root ); + } + return $this->Body; } /** @@ -249,7 +250,10 @@ * @since 0.4.4 */ public function getFontFaceDeclaration(){ - return $this->DocumentObjects[ "fontfacedecl" ]; + if ( empty($this->FontFaceDeclaration)) { + $this->FontFaceDeclaration = new FontFaceDeclaration( $this->dom, $this->root ); + } + return $this->FontFaceDeclaration; } /** @@ -259,10 +263,10 @@ * @since 0.4.4 */ public function getSettings(){ - if ( !array_key_exists( "settings", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "settings" ] = new Settings( $this->dom, $this->root ); + if ( empty($this->Settings)) { + $this->Settings = new Settings( $this->dom, $this->root ); } - return $this->DocumentObjects[ "settings" ]; + return $this->Settings; } /** @@ -272,10 +276,10 @@ * @since 0.4.4 */ public function getScripts(){ - if ( !array_key_exists( "scripts", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom, $this->root ); + if ( empty($this->Scripts)) { + $this->Scripts = new Scripts( $this->dom, $this->root ); } - return $this->DocumentObjects[ "scripts" ]; + return $this->Scripts; } @@ -286,10 +290,10 @@ * @since 0.4.4 */ public function getAutomaticStyles(){ - if ( !array_key_exists( "automaticstyles", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom, $this->root ); + if ( empty($this->AutomaticStyles)) { + $this->AutomaticStyles = new AutomaticStyles( $this->dom, $this->root ); } - return $this->DocumentObjects[ "automaticstyles" ]; + return $this->AutomaticStyles; } /** @@ -299,11 +303,10 @@ * @since 0.4.4 */ public function getMasterStyles(){ - if ( !array_key_exists( "masterstyles", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "masterstyles" ] = new AutomaticStyles( $this->dom, $this->root ); + if ( empty($this->MasterStyles)) { + $this->MasterStyles = new MasterStyles( $this->dom, $this->root ); } - return $this->DocumentObjects[ "masterstyles" ]; + return $this->MasterStyles; } - } ?> \ No newline at end of file Modified: poc/src/content/Body.php =================================================================== --- poc/src/content/Body.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/content/Body.php 2006-04-05 15:52:08 UTC (rev 47) @@ -12,16 +12,29 @@ * @subpackage content * @since 0.4.3 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "content/BodyText.php" ); require_once( "content/BodyTable.php" ); require_once( "util/NameSpaces.php" ); -class Body extends OpenDocumentObjectAbstract { - +class Body { /** * * @access private + * @since 0.4.7 + */ + private $dom; + + /** + * + * @access private + * @since 0.4.7 + */ + private $isCommited; + + /** + * + * @depricated + * @access private * @since 0.4.3 */ private $DomFragment; @@ -46,10 +59,7 @@ * @access public * @since 0.4.3 */ - public function __construct( $dom ) { - parent::__construct(); - $this->logger->debug( "Constructing content/Body." ); - + public function __construct( $dom ) { $this->dom = $dom; $this->BodyFragment = $this->dom->createDocumentFragment(); $this->body = $this->dom->createElementNS( NS::OFFICE, "office:body" ); @@ -62,7 +72,6 @@ * @since 0.4.3 */ public function commit() { - $this->logger->debug( "content/Body->commit()" ); foreach( $this->Fragments as $namespace => $class ) { $tmp = $class->get(); if (!empty( $tmp )) { @@ -81,7 +90,6 @@ * @since 0.4.3 */ private function getByNamespace( $NS, $class ) { - $this->logger->debug( "content/Body->getByNamespace(\"".$NS."\", \"".$class."\")" ); if (!array_key_exists( $NS, $this->Fragments ) ) { $this->Fragments[ $NS ] = new $class( $this->dom ); } @@ -94,7 +102,6 @@ * @since 0.4.3 */ public function getText() { - $this->logger->debug( "content/Body->getText()" ); return $this->getByNamespace( NS::TEXT, "BodyText" ); } @@ -104,7 +111,6 @@ * @since 0.4.3 */ public function getTable() { - $this->logger->debug( "content/Body->getTable()" ); return $this->getByNamespace( NS::TABLE, "BodyTable" ); } @@ -115,7 +121,6 @@ * @since 0.4.3 */ final public function get() { - $this->logger->debug( "content/Body->get()" ); if (!$this->isCommited) { $this->commit(); } Modified: poc/src/content/BodyTable.php =================================================================== --- poc/src/content/BodyTable.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/content/BodyTable.php 2006-04-05 15:52:08 UTC (rev 47) @@ -13,19 +13,24 @@ * @since 0.4.3 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class BodyTable extends OpenDocumentObjectAbstract { +class BodyTable { + + /** + * + * @access private + * @since 0.4.7 + */ + private $dom; + /** * Class construtor. * * @access public * @since 0.4.3 */ - public function __construct( $dom ) { - parent::__construct(); - + public function __construct( $dom ) { $this->dom = $dom; $this->DomFragment = $dom->createDocumentFragment(); $this->body = $this->DomFragment->createElementNS( NS::OFFICE, "office:table" ); Modified: poc/src/content/BodyText.php =================================================================== --- poc/src/content/BodyText.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/content/BodyText.php 2006-04-05 15:52:08 UTC (rev 47) @@ -12,11 +12,24 @@ * @since 0.4.0 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class BodyText extends OpenDocumentObjectAbstract { +class BodyText { /** + * + * @access private + * @since 0.4.7 + */ + private $dom; + + /** + * + * @access private + * @since 0.4.7 + */ + private $isCommited; + + /** * Class construtor. * * @access public @@ -24,9 +37,6 @@ * @since 0.4.0 */ public function __construct( $dom ) { - parent::__construct(); - $this->logger->debug( "Constructing OpenDocumentContentBodyText." ); - $this->dom = $dom; $this->text = $this->dom->createElementNS( NS::OFFICE, "office:text" ); } @@ -38,7 +48,6 @@ * @since 0.4.0 */ public function commit() { - $this->logger->debug( "OpenDocumentContentBodyText->commit()" ); $this->isCommited = true; } @@ -49,7 +58,6 @@ * @since 0.4.0 */ public function getTextParagraph( $styleName, $parText=0 ) { - $this->logger->debug( "OpenDocumentContentBodyText->getTextParagraph(\"".$styleName."\",\"".$parText."\")" ); if (empty($parText)) { $par = $this->dom->createElementNS( NS::TEXT, "text:p" ); } else { @@ -66,7 +74,6 @@ * @since 0.4.0 */ public function addToText( $Node ) { - $this->logger->debug( "OpenDocumentContentBodyText->addToText()" ); $this->text->appendChild( $Node ); } @@ -77,7 +84,6 @@ * @since 0.4.0 */ public function getTextHeading( $styleName, $outlineLevel=1, $headText=0 ) { - $this->logger->debug( "OpenDocumentContentBodyText->getTextHeading()" ); if (empty($headText)) { $head = $this->dom->createElementNS( NS::TEXT, "text:h" ); } else { @@ -95,7 +101,6 @@ * @since 0.4.0 */ public function addNoForms() { - $this->logger->debug( "OpenDocumentContentBodyText->addNoForms()" ); $forms = $this->dom->createElementNS( NS::OFFICE, "office:forms" ); $forms->setAttributeNS( NS::FORM, "form:automatic-focus", "false" ); @@ -112,7 +117,6 @@ * @since 0.4.0 */ final public function get() { - $this->logger->debug( "OpenDocumentContentBodyText->get()" ); if (!$this->isCommited) { $this->commit(); } Modified: poc/src/content/Content.php =================================================================== --- poc/src/content/Content.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/content/Content.php 2006-04-05 15:52:08 UTC (rev 47) @@ -20,13 +20,54 @@ require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class Content extends OpenDocumentObjectAbstract { +class Content { + /** + * + * @access private + * @since 0.4.4 + */ + private $root; - private $root; + /** + * + * @access private + * @since 0.4.7 + */ + private $dom; + + /** + * + * @access private + * @since 0.4.4 + */ private $Scripts; + + /** + * + * @access private + * @since 0.4.4 + */ private $FontFaceDecl; + + /** + * + * @access private + * @since 0.4.4 + */ private $AutomaticStyles; + + /** + * + * @access private + * @since 0.4.4 + */ private $Body; + + /** + * + * @access private + * @since 0.4.4 + */ private $text; /** @@ -37,8 +78,6 @@ * @since 0.4.0 */ public function __construct() { - parent::__construct(); - $this->logger->debug( "Constructing content/Content." ); // this is part of a package document $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->dom->formatOutput = true; Modified: poc/src/content/Scripts.php =================================================================== --- poc/src/content/Scripts.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/content/Scripts.php 2006-04-05 15:52:08 UTC (rev 47) @@ -15,14 +15,13 @@ * * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class Scripts extends OpenDocumentObjectAbstract { +class Scripts { + /** * * @access private - * * @since 0.4.4 */ private $scripts; @@ -30,10 +29,16 @@ /** * * @access private - * * @since 0.4.4 */ private $root; + + /** + * + * @access private + * @since 0.4.7 + */ + private $dom; /** * Class construtor. @@ -41,10 +46,7 @@ * @access public * @since 0.4.4 */ - public function __construct( $dom ) { - parent::__construct(); - $this->logger->debug( "Constructing content/Scripts." ); - + public function __construct( $dom ) { $this->dom = $dom; $this->scripts = $this->dom->createElementNS( NS::OFFICE, "office:scripts" ); Modified: poc/src/manifest/Manifest.php =================================================================== --- poc/src/manifest/Manifest.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/manifest/Manifest.php 2006-04-05 15:52:08 UTC (rev 47) @@ -12,17 +12,38 @@ * @subpackage manifest * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class Manifest extends OpenDocumentObjectAbstract { +class Manifest { const odmPUBLIC = "-//OpenOffice.org//DTD Manifest 1.0//EN"; const odmSYSTEM = "Manifest.dtd"; const odmROOT = "manifest:manifest"; const defaultMimeType = "application/vnd.oasis.opendocument.text"; + /** + * + * @access private + * + * @since 0.4.4 + */ private $root; + /** + * + * @access private + * + * @since 0.4.7 + */ + private $dom; + + /** + * + * @access private + * + * @since 0.4.7 + */ + private $mimetype; + /** * * @access public @@ -30,7 +51,6 @@ * @since 0.4.0 */ public function __construct( $mimetype = self::defaultMimeType ) { - parent::__construct( $mimetype ); $this->createManifestDOM(); } Modified: poc/src/meta/Meta.php =================================================================== --- poc/src/meta/Meta.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/meta/Meta.php 2006-04-05 15:52:08 UTC (rev 47) @@ -16,18 +16,33 @@ * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); +require_once( "util/ReleaseInformation.php" ); +class Meta { -class Meta extends OpenDocumentObjectAbstract { - /** * This points to the "root" element of the meta data. * * @since 0.3.0 */ private $root; + + /** + * + * @access private + * + * @since 0.4.7 + */ + private $dom; + + /** + * + * @access private + * + * @since 0.4.7 + */ + private $isCommited; /** * This points to the "root" element of the document meta data structure. @@ -45,10 +60,6 @@ * @since 0.3.0 */ public function __construct( $dom=0, $root=0 ) { - parent::__construct(); - - $this->logger->debug( "Constructing meta/Meta." ); - if (empty($dom)) { // this is part of a package document $this->dom = new DOMDocument( "1.0", "utf-8" ); @@ -73,14 +84,7 @@ * * @since 0.3.0 */ - public function __destruct() { - unset( $dom ); - unset( $root ); - unset( $meta ); - - $this->logger->debug( "meta/Meta destructed." ); - - parent::__destruct(); + public function __destruct() { } /** @@ -95,7 +99,6 @@ if($tmpDom->load( $filename ) === false) { trigger_error( 'Could not parse XML contents in OpenDocument file' ); - $this->logger->crit( "Could not parse XML contents in OpenDocument file" ); return false; } @@ -126,7 +129,6 @@ * @since 0.3.2 */ public function addDublinCore( $dc, $value) { - $this->logger->debug( "meta/Meta->addDublinCore: ". $value ."." ); $node = $this->dom->createElementNS( NS::DC, "dc:".$dc, $value ); $this->root->appendChild( $node ); unset( $node ); @@ -148,8 +150,6 @@ if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; } - unset( $nodelist ); - $this->logger->debug( "meta/Meta->getDublinCore: ". $retValue ."." ); return $retValue; } @@ -178,14 +178,10 @@ } else { $creation_time = date( "Y-m-d\TH:i:s", $date ); } - $this->logger->debug( "meta/Meta->addCreationTime: ". $creation_time ."." ); - $node = $this->dom->createElementNS( NS::META, "meta:creation-date", $creation_time ); $this->root->appendChild( $node ); - - unset( $creation_time ); - + } /** @@ -209,20 +205,17 @@ */ public function addGenerator( $generator=0 ) { $lgenerator = ""; - + /* FIX ME !!!*/ if (empty($generator)) { - $lgenerator = "OpenDocmentPHP/".$this->getRelease(); + $lgenerator = "OpenDocmentPHP/" /*.ReleaseInformation->getRelease() */; } else { $lgenerator = $generator; } - $this->logger->debug( "meta/Meta->addGenerator: ". $lgenerator ."." ); - $node = $this->dom->createElementNS( NS::META, "meta:generator", $lgenerator ); $this->root->appendChild( $node ); - unset( $lgenerator ); } /** @@ -254,8 +247,7 @@ if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; } - unset( $nodelist ); - $this->logger->debug( "meta/Meta->getGenerator: ". $retValue ."." ); + return $retValue; } @@ -266,7 +258,6 @@ * @since 0.4.0 */ public function addInitialCreator( $initialCreator ) { - $this->logger->debug( "meta/Meta->addInitialCreator: ". $initialCreator ."." ); $node = $this->dom->createElementNS( NS::META, "meta:initial-creator", $initialCreator ); $this->root->appendChild( $node ); } @@ -283,8 +274,6 @@ if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; } -// unset( $nodelist ); - $this->logger->debug( "meta/Meta->getInitialCreator: ". $retValue ."." ); return $retValue; } @@ -304,7 +293,6 @@ $node->setAttributeNS( NS::META, "meta:value", $value ); } $this->root->appendChild( $node ); - unset( $node ); } /** @@ -320,7 +308,6 @@ $this->meta->appendChild( $this->root ); $this->dom->normalize(); $this->isCommited = true; - $this->logger->debug( "meta/Meta->commit()." ); } /** @@ -340,7 +327,6 @@ if (!$this->isCommited) { $this->commit(); } - $this->logger->debug( "OpenDocumentMeta->get()." ); return $this->dom; } @@ -352,7 +338,6 @@ * @since 0.4.0 */ final public function save( $filename ) { - $this->logger->debug( "OpenDocumentMeta->save(". $filename .")." ); $this->get()->save( $filename ); } } Modified: poc/src/settings/Settings.php =================================================================== --- poc/src/settings/Settings.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/settings/Settings.php 2006-04-05 15:52:08 UTC (rev 47) @@ -15,14 +15,12 @@ * * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class Settings extends OpenDocumentObjectAbstract { +class Settings { /** * * @access private - * * @since 0.4.4 */ private $settings; @@ -30,18 +28,18 @@ /** * * @access private - * * @since 0.4.4 */ private $root; /** - * This is true, if something was added to settings. - * @accedd private - * @since 0.4.4 + * + * @access private + * @since 0.4.7 */ - private $somethingAdded; - + private $dom; + + /** * Class construtor. * @@ -49,7 +47,6 @@ * @since 0.4.4 */ public function __construct( $dom=0, $root=0 ) { - parent::__construct(); $this->logger->debug( "Constructing settings/Settings." ); if (empty($dom)) { // this is part of a package document Modified: poc/src/styles/AutomaticStyles.php =================================================================== --- poc/src/styles/AutomaticStyles.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/AutomaticStyles.php 2006-04-05 15:52:08 UTC (rev 47) @@ -14,10 +14,10 @@ * @subpackage styles * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "styles/AutomaticStylesInterface.php" ); require_once( "util/NameSpaces.php" ); -class AutomaticStyles extends OpenDocumentObjectAbstract { +class AutomaticStyles{ /** * @@ -33,6 +33,12 @@ /** * + * @since 0.4.7 + */ + private $dom; + + /** + * * @param DOMDocument $dom * * @access public @@ -40,10 +46,6 @@ * @since 0.4.4 */ public function __construct( $dom, $root=0) { - parent::__construct(); - - $this->logger->debug( "Constructing styles/AutomaticStyles." ); - $this->dom = $dom; $this->root = $this->dom->createElementNS( NS::OFFICE, "office:automatic-styles" ); } Added: poc/src/styles/AutomaticStylesInterface.php =================================================================== --- poc/src/styles/AutomaticStylesInterface.php (rev 0) +++ poc/src/styles/AutomaticStylesInterface.php 2006-04-05 15:52:08 UTC (rev 47) @@ -0,0 +1,28 @@ +<?php +/** + * AutomaticStyles Interface + * + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage styles + * @since 0.4.7 + */ + +interface AutomaticStylesInterface { + + /** + * + * @access public + * + * @since 0.4.7 + */ + public function commit(); + +} +?> \ No newline at end of file Property changes on: poc/src/styles/AutomaticStylesInterface.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: poc/src/styles/AutomaticStylesSplitter.php =================================================================== --- poc/src/styles/AutomaticStylesSplitter.php (rev 0) +++ poc/src/styles/AutomaticStylesSplitter.php 2006-04-05 15:52:08 UTC (rev 47) @@ -0,0 +1,43 @@ +<?php +/** + * AutomaticStylesSplitter Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage styles + * @since 0.4.7 + */ + +class AutomaticStylesSplitter implements AutomaticStylesInterface { + private $FFD1; + private $FFD2; + /** + * + * @param DOMDocument $dom + * + * @access public + * + * @since 0.4.4 + */ + public function __construct( $f1, $f2 ) { + $this->FFD1 = $f1; + $this->FFD2 = $f2; + } + + /** + * + * @access public + * + * @since 0.4.4 + */ + public function commit() { + $this->isCommited = true; + } + +} +?> \ No newline at end of file Property changes on: poc/src/styles/AutomaticStylesSplitter.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: poc/src/styles/FontFaceDeclInterface.php =================================================================== --- poc/src/styles/FontFaceDeclInterface.php (rev 0) +++ poc/src/styles/FontFaceDeclInterface.php 2006-04-05 15:52:08 UTC (rev 47) @@ -0,0 +1,35 @@ +<?php +/** + * FontFaceDeclaration Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage styles + * @since 0.4.7 + */ + +interface FontFaceDeclInterface { + + /** + * + * @access public + * + * @since 0.4.7 + */ + public function addFontFace( $name, $styleAttr=0, $SVGAttr=0 ); + + /** + * + * @access public + * + * @since 0.4.7 + */ + public function commit(); + +} +?> \ No newline at end of file Property changes on: poc/src/styles/FontFaceDeclInterface.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Modified: poc/src/styles/FontFaceDeclSplitter.php =================================================================== --- poc/src/styles/FontFaceDeclSplitter.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/FontFaceDeclSplitter.php 2006-04-05 15:52:08 UTC (rev 47) @@ -12,9 +12,9 @@ * @subpackage styles * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "styles/FontFaceDeclInterface.php" ); -class FontFaceDeclSplitter extends OpenDocumentObjectAbstract { +class FontFaceDeclSplitter implements FontFaceDeclInterface { private $FFD1; private $FFD2; /** @@ -26,8 +26,6 @@ * @since 0.4.4 */ public function __construct( $f1, $f2 ) { - parent::__construct(); - $this->FFD1 = $f1; $this->FFD2 = $f2; } Modified: poc/src/styles/FontFaceDeclaration.php =================================================================== --- poc/src/styles/FontFaceDeclaration.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/FontFaceDeclaration.php 2006-04-05 15:52:08 UTC (rev 47) @@ -4,23 +4,32 @@ * * $Id$ * - * @license GNU General Public License - * @copyright Copyright © 2006, Norman Markgraf - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument * @subpackage styles - * @since 0.4.2 + * @since 0.4.2 */ -require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "styles/FontFaceDeclInterface.php" ); require_once( "util/NameSpaces.php" ); -class FontFaceDeclaration extends OpenDocumentObjectAbstract { +class FontFaceDeclaration implements FontFaceDeclInterface { /** * - */ + * @access private + * @since 0.4.2 + */ private $FontFaceDecl; + + /** + * + * @access private + * @since 0.4.7 + */ + private $isCommited; /** * @@ -31,7 +40,6 @@ * @since 0.4.2 */ public function __construct( $dom, $root=0) { - parent::__construct(); $this->dom = $dom; $this->useDom2 = false; Modified: poc/src/styles/MasterStyles.php =================================================================== --- poc/src/styles/MasterStyles.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/MasterStyles.php 2006-04-05 15:52:08 UTC (rev 47) @@ -14,23 +14,31 @@ * @subpackage styles * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class MasterStyles extends OpenDocumentObjectAbstract { +class MasterStyles { /** * + * @since 0.4.4 */ private $style; /** * + * @since 0.4.4 */ private $root; /** * + * @since 0.4.7 + */ + private $dom; + + + /** + * * @param DOMDocument $dom * * @access public @@ -38,10 +46,6 @@ * @since 0.4.4 */ public function __construct( $dom, $root) { - parent::__construct(); - - $this->logger->debug( "Constructing styles/MasterStyles." ); - $this->dom = $dom; $this->style = $root; $this->root = $this->dom->createElementNS( NS::OFFICE, "office:master-styles" ); Modified: poc/src/styles/Style.php =================================================================== --- poc/src/styles/Style.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/Style.php 2006-04-05 15:52:08 UTC (rev 47) @@ -12,10 +12,9 @@ * @subpackage styles * @since 0.4.4 */ -require_once( "OpenDocumentObjectAbstract.php" ); require_once( "util/NameSpaces.php" ); -class Style extends OpenDocumentObjectAbstract { +class Style { /** * @@ -31,6 +30,12 @@ /** * + * @since 0.4.7 + */ + private $dom; + + /** + * * @since 0.4.4 */ private $Styles; @@ -43,6 +48,13 @@ /** * + * @access private + * @since 0.4.7 + */ + private $isCommited; + + /** + * * @param DOMDocument $dom * * @access public @@ -50,10 +62,6 @@ * @since 0.4.4 */ public function __construct( $dom, $root=0) { - parent::__construct(); - - $this->logger->debug( "Constructing style/Style." ); - $this->dom = $dom; $this->root = $this->dom->createElementNS( NS::OFFICE, "office:styles" ); Modified: poc/src/styles/Styles.php =================================================================== --- poc/src/styles/Styles.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/styles/Styles.php 2006-04-05 15:52:08 UTC (rev 47) @@ -18,14 +18,45 @@ require_once( "styles/MasterStyles.php" ); require_once( "util/NameSpaces.php" ); -class Styles extends OpenDocumentObjectAbstract { +class Styles { + + /** + * + * @since 0.4.7 + */ + private $dom; + /** + * + * @since 0.4.0 + */ private $root; + + /** + * + * @since 0.4.0 + */ private $styles; + /** + * + * @since 0.4.5 + */ private $FontFaceDecl; + /** + * + * @since 0.4.5 + */ private $Style; + /** + * + * @since 0.4.5 + */ private $AutomaticStyles; + /** + * + * @since 0.4.5 + */ private $MasterStyles; /** @@ -38,7 +69,6 @@ * @since 0.4.0 */ public function __construct( ) { - parent::__construct(); // this is part of a package document $this->dom = new DOMDocument( "1.0", "utf-8" ); Added: poc/src/util/AbstractDocument.php =================================================================== --- poc/src/util/AbstractDocument.php (rev 0) +++ poc/src/util/AbstractDocument.php 2006-04-05 15:52:08 UTC (rev 47) @@ -0,0 +1,256 @@ +<?php +/** + * AbstractDocument Class + * + * This class will include Meta, Settings, Scripts, FontFaceDeclarations, Styles, + * Automatic Styles, Master Styles, and Body classes in one single XML file. + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @author Norman Markgraf <nma...@us...> + * @author Alex Latchford <yaw...@us...> + * @version $Revision$ + * @package OpenDocument + * + * @since 0.3.0 + */ +require_once( "OpenDocument.php" ); + +abstract class AbstractDocument implements OpenDocument { + /** + * + * @access private + * @since 0.4.7 + */ + private $AutomaticStyle; + + /** + * + * @access private + * @since 0.4.7 + */ + private $Body; + + /** + * + * @access private + * @since 0.4.7 + */ + private $FontFaceDeclaration; + + /** + * + * @access private + * @since 0.4.7 + */ + private $MasterStyle; + + /** + * + * @access private + * @since 0.4.7 + */ + private $Meta; + + /** + * + * @access private + * @since 0.4.7 + */ + private $Scripts; + + /** + * + * @access private + * @since 0.4.7 + */ + private $Settings; + + /** + * + * @access private + * @since 0.4.7 + */ + private $Style; + + /** + * The mime type of the document + * + * @access protected + * @since 0.4.7 + */ + protected $mimetype; + + /** + * + * @access public + * @since 0.4.7 + */ + public function __construct( $mimetype = 0 ) { + $this->logger = &Log::factory( "null", "", "OpenDocument" ); + $this->logger->debug( "Constructing AbstractDocument." ); + + $this->mimetype = $mimetype; + } + + /** + * + * @access public + * @since 0.3.0 + */ + public function __destruct() { + $this->logger->debug( "AbstractDocument destructed." ); + $this->logger->close(); + } + + + /** + * + * @access public + * @since 0.4.7 + */ + public function getMeta() { + if ( empty($this->Meta)) { + $this->Meta = new Meta( $this->dom, $this->root ); + } + return $this->Meta; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getStyle() { + if ( empty($this->Style)) { + $this->Style = new Style( $this->dom, $this->root ); + } + return $this->Style; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getBody() { + if ( empty($this->Body)) { + $this->Body = new Body( $this->dom, $this->root ); + } + return $this->Body; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getFontFaceDeclaration(){ + if ( empty($this->FontFaceDeclaration)) { + $this->FontFaceDeclaration = new FontFaceDeclaration( $this->dom, $this->root ); + } + return $this->FontFaceDeclaration; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getSettings(){ + if ( empty($this->Settings)) { + $this->Settings = new Settings( $this->dom, $this->root ); + } + return $this->Settings; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getScripts(){ + if ( empty($this->Scripts)) { + $this->Scripts = new Scripts( $this->dom, $this->root ); + } + return $this->Scripts; + } + + + /** + * + * @access public + * @since 0.4.7 + */ + public function getAutomaticStyles(){ + if ( empty($this->AutomaticStyles)) { + $this->AutomaticStyles = new AutomaticStyles( $this->dom, $this->root ); + } + return $this->AutomaticStyles; + } + + /** + * + * @access public + * @since 0.4.7 + */ + public function getMasterStyles(){ + if ( empty($this->MasterStyles)) { + $this->MasterStyles = new MasterStyles( $this->dom, $this->root ); + } + return $this->MasterStyles; + } + + /** + * Returns the setted mime type of this document. + * + * @return string Current mime type of this document. + * @access public + * @final + * @since 0.4.0 + */ + final public function getMimeType() { + return $this->mimetype; + } + + /** + * Returns revision information + * + * @return string Revision information. + * @access public + * @final + * @since 0.4.0 + */ + final public function getRevision() { + $Revision = ""; + return "(".substr("$Revision$",-2).")".ReleaseInformation::Revision; + } + + /** + * Returns release and revision information. + * + * @return string Release and revision information. + * @access public + * @final + * @since 0.4.0 + */ + final public function getRelease() { + return ReleaseInformation::Release.".".ReleaseInformation::Revision; + } + + /** + * Returns some informations about this package, release and copyright. + * + * @return string Package name, release and copyright. + * @access public + * @final + * @since 0.4.0 + */ + final public function getPackageInformation() { + return self::PackageName . " " . $this->getRelease() . " " . self::Copyright; + } + + +} \ No newline at end of file Property changes on: poc/src/util/AbstractDocument.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: poc/src/util/MimeTypes.php =================================================================== --- poc/src/util/MimeTypes.php (rev 0) +++ poc/src/util/MimeTypes.php 2006-04-05 15:52:08 UTC (rev 47) @@ -0,0 +1,22 @@ +<?php +/** + * NameSpaces Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage util + * @since 0.4.7 + */ + +class MimeTypes { + const Text = "application/vnd.oasis.opendocument.text"; + const Calc = "application/vnd.oasis.opendocument.calc"; + const defaultMimeType = "application/vnd.oasis.opendocument.text"; +} + +?> \ No newline at end of file Property changes on: poc/src/util/MimeTypes.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Modified: poc/src/util/NameSpaces.php =================================================================== --- poc/src/util/NameSpaces.php 2006-03-30 14:12:08 UTC (rev 46) +++ poc/src/util/NameSpaces.php 2006-04-05 15:52:08 UTC (rev 47) @@ -10,7 +10,7 @@ * @version $Revision$ * @package OpenDocument * @subpackage util - * @since 0.5.0 + * @since 0.4.6 */ class NameSpaces { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-30 14:12:29
|
Revision: 46 Author: nmarkgraf Date: 2006-03-30 06:12:08 -0800 (Thu, 30 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=46&view=rev Log Message: ----------- Moved release information in a new, generated class util/ReleaseInformation.php. This file will be created by PHing. Because of that, some changes in OpenDocumentAbstract and a new template file (etc/ReleaseInformation.tpl). Modified Paths: -------------- poc/build.properties poc/build.xml poc/src/OpenDocumentAbstract.php Added Paths: ----------- poc/etc/ReleaseInformation.tpl Modified: poc/build.properties =================================================================== --- poc/build.properties 2006-03-30 13:37:20 UTC (rev 45) +++ poc/build.properties 2006-03-30 14:12:08 UTC (rev 46) @@ -7,3 +7,5 @@ # $Id$ release=0.4.6 releaseDos=0_4_6 +# This could be ALPHA, BETA or STABLE +revision=ALPHA \ No newline at end of file Modified: poc/build.xml =================================================================== --- poc/build.xml 2006-03-30 13:37:20 UTC (rev 45) +++ poc/build.xml 2006-03-30 14:12:08 UTC (rev 46) @@ -35,18 +35,14 @@ </target> <target name="updateReleaseInfo"> - <copy file="src/OpenDocumentAbstract.php" tofile="tmp.tmp" overwrite="true"> + <copy file="etc/ReleaseInformation.tpl" tofile="src/util/ReleaseInformation.php" overwrite="true"> <filterchain> - <replaceregexp> - <regexp pattern=".*const.*Release.*=.*" replace="##release##"/> - </replaceregexp> <replacetokens begintoken="##" endtoken="##"> - <token key="release" value=" const Release = '${release}';" /> + <token key="release" value="${release}" /> + <token key="revision" value="${revision}" /> </replacetokens> </filterchain> </copy> - <copy file="tmp.tmp" tofile="src/OpenDocumentAbstract.php" overwrite="true" /> - <delete file="tmp.tmp" /> </target> <target name="reports" depends="preparereport"> Added: poc/etc/ReleaseInformation.tpl =================================================================== --- poc/etc/ReleaseInformation.tpl (rev 0) +++ poc/etc/ReleaseInformation.tpl 2006-03-30 14:12:08 UTC (rev 46) @@ -0,0 +1,30 @@ +<?php +/** + * DO NOT EDIT THIS FILE! It is automaticaly generated by PHing build script! + * + * $Id $ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision: 39 $ + * @package OpenDocument + * @subpackage util + * + * @since 0.4.6 + */ +class ReleaseInformation { + /** + * Is this ALPHA, BETA or STABLE code? + */ + const Revision = "##revision##"; + + /** + * Release number: X.Y.Z + * + * X = 0 : "proof of concept" (a.k.a POC) code + * X = 1 : "stage 1" code + */ + const Release = "##release##"; +} +?> \ No newline at end of file Modified: poc/src/OpenDocumentAbstract.php =================================================================== --- poc/src/OpenDocumentAbstract.php 2006-03-30 13:37:20 UTC (rev 45) +++ poc/src/OpenDocumentAbstract.php 2006-03-30 14:12:08 UTC (rev 46) @@ -16,21 +16,11 @@ * @since 0.3.0 */ +require_once( "util/ReleaseInformation.php" ); + class OpenDocumentAbstract { - /** - * Is this ALPHA, BETA or STABLE code? - */ - const Revision = "ALPHA"; /** - * Release number: X.Y.Z - * - * X = 0 : "proof of concept" (a.k.a POC) code - * X = 1 : "stage 1" code - */ - const Release = '0.4.6'; - - /** * Copyright notice for this package. */ const Copyright = "(C) in 2006 by Norman Markgraf, Alex Latchford, et al."; @@ -113,7 +103,7 @@ */ final public function getRevision() { $Revision = ""; - return "(".substr("$Revision$",-2).")".self::Revision; + return "(".substr("$Revision$",-2).")".ReleaseInformation::Revision; } /** @@ -125,7 +115,7 @@ * @since 0.4.0 */ final public function getRelease() { - return self::Release.".".self::Revision; + return ReleaseInformation::Release.".".ReleaseInformation::Revision; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-30 13:37:34
|
Revision: 45 Author: nmarkgraf Date: 2006-03-30 05:37:20 -0800 (Thu, 30 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=45&view=rev Log Message: ----------- Tiny bug fixes. Modified Paths: -------------- poc/build.xml poc/src/util/NameSpaces.php Modified: poc/build.xml =================================================================== --- poc/build.xml 2006-03-30 13:20:40 UTC (rev 44) +++ poc/build.xml 2006-03-30 13:37:20 UTC (rev 45) @@ -146,6 +146,7 @@ <fileset dir="."> <include name="**/etc/solid.txt" /> <include name="**/production/**/*.php" /> + <exclude name="**/samples/**/*.php" /> </fileset> <filterchain> <replaceregexp> Modified: poc/src/util/NameSpaces.php =================================================================== --- poc/src/util/NameSpaces.php 2006-03-30 13:20:40 UTC (rev 44) +++ poc/src/util/NameSpaces.php 2006-03-30 13:37:20 UTC (rev 45) @@ -142,3 +142,5 @@ class NS extends NameSpaces { }; + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-30 13:20:53
|
Revision: 44 Author: nmarkgraf Date: 2006-03-30 05:20:40 -0800 (Thu, 30 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=44&view=rev Log Message: ----------- New feature: - The release property in build.properties will be used to update OpenDocumentAbstract::Release. We need an build.xml refactoring as soon as we heading to 0.6.0 ...;) Modified Paths: -------------- poc/build.xml poc/src/OpenDocumentAbstract.php Modified: poc/build.xml =================================================================== --- poc/build.xml 2006-03-30 10:47:03 UTC (rev 43) +++ poc/build.xml 2006-03-30 13:20:40 UTC (rev 44) @@ -5,7 +5,7 @@ <property file="build.properties" /> <property name="OpenDocumentPHPSolid" value="OpenDocumentPHP-${release}-solid.php" /> - <target name="prepare"> + <target name="prepare" depends="updateReleaseInfo"> <mkdir dir="reports"/> <mkdir dir="reports/coverage"/> <mkdir dir="reports/tests"/> @@ -34,6 +34,21 @@ <mkdir dir="reports/tests"/> </target> + <target name="updateReleaseInfo"> + <copy file="src/OpenDocumentAbstract.php" tofile="tmp.tmp" overwrite="true"> + <filterchain> + <replaceregexp> + <regexp pattern=".*const.*Release.*=.*" replace="##release##"/> + </replaceregexp> + <replacetokens begintoken="##" endtoken="##"> + <token key="release" value=" const Release = '${release}';" /> + </replacetokens> + </filterchain> + </copy> + <copy file="tmp.tmp" tofile="src/OpenDocumentAbstract.php" overwrite="true" /> + <delete file="tmp.tmp" /> + </target> + <target name="reports" depends="preparereport"> <coverage-setup database="reports/data/${release}/coverage.db"> <fileset dir="src"> @@ -125,36 +140,36 @@ </copy> </target> - <target name="solid-production" depends="production" description="Creates a single file production release without unit tests in the dist directory."> - <mkdir dir="solid-production"/> - <copy todir="solid-production"> <!--"/OpenDocumentPHP-solid.php" overwrite="true" --> - <fileset dir="production"> - <include name="**/*.php" /> - </fileset> + <target name="solid-file" depends="production"> + <delete file="dist/tmp.tmp"/> + <append destFile="dist/tmp.tmp"> + <fileset dir="."> + <include name="**/etc/solid.txt" /> + <include name="**/production/**/*.php" /> + </fileset> <filterchain> <replaceregexp> <regexp pattern=".*require_once" replace="//require_once" ignoreCase="true" /> <regexp pattern=".*include_once" replace="//include_once" ignoreCase="true" /> - <regexp pattern=".+this-.logger.+" replace="//this-logger-" /> - </replaceregexp> - <!-- stripphpcomments /--> + <regexp pattern=".+this-.logger.+" replace="//this-logger-" /> + </replaceregexp> + </filterchain> + </append> + </target> + + <target name="solid-production" depends="solid-file" description="Creates a single file production release without unit tests in the dist directory."> + <copy file="dist/tmp.tmp" tofile="dist/${OpenDocumentPHPSolid}" overwrite="true"> + <filterchain> + <replaceregexp> + <regexp pattern="\?>.\?php" replace="//" /> + </replaceregexp> <striplinecomments> <comment value="//" /> </striplinecomments> - </filterchain> - </copy> - <!-- echo msg="${OpenDocumentPHPSolid}"/--> - <!-- echo msg="${os.name}"/--> - <exec command="copy ..\etc\solid.txt + *.php + manifest\*.php + content\*.php + settings\*.php + styles\*.php + meta\*.php tmp.tmp" dir="solid-production"/> - <exec command="cat ../etc/solid.txt > ../tmp.tmp && cat *.php >> ../tmp.tmp && cat */*.php >> ../tmp.tmp" dir="solid-production" os="linux"/> - <copy file="solid-production/tmp.tmp" tofile="dist/${OpenDocumentPHPSolid}" overwrite="true"> - <filterchain> - <replaceregexp> - <regexp pattern="\?>.\?php" replace=" " /> - </replaceregexp> + <!--stripphpcomments /--> </filterchain> - </copy> - <delete dir="solid-production"/> + </copy> + <delete file="dist/tmp.tmp"/> </target> <target name="build" depends="prepare,test,reports,docs,dist"> @@ -174,6 +189,7 @@ <delete file="OpenDocumentPHP.tar"/> <delete dir="production"/> <delete dir="solid-production"/> + <delete file="dist/tmp.tmp"/> </target> <target name="proper" depends="clean"> Modified: poc/src/OpenDocumentAbstract.php =================================================================== --- poc/src/OpenDocumentAbstract.php 2006-03-30 10:47:03 UTC (rev 43) +++ poc/src/OpenDocumentAbstract.php 2006-03-30 13:20:40 UTC (rev 44) @@ -28,7 +28,7 @@ * X = 0 : "proof of concept" (a.k.a POC) code * X = 1 : "stage 1" code */ - const Release = "0.4.6"; + const Release = '0.4.6'; /** * Copyright notice for this package. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-30 10:47:14
|
Revision: 43 Author: nmarkgraf Date: 2006-03-30 02:47:03 -0800 (Thu, 30 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=43&view=rev Log Message: ----------- We are now heading to POC 0.4.6... ;) Modified Paths: -------------- poc/build.properties poc/src/OpenDocumentAbstract.php Modified: poc/build.properties =================================================================== --- poc/build.properties 2006-03-30 08:24:22 UTC (rev 42) +++ poc/build.properties 2006-03-30 10:47:03 UTC (rev 43) @@ -5,6 +5,5 @@ # Last edited by $Author$ # # $Id$ -release=0.5.0 -releaseDos=0_5_0 -revision=$revision$ \ No newline at end of file +release=0.4.6 +releaseDos=0_4_6 Modified: poc/src/OpenDocumentAbstract.php =================================================================== --- poc/src/OpenDocumentAbstract.php 2006-03-30 08:24:22 UTC (rev 42) +++ poc/src/OpenDocumentAbstract.php 2006-03-30 10:47:03 UTC (rev 43) @@ -28,7 +28,7 @@ * X = 0 : "proof of concept" (a.k.a POC) code * X = 1 : "stage 1" code */ - const Release = "0.4.3"; + const Release = "0.4.6"; /** * Copyright notice for this package. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-30 08:24:56
|
Revision: 42 Author: nmarkgraf Date: 2006-03-30 00:24:22 -0800 (Thu, 30 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=42&view=rev Log Message: ----------- Refactoring session: - Removed OpenDocumentObjectAbstractTest, because namespaces now have a class names NameSpaces. Most of the unit test is now in NameSpacesTest.php. - Much fixes in other classes to match these changes. Remarks: - I think OpenDocumentObjectAbstract is obsolete and can be removed in future. Most of the stuff in it can be made in OpenDocumentAbstract. - All base classes should moved to util directory to clean up a little bit. Modified Paths: -------------- poc/build.xml poc/src/OpenDocumentObjectAbstract.php poc/src/OpenDocumentSingle.php poc/src/OpenDocumentSingleTest.php poc/src/content/Body.php poc/src/content/BodyTable.php poc/src/content/BodyText.php poc/src/content/Content.php poc/src/content/Scripts.php poc/src/manifest/Manifest.php poc/src/meta/Meta.php poc/src/samples/TestOutput.php poc/src/settings/Settings.php poc/src/styles/AutomaticStyles.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/MasterStyles.php poc/src/styles/Style.php poc/src/styles/Styles.php Added Paths: ----------- poc/src/util/ poc/src/util/NameSpaces.php poc/src/util/NameSpacesTest.php Removed Paths: ------------- poc/src/OpenDocumentObjectAbstractTest.php Modified: poc/build.xml =================================================================== --- poc/build.xml 2006-03-29 13:59:14 UTC (rev 41) +++ poc/build.xml 2006-03-30 08:24:22 UTC (rev 42) @@ -81,12 +81,12 @@ <target name="dist" depends="production" description="Creates a snapshot of the current production release in a zip and a tar file in the dist directory."> <zip destfile="dist/OpenDocumentPHP-${release}.zip" basedir="production"/> - <tar destfile="dist/OpenDocumentPHP-${release}.tar" basedir="production"/> + <tar destfile="dist/OpenDocumentPHP-${release}.tar.gz" basedir="production" compression="gzip"/> </target> <target name="dist-src" depends="preparedist" description="Creates a snapshot of the current src directory in a zip and a tar file in the dist directory."> <zip destfile="dist/OpenDocumentPHP-${release}-src.zip" basedir="src"/> - <tar destfile="dist/OpenDocumentPHP-${release}-src.tar" basedir="src"/> + <tar destfile="dist/OpenDocumentPHP-${release}-src.tar.gz" basedir="src" compression="gzip"/> </target> <target name="dev-dist" depends="preparedist" description="Creates a snapshot of the all the current project directories in a zip and a tar file in the dist directory."> @@ -94,16 +94,27 @@ <fileset dir="."> <include name="**/**"/> <exclude name="**/?svn/**"/> + <exclude name="**/dist/**"/> + <exclude name="**/reports/**"/> + <exclude name="**/docs/**"/> + <exclude name="**/production/**"/> </fileset> </zip> - <tar destfile="dist/OpenDocumentPHP-${release}-dev.tar" basedir="."> + <tar destfile="dist/OpenDocumentPHP-${release}-dev.tar.gz" basedir="." compression="gzip"> <fileset dir="."> <include name="**/**"/> <exclude name="**/?svn/**"/> + <exclude name="**/dist/**"/> + <exclude name="**/reports/**"/> + <exclude name="**/docs/**"/> + <exclude name="**/production/**"/> </fileset> - </tar> + </tar> </target> + <target name="dist-all" depends="dist,dist-src,dev-dist,solid-production" description="Creates a all snapshots in the dist directory."> + </target> + <target name="production" depends="prepare" description="Creates a production release without unit tests in the production directory."> <copy todir="production"> <fileset dir="src"> Modified: poc/src/OpenDocumentObjectAbstract.php =================================================================== --- poc/src/OpenDocumentObjectAbstract.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/OpenDocumentObjectAbstract.php 2006-03-30 08:24:22 UTC (rev 42) @@ -15,118 +15,8 @@ require_once( "OpenDocumentAbstract.php" ); class OpenDocumentObjectAbstract extends OpenDocumentAbstract { - - /** - * namespace OpenDocument meta - */ - const NS_META = "urn:oasis:names:tc:opendocument:xmlns:meta:1.0"; - - /** - * namespace OpenDocument office - */ - const NS_OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0"; - - /** - * namespace OpenDocument manifest - */ - const NS_MANIFEST = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"; /** - * namespace OpenDocument style - */ - const NS_STYLE = "urn:oasis:names:tc:opendocument:xmlns:style:1.0"; - - /** - * namespace OpenDocument text - */ - const NS_TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0"; - - /** - * namespace OpenDocument draw - */ - const NS_DRAW = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"; - - /** - * namespace OpenDocument table - */ - const NS_TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0"; - - /** - * namespace OpenDocument number - */ - const NS_NUMBER = "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; - - /** - * namespace OpenDocument chart - */ - const NS_CHART = "urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; - - /** - * namespace OpenDocument form - */ - const NS_FORM = "urn:oasis:names:tc:opendocument:xmlns:form:1.0"; - - /** - * namespace OpenDocument config - */ - const NS_CONFIG = "urn:oasis:names:tc:opendocument:xmlns:config:1.0"; - - /** - * namespace OpenDocument presentation - */ - const NS_PRESENTATION = "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"; - - /** - * namespace OpenDocument dr3d - */ - const NS_DR3D = "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; - - /** - * namespace OpenDocument animation - */ - const NS_ANIM = "urn:oasis:names:tc:opendocument:xmlns:animation:1.0"; - - /** - * namespace OpenDocument script - */ - const NS_SCRIPT = "urn:oasis:names:tc:opendocument:xmlns:script:1.0"; - - /** - * namespace OpenDocument svg - */ - const NS_SVG = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; - - /** - * namespace OpenDocument fo (formation objects) - */ - const NS_FO = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; - - /** - * namespace OpenDocument smil - */ - const NS_SMIL = "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"; - - /** - * namespace Dublin Core - */ - const NS_DC = "http://purl.org/dc/elements/1.1/"; - - /** - * namespace XLink - */ - const NS_XLINK = "http://www.w3.org/1999/xlink"; - - /** - * namespace XForms - */ - const NS_XFORMS = "http://www.w3.org/2002/xforms"; - - /** - * namespace MathML - */ - const NS_MATHML = "http://www.w3.org/1998/Math/MathML"; - - /** * @access protected */ protected $dom; Deleted: poc/src/OpenDocumentObjectAbstractTest.php =================================================================== --- poc/src/OpenDocumentObjectAbstractTest.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/OpenDocumentObjectAbstractTest.php 2006-03-30 08:24:22 UTC (rev 42) @@ -1,74 +0,0 @@ -<?php -/** - * TestCase for OpenDocumentObjectAbstract class - * - * $Id$ - * - * @copyright Copyright © 2006, Norman Markgraf, et al. - * @license GNU General Public License - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument - * @subpackage UnitTest - * @since 0.5.0 - */ - -require_once "PHPUnit2/Framework/TestCase.php"; -require_once "OpenDocumentObjectAbstract.php"; - -class OpenDocumentObjectAbstractTest extends PHPUnit2_Framework_TestCase { - -const office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"; -const style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"; -const text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"; -const table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"; -const draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"; -const fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; -const xlink="http://www.w3.org/1999/xlink"; -const dc="http://purl.org/dc/elements/1.1/"; -const meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"; -const number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; -const svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; -const chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; -const dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; -const math="http://www.w3.org/1998/Math/MathML"; -const form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"; -const script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"; -const ooo="http://openoffice.org/2004/office"; -const ooow="http://openoffice.org/2004/writer"; -const oooc="http://openoffice.org/2004/calc"; -const dom="http://www.w3.org/2001/xml-events"; - - /** - * This test will check all name spaces. The namespaces in this file are extracted from - * an OpenOffice document, so they are not written by hand out of the OpenDocument documentation. - * This should help to fix typos. (And it did!!!) - * - * @since 0.5.0 - */ - function testNamespaces() { - $this->assertEquals( OpenDocumentObjectAbstract::NS_OFFICE, self::office ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_STYLE, self::style ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_TEXT, self::text ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_TABLE, self::table ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_DRAW, self::draw ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_FO, self::fo ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_XLINK, self::xlink ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_DC, self::dc ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_META, self::meta ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_NUMBER, self::number ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_SVG, self::svg ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_CHART, self::chart ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_DR3D, self::dr3d ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_MATHML, self::math ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_FORM, self::form ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_SCRIPT, self::script ); -/* - $this->assertEquals( OpenDocumentObjectAbstract::NS_OOO, self::ooo ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_OOOW, self::ooow ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_OOOC, self::oooc ); - $this->assertEquals( OpenDocumentObjectAbstract::NS_DOM, self::dom ); -*/ - } -} -?> \ No newline at end of file Modified: poc/src/OpenDocumentSingle.php =================================================================== --- poc/src/OpenDocumentSingle.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/OpenDocumentSingle.php 2006-03-30 08:24:22 UTC (rev 42) @@ -25,6 +25,7 @@ require_once( "styles/MasterStyles.php" ); require_once( "content/Body.php" ); require_once( "OpenDocumentAbstract.php" ); +require_once( "util/NameSpaces.php" ); class OpenDocumentSingle extends OpenDocumentAbstract implements OpenDocument { /** @@ -49,12 +50,6 @@ private $root; /** - * namespace OpenDocument office - * @since 0.3.0 - */ - const NS_OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0"; - - /** * * @access public * @@ -68,8 +63,8 @@ $this->isCommited = false; $this->dom = new DOMDocument( "1.0", "utf-8" ); - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:document" ); - $this->root->setAttributeNS( self::NS_OFFICE, "office:mimetype", $mimetype ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:document" ); + $this->root->setAttributeNS( NS::OFFICE, "office:mimetype", $mimetype ); $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclaration( $this->dom, $this->root ); Modified: poc/src/OpenDocumentSingleTest.php =================================================================== --- poc/src/OpenDocumentSingleTest.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/OpenDocumentSingleTest.php 2006-03-30 08:24:22 UTC (rev 42) @@ -38,12 +38,30 @@ $meta->addInitialCreator( "Testo Tester" ); $meta->addCreationDate(); - /* Initialize Font Face Declarations: */ + /* Initialize Font Face Declarations: */ + $fontfacedecl = $ODT->getFontFaceDeclaration(); + $styleAttr = array(); - $styleAttr[ "font-family" ] ="Tahoma"; - - $fontfacedelc = $ODT->getFontFaceDeclaration(); - $fontfacedelc->addFontFace( "Test", $styleAttr ); + $svgAttr = array(); + + $styleAttr[ "font-pitch" ] = "variable"; + $svgAttr [ "font-family" ] = "'Arial Unicode MS'"; + $fontfacedecl->addFontFace( "Arial Unicode MS", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "Tahoma"; + $fontfacedecl->addFontFace( "Tahoma", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "'MS Mincho'"; + $fontfacedecl->addFontFace( "MS Mincho", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "'Times New Roman'"; + $styleAttr[ "font-family-generic" ] = "roman"; + $fontfacedecl->addFontFace( "Times New Roman", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "Arial"; + $styleAttr[ "font-family-generic" ] = "swiss"; + $fontfacedecl->addFontFace( "Arial", $styleAttr, $svgAttr ); + unset( $styleAttr ); /* Add text to Body: */ Modified: poc/src/content/Body.php =================================================================== --- poc/src/content/Body.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/content/Body.php 2006-03-30 08:24:22 UTC (rev 42) @@ -15,6 +15,7 @@ require_once( "OpenDocumentObjectAbstract.php" ); require_once( "content/BodyText.php" ); require_once( "content/BodyTable.php" ); +require_once( "util/NameSpaces.php" ); class Body extends OpenDocumentObjectAbstract { @@ -51,7 +52,7 @@ $this->dom = $dom; $this->BodyFragment = $this->dom->createDocumentFragment(); - $this->body = $this->dom->createElementNS( self::NS_OFFICE, "office:body" ); + $this->body = $this->dom->createElementNS( NS::OFFICE, "office:body" ); $this->Fragments = array(); } @@ -94,7 +95,7 @@ */ public function getText() { $this->logger->debug( "content/Body->getText()" ); - return $this->getByNamespace( self::NS_TEXT, "BodyText" ); + return $this->getByNamespace( NS::TEXT, "BodyText" ); } /** @@ -104,7 +105,7 @@ */ public function getTable() { $this->logger->debug( "content/Body->getTable()" ); - return $this->getByNamespace( self::NS_TABLE, "BodyTable" ); + return $this->getByNamespace( NS::TABLE, "BodyTable" ); } /** Modified: poc/src/content/BodyTable.php =================================================================== --- poc/src/content/BodyTable.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/content/BodyTable.php 2006-03-30 08:24:22 UTC (rev 42) @@ -14,6 +14,7 @@ */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class BodyTable extends OpenDocumentObjectAbstract { /** @@ -27,7 +28,7 @@ $this->dom = $dom; $this->DomFragment = $dom->createDocumentFragment(); - $this->body = $this->DomFragment->createElementNS( self::NS_OFFICE, "office:table" ); + $this->body = $this->DomFragment->createElementNS( NS::OFFICE, "office:table" ); } /** Modified: poc/src/content/BodyText.php =================================================================== --- poc/src/content/BodyText.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/content/BodyText.php 2006-03-30 08:24:22 UTC (rev 42) @@ -13,6 +13,7 @@ */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class BodyText extends OpenDocumentObjectAbstract { /** @@ -27,7 +28,7 @@ $this->logger->debug( "Constructing OpenDocumentContentBodyText." ); $this->dom = $dom; - $this->text = $this->dom->createElementNS( self::NS_OFFICE, "office:text" ); + $this->text = $this->dom->createElementNS( NS::OFFICE, "office:text" ); } /** @@ -50,11 +51,11 @@ public function getTextParagraph( $styleName, $parText=0 ) { $this->logger->debug( "OpenDocumentContentBodyText->getTextParagraph(\"".$styleName."\",\"".$parText."\")" ); if (empty($parText)) { - $par = $this->dom->createElementNS( self::NS_TEXT, "text:p" ); + $par = $this->dom->createElementNS( NS::TEXT, "text:p" ); } else { - $par = $this->dom->createElementNS( self::NS_TEXT, "text:p", $parText ); + $par = $this->dom->createElementNS( NS::TEXT, "text:p", $parText ); } - $par->setAttributeNS( self::NS_TEXT, "text:style-name", $styleName ); + $par->setAttributeNS( NS::TEXT, "text:style-name", $styleName ); return $par; } @@ -78,12 +79,12 @@ public function getTextHeading( $styleName, $outlineLevel=1, $headText=0 ) { $this->logger->debug( "OpenDocumentContentBodyText->getTextHeading()" ); if (empty($headText)) { - $head = $this->dom->createElementNS( self::NS_TEXT, "text:h" ); + $head = $this->dom->createElementNS( NS::TEXT, "text:h" ); } else { - $head = $this->dom->createElementNS( self::NS_TEXT, "text:h", $headText ); + $head = $this->dom->createElementNS( NS::TEXT, "text:h", $headText ); } - $head->setAttributeNS( self::NS_TEXT, "text:style-name", $styleName ); - $head->setAttributeNS( self::NS_TEXT, "text:outline-level", $outlineLevel ); + $head->setAttributeNS( NS::TEXT, "text:style-name", $styleName ); + $head->setAttributeNS( NS::TEXT, "text:outline-level", $outlineLevel ); return $head; } @@ -95,10 +96,10 @@ */ public function addNoForms() { $this->logger->debug( "OpenDocumentContentBodyText->addNoForms()" ); - $forms = $this->dom->createElementNS( self::NS_OFFICE, "office:forms" ); + $forms = $this->dom->createElementNS( NS::OFFICE, "office:forms" ); - $forms->setAttributeNS( self::NS_FORM, "form:automatic-focus", "false" ); - $forms->setAttributeNS( self::NS_FORM, "form:apply-design-mode", "false" ); + $forms->setAttributeNS( NS::FORM, "form:automatic-focus", "false" ); + $forms->setAttributeNS( NS::FORM, "form:apply-design-mode", "false" ); $this->text->appendChild( $forms ); unset( $forms ); Modified: poc/src/content/Content.php =================================================================== --- poc/src/content/Content.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/content/Content.php 2006-03-30 08:24:22 UTC (rev 42) @@ -18,6 +18,7 @@ require_once( "styles/AutomaticStyles.php" ); require_once( "content/Body.php" ); require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class Content extends OpenDocumentObjectAbstract { @@ -42,8 +43,8 @@ $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->dom->formatOutput = true; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:document-content" ); - $this->root->setAttributeNS( self::NS_OFFICE, "office:version", "1.0" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:document-content" ); + $this->root->setAttributeNS( NS::OFFICE, "office:version", "1.0" ); $this->content = $this->dom; $this->Scripts = new Scripts( $this->dom, $this->root ); Modified: poc/src/content/Scripts.php =================================================================== --- poc/src/content/Scripts.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/content/Scripts.php 2006-03-30 08:24:22 UTC (rev 42) @@ -16,6 +16,7 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class Scripts extends OpenDocumentObjectAbstract { /** @@ -45,7 +46,7 @@ $this->logger->debug( "Constructing content/Scripts." ); $this->dom = $dom; - $this->scripts = $this->dom->createElementNS( self::NS_OFFICE, "office:scripts" ); + $this->scripts = $this->dom->createElementNS( NS::OFFICE, "office:scripts" ); $this->root = 0; } Modified: poc/src/manifest/Manifest.php =================================================================== --- poc/src/manifest/Manifest.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/manifest/Manifest.php 2006-03-30 08:24:22 UTC (rev 42) @@ -13,7 +13,8 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); - +require_once( "util/NameSpaces.php" ); + class Manifest extends OpenDocumentObjectAbstract { const odmPUBLIC = "-//OpenOffice.org//DTD Manifest 1.0//EN"; const odmSYSTEM = "Manifest.dtd"; @@ -61,11 +62,11 @@ $this->dom->encoding = "UTF-8"; $this->dom->formatOutput = true; - $this->root = $this->dom->createElementNS( self::NS_MANIFEST, self::odmROOT ); + $this->root = $this->dom->createElementNS( NS::MANIFEST, self::odmROOT ); - $node = $this->dom->createElementNS( self::NS_MANIFEST, "manifest:file-entry" ); - $node->setAttributeNS( self::NS_MANIFEST, "manifest:media-type", $this->mimetype ); - $node->setAttributeNS( self::NS_MANIFEST, "manifest:full-path", "/" ); + $node = $this->dom->createElementNS( NS::MANIFEST, "manifest:file-entry" ); + $node->setAttributeNS( NS::MANIFEST, "manifest:media-type", $this->mimetype ); + $node->setAttributeNS( NS::MANIFEST, "manifest:full-path", "/" ); $this->root->appendChild( $node ); @@ -82,11 +83,11 @@ * @since 0.4.0 */ final public function addEntryToManifest( $fullpath, $mimetype, $size=-1, $encrypt=0 ) { - $node = $this->dom->createElementNS( self::NS_MANIFEST, "manifest:file-entry" ); - $node->setAttributeNS( self::NS_MANIFEST, "manifest:media-type", $mimetype ); - $node->setAttributeNS( self::NS_MANIFEST, "manifest:full-path", $fullpath ); + $node = $this->dom->createElementNS( NS::MANIFEST, "manifest:file-entry" ); + $node->setAttributeNS( NS::MANIFEST, "manifest:media-type", $mimetype ); + $node->setAttributeNS( NS::MANIFEST, "manifest:full-path", $fullpath ); if ( $size >= 0 ) { - $node->setAttributeNS( self::NS_MANIFEST, "manifest:size", $size ); + $node->setAttributeNS( NS::MANIFEST, "manifest:size", $size ); } if (!empty($encrypt)) { $node->appendChild( $encrypt ); @@ -103,7 +104,7 @@ * @since 0.4.0 */ final public function createEncryptionData( ) { - return $this->dom->createElmentNS( self::NS_MANIFEST, "manifest:encryption-data" ); + return $this->dom->createElmentNS( NS::MANIFEST, "manifest:encryption-data" ); } /** Modified: poc/src/meta/Meta.php =================================================================== --- poc/src/meta/Meta.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/meta/Meta.php 2006-03-30 08:24:22 UTC (rev 42) @@ -16,6 +16,10 @@ * @since 0.4.4 */ +require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); + + class Meta extends OpenDocumentObjectAbstract { /** @@ -50,8 +54,8 @@ $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->dom->formatOutput = true; - $node = $this->dom->createElementNS( self::NS_OFFICE, "office:document-meta" ); - $node->setAttributeNS( self::NS_OFFICE, "office:version", "1.0" ); + $node = $this->dom->createElementNS( NS::OFFICE, "office:document-meta" ); + $node->setAttributeNS( NS::OFFICE, "office:version", "1.0" ); $this->dom->appendChild( $node ); $this->meta = $node; @@ -60,7 +64,7 @@ $this->dom = $dom; $this->meta = $root; } - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:meta" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:meta" ); } /** @@ -95,19 +99,19 @@ return false; } - $OFFICE_PREFIX = $tmpDom->getElementsByTagNameNS( self::NS_OFFICE, "*").item( 0 )->prefix; + $OFFICE_PREFIX = $tmpDom->getElementsByTagNameNS( NS::OFFICE, "*").item( 0 )->prefix; // Figgure out if file is part of a package or a single document; - $isSingleDoc = (count($tmpDom->getElementsByTagNameNS( self::NS_OFFICE, $OFFICE_PREFIX.":document-meta" ))==0); + $isSingleDoc = (count($tmpDom->getElementsByTagNameNS( NS::OFFICE, $OFFICE_PREFIX.":document-meta" ))==0); if ($isSingleDoc) { $this->dom = $tmpDoc; $this->meta = $tmpDoc; } else { $this->dom = $tmpDoc; - $this->meta = $tmtDoc->getElementsByTageNameNS( self::NS_OFFICE, $OFFICE_PREFIX.":document-meta").item( 0 ); + $this->meta = $tmtDoc->getElementsByTageNameNS( NS::OFFICE, $OFFICE_PREFIX.":document-meta").item( 0 ); } - $this->root = $this->dom->getElementsByTageNameNS( self::NS_OFFICE, $OFFICE_PREFIX.":meta").item( 0 ); + $this->root = $this->dom->getElementsByTageNameNS( NS::OFFICE, $OFFICE_PREFIX.":meta").item( 0 ); return true; } @@ -123,7 +127,7 @@ */ public function addDublinCore( $dc, $value) { $this->logger->debug( "meta/Meta->addDublinCore: ". $value ."." ); - $node = $this->dom->createElementNS( self::NS_DC, "dc:".$dc, $value ); + $node = $this->dom->createElementNS( NS::DC, "dc:".$dc, $value ); $this->root->appendChild( $node ); unset( $node ); } @@ -140,7 +144,7 @@ */ public function getDublicCore( $dc ) { $retValue = ""; - $nodelist = $this->dom->getElementsByTagNameNS( self::NS_DC, $dc ); + $nodelist = $this->dom->getElementsByTagNameNS( NS::DC, $dc ); if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; } @@ -176,7 +180,7 @@ } $this->logger->debug( "meta/Meta->addCreationTime: ". $creation_time ."." ); - $node = $this->dom->createElementNS( self::NS_META, "meta:creation-date", $creation_time ); + $node = $this->dom->createElementNS( NS::META, "meta:creation-date", $creation_time ); $this->root->appendChild( $node ); @@ -214,7 +218,7 @@ $this->logger->debug( "meta/Meta->addGenerator: ". $lgenerator ."." ); - $node = $this->dom->createElementNS( self::NS_META, "meta:generator", $lgenerator ); + $node = $this->dom->createElementNS( NS::META, "meta:generator", $lgenerator ); $this->root->appendChild( $node ); @@ -245,7 +249,7 @@ public function getGenerator() { $retValue = ""; - $nodelist = $this->dom->getElementsByTagNameNS( self::NS_META, "generator" ); + $nodelist = $this->dom->getElementsByTagNameNS( NS::META, "generator" ); if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; @@ -263,7 +267,7 @@ */ public function addInitialCreator( $initialCreator ) { $this->logger->debug( "meta/Meta->addInitialCreator: ". $initialCreator ."." ); - $node = $this->dom->createElementNS( self::NS_META, "meta:initial-creator", $initialCreator ); + $node = $this->dom->createElementNS( NS::META, "meta:initial-creator", $initialCreator ); $this->root->appendChild( $node ); } @@ -275,7 +279,7 @@ */ public function getInitialCreator() { $retValue = ""; - $nodelist = $this->dom->getElementsByTagNameNS( self::NS_META, "initial-creator" ); + $nodelist = $this->dom->getElementsByTagNameNS( NS::META, "initial-creator" ); if ($nodelist->length == 1) { $retValue = $nodelist->item( 0 )->nodeValue; } @@ -291,13 +295,13 @@ * @since 0.4.0 */ public function addUserDefinedMetadata( $name, $type, $value ) { - $node = $this->dom->createElementNS( self::NS_META, "meta:user-defined" ); - $node->setAttributeNS( self::NS_META, "meta:name", $name ); + $node = $this->dom->createElementNS( NS::META, "meta:user-defined" ); + $node->setAttributeNS( NS::META, "meta:name", $name ); if ( !empty( $type ) ) { - $node->setAttributeNS( self::NS_META, "meta:type", $type ); + $node->setAttributeNS( NS::META, "meta:type", $type ); } if ( !empty( $value ) ) { - $node->setAttributeNS( self::NS_META, "meta:value", $value ); + $node->setAttributeNS( NS::META, "meta:value", $value ); } $this->root->appendChild( $node ); unset( $node ); Modified: poc/src/samples/TestOutput.php =================================================================== --- poc/src/samples/TestOutput.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/samples/TestOutput.php 2006-03-30 08:24:22 UTC (rev 42) @@ -68,16 +68,16 @@ $svgAttr = array(); $styleAttr[ "font-pitch" ] = "variable"; - $svgAttr [ "font-family" ] = "'Arial Unicode MS'"; + $svgAttr [ "font-family" ] = "'Arial Unicode MS'"; $fontFaceDecl->addFontFace( "Arial Unicode MS", $styleAttr, $svgAttr ); $svgAttr [ "font-family" ] = "Tahoma"; $fontFaceDecl->addFontFace( "Tahoma", $styleAttr, $svgAttr ); - $svgAttr [ "font-family" ] = "'MS Mincho'"; + $svgAttr [ "font-family" ] = "'MS Mincho'"; $fontFaceDecl->addFontFace( "MS Mincho", $styleAttr, $svgAttr ); - $svgAttr [ "font-family" ] = "'Times New Roman'"; + $svgAttr [ "font-family" ] = "'Times New Roman'"; $styleAttr[ "font-family-generic" ] = "roman"; $fontFaceDecl->addFontFace( "Times New Roman", $styleAttr, $svgAttr ); Modified: poc/src/settings/Settings.php =================================================================== --- poc/src/settings/Settings.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/settings/Settings.php 2006-03-30 08:24:22 UTC (rev 42) @@ -16,6 +16,7 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class Settings extends OpenDocumentObjectAbstract { /** @@ -55,15 +56,15 @@ $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->dom->formatOutput = true; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:document-settings" ); - $this->root->setAttributeNS( self::NS_OFFICE, "office:version", "1.0" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:document-settings" ); + $this->root->setAttributeNS( NS::OFFICE, "office:version", "1.0" ); $this->settings = $this->dom; } else { // this is part of a single document $this->dom = $dom; $this->settings = $root; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:settings" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:settings" ); } } Modified: poc/src/styles/AutomaticStyles.php =================================================================== --- poc/src/styles/AutomaticStyles.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/styles/AutomaticStyles.php 2006-03-30 08:24:22 UTC (rev 42) @@ -15,6 +15,7 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class AutomaticStyles extends OpenDocumentObjectAbstract { @@ -44,7 +45,7 @@ $this->logger->debug( "Constructing styles/AutomaticStyles." ); $this->dom = $dom; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:automatic-styles" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:automatic-styles" ); } /** Modified: poc/src/styles/FontFaceDeclaration.php =================================================================== --- poc/src/styles/FontFaceDeclaration.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/styles/FontFaceDeclaration.php 2006-03-30 08:24:22 UTC (rev 42) @@ -13,6 +13,7 @@ * @since 0.4.2 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class FontFaceDeclaration extends OpenDocumentObjectAbstract { @@ -35,7 +36,7 @@ $this->dom = $dom; $this->useDom2 = false; - $this->FontFaceDecl = $this->dom->createElementNS( self::NS_OFFICE, "office:font-face-decls" ); + $this->FontFaceDecl = $this->dom->createElementNS( NS::OFFICE, "office:font-face-decls" ); } /** @@ -114,13 +115,13 @@ * @since 0.4.2 */ public function addFontFace( $name, $styleAttr=0, $SVGAttr=0 ) { - $font = $this->dom->createElementNS( self::NS_STYLE, "style:font-face" ); - $font->setAttributeNS( self::NS_STYLE, "style:name", $name ); + $font = $this->dom->createElementNS( NS::STYLE, "style:font-face" ); + $font->setAttributeNS( NS::STYLE, "style:name", $name ); if (!empty($styleAttr)) { foreach( $styleAttr as $key => $value ) { // ***FIX ME*** Here we should check if the keys are possible if ($this->checkStyle($key, $value)) { - $font->setAttributeNS( self::NS_STYLE, "style:".$key, $value ); + $font->setAttributeNS( NS::STYLE, "style:".$key, $value ); } } } @@ -128,7 +129,7 @@ foreach( $SVGAttr as $key => $value ) { // ***FIX ME*** Here we should check if the keys are possible if ($this->checkSVG( $key, $value )) { - $font->setAttributeNS( self::NS_SVG, "svg:".$key, $value ); + $font->setAttributeNS( NS::SVG, "svg:".$key, $value ); } } } Modified: poc/src/styles/MasterStyles.php =================================================================== --- poc/src/styles/MasterStyles.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/styles/MasterStyles.php 2006-03-30 08:24:22 UTC (rev 42) @@ -15,6 +15,7 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class MasterStyles extends OpenDocumentObjectAbstract { @@ -43,7 +44,7 @@ $this->dom = $dom; $this->style = $root; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:master-styles" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:master-styles" ); } /** Modified: poc/src/styles/Style.php =================================================================== --- poc/src/styles/Style.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/styles/Style.php 2006-03-30 08:24:22 UTC (rev 42) @@ -13,6 +13,7 @@ * @since 0.4.4 */ require_once( "OpenDocumentObjectAbstract.php" ); +require_once( "util/NameSpaces.php" ); class Style extends OpenDocumentObjectAbstract { @@ -54,7 +55,7 @@ $this->logger->debug( "Constructing style/Style." ); $this->dom = $dom; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:styles" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:styles" ); $this->Styles = array(); $this->DefaultStyles = array(); @@ -69,9 +70,9 @@ * @since 0.4.2 */ public function addDefaultStyle( $family = 0 ) { - $node = $this->dom->createElementNS( self::NS_STYLE, "style:default-style" ); + $node = $this->dom->createElementNS( NS::STYLE, "style:default-style" ); if (!empty($family)) { - $node->setAttributeNS( self::NS_STYLE, "style:family", $family ); + $node->setAttributeNS( NS::STYLE, "style:family", $family ); } $this->DefaultStyles[ $family ] = $node; } @@ -84,15 +85,15 @@ * @since 0.4.2 */ private function addParagraphPropertiesToNode( $node, $styleAttr, $foAttr ) { - $ParProp = $this->dom->createElementNS( self::NS_STYLE, "style:paragraph-properties" ); + $ParProp = $this->dom->createElementNS( NS::STYLE, "style:paragraph-properties" ); if (!empty($styleAttr)) { foreach( $styleAttr as $key=>$value ) { - $ParProp->setAttributeNS( self::NS_STYLE, "style:".$key, $value ); + $ParProp->setAttributeNS( NS::STYLE, "style:".$key, $value ); } } if (!empty($foAttr)) { foreach( $foAttr as $key=>$value ) { - $ParProp->setAttributeNS( self::NS_FO, "fo:".$key, $value ); + $ParProp->setAttributeNS( NS::FO, "fo:".$key, $value ); } } $node->appendChild( $ParProp ); @@ -106,15 +107,15 @@ * @since 0.4.2 */ private function addTextPropertiesToNode( $node, $styleAttr, $foAttr ) { - $ParProp = $this->dom->createElementNS( self::NS_STYLE, "style:text-properties" ); + $ParProp = $this->dom->createElementNS( NS::STYLE, "style:text-properties" ); if (!empty($styleAttr)) { foreach( $styleAttr as $key=>$value ) { - $ParProp->setAttributeNS( self::NS_STYLE, "style:".$key, $value ); + $ParProp->setAttributeNS( NS::STYLE, "style:".$key, $value ); } } if (!empty($foAttr)) { foreach( $foAttr as $key=>$value ) { - $ParProp->setAttributeNS( self::NS_FO, "fo:".$key, $value ); + $ParProp->setAttributeNS( NS::FO, "fo:".$key, $value ); } } $node->appendChild( $ParProp ); @@ -190,11 +191,11 @@ * @since 0.4.2 */ public function addStyle( $name, $styleAttr=0 ) { - $node = $this->dom->createElementNS( self::NS_STYLE, "style:style" ); - $node->setAttributeNS( self::NS_STYLE, "style:name", $name ); + $node = $this->dom->createElementNS( NS::STYLE, "style:style" ); + $node->setAttributeNS( NS::STYLE, "style:name", $name ); if (!empty($styleAttr)) { foreach( $styleAttr as $key=>$value ) { - $node->setAttributeNS ( self::NS_STYLE, "style:".$key, $value ); + $node->setAttributeNS ( NS::STYLE, "style:".$key, $value ); } } $this->Styles[ $name ] = $node; Modified: poc/src/styles/Styles.php =================================================================== --- poc/src/styles/Styles.php 2006-03-29 13:59:14 UTC (rev 41) +++ poc/src/styles/Styles.php 2006-03-30 08:24:22 UTC (rev 42) @@ -16,6 +16,7 @@ require_once( "styles/Style.php" ); require_once( "styles/AutomaticStyles.php" ); require_once( "styles/MasterStyles.php" ); +require_once( "util/NameSpaces.php" ); class Styles extends OpenDocumentObjectAbstract { @@ -43,8 +44,8 @@ $this->dom = new DOMDocument( "1.0", "utf-8" ); $this->dom->formatOutput = true; - $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:document-styles" ); - $this->root->setAttributeNS( self::NS_OFFICE, "office:version", "1.0" ); + $this->root = $this->dom->createElementNS( NS::OFFICE, "office:document-styles" ); + $this->root->setAttributeNS( NS::OFFICE, "office:version", "1.0" ); $this->styles = $this->dom; $this->FontFaceDecl = new FontFaceDeclaration( $this->dom, $this->root ); Added: poc/src/util/NameSpaces.php =================================================================== --- poc/src/util/NameSpaces.php (rev 0) +++ poc/src/util/NameSpaces.php 2006-03-30 08:24:22 UTC (rev 42) @@ -0,0 +1,144 @@ +<?php +/** + * NameSpaces Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage util + * @since 0.5.0 + */ + +class NameSpaces { + + /** + * namespace OpenDocument meta + */ + const META = "urn:oasis:names:tc:opendocument:xmlns:meta:1.0"; + + /** + * namespace OpenDocument office + */ + const OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0"; + + /** + * namespace OpenDocument manifest + */ + const MANIFEST = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"; + + /** + * namespace OpenDocument style + */ + const STYLE = "urn:oasis:names:tc:opendocument:xmlns:style:1.0"; + + /** + * namespace OpenDocument text + */ + const TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0"; + + /** + * namespace OpenDocument draw + */ + const DRAW = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"; + + /** + * namespace OpenDocument table + */ + const TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0"; + + /** + * namespace OpenDocument number + */ + const NUMBER = "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; + + /** + * namespace OpenDocument chart + */ + const CHART = "urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; + + /** + * namespace OpenDocument form + */ + const FORM = "urn:oasis:names:tc:opendocument:xmlns:form:1.0"; + + /** + * namespace OpenDocument config + */ + const CONFIG = "urn:oasis:names:tc:opendocument:xmlns:config:1.0"; + + /** + * namespace OpenDocument presentation + */ + const PRESENTATION = "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"; + + /** + * namespace OpenDocument dr3d + */ + const DR3D = "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; + + /** + * namespace OpenDocument animation + */ + const ANIM = "urn:oasis:names:tc:opendocument:xmlns:animation:1.0"; + + /** + * namespace OpenDocument script + */ + const SCRIPT = "urn:oasis:names:tc:opendocument:xmlns:script:1.0"; + + /** + * namespace OpenDocument svg + */ + const SVG = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; + + /** + * namespace OpenDocument fo (formation objects) + */ + const FO = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; + + /** + * namespace OpenDocument smil + */ + const SMIL = "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"; + + /** + * namespace Dublin Core + */ + const DC = "http://purl.org/dc/elements/1.1/"; + + /** + * namespace XLink + */ + const XLINK = "http://www.w3.org/1999/xlink"; + + /** + * namespace XForms + */ + const XFORMS = "http://www.w3.org/2002/xforms"; + + /** + * namespace MathML + */ + const MATHML = "http://www.w3.org/1998/Math/MathML"; + +} + +/** + * This is just a shortcast to the NameSpaces Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @since 0.5.0 + */ +class NS extends NameSpaces { + +}; Property changes on: poc/src/util/NameSpaces.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: poc/src/util/NameSpacesTest.php =================================================================== --- poc/src/util/NameSpacesTest.php (rev 0) +++ poc/src/util/NameSpacesTest.php 2006-03-30 08:24:22 UTC (rev 42) @@ -0,0 +1,101 @@ +<?php +/** + * TestCase for OpenDocumentObjectAbstract class + * + * $Id$ + * + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @license GNU General Public License + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage UnitTest + * @since 0.5.0 + */ + +require_once "PHPUnit2/Framework/TestCase.php"; +require_once "util/NameSpaces.php"; + +class NameSpaceTest extends PHPUnit2_Framework_TestCase { + +const office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"; +const style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"; +const text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"; +const table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"; +const draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"; +const fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; +const xlink="http://www.w3.org/1999/xlink"; +const dc="http://purl.org/dc/elements/1.1/"; +const meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"; +const number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; +const svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; +const chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; +const dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; +const math="http://www.w3.org/1998/Math/MathML"; +const form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"; +const script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"; +const ooo="http://openoffice.org/2004/office"; +const ooow="http://openoffice.org/2004/writer"; +const oooc="http://openoffice.org/2004/calc"; +const dom="http://www.w3.org/2001/xml-events"; + + /** + * This test will check all name spaces. The namespaces in this file are extracted from + * an OpenOffice document, so they are not written by hand out of the OpenDocument documentation. + * This should help to fix typos. (And it did!!!) + * + * @since 0.5.0 + */ + function testNamespaces() { + $this->assertEquals( NameSpaces::OFFICE, self::office ); + $this->assertEquals( NameSpaces::STYLE, self::style ); + $this->assertEquals( NameSpaces::TEXT, self::text ); + $this->assertEquals( NameSpaces::TABLE, self::table ); + $this->assertEquals( NameSpaces::DRAW, self::draw ); + $this->assertEquals( NameSpaces::FO, self::fo ); + $this->assertEquals( NameSpaces::XLINK, self::xlink ); + $this->assertEquals( NameSpaces::DC, self::dc ); + $this->assertEquals( NameSpaces::META, self::meta ); + $this->assertEquals( NameSpaces::NUMBER, self::number ); + $this->assertEquals( NameSpaces::SVG, self::svg ); + $this->assertEquals( NameSpaces::CHART, self::chart ); + $this->assertEquals( NameSpaces::DR3D, self::dr3d ); + $this->assertEquals( NameSpaces::MATHML, self::math ); + $this->assertEquals( NameSpaces::FORM, self::form ); + $this->assertEquals( NameSpaces::SCRIPT, self::script ); +/* + $this->assertEquals( NameSpace::OOO, self::ooo ); + $this->assertEquals( NameSpace::OOOW, self::ooow ); + $this->assertEquals( NameSpace::OOOC, self::oooc ); + $this->assertEquals( NameSpace::DOM, self::dom ); +*/ + } + + /** + * This test will check all name spaces. The namespaces in this file are extracted from + * an OpenOffice document, so they are not written by hand out of the OpenDocument documentation. + * This should help to fix typos. (And it did!!!) + * + * @since 0.5.0 + */ + function testNS() { + $this->assertEquals( NS::OFFICE, self::office ); + $this->assertEquals( NS::STYLE, self::style ); + $this->assertEquals( NS::TEXT, self::text ); + $this->assertEquals( NS::TABLE, self::table ); + $this->assertEquals( NS::DRAW, self::draw ); + $this->assertEquals( NS::FO, self::fo ); + $this->assertEquals( NS::XLINK, self::xlink ); + $this->assertEquals( NS::DC, self::dc ); + $this->assertEquals( NS::META, self::meta ); + $this->assertEquals( NS::NUMBER, self::number ); + $this->assertEquals( NS::SVG, self::svg ); + $this->assertEquals( NS::CHART, self::chart ); + $this->assertEquals( NS::DR3D, self::dr3d ); + $this->assertEquals( NS::MATHML, self::math ); + $this->assertEquals( NS::FORM, self::form ); + $this->assertEquals( NS::SCRIPT, self::script ); + } + +} +?> \ No newline at end of file Property changes on: poc/src/util/NameSpacesTest.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-29 13:59:38
|
Revision: 41 Author: nmarkgraf Date: 2006-03-29 05:59:14 -0800 (Wed, 29 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=41&view=rev Log Message: ----------- Fixed some very bad typos. Therefor I added a new unit test just for the name spaces. Modified Paths: -------------- poc/src/OpenDocumentObjectAbstract.php Added Paths: ----------- poc/src/OpenDocumentObjectAbstractTest.php Modified: poc/src/OpenDocumentObjectAbstract.php =================================================================== --- poc/src/OpenDocumentObjectAbstract.php 2006-03-29 11:01:01 UTC (rev 40) +++ poc/src/OpenDocumentObjectAbstract.php 2006-03-29 13:59:14 UTC (rev 41) @@ -93,18 +93,18 @@ /** * namespace OpenDocument svg - */ - const NS_SVG = "urn:oasis:names:tc:openedocument:xmlsns:svg-compartible:1.0"; + */ + const NS_SVG = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; /** * namespace OpenDocument fo (formation objects) */ - const NS_FO = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compartible:1.0"; + const NS_FO = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; /** * namespace OpenDocument smil */ - const NS_SMIL = "urn:oasis:names:tc:opendocument:xmlns:smil-compartible:1.0"; + const NS_SMIL = "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"; /** * namespace Dublin Core Added: poc/src/OpenDocumentObjectAbstractTest.php =================================================================== --- poc/src/OpenDocumentObjectAbstractTest.php (rev 0) +++ poc/src/OpenDocumentObjectAbstractTest.php 2006-03-29 13:59:14 UTC (rev 41) @@ -0,0 +1,74 @@ +<?php +/** + * TestCase for OpenDocumentObjectAbstract class + * + * $Id$ + * + * @copyright Copyright © 2006, Norman Markgraf, et al. + * @license GNU General Public License + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage UnitTest + * @since 0.5.0 + */ + +require_once "PHPUnit2/Framework/TestCase.php"; +require_once "OpenDocumentObjectAbstract.php"; + +class OpenDocumentObjectAbstractTest extends PHPUnit2_Framework_TestCase { + +const office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"; +const style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"; +const text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"; +const table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"; +const draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"; +const fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; +const xlink="http://www.w3.org/1999/xlink"; +const dc="http://purl.org/dc/elements/1.1/"; +const meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"; +const number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; +const svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; +const chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; +const dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; +const math="http://www.w3.org/1998/Math/MathML"; +const form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"; +const script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"; +const ooo="http://openoffice.org/2004/office"; +const ooow="http://openoffice.org/2004/writer"; +const oooc="http://openoffice.org/2004/calc"; +const dom="http://www.w3.org/2001/xml-events"; + + /** + * This test will check all name spaces. The namespaces in this file are extracted from + * an OpenOffice document, so they are not written by hand out of the OpenDocument documentation. + * This should help to fix typos. (And it did!!!) + * + * @since 0.5.0 + */ + function testNamespaces() { + $this->assertEquals( OpenDocumentObjectAbstract::NS_OFFICE, self::office ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_STYLE, self::style ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_TEXT, self::text ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_TABLE, self::table ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_DRAW, self::draw ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_FO, self::fo ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_XLINK, self::xlink ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_DC, self::dc ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_META, self::meta ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_NUMBER, self::number ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_SVG, self::svg ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_CHART, self::chart ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_DR3D, self::dr3d ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_MATHML, self::math ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_FORM, self::form ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_SCRIPT, self::script ); +/* + $this->assertEquals( OpenDocumentObjectAbstract::NS_OOO, self::ooo ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_OOOW, self::ooow ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_OOOC, self::oooc ); + $this->assertEquals( OpenDocumentObjectAbstract::NS_DOM, self::dom ); +*/ + } +} +?> \ No newline at end of file Property changes on: poc/src/OpenDocumentObjectAbstractTest.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-29 11:01:19
|
Revision: 40 Author: nmarkgraf Date: 2006-03-29 03:01:01 -0800 (Wed, 29 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=40&view=rev Log Message: ----------- Minor updates: - Fixed some bugs in the OpenDocumentSingle, Styles and FontFaceDeclaration classes. - PHing now removes "?><?php" lines when make solid file. TestOutput now works, but OpenOffice still does not take the document as it should be. This is a BUG that must be solved before 0.5.0 can be announced. Modified Paths: -------------- poc/build.xml poc/src/OpenDocumentSingle.php poc/src/samples/TestOutput.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/Styles.php Modified: poc/build.xml =================================================================== --- poc/build.xml 2006-03-29 08:59:58 UTC (rev 39) +++ poc/build.xml 2006-03-29 11:01:01 UTC (rev 40) @@ -134,9 +134,15 @@ </copy> <!-- echo msg="${OpenDocumentPHPSolid}"/--> <!-- echo msg="${os.name}"/--> - <exec command="copy ..\etc\solid.txt + *.php + manifest\*.php + content\*.php + settings\*.php + styles\*.php tmp.tmp" dir="solid-production"/> + <exec command="copy ..\etc\solid.txt + *.php + manifest\*.php + content\*.php + settings\*.php + styles\*.php + meta\*.php tmp.tmp" dir="solid-production"/> <exec command="cat ../etc/solid.txt > ../tmp.tmp && cat *.php >> ../tmp.tmp && cat */*.php >> ../tmp.tmp" dir="solid-production" os="linux"/> - <copy file="solid-production/tmp.tmp" tofile="dist/${OpenDocumentPHPSolid}" overwrite="true"/> + <copy file="solid-production/tmp.tmp" tofile="dist/${OpenDocumentPHPSolid}" overwrite="true"> + <filterchain> + <replaceregexp> + <regexp pattern="\?>.\?php" replace=" " /> + </replaceregexp> + </filterchain> + </copy> <delete dir="solid-production"/> </target> Modified: poc/src/OpenDocumentSingle.php =================================================================== --- poc/src/OpenDocumentSingle.php 2006-03-29 08:59:58 UTC (rev 39) +++ poc/src/OpenDocumentSingle.php 2006-03-29 11:01:01 UTC (rev 40) @@ -109,8 +109,7 @@ * @since 0.3.0 */ public function addXMLDocument( $fullpath, $domFrag, $mimetype="text/xml" ) { - $this->logger->info( "OpenDocumentSingle->addXMLDocument(" . $fullpath . - ") with mimetype '" . $mimetype . "' to package '". $this->packagetmp . "'" ); + $this->logger->info( "OpenDocumentSingle->addXMLDocument(" . $fullpath . ") with mimetype '" . $mimetype . "' to package '". $this->packagetmp . "'" ); $this->dom->appendChild( $domFrag ); } Modified: poc/src/samples/TestOutput.php =================================================================== --- poc/src/samples/TestOutput.php 2006-03-29 08:59:58 UTC (rev 39) +++ poc/src/samples/TestOutput.php 2006-03-29 11:01:01 UTC (rev 40) @@ -65,10 +65,28 @@ function makeFontFaceDecl( $fontFaceDecl ) { $styleAttr = array(); - $styleAttr[ "font-family" ] ="Tahoma"; - $fontFaceDecl->addFontFace( "Test", $styleAttr ); + $svgAttr = array(); + + $styleAttr[ "font-pitch" ] = "variable"; + $svgAttr [ "font-family" ] = "'Arial Unicode MS'"; + $fontFaceDecl->addFontFace( "Arial Unicode MS", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "Tahoma"; + $fontFaceDecl->addFontFace( "Tahoma", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "'MS Mincho'"; + $fontFaceDecl->addFontFace( "MS Mincho", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "'Times New Roman'"; + $styleAttr[ "font-family-generic" ] = "roman"; + $fontFaceDecl->addFontFace( "Times New Roman", $styleAttr, $svgAttr ); + + $svgAttr [ "font-family" ] = "Arial"; + $styleAttr[ "font-family-generic" ] = "swiss"; + $fontFaceDecl->addFontFace( "Arial", $styleAttr, $svgAttr ); } + function makeAutomaticStyles( $automaticStyles ) { // return $automaticStyles; } @@ -77,7 +95,7 @@ // return $scripts; } - function makeStyle( $style ) { + function makeStyle( $style ) { // Set default style $style->addDefaultStyle( "paragraph" ); @@ -119,10 +137,21 @@ //Set a style $styleAttr = array( "family"=>"paragraph", "class"=>"text" ); + $style->addStyle( "Standard", $styleAttr ); + + //Set a style + $styleAttr = array( "family"=>"paragraph", "class"=>"text" ); + $styleAttr[ "display-name" ] = "Paragraph ODP"; + $styleAttr[ "parent-style-name" ] = "Standard"; $style->addStyle( "Paragraph", $styleAttr ); - //Set a style - $style->addStyle( "Heading", $styleAttr ); + //Set a style + $styleAttr[ "default-outline-level" ] = "1"; + $styleAttr[ "display-name" ] = "Heading ODP"; + $styleAttr[ "parent-style-name" ] = "Standard"; + $styleAttr[ "next-style-name" ] = "Standard"; + $foAttr[ "font-weight" ] = "bold"; + $style->addStyle( "Heading", $styleAttr, $foAttr ); unset( $styleAttr ); unset( $foAttr ); @@ -137,7 +166,7 @@ $styleAttr[ "font-name" ] = "Arial"; $styleAttr[ "font-name-asian" ] = "MS Mincho"; $styleAttr[ "font-size" ] = "20pt"; - $styleAttr[ "font-name-complex" ] = "Tahoma1"; + $styleAttr[ "font-name-complex" ] = "Tahoma"; $styleAttr[ "font-size-complex" ] = "20pt"; $style->addStyleTextProperties( "Heading", $styleAttr, $foAttr ); } Modified: poc/src/styles/FontFaceDeclaration.php =================================================================== --- poc/src/styles/FontFaceDeclaration.php 2006-03-29 08:59:58 UTC (rev 39) +++ poc/src/styles/FontFaceDeclaration.php 2006-03-29 11:01:01 UTC (rev 40) @@ -124,7 +124,7 @@ } } } - if (!empty($SVGAtrr)) { + if (!empty($SVGAttr)) { foreach( $SVGAttr as $key => $value ) { // ***FIX ME*** Here we should check if the keys are possible if ($this->checkSVG( $key, $value )) { Modified: poc/src/styles/Styles.php =================================================================== --- poc/src/styles/Styles.php 2006-03-29 08:59:58 UTC (rev 39) +++ poc/src/styles/Styles.php 2006-03-29 11:01:01 UTC (rev 40) @@ -120,7 +120,8 @@ $this->root->appendChild( $this->MasterStyles->get() ); $this->styles->appendChild( $this->root ); - $this->dom->normalize(); + $this->dom->normalize(); + $this->dom->normalize(); $this->isCommited = true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-29 09:00:18
|
Revision: 39 Author: nmarkgraf Date: 2006-03-29 00:59:58 -0800 (Wed, 29 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=39&view=rev Log Message: ----------- Some changes: - ZipFile.php is now in the others directory, to show that this is mainly not our code. - The TestInput.php and TestOutput.php in the samples directory are now checking in they used with the right PHP version. - Added some descriptions to build.xml, so "phing -projecthelp" will display something useful. Modified Paths: -------------- poc/build.xml poc/src/AllInclude.inc poc/src/OpenDocumentPackage.php poc/src/samples/TestInput.php poc/src/samples/TestOutput.php Added Paths: ----------- poc/src/others/ poc/src/others/ZipFile.php Removed Paths: ------------- poc/src/ZipFile.php Modified: poc/build.xml =================================================================== --- poc/build.xml 2006-03-29 08:36:06 UTC (rev 38) +++ poc/build.xml 2006-03-29 08:59:58 UTC (rev 39) @@ -10,6 +10,7 @@ <mkdir dir="reports/coverage"/> <mkdir dir="reports/tests"/> <mkdir dir="docs"/> + <mkdir dir="docs/${release}"/> <mkdir dir="production"/> </target> @@ -19,8 +20,12 @@ <target name="preparetest"> <mkdir dir="reports"/> + <mkdir dir="reports/data"/> + <mkdir dir="reports/data/${release}"/> <mkdir dir="reports/coverage"/> + <mkdir dir="reports/coverage/${release}"/> <mkdir dir="reports/tests"/> + <mkdir dir="reports/tests/${release}"/> </target> <target name="preparereport"> @@ -30,7 +35,7 @@ </target> <target name="reports" depends="preparereport"> - <coverage-setup database="reports/coverage.db"> + <coverage-setup database="reports/data/${release}/coverage.db"> <fileset dir="src"> <include name="**/*.php"/> <exclude name="**/*Test.php"/> @@ -39,7 +44,7 @@ </coverage-setup> <phpunit2 codecoverage="true" haltonerror="false" haltonfailure="false" printsummary="false"> - <formatter type="xml" todir="reports"/> + <formatter type="xml" todir="reports/data/${release}"/> <batchtest> <fileset dir="src"> <include name="**/*Test.php"/> @@ -47,16 +52,16 @@ </batchtest> </phpunit2> - <phpunit2report infile="reports/testsuites.xml" format="frames" todir="reports/tests" styledir="etc"/> + <phpunit2report infile="reports/data/${release}/testsuites.xml" format="frames" todir="reports/tests/${release}" styledir="etc"/> - <coverage-report outfile="reports/coverage.xml"> - <report todir="reports/coverage" styledir="etc"/> + <coverage-report outfile="reports/data/${release}/coverage.xml"> + <report todir="reports/coverage/${release}" styledir="etc"/> </coverage-report> </target> <target name="test" depends="preparetest"> <phpunit2 haltonerror="false" haltonfailure="false" printsummary="true"> - <formatter todir="reports" type="xml"/> + <formatter todir="reports/data/${release}" type="xml"/> <batchtest> <fileset dir="src"> <include name="**/*Test.php"/> @@ -64,22 +69,27 @@ </batchtest> </phpunit2> - <phpunit2report infile="reports/testsuites.xml" format="frames" todir="reports/tests" styledir="etc"/> + <phpunit2report infile="reports/data/${release}/testsuites.xml" format="frames" todir="reports/tests/${release}" styledir="etc"/> </target> - <target name="docs"> - <phpdoc title="OpenDocumentPHP" destdir="docs" + <target name="docs" description="Creates PHPDocumentor documents in a directory in the docs directory."> + <phpdoc title="OpenDocumentPHP" destdir="docs/${release}" sourcepath="src" output="HTML:Smarty:PHP" linksource="true"/> </target> - <target name="dist" depends="preparedist"> - <zip destfile="dist/OpenDocumentPHP-${release}.zip" basedir="src"/> - <tar destfile="dist/OpenDocumentPHP-${release}.tar" basedir="src"/> + <target name="dist" depends="production" description="Creates a snapshot of the current production release in a zip and a tar file in the dist directory."> + <zip destfile="dist/OpenDocumentPHP-${release}.zip" basedir="production"/> + <tar destfile="dist/OpenDocumentPHP-${release}.tar" basedir="production"/> </target> - <target name="dev-dist" depends="preparedist"> + <target name="dist-src" depends="preparedist" description="Creates a snapshot of the current src directory in a zip and a tar file in the dist directory."> + <zip destfile="dist/OpenDocumentPHP-${release}-src.zip" basedir="src"/> + <tar destfile="dist/OpenDocumentPHP-${release}-src.tar" basedir="src"/> + </target> + + <target name="dev-dist" depends="preparedist" description="Creates a snapshot of the all the current project directories in a zip and a tar file in the dist directory."> <zip destfile="dist/OpenDocumentPHP-${release}-dev.zip" basedir="."> <fileset dir="."> <include name="**/**"/> @@ -94,7 +104,7 @@ </tar> </target> - <target name="production" depends="prepare"> + <target name="production" depends="prepare" description="Creates a production release without unit tests in the production directory."> <copy todir="production"> <fileset dir="src"> <include name="**/*.php"/> @@ -104,7 +114,7 @@ </copy> </target> - <target name="solid-production" depends="production"> + <target name="solid-production" depends="production" description="Creates a single file production release without unit tests in the dist directory."> <mkdir dir="solid-production"/> <copy todir="solid-production"> <!--"/OpenDocumentPHP-solid.php" overwrite="true" --> <fileset dir="production"> @@ -116,7 +126,10 @@ <regexp pattern=".*include_once" replace="//include_once" ignoreCase="true" /> <regexp pattern=".+this-.logger.+" replace="//this-logger-" /> </replaceregexp> - <stripphpcomments /> + <!-- stripphpcomments /--> + <striplinecomments> + <comment value="//" /> + </striplinecomments> </filterchain> </copy> <!-- echo msg="${OpenDocumentPHPSolid}"/--> @@ -139,7 +152,7 @@ <delete file="reports/testsuites.xml"/> <delete dir="reports/tests"/> <delete dir="reports/coverage"/> - <delete dir="docs"/> + <delete dir="docs/${release}"/> <delete file="OpenDocumentPHP.zip"/> <delete file="OpenDocumentPHP.tar"/> <delete dir="production"/> @@ -148,6 +161,7 @@ <target name="proper" depends="clean"> <delete dir="reports"/> - <delete file="${OpenDocumentPHPSolid}"/> + <delete file="${OpenDocumentPHPSolid}"/> + <delete dir="docs"/> </target> </project> Modified: poc/src/AllInclude.inc =================================================================== --- poc/src/AllInclude.inc 2006-03-29 08:36:06 UTC (rev 38) +++ poc/src/AllInclude.inc 2006-03-29 08:59:58 UTC (rev 39) @@ -32,7 +32,7 @@ require_once( "content/BodyTable.php" ); require_once( "styles/FontFaceDeclaration.php" ); // Non-PEAR and not our stuff: -require_once( "ZipFile.php" ); +require_once( "others/ZipFile.php" ); // PEAR stuff: require_once( "Log.php" ); ?> \ No newline at end of file Modified: poc/src/OpenDocumentPackage.php =================================================================== --- poc/src/OpenDocumentPackage.php 2006-03-29 08:36:06 UTC (rev 38) +++ poc/src/OpenDocumentPackage.php 2006-03-29 08:59:58 UTC (rev 39) @@ -26,6 +26,8 @@ require_once( "content/Body.php" ); require_once( "OpenDocumentAbstract.php" ); +require_once( "others/ZipFile.php" ); + class OpenDocumentPackage extends OpenDocumentAbstract implements OpenDocument { private $packagename; @@ -49,7 +51,7 @@ $this->isCommited = false; $this->logger->debug( "Generating ZipFile object." ); - $this->zip = new ZipFile; + $this->zip = new ZipFile(); if ( !empty( $documentName ) ) { $this->setPackageName( $documentName ); Deleted: poc/src/ZipFile.php =================================================================== --- poc/src/ZipFile.php 2006-03-29 08:36:06 UTC (rev 38) +++ poc/src/ZipFile.php 2006-03-29 08:59:58 UTC (rev 39) @@ -1,184 +0,0 @@ -<?php -/** - * Zip file creation class. - * Makes zip files. - * - * Based on : - * - * http://www.zend.com/codex.php?id=535&single=1 - * By Eric Mueller <er...@th...> - * - * http://www.zend.com/codex.php?id=470&single=1 - * by Denis125 <web...@at...> - * - * a patch from Peter Listiak <ml...@us...> for last modified - * date and time of the compressed file - * - * Official ZIP file format: http://www.pkware.com/appnote.txt - * - * @access public - */ -class ZipFile -{ - /** - * Array to store compressed data - * - * @var array $datasec - */ - private $datasec = array(); - - /** - * Central directory - * - * @var array $ctrl_dir - */ - private $ctrl_dir = array(); - - /** - * End of central directory record - * - * @var string $eof_ctrl_dir - */ - private $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; - - /** - * Last offset position - * - * @var integer $old_offset - */ - private $old_offset = 0; - - - /** - * Converts an Unix timestamp to a four byte DOS date and time format (date - * in high two bytes, time in low two bytes allowing magnitude comparison). - * - * @param integer the current Unix timestamp - * - * @return integer the current date in a four byte DOS format - * - * @access private - */ - private function unix2DosTime($unixtime = 0) { - $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime); - - if ($timearray['year'] < 1980) { - $timearray['year'] = 1980; - $timearray['mon'] = 1; - $timearray['mday'] = 1; - $timearray['hours'] = 0; - $timearray['minutes'] = 0; - $timearray['seconds'] = 0; - } // end if - - return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | - ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); - } // end of the 'unix2DosTime()' method - - - /** - * Adds "file" to archive - * - * @param string file contents - * @param string name of the file in the archive (may contains the path) - * @param integer the current timestamp - * - * @access public - */ - public function addFile($data, $name, $time = 0) - { - $name = str_replace('\\', '/', $name); - - $dtime = dechex($this->unix2DosTime($time)); - $hexdtime = '\x' . $dtime[6] . $dtime[7] - . '\x' . $dtime[4] . $dtime[5] - . '\x' . $dtime[2] . $dtime[3] - . '\x' . $dtime[0] . $dtime[1]; - eval('$hexdtime = "' . $hexdtime . '";'); - - $fr = "\x50\x4b\x03\x04"; - $fr .= "\x14\x00"; // ver needed to extract - $fr .= "\x00\x00"; // gen purpose bit flag - $fr .= "\x08\x00"; // compression method - $fr .= $hexdtime; // last mod time and date - - // "local file header" segment - $unc_len = strlen($data); - $crc = crc32($data); - $zdata = gzcompress($data); - $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug - $c_len = strlen($zdata); - $fr .= pack('V', $crc); // crc32 - $fr .= pack('V', $c_len); // compressed filesize - $fr .= pack('V', $unc_len); // uncompressed filesize - $fr .= pack('v', strlen($name)); // length of filename - $fr .= pack('v', 0); // extra field length - $fr .= $name; - - // "file data" segment - $fr .= $zdata; - - // "data descriptor" segment (optional but necessary if archive is not - // served as file) - // nijel(2004-10-19): this seems not to be needed at all and causes - // problems in some cases (bug #1037737) - //$fr .= pack('V', $crc); // crc32 - //$fr .= pack('V', $c_len); // compressed filesize - //$fr .= pack('V', $unc_len); // uncompressed filesize - - // add this entry to array - $this -> datasec[] = $fr; - - // now add to central directory record - $cdrec = "\x50\x4b\x01\x02"; - $cdrec .= "\x00\x00"; // version made by - $cdrec .= "\x14\x00"; // version needed to extract - $cdrec .= "\x00\x00"; // gen purpose bit flag - $cdrec .= "\x08\x00"; // compression method - $cdrec .= $hexdtime; // last mod time & date - $cdrec .= pack('V', $crc); // crc32 - $cdrec .= pack('V', $c_len); // compressed filesize - $cdrec .= pack('V', $unc_len); // uncompressed filesize - $cdrec .= pack('v', strlen($name) ); // length of filename - $cdrec .= pack('v', 0 ); // extra field length - $cdrec .= pack('v', 0 ); // file comment length - $cdrec .= pack('v', 0 ); // disk number start - $cdrec .= pack('v', 0 ); // internal file attributes - $cdrec .= pack('V', 32 ); // external file attributes - 'archive' bit set - - $cdrec .= pack('V', $this -> old_offset ); // relative offset of local header - $this -> old_offset += strlen($fr); - - $cdrec .= $name; - - // optional extra field, file comment goes here - // save to central directory - $this -> ctrl_dir[] = $cdrec; - } // end of the 'addFile()' method - - - /** - * Dumps out file - * - * @return string the zipped file - * - * @access public - */ - public function file() - { - $data = implode('', $this -> datasec); - $ctrldir = implode('', $this -> ctrl_dir); - - return - $data . - $ctrldir . - $this -> eof_ctrl_dir . - pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk" - pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall - pack('V', strlen($ctrldir)) . // size of central dir - pack('V', strlen($data)) . // offset to start of central dir - "\x00\x00"; // .zip file comment length - } // end of the 'file()' method - -} // end of the 'zipfile' class -?> \ No newline at end of file Added: poc/src/others/ZipFile.php =================================================================== --- poc/src/others/ZipFile.php (rev 0) +++ poc/src/others/ZipFile.php 2006-03-29 08:59:58 UTC (rev 39) @@ -0,0 +1,196 @@ +<?php +/** + * + * THIS IS NOT PART OF THE CODE DEVELOPT BY THE OpenDocumentPHP TEAM! + * ================================================================== + * $Id$ + * + * @version $Revision$ + * @package OpenDocument + * @subpackage others + * @since 0.4.0 + * + * ================================================================== + * + * Zip file creation class. + * Makes zip files. + * + * Based on : + * + * http://www.zend.com/codex.php?id=535&single=1 + * By Eric Mueller <er...@th...> + * + * http://www.zend.com/codex.php?id=470&single=1 + * by Denis125 <web...@at...> + * + * a patch from Peter Listiak <ml...@us...> for last modified + * date and time of the compressed file + * + * Official ZIP file format: http://www.pkware.com/appnote.txt + * + * @access public + */ +class ZipFile +{ + /** + * Array to store compressed data + * + * @var array $datasec + */ + private $datasec = array(); + + /** + * Central directory + * + * @var array $ctrl_dir + */ + private $ctrl_dir = array(); + + /** + * End of central directory record + * + * @var string $eof_ctrl_dir + */ + private $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; + + /** + * Last offset position + * + * @var integer $old_offset + */ + private $old_offset = 0; + + + /** + * Converts an Unix timestamp to a four byte DOS date and time format (date + * in high two bytes, time in low two bytes allowing magnitude comparison). + * + * @param integer the current Unix timestamp + * + * @return integer the current date in a four byte DOS format + * + * @access private + */ + private function unix2DosTime($unixtime = 0) { + $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime); + + if ($timearray['year'] < 1980) { + $timearray['year'] = 1980; + $timearray['mon'] = 1; + $timearray['mday'] = 1; + $timearray['hours'] = 0; + $timearray['minutes'] = 0; + $timearray['seconds'] = 0; + } // end if + + return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | + ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); + } // end of the 'unix2DosTime()' method + + + /** + * Adds "file" to archive + * + * @param string file contents + * @param string name of the file in the archive (may contains the path) + * @param integer the current timestamp + * + * @access public + */ + public function addFile($data, $name, $time = 0) + { + $name = str_replace('\\', '/', $name); + + $dtime = dechex($this->unix2DosTime($time)); + $hexdtime = '\x' . $dtime[6] . $dtime[7] + . '\x' . $dtime[4] . $dtime[5] + . '\x' . $dtime[2] . $dtime[3] + . '\x' . $dtime[0] . $dtime[1]; + eval('$hexdtime = "' . $hexdtime . '";'); + + $fr = "\x50\x4b\x03\x04"; + $fr .= "\x14\x00"; // ver needed to extract + $fr .= "\x00\x00"; // gen purpose bit flag + $fr .= "\x08\x00"; // compression method + $fr .= $hexdtime; // last mod time and date + + // "local file header" segment + $unc_len = strlen($data); + $crc = crc32($data); + $zdata = gzcompress($data); + $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug + $c_len = strlen($zdata); + $fr .= pack('V', $crc); // crc32 + $fr .= pack('V', $c_len); // compressed filesize + $fr .= pack('V', $unc_len); // uncompressed filesize + $fr .= pack('v', strlen($name)); // length of filename + $fr .= pack('v', 0); // extra field length + $fr .= $name; + + // "file data" segment + $fr .= $zdata; + + // "data descriptor" segment (optional but necessary if archive is not + // served as file) + // nijel(2004-10-19): this seems not to be needed at all and causes + // problems in some cases (bug #1037737) + //$fr .= pack('V', $crc); // crc32 + //$fr .= pack('V', $c_len); // compressed filesize + //$fr .= pack('V', $unc_len); // uncompressed filesize + + // add this entry to array + $this -> datasec[] = $fr; + + // now add to central directory record + $cdrec = "\x50\x4b\x01\x02"; + $cdrec .= "\x00\x00"; // version made by + $cdrec .= "\x14\x00"; // version needed to extract + $cdrec .= "\x00\x00"; // gen purpose bit flag + $cdrec .= "\x08\x00"; // compression method + $cdrec .= $hexdtime; // last mod time & date + $cdrec .= pack('V', $crc); // crc32 + $cdrec .= pack('V', $c_len); // compressed filesize + $cdrec .= pack('V', $unc_len); // uncompressed filesize + $cdrec .= pack('v', strlen($name) ); // length of filename + $cdrec .= pack('v', 0 ); // extra field length + $cdrec .= pack('v', 0 ); // file comment length + $cdrec .= pack('v', 0 ); // disk number start + $cdrec .= pack('v', 0 ); // internal file attributes + $cdrec .= pack('V', 32 ); // external file attributes - 'archive' bit set + + $cdrec .= pack('V', $this -> old_offset ); // relative offset of local header + $this -> old_offset += strlen($fr); + + $cdrec .= $name; + + // optional extra field, file comment goes here + // save to central directory + $this -> ctrl_dir[] = $cdrec; + } // end of the 'addFile()' method + + + /** + * Dumps out file + * + * @return string the zipped file + * + * @access public + */ + public function file() + { + $data = implode('', $this -> datasec); + $ctrldir = implode('', $this -> ctrl_dir); + + return + $data . + $ctrldir . + $this -> eof_ctrl_dir . + pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk" + pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall + pack('V', strlen($ctrldir)) . // size of central dir + pack('V', strlen($data)) . // offset to start of central dir + "\x00\x00"; // .zip file comment length + } // end of the 'file()' method + +} // end of the 'zipfile' class +?> \ No newline at end of file Property changes on: poc/src/others/ZipFile.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Modified: poc/src/samples/TestInput.php =================================================================== --- poc/src/samples/TestInput.php 2006-03-29 08:36:06 UTC (rev 38) +++ poc/src/samples/TestInput.php 2006-03-29 08:59:58 UTC (rev 39) @@ -55,6 +55,9 @@ <title>TestOutput File!</title> </head> <body> +<?php if (version_compare(PHP_VERSION, "5.0.0") < 0) { + ?><p>This web server runs PHP <?php echo PHP_VERSION ?> ! Be aware that <strong>OpenDocumentPHP</strong> will <strong>not work</strong>!</p><?php +}?> <form method="POST" action="TestOutput.php"> <fieldset> <legend>Generate a sample OpenDocument:</legend> Modified: poc/src/samples/TestOutput.php =================================================================== --- poc/src/samples/TestOutput.php 2006-03-29 08:36:06 UTC (rev 38) +++ poc/src/samples/TestOutput.php 2006-03-29 08:59:58 UTC (rev 39) @@ -21,10 +21,16 @@ ini_set( "include_path", ini_get( "include_path" ). "$sep$IP" ); include_once( "AllInclude.inc" ); - require_once( "OpenDocumentFactory.php" ); require_once( "Log/observer.php" ); +/* If you remove all "$this->logger" statements you and the *_once lines above you can try this: */ +// require_once( "OpenDocumentPHP-0.5.0-solid.php" ); + +if (version_compare(PHP_VERSION, "5.0.0") < 0) { + die( "You need at least PHP 5.0.0 to run this script!" ); +} + class TestOutput { const DocumentName = "test.odt"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-29 08:36:12
|
Revision: 38 Author: nmarkgraf Date: 2006-03-29 00:36:06 -0800 (Wed, 29 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=38&view=rev Log Message: ----------- Minor bug fix: Added a missing "?>" ad the end of the file. Modified Paths: -------------- poc/src/styles/FontFaceDeclSplitter.php Modified: poc/src/styles/FontFaceDeclSplitter.php =================================================================== --- poc/src/styles/FontFaceDeclSplitter.php 2006-03-28 12:38:15 UTC (rev 37) +++ poc/src/styles/FontFaceDeclSplitter.php 2006-03-29 08:36:06 UTC (rev 38) @@ -54,3 +54,4 @@ } } +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-28 12:38:30
|
Revision: 37 Author: nmarkgraf Date: 2006-03-28 04:38:15 -0800 (Tue, 28 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=37&view=rev Log Message: ----------- New features: - PHing can make a copy for use in a production environment. Try "phing production" and look at "OpenDocumentPHP-0.5.0-solid.php" in "./dist" directory. - PHing can now create a single file out of all (nes.) files. Try "phing solid-production" and look in the "./production" directory. - New file "build.properties" now has the current release informations in i, and "build.xml" uses this information to build better names for produced files. Like "OpenDocumentPHP-0.5.0.zip" or "OpenDocumentPHP-0.5.0-solid.php" ... Norman Modified Paths: -------------- poc/build.xml Added Paths: ----------- poc/build.properties poc/etc/solid.txt Added: poc/build.properties =================================================================== --- poc/build.properties (rev 0) +++ poc/build.properties 2006-03-28 12:38:15 UTC (rev 37) @@ -0,0 +1,10 @@ +# This is the main build.xml property file. +# (C) by Norman Markgraf, Alex Latchford, et al. +# Published under GPL 2.0 or above. +# +# Last edited by $Author$ +# +# $Id$ +release=0.5.0 +releaseDos=0_5_0 +revision=$revision$ \ No newline at end of file Property changes on: poc/build.properties ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Modified: poc/build.xml =================================================================== --- poc/build.xml 2006-03-23 09:06:06 UTC (rev 36) +++ poc/build.xml 2006-03-28 12:38:15 UTC (rev 37) @@ -1,6 +1,10 @@ <?xml version="1.0"?> <project name="OpenDocumentPHP" default="build" basedir="."> + + <property file="build.properties" /> + <property name="OpenDocumentPHPSolid" value="OpenDocumentPHP-${release}-solid.php" /> + <target name="prepare"> <mkdir dir="reports"/> <mkdir dir="reports/coverage"/> @@ -71,18 +75,18 @@ </target> <target name="dist" depends="preparedist"> - <zip destfile="dist/OpenDocumentPHP.zip" basedir="src"/> - <tar destfile="dist/OpenDocumentPHP.tar" basedir="src"/> + <zip destfile="dist/OpenDocumentPHP-${release}.zip" basedir="src"/> + <tar destfile="dist/OpenDocumentPHP-${release}.tar" basedir="src"/> </target> <target name="dev-dist" depends="preparedist"> - <zip destfile="dist/OpenDocumentPHPdev.zip" basedir="."> + <zip destfile="dist/OpenDocumentPHP-${release}-dev.zip" basedir="."> <fileset dir="."> <include name="**/**"/> <exclude name="**/?svn/**"/> </fileset> </zip> - <tar destfile="dist/OpenDocumentPHPdev.tar" basedir="."> + <tar destfile="dist/OpenDocumentPHP-${release}-dev.tar" basedir="."> <fileset dir="."> <include name="**/**"/> <exclude name="**/?svn/**"/> @@ -99,11 +103,34 @@ </fileset> </copy> </target> + + <target name="solid-production" depends="production"> + <mkdir dir="solid-production"/> + <copy todir="solid-production"> <!--"/OpenDocumentPHP-solid.php" overwrite="true" --> + <fileset dir="production"> + <include name="**/*.php" /> + </fileset> + <filterchain> + <replaceregexp> + <regexp pattern=".*require_once" replace="//require_once" ignoreCase="true" /> + <regexp pattern=".*include_once" replace="//include_once" ignoreCase="true" /> + <regexp pattern=".+this-.logger.+" replace="//this-logger-" /> + </replaceregexp> + <stripphpcomments /> + </filterchain> + </copy> + <!-- echo msg="${OpenDocumentPHPSolid}"/--> + <!-- echo msg="${os.name}"/--> + <exec command="copy ..\etc\solid.txt + *.php + manifest\*.php + content\*.php + settings\*.php + styles\*.php tmp.tmp" dir="solid-production"/> + <exec command="cat ../etc/solid.txt > ../tmp.tmp && cat *.php >> ../tmp.tmp && cat */*.php >> ../tmp.tmp" dir="solid-production" os="linux"/> + <copy file="solid-production/tmp.tmp" tofile="dist/${OpenDocumentPHPSolid}" overwrite="true"/> + <delete dir="solid-production"/> + </target> <target name="build" depends="prepare,test,reports,docs,dist"> </target> - <target name="build-all" depends="prepare,test,reports,docs,dist,dev-dist,production"> + <target name="build-all" depends="prepare,test,reports,docs,dist,dev-dist,production,solid-production"> </target> @@ -116,9 +143,11 @@ <delete file="OpenDocumentPHP.zip"/> <delete file="OpenDocumentPHP.tar"/> <delete dir="production"/> + <delete dir="solid-production"/> </target> <target name="proper" depends="clean"> <delete dir="reports"/> + <delete file="${OpenDocumentPHPSolid}"/> </target> </project> Added: poc/etc/solid.txt =================================================================== --- poc/etc/solid.txt (rev 0) +++ poc/etc/solid.txt 2006-03-28 12:38:15 UTC (rev 37) @@ -0,0 +1,20 @@ +<?php +/** + * OpenDocumentPHP in one solid file! + * + * This is a generated Text, please do not edit any thing in this file! Use the + * non solid files instead! + * + * + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * + * @since 0.5.0 + */ + ?> \ No newline at end of file Property changes on: poc/etc/solid.txt ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-23 09:06:14
|
Revision: 36 Author: nmarkgraf Date: 2006-03-23 01:06:06 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=36&view=rev Log Message: ----------- Fix should fix some errors with the "ini_set" statement in unix or windows environment. Modified Paths: -------------- poc/src/samples/TestInput.php poc/src/samples/TestOutput.php Modified: poc/src/samples/TestInput.php =================================================================== --- poc/src/samples/TestInput.php 2006-03-20 22:14:51 UTC (rev 35) +++ poc/src/samples/TestInput.php 2006-03-23 09:06:06 UTC (rev 36) @@ -42,6 +42,13 @@ * @subpackage samples * @since 0.4.2 */ + +// Very dirty hack ... +$dsep = DIRECTORY_SEPARATOR; +$IP = dirname( realpath( dirname( dirname ( __FILE__) . "$dsep..$dsep") ) ); +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +ini_set( "include_path", ini_get( "include_path" ). "$sep$IP" ); + ?> <html> <head> Modified: poc/src/samples/TestOutput.php =================================================================== --- poc/src/samples/TestOutput.php 2006-03-20 22:14:51 UTC (rev 35) +++ poc/src/samples/TestOutput.php 2006-03-23 09:06:06 UTC (rev 36) @@ -14,7 +14,12 @@ * @since 0.4.2 */ -ini_set( "include_path", ini_get( "include_path" ). ";..\\;.\\styles\\;..\\styles\\;.\\content\\;..\\content\\" ); +// Very dirty hack ... +$dsep = DIRECTORY_SEPARATOR; +$IP = dirname( realpath( dirname( dirname ( __FILE__) . "$dsep..$dsep") ) ) . $dsep; +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +ini_set( "include_path", ini_get( "include_path" ). "$sep$IP" ); + include_once( "AllInclude.inc" ); require_once( "OpenDocumentFactory.php" ); @@ -30,7 +35,7 @@ function __construct() { $conf = array( "mode" => 0600 ); - $this->logger = &Log::factory( "file", "D:/PHP/OpenDocument.log", "OpenDocument", $conf ); +// $this->logger = &Log::factory( "file", "D:/PHP/OpenDocument.log", "OpenDocument", $conf ); $this->logger = &Log::factory( "console", "", "OpenDocument" ); } @@ -48,8 +53,6 @@ $text = $content->getText(); - $text->addNoForms(); - $text->addToText( $text->getTextHeading( "Heading", 1, "The first step" ) ); $text->addToText( $text->getTextParagraph( "Paragraph", "This is a little test!" ) ); } @@ -61,11 +64,11 @@ } function makeAutomaticStyles( $automaticStyles ) { - return $automaticStyles; + // return $automaticStyles; } function makeScripts( $scripts ) { - return $scripts; + // return $scripts; } function makeStyle( $style ) { @@ -168,8 +171,8 @@ */ $this->makeMeta( $TestDoc->getMeta(), $creator, $title, "en-EN" ); - $this->makeAutomaticStyles( $TestDoc->getAutomaticStyles() ); - $this->makeScripts( $TestDoc->getScripts() ); +// $this->makeAutomaticStyles( $TestDoc->getAutomaticStyles() ); +// $this->makeScripts( $TestDoc->getScripts() ); $this->makeFontFaceDecl( $TestDoc->getFontFaceDeclaration() ); $this->makeStyle( $TestDoc->getStyle() ); $this->makeContent( $TestDoc->getBody() ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-20 22:15:08
|
Revision: 35 Author: nmarkgraf Date: 2006-03-20 14:14:51 -0800 (Mon, 20 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=35&view=rev Log Message: ----------- Minor changes: - Reverted to changes on OpenDocumentPackage and OpenDocumentSingle. Comment is in the source. - Minor bug fix in content/Content Modified Paths: -------------- poc/src/OpenDocumentPackage.php poc/src/OpenDocumentSingle.php poc/src/content/Content.php Modified: poc/src/OpenDocumentPackage.php =================================================================== --- poc/src/OpenDocumentPackage.php 2006-03-20 18:04:48 UTC (rev 34) +++ poc/src/OpenDocumentPackage.php 2006-03-20 22:14:51 UTC (rev 35) @@ -46,9 +46,6 @@ $this->logger->debug( "Constructing OpenDocumentPackage." ); - $this->dom = new DOMDocument( "1.0", "utf-8" ); - $this->dom->formatOutput = true; - $this->isCommited = false; $this->logger->debug( "Generating ZipFile object." ); @@ -61,24 +58,23 @@ } } $this->logger->debug( "Generating Manifest with mimetype \"".$this->getMimeType()."\"." ); - $this->DocumentObjects[ "manifest" ] = new Manifest( $this->getMimeType() ); - $this->DocumentObjects[ "meta" ] = new Meta( ); -// $this->DocumentObjects[ "settings" ] = new Settings( ); + $this->DocumentObjects[ "manifest" ] = new Manifest( $this->getMimeType() ); + $this->DocumentObjects[ "meta" ] = new Meta( ); +// $this->DocumentObjects[ "settings" ] = new Settings( ); - $this->DocumentObjects[ "content" ] = new Content();; + $this->DocumentObjects[ "content" ] = new Content();; - $this->DocumentObjects[ "styles" ] = new Styles(); + $this->DocumentObjects[ "styles" ] = new Styles(); - $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom ); - $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom ); - $this->DocumentObjects[ "body" ] = $this->DocumentObjects["content"]->getBody(); - + $this->DocumentObjects[ "body" ] = $this->DocumentObjects["content"]->getBody(); - $this->DocumentObjects[ "style" ] = $this->DocumentObjects["styles"]->getStyle(); - $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclSplitter( $this->DocumentObjects["content"]->getFontFaceDecl(), - $this->DocumentObjects["styles"]->getFontFaceDecl() ); -// $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStylesSpliter(... ); -// $this->DocumentObjects[ "masterstyles" ] = $styles->getMasterStyles(); + $this->DocumentObjects[ "style" ] = $this->DocumentObjects["styles"]->getStyle(); + $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclSplitter( + $this->DocumentObjects[ "content" ]->getFontFaceDecl(), + $this->DocumentObjects[ "styles" ]->getFontFaceDecl() + ); + // Because all other parts will be inserted on demand, there is no need to initialise them here! + } /** @@ -246,11 +242,9 @@ case "content" : $this->addXMLDocument( "content.xml", $docObj->get() ); break; -/* case "settings" : - $this->addXMLDocument( "settings.xml", $dom ); + $this->addXMLDocument( "settings.xml", $domObj->get() ); break; -*/ } } @@ -347,7 +341,10 @@ * @since 0.4.4 */ public function getSettings(){ - return 0; + if (!array_key_exists ( "settings", $this->DocumentObjects) ) { + $this->DocumentObjects[ "settings" ] = new Settings(); + } + return $this->DocumentObjects[ "settings" ]; } /** @@ -383,6 +380,14 @@ public function getAutomaticStyles(){ if ( !array_key_exists( "automaticstyles", $this->DocumentObjects ) ) { $this->DocumentObjects[ "automaticstyles" ] = 0; +/* +// This should be something like: + $this->DocumentObjects[ "automaticstyles" ] = new AutmaticStylesSplitter( + $this->DocumentObjects[ "content" ]->getAutmaticStyles(), + $this->DocumentObjects[ "styles" ]->getAutomaticStyles() + ); + +*/ } return $this->DocumentObjects[ "automaticstyles" ]; } @@ -395,7 +400,7 @@ */ public function getMasterStyles(){ if ( !array_key_exists( "masterstyles", $this->DocumentObjects ) ) { - $this->DocumentObjects[ "masterstyles" ] = 0; + $this->DocumentObjects[ "masterstyles" ] = $this->DocumentObjects[ "styles" ]->getMasterStyles(); } return $this->DocumentObjects[ "masterstyles" ]; } Modified: poc/src/OpenDocumentSingle.php =================================================================== --- poc/src/OpenDocumentSingle.php 2006-03-20 18:04:48 UTC (rev 34) +++ poc/src/OpenDocumentSingle.php 2006-03-20 22:14:51 UTC (rev 35) @@ -71,14 +71,11 @@ $this->root = $this->dom->createElementNS( self::NS_OFFICE, "office:document" ); $this->root->setAttributeNS( self::NS_OFFICE, "office:mimetype", $mimetype ); - $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); -// $this->DocumentObjects[ "settings" ] = new Settings( $this->dom, $this->root ); - $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom, $this->root ); + $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclaration( $this->dom, $this->root ); $this->DocumentObjects[ "style" ] = new Style( $this->dom, $this->root ); - $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom, $this->root ); -// $this->DocumentObjects[ "masterstyles" ] = new MasterStyles( $this->dom, $this->root ); - $this->DocumentObjects[ "body" ] = new Body( $this->dom, $this->root ); + $this->DocumentObjects[ "body" ] = new Body( $this->dom, $this->root ); + // Because all other parts will be inserted on demand, there is no need to initialise them here! } /** Modified: poc/src/content/Content.php =================================================================== --- poc/src/content/Content.php 2006-03-20 18:04:48 UTC (rev 34) +++ poc/src/content/Content.php 2006-03-20 22:14:51 UTC (rev 35) @@ -4,13 +4,13 @@ * * $Id$ * - * @license GNU General Public License - * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. - * @author Norman Markgraf <nma...@us...> - * @version $Revision$ - * @package OpenDocument - * - * @since 0.4.4 + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage content + * @since 0.4.4 */ require_once( "content/Scripts.php" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yaw...@us...> - 2006-03-20 18:05:09
|
Revision: 34 Author: yawnster Date: 2006-03-20 10:04:48 -0800 (Mon, 20 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=34&view=rev Log Message: ----------- - Added in modular support for Scripts and AutoStyles. - Should output correctly now in both modes. - Started on ZipFile Task, added scope declarations. - Norman.. Its now OOo 2.0.2 :P Modified Paths: -------------- poc/src/OpenDocumentPackage.php poc/src/OpenDocumentSingle.php poc/src/ZipFile.php poc/src/samples/TestInput.php poc/src/samples/TestOutput.php Removed Paths: ------------- poc/src/samples/TestTranslate.php Modified: poc/src/OpenDocumentPackage.php =================================================================== --- poc/src/OpenDocumentPackage.php 2006-03-20 13:49:26 UTC (rev 33) +++ poc/src/OpenDocumentPackage.php 2006-03-20 18:04:48 UTC (rev 34) @@ -46,6 +46,9 @@ $this->logger->debug( "Constructing OpenDocumentPackage." ); + $this->dom = new DOMDocument( "1.0", "utf-8" ); + $this->dom->formatOutput = true; + $this->isCommited = false; $this->logger->debug( "Generating ZipFile object." ); @@ -62,20 +65,18 @@ $this->DocumentObjects[ "meta" ] = new Meta( ); // $this->DocumentObjects[ "settings" ] = new Settings( ); - $content = new Content( ); - $this->DocumentObjects[ "content" ] = $content; + $this->DocumentObjects[ "content" ] = new Content();; - $styles = new Styles( ); - $this->DocumentObjects[ "styles" ] = $styles; + $this->DocumentObjects[ "styles" ] = new Styles(); -// $this->DocumentObjects[ "scripts" ] = new Scripts( $contentDom ); -// $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $contentDom ); - $this->DocumentObjects[ "body" ] = $content->getBody(); + $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom ); + $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom ); + $this->DocumentObjects[ "body" ] = $this->DocumentObjects["content"]->getBody(); - $this->DocumentObjects[ "style" ] = $styles->getStyle(); - $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclSplitter( $content->getFontFaceDecl(), - $styles->getFontFaceDecl() ); + $this->DocumentObjects[ "style" ] = $this->DocumentObjects["styles"]->getStyle(); + $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclSplitter( $this->DocumentObjects["content"]->getFontFaceDecl(), + $this->DocumentObjects["styles"]->getFontFaceDecl() ); // $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStylesSpliter(... ); // $this->DocumentObjects[ "masterstyles" ] = $styles->getMasterStyles(); } Modified: poc/src/OpenDocumentSingle.php =================================================================== --- poc/src/OpenDocumentSingle.php 2006-03-20 13:49:26 UTC (rev 33) +++ poc/src/OpenDocumentSingle.php 2006-03-20 18:04:48 UTC (rev 34) @@ -10,6 +10,7 @@ * @license GNU General Public License * @copyright Copyright © 2006, Norman Markgraf, et al. * @author Norman Markgraf <nma...@us...> + * @author Alex Latchford <yaw...@us...> * @version $Revision$ * @package OpenDocument * @@ -72,10 +73,10 @@ $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); // $this->DocumentObjects[ "settings" ] = new Settings( $this->dom, $this->root ); -// $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom, $this->root ); + $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom, $this->root ); $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclaration( $this->dom, $this->root ); $this->DocumentObjects[ "style" ] = new Style( $this->dom, $this->root ); -// $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom, $this->root ); + $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom, $this->root ); // $this->DocumentObjects[ "masterstyles" ] = new MasterStyles( $this->dom, $this->root ); $this->DocumentObjects[ "body" ] = new Body( $this->dom, $this->root ); } Modified: poc/src/ZipFile.php =================================================================== --- poc/src/ZipFile.php 2006-03-20 13:49:26 UTC (rev 33) +++ poc/src/ZipFile.php 2006-03-20 18:04:48 UTC (rev 34) @@ -25,28 +25,28 @@ * * @var array $datasec */ - var $datasec = array(); + private $datasec = array(); /** * Central directory * * @var array $ctrl_dir */ - var $ctrl_dir = array(); + private $ctrl_dir = array(); /** * End of central directory record * * @var string $eof_ctrl_dir */ - var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; + private $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; /** * Last offset position * * @var integer $old_offset */ - var $old_offset = 0; + private $old_offset = 0; /** @@ -59,7 +59,7 @@ * * @access private */ - function unix2DosTime($unixtime = 0) { + private function unix2DosTime($unixtime = 0) { $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime); if ($timearray['year'] < 1980) { @@ -85,7 +85,7 @@ * * @access public */ - function addFile($data, $name, $time = 0) + public function addFile($data, $name, $time = 0) { $name = str_replace('\\', '/', $name); @@ -164,7 +164,7 @@ * * @access public */ - function file() + public function file() { $data = implode('', $this -> datasec); $ctrldir = implode('', $this -> ctrl_dir); Modified: poc/src/samples/TestInput.php =================================================================== --- poc/src/samples/TestInput.php 2006-03-20 13:49:26 UTC (rev 33) +++ poc/src/samples/TestInput.php 2006-03-20 18:04:48 UTC (rev 34) @@ -55,7 +55,7 @@ <legend>Document Type:</legend> <label for="single">Single </label><input type="radio" id="single" name="SingleDocument" value="true" checked="checked" /> <label for="package">Package </label><input type="radio" id="package" name="SingleDocument" value="false" /><br /> - <p>If you want to display the results in <strong>OpenOffice 2.0.1</strong>, you should take the <em>package</em> document type.</p> + <p>If you want to display the results in <strong>OpenOffice 2.0.2</strong>, you should take the <em>package</em> document type.</p> </fieldset> <fieldset> <legend>Metadata:</legend> Modified: poc/src/samples/TestOutput.php =================================================================== --- poc/src/samples/TestOutput.php 2006-03-20 13:49:26 UTC (rev 33) +++ poc/src/samples/TestOutput.php 2006-03-20 18:04:48 UTC (rev 34) @@ -7,7 +7,7 @@ * @license GNU General Public License * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. * @author Norman Markgraf <nma...@us...> - * @author Alex Latchford <yan...@us...> + * @author Alex Latchford <yaw...@us...> * @version $Revision$ * @package OpenDocument * @subpackage samples @@ -29,19 +29,9 @@ private $logger; function __construct() { - /* ***TO DO *** This raises a warning ... - // $conf = array( "mode" => 0600 ); - $this->logger = &Log_observer::factory( "file", "D:/PHP/OpenDocument.log", "OpenDocument", $conf ); - $this->logger = &Log_observer::factory( "console", "", "OpenDocument" ); - */ - - /* - Console output: - $this->logger = &Log_observer::factory( "console", "", "OpenDocument" ); - - File output: - $this->logger = &Log_observer::factory( "file", "OpenDocument.log", "OpenDocument" ); - */ + $conf = array( "mode" => 0600 ); + $this->logger = &Log::factory( "file", "D:/PHP/OpenDocument.log", "OpenDocument", $conf ); + $this->logger = &Log::factory( "console", "", "OpenDocument" ); } function makeMeta( $meta, $creator="Norman Markgraf", $title="This is a test!", $language="en-EN" ) { @@ -55,25 +45,28 @@ } function makeContent( $content ) { - $content->addNoScript(); - $content->addFontFace( "Test", "Tahoma" ); - - $content->addNoAutomaticStyles(); + $text = $content->getText(); - $text = $content->getBody()->getText(); - $text->addNoForms(); $text->addToText( $text->getTextHeading( "Heading", 1, "The first step" ) ); $text->addToText( $text->getTextParagraph( "Paragraph", "This is a little test!" ) ); } - function makeFontFaceDecl( $fontfacedecl ) { + function makeFontFaceDecl( $fontFaceDecl ) { $styleAttr = array(); $styleAttr[ "font-family" ] ="Tahoma"; $fontFaceDecl->addFontFace( "Test", $styleAttr ); } + + function makeAutomaticStyles( $automaticStyles ) { + return $automaticStyles; + } + + function makeScripts( $scripts ) { + return $scripts; + } function makeStyle( $style ) { // Set default style @@ -175,9 +168,11 @@ */ $this->makeMeta( $TestDoc->getMeta(), $creator, $title, "en-EN" ); - $this->makeFontFaceDecl( $TestDoc->getFontFaceDeclaration() ); + $this->makeAutomaticStyles( $TestDoc->getAutomaticStyles() ); + $this->makeScripts( $TestDoc->getScripts() ); + $this->makeFontFaceDecl( $TestDoc->getFontFaceDeclaration() ); $this->makeStyle( $TestDoc->getStyle() ); - $this->makeContent( $TestDoc->getContent() ); + $this->makeContent( $TestDoc->getBody() ); echo $TestDoc->get(); Deleted: poc/src/samples/TestTranslate.php =================================================================== --- poc/src/samples/TestTranslate.php 2006-03-20 13:49:26 UTC (rev 33) +++ poc/src/samples/TestTranslate.php 2006-03-20 18:04:48 UTC (rev 34) @@ -1,48 +0,0 @@ -<?php -/** - * TestTranslate class that will translate a given formatting style to ODF formatting. - * - * $Id$ - * - * @license GNU General Public License - * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et al. - * @author Alex Latchford <yaw...@us...> - * @version $Revision$ - * @package OpenDocument - * @subpackage samples - * @since 0.4.2 - */ - -require_once( "Log/observer.php" ); - -class TestTranslate { - - private $expression; - private $logger; - private $matches = array(); - - public function __construct() { - $this->logger = &Log::factory( "null", "", "OpenDocument" ); - $this->logger->debug( "Constructing TestTranslate." ); - } - - public function __destruct() { - $this->logger->debug( "Destructing TestTranslate." ); - } - - public function getParagraphs($document_content) { - - $matches = preg_split( "/\n/", $document_content, 0, PREG_SPLIT_NO_EMPTY); - - return $matches; - } - - public function getHeadings($document_content) { - - $matches = preg_split( "/(<h[1-6])+\w.+(<\/h[1-6]>)+/", $document_content, 0, PREG_SPLIT_NO_EMPTY); - - return $matches; - } - -} - ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nma...@us...> - 2006-03-20 13:49:58
|
Revision: 33 Author: nmarkgraf Date: 2006-03-20 05:49:26 -0800 (Mon, 20 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=33&view=rev Log Message: ----------- done. This could be the last revision before POC 0.5. Please test it a lot and tell me every error you found. Updated: - etc/coverage-frames.xsl copied from PHing svn distribution. - samples/TestOutput.php now acts with the new classes and methods. - OpenDocument, OpenDocumentSingle, OpenDocumentPackage are now running. - content/Content and styles/Styles are up to date and using FontFaceDeclSplitter to share FontFaceDeclarations. To do: - Like FontFaceDeclSplitter we need a AutomaticStylesSplitter to share AutomaticStyles between content.xml and styles.xml - Maybe FontFaceDecl could be a interface implemeted by FontFaceDeclaration and FontFaceDeclSplitter - ... Norman Modified Paths: -------------- poc/etc/coverage-frames.xsl poc/src/OpenDocument.php poc/src/OpenDocumentPackage.php poc/src/OpenDocumentSingle.php poc/src/content/Content.php poc/src/samples/TestOutput.php poc/src/styles/FontFaceDeclaration.php poc/src/styles/Styles.php Added Paths: ----------- poc/src/styles/FontFaceDeclSplitter.php Modified: poc/etc/coverage-frames.xsl =================================================================== --- poc/etc/coverage-frames.xsl 2006-03-20 09:43:58 UTC (rev 32) +++ poc/etc/coverage-frames.xsl 2006-03-20 13:49:26 UTC (rev 33) @@ -291,6 +291,7 @@ <td class="small">Classes: <xsl:value-of select="count(package/class)"/></td> <td class="small">Methods: <xsl:value-of select="@methodcount"/></td> <td class="small">LOC: <xsl:value-of select="count(package/class/sourcefile/sourceline)"/></td> + <td class="small">Statements: <xsl:value-of select="@statementcount"/></td> </tr> </table> <br/> @@ -414,6 +415,7 @@ <td class="small">Classes: <xsl:value-of select="count(class)"/></td> <td class="small">Methods: <xsl:value-of select="@methodcount"/></td> <td class="small">LOC: <xsl:value-of select="count(class/sourcefile/sourceline)"/></td> + <td class="small">Statements: <xsl:value-of select="@statementcount"/></td> </tr> </table> <br/> @@ -462,6 +464,7 @@ <tr class="a"> <td class="small">Methods: <xsl:value-of select="@methodcount"/></td> <td class="small">LOC: <xsl:value-of select="count(sourcefile/sourceline)"/></td> + <td class="small">Statements: <xsl:value-of select="@statementcount"/></td> </tr> </table> <br/> Modified: poc/src/OpenDocument.php =================================================================== --- poc/src/OpenDocument.php 2006-03-20 09:43:58 UTC (rev 32) +++ poc/src/OpenDocument.php 2006-03-20 13:49:26 UTC (rev 33) @@ -65,7 +65,13 @@ */ public function getStyle(); - + /** + * + * @access public + * + * @since 0.4.4 + */ + public function getScripts(); /** * Modified: poc/src/OpenDocumentPackage.php =================================================================== --- poc/src/OpenDocumentPackage.php 2006-03-20 09:43:58 UTC (rev 32) +++ poc/src/OpenDocumentPackage.php 2006-03-20 13:49:26 UTC (rev 33) @@ -2,6 +2,11 @@ /** * OpenDocumentPackage Class * + * This class will include the following files in one ZIP file with a Manifest file (like JAR files + * for Java) Meta in meta.xml, Settings in settings.xml, Scripts, FontFaceDeclarations, Automatic Styles, + * Body in content.xml, FontFaceDelarations, Styles, Automatic Styles, Master Styles in styles.xml. + * <i>Be aware:</i> FontFaceDeclarations and Automatic Styles are the same in content.xml and styles.xml. + * * $Id$ * * @copyright GNU General Public License @@ -14,6 +19,7 @@ require_once( "settings/Settings.php" ); require_once( "content/Scripts.php" ); require_once( "styles/FontFaceDeclaration.php" ); +require_once( "styles/FontFaceDeclSplitter.php" ); require_once( "styles/Style.php" ); require_once( "styles/AutomaticStyles.php" ); require_once( "styles/MasterStyles.php" ); @@ -21,7 +27,7 @@ require_once( "OpenDocumentAbstract.php" ); class OpenDocumentPackage extends OpenDocumentAbstract implements OpenDocument { - private $manifest; + private $packagename; private $packagetmp; private $zip; @@ -44,8 +50,6 @@ $this->logger->debug( "Generating ZipFile object." ); $this->zip = new ZipFile; - $this->logger->debug( "Generating Manifest with mimetype \"".$this->getMimeType()."\"." ); - $this->manifest = new Manifest( $this->getMimeType() ); if ( !empty( $documentName ) ) { $this->setPackageName( $documentName ); @@ -53,6 +57,27 @@ $this->path = $documentPath; } } + $this->logger->debug( "Generating Manifest with mimetype \"".$this->getMimeType()."\"." ); + $this->DocumentObjects[ "manifest" ] = new Manifest( $this->getMimeType() ); + $this->DocumentObjects[ "meta" ] = new Meta( ); +// $this->DocumentObjects[ "settings" ] = new Settings( ); + + $content = new Content( ); + $this->DocumentObjects[ "content" ] = $content; + + $styles = new Styles( ); + $this->DocumentObjects[ "styles" ] = $styles; + +// $this->DocumentObjects[ "scripts" ] = new Scripts( $contentDom ); +// $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $contentDom ); + $this->DocumentObjects[ "body" ] = $content->getBody(); + + + $this->DocumentObjects[ "style" ] = $styles->getStyle(); + $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclSplitter( $content->getFontFaceDecl(), + $styles->getFontFaceDecl() ); +// $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStylesSpliter(... ); +// $this->DocumentObjects[ "masterstyles" ] = $styles->getMasterStyles(); } /** @@ -197,7 +222,7 @@ public function addXMLDocument( $fullpath, $dom, $mimetype="text/xml" ) { $this->logger->info( "OpenDocumentPackage->addXMLDocument(" . $fullpath . ") with mimetype '" . $mimetype . "' to package '". $this->packagetmp . "'" ); - $this->manifest->addEntryToManifest( $fullpath, $mimetype ); + $this->DocumentObjects[ "manifest" ]->addEntryToManifest( $fullpath, $mimetype ); $this->writeDOMToPackage( $fullpath, $dom ); } @@ -214,8 +239,8 @@ case "meta" : $this->addXMLDocument( "meta.xml", $docObj->get() ); break; - case "style" : - $this->addXMLDocument( "style.xml", $docObj->get() ); + case "styles" : + $this->addXMLDocument( "styles.xml", $docObj->get() ); break; case "content" : $this->addXMLDocument( "content.xml", $docObj->get() ); @@ -228,7 +253,7 @@ } } - $this->writeDOMToPackage( "META-INF/manifest.xml" , $this->manifest->get() ); + $this->writeDOMToPackage( "META-INF/manifest.xml" , $this->DocumentObjects[ "manifest" ]->get() ); $this->logger->debug( "OpenDocumentPackage->commit: Write mimetype \"". $this->getMimeType()."\" to file \"mimetype\"..." ); $this->zip->addFile( $this->getMimeType(), "mimetype" ); $this->logger->debug( "OpenDocumentPackage->commit: Commited package named \"" . $this->packagename . "\"..." ); @@ -289,21 +314,21 @@ */ public function getStyle() { if (!array_key_exists ( "style", $this->DocumentObjects) ) { - $this->DocumentObjects[ "style" ] = new Style(); + $this->DocumentObjects[ "style" ] = $this->DocumentObjects[ "styles" ]->getStyle(); } return $this->DocumentObjects[ "style" ]; } - + /** * * @access public - * * @since 0.4.0 */ - public function getBody(){ - return 0; + public function getStyles() { + return getStyle(); } - + + /** * * @access public @@ -311,7 +336,7 @@ * @since 0.4.4 */ public function getFontFaceDeclaration(){ - return 0; + return $this->DocumentObjects[ "fontfacedecl" ]; } /** @@ -323,6 +348,16 @@ public function getSettings(){ return 0; } + + /** + * + * @access public + * + * @since 0.4.0 + */ + public function getBody() { + return $this->DocumentObjects[ "body" ]; + } /** * @@ -330,9 +365,14 @@ * * @since 0.4.4 */ - public function getStyles(){ - return 0; + public function getScripts(){ + if ( !array_key_exists( "scripts", $this->DocumentObjects ) ) { + $this->DocumentObjects[ "scripts" ] = $this->DocumentObjects[ "content" ]->getScripts(); + } + return $this->DocumentObjects[ "scripts" ]; } + + /** * * @access public @@ -340,7 +380,10 @@ * @since 0.4.4 */ public function getAutomaticStyles(){ - return 0; + if ( !array_key_exists( "automaticstyles", $this->DocumentObjects ) ) { + $this->DocumentObjects[ "automaticstyles" ] = 0; + } + return $this->DocumentObjects[ "automaticstyles" ]; } /** @@ -349,10 +392,12 @@ * * @since 0.4.4 */ - public function getMasterStyles() { - return 0; + public function getMasterStyles(){ + if ( !array_key_exists( "masterstyles", $this->DocumentObjects ) ) { + $this->DocumentObjects[ "masterstyles" ] = 0; + } + return $this->DocumentObjects[ "masterstyles" ]; } - } ?> \ No newline at end of file Modified: poc/src/OpenDocumentSingle.php =================================================================== --- poc/src/OpenDocumentSingle.php 2006-03-20 09:43:58 UTC (rev 32) +++ poc/src/OpenDocumentSingle.php 2006-03-20 13:49:26 UTC (rev 33) @@ -71,14 +71,13 @@ $this->root->setAttributeNS( self::NS_OFFICE, "office:mimetype", $mimetype ); $this->DocumentObjects[ "meta" ] = new Meta( $this->dom, $this->root ); - $this->DocumentObjects[ "settings" ] = new Settings( $this->dom, $this->root ); - $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom, $this->root ); +// $this->DocumentObjects[ "settings" ] = new Settings( $this->dom, $this->root ); +// $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom, $this->root ); $this->DocumentObjects[ "fontfacedecl" ] = new FontFaceDeclaration( $this->dom, $this->root ); $this->DocumentObjects[ "style" ] = new Style( $this->dom, $this->root ); - $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom, $this->root ); - $this->DocumentObjects[ "masterstyles" ] = new MasterStyles( $this->dom, $this->root ); - $this->DocumentObjects[ "body" ] = new Body( $this->dom, $this->root ); - +// $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom, $this->root ); +// $this->DocumentObjects[ "masterstyles" ] = new MasterStyles( $this->dom, $this->root ); + $this->DocumentObjects[ "body" ] = new Body( $this->dom, $this->root ); } /** @@ -125,18 +124,35 @@ */ private function commit() { $this->logger->debug( "OpenDocumentSingle->commit()" ); - - $this->DocumentObjects[ "meta" ]->commit(); -// $this->DocumentObjects[ "settings" ]->commit(); -// $this->root->appendChild( $this->DocumentObjects[ "scripts" ]->get() ); - $this->root->appendChild( $this->DocumentObjects[ "fontfacedecl" ]->get() ); - $this->root->appendChild( $this->DocumentObjects[ "style" ]->get() ); -// $this->root->appendChild( $this->DocumentObjects[ "automaticstyles" ]->get() ); -// $this->root->appendChild( $this->DocumentObjects[ "masterstyles" ]->get() ); - $this->root->appendChild( $this->DocumentObjects[ "body" ]->get() ); - + // Add Meta data + $this->DocumentObjects[ "meta" ]->commit(); + // Add settings, if needed + if ( array_key_exists( "settings", $this->DocumentObjects ) ) { + $this->DocumentObjects[ "settings" ]->commit(); + } + // Add scripts, if needed + if ( array_key_exists( "scripts", $this->DocumentObjects ) ) { + $this->root->appendChild( $this->DocumentObjects[ "scripts" ]->get() ); + } + // Add FontFaceDeclarations + $this->root->appendChild( $this->DocumentObjects[ "fontfacedecl" ]->get() ); + // Add Style + $this->root->appendChild( $this->DocumentObjects[ "style" ]->get() ); + // Add AutomaticSytles, if needed + if ( array_key_exists( "automaticstyles", $this->DocumentObjects ) ) { + $this->root->appendChild( $this->DocumentObjects[ "automaticstyles" ]->get() ); + } + // Add MasterStyles, if needed + if ( array_key_exists( "masterstyles", $this->DocumentObjects ) ) { + $this->root->appendChild( $this->DocumentObjects[ "masterstyles" ]->get() ); + } + // Add Body + $this->root->appendChild( $this->DocumentObjects[ "body" ]->get() ); + // Add all to DOM document $this->dom->appendChild( $this->root ); + // Normalzise DOM document $this->dom->normalize(); + // Set everthing to commited. $this->isCommited = true; } @@ -207,8 +223,8 @@ * * @since 0.3.0 */ - public function getStyle() { - return $this->getStyles(); + public function getStyles() { + return $this->getStyle(); } /** @@ -217,7 +233,7 @@ * * @since 0.3.0 */ - public function getStyles() { + public function getStyle() { if ( !array_key_exists( "style", $this->DocumentObjects ) ) { $this->DocumentObjects[ "style" ] = new Style( $this->dom, $this->root ); } @@ -251,7 +267,10 @@ * @since 0.4.4 */ public function getSettings(){ - return $this->DocumentObjects[ "setting" ]; + if ( !array_key_exists( "settings", $this->DocumentObjects ) ) { + $this->DocumentObjects[ "settings" ] = new Settings( $this->dom, $this->root ); + } + return $this->DocumentObjects[ "settings" ]; } /** @@ -260,7 +279,24 @@ * * @since 0.4.4 */ + public function getScripts(){ + if ( !array_key_exists( "scripts", $this->DocumentObjects ) ) { + $this->DocumentObjects[ "scripts" ] = new Scripts( $this->dom, $this->root ); + } + return $this->DocumentObjects[ "scripts" ]; + } + + + /** + * + * @access public + * + * @since 0.4.4 + */ public function getAutomaticStyles(){ + if ( !array_key_exists( "automaticstyles", $this->DocumentObjects ) ) { + $this->DocumentObjects[ "automaticstyles" ] = new AutomaticStyles( $this->dom, $this->root ); + } return $this->DocumentObjects[ "automaticstyles" ]; } @@ -271,6 +307,9 @@ * @since 0.4.4 */ public function getMasterStyles(){ + if ( !array_key_exists( "masterstyles", $this->DocumentObjects ) ) { + $this->DocumentObjects[ "masterstyles" ] = new AutomaticStyles( $this->dom, $this->root ); + } return $this->DocumentObjects[ "masterstyles" ]; } Modified: poc/src/content/Content.php =================================================================== --- poc/src/content/Content.php 2006-03-20 09:43:58 UTC (rev 32) +++ poc/src/content/Content.php 2006-03-20 13:49:26 UTC (rev 33) @@ -66,71 +66,16 @@ /** * * @access public - * @depricated * - * @since 0.4.0 - */ - public function addNoScript() { - $this->root->appendChild( $this->dom->createElementNS( self::NS_OFFICE, "office:script" ) ); - } - - /** - * - * @depricated - * - * @access public - * - * @since 0.4.0 - */ - public function addFontFace( $name, $fontFamily, $genericFamily=0, $fontPitch=0, $fontCharset=0 ) { - $this->FontFaceDecl->addFontFaceOld( $name, $fontFamily, $genericFamily, $fontPitch, $fontCharset ); - } - - /** - * - * @access public - * * @since 0.4.2 */ public function getFontFaceDecl() { return $this->FontFaceDecl; } - /** - * - * @access public - * @depricated - * - * @since 0.4.0 - */ - public function addAutomaticStyles() { - - } /** * - * @access public - * @depricated - * - * @since 0.4.0 - */ - public function addNoAutomaticStyles() { - $this->root->appendChild( $this->dom->createElementNS( self::NS_OFFICE, "office:automatics-sytles" ) ); - } - - -/* - <text:sequence-decls> - <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> - <text:sequence-decl text:display-outline-level="0" text:name="Table"/> - <text:sequence-decl text:display-outline-level="0" text:name="Text"/> - <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> - </text:sequence-decls> - -*/ - - /** - * * @return * * @access public Modified: poc/src/samples/TestOutput.php =================================================================== --- poc/src/samples/TestOutput.php 2006-03-20 09:43:58 UTC (rev 32) +++ poc/src/samples/TestOutput.php 2006-03-20 13:49:26 UTC (rev 33) @@ -65,16 +65,17 @@ $text->addNoForms(); - $text->addToText( $text->getTextHeading( "Heading", "The first step" ) ); + $text->addToText( $text->getTextHeading( "Heading", 1, "The first step" ) ); $text->addToText( $text->getTextParagraph( "Paragraph", "This is a little test!" ) ); } - - function makeStyle( $style ) { + + function makeFontFaceDecl( $fontfacedecl ) { $styleAttr = array(); $styleAttr[ "font-family" ] ="Tahoma"; - $style->getFontFaceDecl()->addFontFace( "Test", $styleAttr ); - unset( $styleAttr ); - + $fontFaceDecl->addFontFace( "Test", $styleAttr ); + } + + function makeStyle( $style ) { // Set default style $style->addDefaultStyle( "paragraph" ); @@ -162,8 +163,7 @@ // Get a OpenDocument object from the factory: - if(isset($SingleDocument)) - { + if(isset($SingleDocument)) { $TestDoc = OpenDocumentFactory::createOpenDocument( self::DocumentName, self::PathToDocument, @@ -175,15 +175,14 @@ */ $this->makeMeta( $TestDoc->getMeta(), $creator, $title, "en-EN" ); + $this->makeFontFaceDecl( $TestDoc->getFontFaceDeclaration() ); $this->makeStyle( $TestDoc->getStyle() ); $this->makeContent( $TestDoc->getContent() ); echo $TestDoc->get(); //$TestDoc->save(); - } - - + } } } Added: poc/src/styles/FontFaceDeclSplitter.php =================================================================== --- poc/src/styles/FontFaceDeclSplitter.php (rev 0) +++ poc/src/styles/FontFaceDeclSplitter.php 2006-03-20 13:49:26 UTC (rev 33) @@ -0,0 +1,56 @@ +<?php +/** + * FontFaceDeclSplitter Class + * + * $Id$ + * + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf + * @author Norman Markgraf <nma...@us...> + * @version $Revision$ + * @package OpenDocument + * @subpackage styles + * @since 0.4.4 + */ +require_once( "OpenDocumentObjectAbstract.php" ); + +class FontFaceDeclSplitter extends OpenDocumentObjectAbstract { + private $FFD1; + private $FFD2; + /** + * + * @param DOMDocument $dom + * + * @access public + * + * @since 0.4.4 + */ + public function __construct( $f1, $f2 ) { + parent::__construct(); + + $this->FFD1 = $f1; + $this->FFD2 = $f2; + } + + /** + * + * @access public + * + * @since 0.4.4 + */ + public function addFontFace( $name, $styleAttr=0, $SVGAttr=0 ) { + $this->FFD1->addFontFace( $name, $styleAttr, $SVGAttr); + $this->FFD2->addFontFace( $name, $styleAttr, $SVGAttr); + } + + /** + * + * @access public + * + * @since 0.4.4 + */ + public function commit() { + $this->isCommited = true; + } + +} Property changes on: poc/src/styles/FontFaceDeclSplitter.php ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Modified: poc/src/styles/FontFaceDeclaration.php =================================================================== --- poc/src/styles/FontFaceDeclaration.php 2006-03-20 09:43:58 UTC (rev 32) +++ poc/src/styles/FontFaceDeclaration.php 2006-03-20 13:49:26 UTC (rev 33) @@ -20,44 +20,22 @@ * */ private $FontFaceDecl; - + /** * - */ - private $FontFaceDecl2; - - /** - * - */ - private $dom2; - - /** - * - */ - private $useDom2; - - /** - * * @param DOMDocument $dom * * @access public * * @since 0.4.2 */ - public function __construct( $dom, $root=0, $dom2=0 ) { + public function __construct( $dom, $root=0) { parent::__construct(); $this->dom = $dom; - $this->dom2 = $dom2; $this->useDom2 = false; $this->FontFaceDecl = $this->dom->createElementNS( self::NS_OFFICE, "office:font-face-decls" ); - - if (!empty($dom2)) { - // Package Document with two DOM documents, $dom <-> content.xml $dom2 <-> styles.xml - $this->FontFaceDecl2 = $this->dom2->createElementNS( self::NS_OFFICE, "office:font-face-decls" ); - $this->useDom2 = true; - } } /** @@ -138,18 +116,11 @@ public function addFontFace( $name, $styleAttr=0, $SVGAttr=0 ) { $font = $this->dom->createElementNS( self::NS_STYLE, "style:font-face" ); $font->setAttributeNS( self::NS_STYLE, "style:name", $name ); - if ($this->useDom2) { - $font2 = $this->dom2->createElementNS( self::NS_STYLE, "style:font-face" ); - $font2->setAttributeNS( self::NS_STYLE, "style:name", $name ); - } if (!empty($styleAttr)) { foreach( $styleAttr as $key => $value ) { // ***FIX ME*** Here we should check if the keys are possible if ($this->checkStyle($key, $value)) { $font->setAttributeNS( self::NS_STYLE, "style:".$key, $value ); - if ($this->useDom2) { - $font2->setAttributeNS( self::NS_STYLE, "style:".$key, $value ); - } } } } @@ -158,17 +129,10 @@ // ***FIX ME*** Here we should check if the keys are possible if ($this->checkSVG( $key, $value )) { $font->setAttributeNS( self::NS_SVG, "svg:".$key, $value ); - if ($this->useDom2) { - $font2->setAttributeNS( self::NS_SVG, "svg:".$key, $value ); - } } } } $this->FontFaceDecl->appendChild( $font ); - if ($this->useDom2) { - $this->FontFaceDecl2->appendChild( $font2 ); - unset( $font2 ); - } unset( $font ); } @@ -218,21 +182,5 @@ return $this->FontFaceDecl; } - /** - * - * @return DOMDocument - * - * @access public - * @final - * - * @since 0.4.4 - */ - final public function get2() { - if (!$this->isCommited) { - $this->commit(); - } - return $this->FontFaceDecl; - } - } ?> \ No newline at end of file Modified: poc/src/styles/Styles.php =================================================================== --- poc/src/styles/Styles.php 2006-03-20 09:43:58 UTC (rev 32) +++ poc/src/styles/Styles.php 2006-03-20 13:49:26 UTC (rev 33) @@ -47,7 +47,7 @@ $this->root->setAttributeNS( self::NS_OFFICE, "office:version", "1.0" ); $this->styles = $this->dom; - $this->FontFaceDecl = new FontFaceDecl( $this->dom, $this->root ); + $this->FontFaceDecl = new FontFaceDeclaration( $this->dom, $this->root ); $this->Style = new Style( $this->dom, $this->root ); $this->AutomaticStyles = new AutomaticStyles( $this->dom, $this->root ); $this->MasterStyles = new MasterStyles( $this->dom, $this->root ); @@ -66,30 +66,45 @@ unset( $this->root ); unset( $this->style ); } + + /** + * + * @access public + * + * @since 0.4.2 + */ + public function getFontFaceDecl() { + return $this->FontFaceDecl; + } - + /** + * + * @access public + * + * @since 0.4.4 + */ + public function getStyle() { + return $this->Style; + } /** * - * @depricated * @access public * - * @since 0.4.0 + * @since 0.4.4 */ - public function addFontFace( $name, $fontFamily, $genericFamily=0, $fontPitch=0, $fontCharset=0 ) { - $this->FontFaceDecl->addFontFaceOld( $name, $fontFamily, $genericFamily, $fontPitch, $fontCharset ); + public function getAutomaticStyles() { + return $this->AutomaticStyles; } - /** * - * @depricated * @access public * - * @since 0.4.2 + * @since 0.4.4 */ - public function getFontFaceDecl() { - return $this->FontFaceDecl; + public function getMasterStyles() { + return $this->MasterStyles; } /** @@ -104,7 +119,7 @@ $this->root->appendChild( $this->AutomaticStyles->get() ); $this->root->appendChild( $this->MasterStyles->get() ); - $this->style->appendChild( $this->root ); + $this->styles->appendChild( $this->root ); $this->dom->normalize(); $this->isCommited = true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |