|
From: <yaw...@us...> - 2006-03-18 22:12:44
|
Revision: 29 Author: yawnster Date: 2006-03-18 14:12:38 -0800 (Sat, 18 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=29&view=rev Log Message: ----------- Removing extra file that isn't used anymore. Removed Paths: ------------- poc/src/OpenDocumentOutput.php Deleted: poc/src/OpenDocumentOutput.php =================================================================== --- poc/src/OpenDocumentOutput.php 2006-03-16 08:08:09 UTC (rev 28) +++ poc/src/OpenDocumentOutput.php 2006-03-18 22:12:38 UTC (rev 29) @@ -1,194 +0,0 @@ -<?php -/** - * SampleClass produces a little OpenDocument and send it to the client - * - * $Id$ - * - * @copyright GNU General Public License - * @author Norman Markgraf <nma...@us...> - * @author Alex Latchford <yaw...@us...> - * @version $Revision$ - * @package OpenDocument - * @since 0.4.2 - */ - -ini_set( "include_path", ini_get( "include_path" ). ";..\\" ); - -require_once( "OpenDocumentFactory.php" ); -require_once( "Log/observer.php" ); -require_once( "samples/TestTranslate.php" ); - -class OpenDocumentOutput { - - const DocumentName = "test.odt"; - - const PathToDocument = "D:/PHP/OpenDocument/"; - - private $logger; - private $content_matches = array(); - - function __construct() { - $conf = array( "mode" => 0600 ); - $this->logger = &Log::factory( "file", "D:/PHP/OpenDocument.log", "OpenDocument", $conf ); - $this->logger = &Log::factory( "console", "", "OpenDocument" ); - - $this->testtranslate = new TestTranslate; - } - - function makeMeta( $meta, $creator="Norman Markgraf", $title="This is a test!", $language="en-EN" ) { - $meta->addDublinCore( "title", $title ); - $meta->addDublinCore( "creator", $creator ); - $meta->addDublinCore( "language", "en-EN" ); - $meta->addDublinCore( "date", date("Y-m-d\TH:i:s") ); - $meta->addGenerator( "" ); - $meta->addInitialCreator( $creator ); - $meta->addCreationDate(); - } - - function makeContent( $content, $document_content ) { - $content->addNoScript(); - - $content->addFontFace( "Test", "Tahoma" ); - - $content->addNoAutomaticStyles(); - - $text = $content->getBody()->getText(); - - $text->addNoForms(); - - $content_matches['paragraphs'] = $this->testtranslate->getParagraphs($document_content); - $content_matches['headings'] = $this->testtranslate->getHeadings($document_content); - - foreach($content_matches['paragraphs'] as $paragraph) { - $text->addToText( $text->getTextParagraph( "Paragraph", $paragraph ) ); - } - - foreach($content_matches['headings'] as $heading) { - $text->addToText( $text->getTextHeading( "Heading", $heading ) ); - } - } - - function makeStyle( $style ) { - $NS_STYLE = "urn:oasis:names:tc:opendocument:xmlns:style:1.0"; - $NS_FO = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compartible:1.0"; - - $style->addFontFace( "Test", "Tahoma" ); - - // Set default style - $defStyle = $style->getDefaultStyle( "paragraph" ); - - $defProp = $style->getDom()->createElementNS( $NS_STYLE, "style:paragraph-properties" ); - $defProp->setAttributeNS( $NS_FO, "fo:hypenation-ladder-count", "no-limit" ); - $defProp->setAttributeNS( $NS_STYLE, "style:text-autospace", "ideograph-alpha" ); - $defProp->setAttributeNS( $NS_STYLE, "style:punctuation-wrap", "hanging" ); - $defProp->setAttributeNS( $NS_STYLE, "style:line-break", "strict" ); - $defProp->setAttributeNS( $NS_STYLE, "style:tab-stop-distance", "1.251cm" ); - $defProp->setAttributeNS( $NS_STYLE, "style:writeing-mode", "page" ); - $defStyle->appendChild( $defProp ); - - $defProp = $style->getDom()->createElementNS( $NS_STYLE, "style:text-properties" ); - $defProp->setAttributeNS( $NS_FO, "fo:font-size", "12pt" ); - $defProp->setAttributeNS( $NS_FO, "fo:language", "de" ); - $defProp->setAttributeNS( $NS_FO, "fo:country", "DE" ); - $defProp->setAttributeNS( $NS_FO, "fo:hyphenate", "false" ); - $defProp->setAttributeNS( $NS_FO, "fo:hypenation-remain-char-count", "2" ); - $defProp->setAttributeNS( $NS_FO, "fo:hypenation-push-char-count", "2" ); - $defProp->setAttributeNS( $NS_STYLE, "style:use-window-font-color", "true" ); - $defProp->setAttributeNS( $NS_STYLE, "style:font-name", "Times New Roman" ); - $defProp->setAttributeNS( $NS_STYLE, "style:font-name-asian", "Arial Unicode MS" ); - $defProp->setAttributeNS( $NS_STYLE, "style:font-size-asian", "12pt" ); - $defProp->setAttributeNS( $NS_STYLE, "style:language-asian", "none" ); - $defProp->setAttributeNS( $NS_STYLE, "style:country-asian", "none" ); - $defProp->setAttributeNS( $NS_STYLE, "style:font-name-complex", "Tahoma" ); - $defProp->setAttributeNS( $NS_STYLE, "style:font-site-complex", "12pt" ); - $defProp->setAttributeNS( $NS_STYLE, "style:language-complex", "none" ); - $defProp->setAttributeNS( $NS_STYLE, "style:country-complex", "none" ); - $defStyle->appendChild( $defProp ); - - $style->addDefaultStyle( $defStyle ); - - //Set a style - $aStyle = $style->getStyle( "Paragraph" ); - $aStyle->setAttributeNS ( $NS_STYLE, "style:family", "paragraph" ); - $aStyle->setAttributeNS ( $NS_STYLE, "style:class", "text" ); - - $style->addStyle( $aStyle, "Paragraph" ); - - //Set a style - $aStyle = $style->getStyle( "Heading" ); - $aStyle->setAttributeNS ( $NS_STYLE, "style:family", "paragraph" ); - $aStyle->setAttributeNS ( $NS_STYLE, "style:class", "text" ); - - $aStyleProp = $style->getDom()->createElementNS( $NS_STYLE, "style:paragraph-properties" ); - $aStyleProp->setAttributeNS ( $NS_FO, "fo:margin-top", "0.423cm" ); - $aStyleProp->setAttributeNS ( $NS_FO, "fo:margin-bottom", "0.212cm" ); - $aStyleProp->setAttributeNS ( $NS_FO, "fo:keep-with-next", "always" ); - $aStyle->appendChild( $aStyleProp ); - - $aStyleProp = $style->getDom()->createElementNS( $NS_STYLE, "style:text-properties" ); - $aStyleProp->setAttributeNS ( $NS_FO, "fo:font-size", "20pt" ); - $aStyleProp->setAttributeNS ( $NS_STYLE, "style:font-name", "Arial" ); - $aStyleProp->setAttributeNS ( $NS_STYLE, "style:font-name-asian", "MS Mincho" ); - $aStyleProp->setAttributeNS ( $NS_STYLE, "style:font-size-asian", "20pt" ); - $aStyleProp->setAttributeNS ( $NS_STYLE, "style:font-name-complex", "Tahoma1" ); - $aStyleProp->setAttributeNS ( $NS_STYLE, "style:font-size-complex", "20pt" ); - $aStyle->appendChild( $aStyleProp ); - - $style->addStyle( $aStyle, "Paragraph" ); - } - - function run($post) { - if (!function_exists('gzencode')) { - $out = "<p>You have to enable zlib at compile time of your PHP! "; - $out .= "use <emph>--with-zlib=[DIR]</emph> at the <emph>configure</emph> "; - $out .= "procedure</p>"; - echo $out; - return; - } - - $SingleDocument = ($post["SingleDocument"] == "true"); - $creator = $post["Creator"]; - $title = $post["Title"]; - $document_content = $post["Content"]; - - header( "Content-type: application/odt" ); - header( "Content-Disposition: attachment; filename=".self::DocumentName ); - header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 - header( "Cache-Control: post-check=0, pre-check=0", false ); - header( "Pragma: no-cache" ); - - // Get a OpenDocument object from the factory: - - if(isset($SingleDocument)) - { - $TestDoc = OpenDocumentFactory::createOpenDocument( - self::DocumentName, - self::PathToDocument, - $SingleDocument - ); - - /* - $TestDoc->attachObserverToLogger( $this->logger ); - */ - - $this->makeMeta( $TestDoc->getMeta(), $creator, $title, "en-EN" ); - $this->makeStyle( $TestDoc->getStyle() ); - $this->makeContent( $TestDoc->getContent(), $document_content ); - - echo $TestDoc->get(); - - //$TestDoc->save(); - } - - - } -} - -if(isset($_POST['SingleDocument'])) -{ - $TestOutput = new OpenDocumentOutput(); - $TestOutput->run($_POST); -} - -// Do TestInput again ... -?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |