$versions['win-ins'] = array('title' => __('Version offline') . ' - ' . __('Installeur Auto-executable Windows'), 'icon' => cubeMedia::silk('application_view_tile.png'));\r
$versions['mac-exe'] = array('title' => __('Version offline') . ' - ' . __('Exécutable Mac OS X'), 'icon' => cubeMedia::image(IMG . '/macos.png'));\r
$versions['win-cd'] = array('title' => __('Version offline') . ' - ' . __('CD-ROM') . ' / ' . __('Clé USB'), 'icon' => cubeMedia::silk('cd.png'));\r
+ if (wsDroits::admin()) {\r
+ $versions['html5'] = array('title' => __('Version HTML5 (α)'), 'icon' => cubeMedia::silk('page_white_world.png'));\r
+ }\r
\r
$res = '<div class="contextMenu downbookContextMenu" id="' . $id . '">';\r
$res .= '<ul>';\r
global $core;\r
commonDroits::min(5);\r
\r
- $dao=new wsDAODocument($core->con);\r
+ $dao = new wsDAODocument($core->con);\r
header('Content-type: text/plain');\r
ob_clean();\r
echo $dao->putLinksFromCSV($args[1]);\r
--- /dev/null
+<?php\r
+class wsPackagerHTML5 extends wsPackager {\r
+ protected $layouts = array();\r
+\r
+ protected $cssSize = array();\r
+ protected $cssColor = array();\r
+ protected $cssOpacity = array();\r
+ protected $cssFont = array();\r
+\r
+ protected $div = array();\r
+ protected $css = array();\r
+\r
+ public function __construct($book_id)\r
+ {\r
+ parent::__construct($book_id);\r
+ $this->version = 'html5';\r
+ }\r
+\r
+ protected function preparePackage()\r
+ {\r
+ parent::preparePackage();\r
+\r
+ foreach($this->pages as $page => $infos) {\r
+ fb($infos);\r
+ $file = WS_DOCS . '/' . $infos['document_id'] . '/html/' . $infos['document_page'] . '.obj';\r
+ fb($file);\r
+ if (file_exists($file)) {\r
+ $this->layouts[$page] = unserialize(file_get_contents($file));\r
+ }\r
+ }\r
+\r
+ $this->createHTML();\r
+ }\r
+\r
+ protected function createHTML()\r
+ {\r
+ foreach($this->layouts as $page => $infos) {\r
+ $this->div[$page] = array();\r
+ foreach($infos->tags as $tag) {\r
+ if ($tag instanceof wsSWF2HTMLFont) {\r
+ $this->addFont($tag, $infos);\r
+ } else if ($tag instanceof wsSWF2HTMLParagraph) {\r
+ $this->addParagraph($tag, $this->div[$page]);\r
+ }\r
+ }\r
+ }\r
+ file_put_contents($this->vdir . 'style.css', implode("\n", $this->css));\r
+ foreach($this->div as $n => $page) {\r
+ file_put_contents($this->vdir . 'p' . $n . '.html', $this->writePage($page));\r
+ }\r
+ }\r
+\r
+ protected function writePage($page)\r
+ {\r
+ $res = '';\r
+ foreach($page as $div) {\r
+ $res .= $this->writeDiv($div);\r
+ }\r
+ return $res;\r
+ }\r
+\r
+ protected function writeDiv($div)\r
+ {\r
+ $res = '<div style="left:' . $div['left'] . 'px;top:' . $div['top'] . 'px;">';\r
+ foreach($div['span'] as $span) {\r
+ $res .= $this->writeSpan($span);\r
+ }\r
+ $res .= '</div>';\r
+ return $res;\r
+ }\r
+\r
+ protected function writeSpan($span)\r
+ {\r
+ $res = '<span ';\r
+ $res .= 'style="left:' . $span['left'] . 'px;top:' . $span['top'] . '" ';\r
+ $res .= 'class="c' . $span['color'] . ' s' . $span['size'] . ' f' . $span['font'] . '"';\r
+ $res .= '>';\r
+ $res .= htmlentities($span['text']);\r
+ $res .= '</span>';\r
+ return $res;\r
+ }\r
+\r
+ protected function addFont($tag)\r
+ {\r
+ }\r
+\r
+ protected function addParagraph($tag, $div)\r
+ {\r
+ $d = array('span' => array(), 'left' => $tag->left, 'right' => $tag->right);\r
+ foreach($tag->textes as $text) {\r
+ $d['span'][] = $this->addText($text);\r
+ }\r
+ $div[] = $d;\r
+ }\r
+\r
+ protected function addCSSText($text)\r
+ {\r
+ return array('text' => $text->text,\r
+ 'color' => $this->getCSSColor($text->color),\r
+ 'size' => $this->getCSSSize($text->size),\r
+ 'font' => $this->getCSSFont($text->font),\r
+ 'left' => $text->left,\r
+ 'right' => $text->right);\r
+ }\r
+\r
+ protected function getCSSSize($size)\r
+ {\r
+ return $this->getIndex($size, $this->cssSize);\r
+ }\r
+\r
+ protected function getCSSFont($font, $page)\r
+ {\r
+ $fontname = $page->fonts[$font]->name;\r
+ return $this->getIndex($fontname, $this->cssFont);\r
+ }\r
+\r
+ protected function getCSSColor($color)\r
+ {\r
+ return $this->getIndex($color, $this->cssColor);\r
+ }\r
+\r
+ protected function getIndex($value, $tab)\r
+ {\r
+ if (isset($tab[$value])) {\r
+ return $tab[$value];\r
+ }\r
+ $res = count($tab);\r
+ $tab[$value] = $res;\r
+ return $res;\r
+ }\r
+\r
+ public function __destruct(){\r
+\r
+ }\r
+}\r
+\r
+?>
\ No newline at end of file