]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 27 Jan 2012 18:44:16 +0000 (18:44 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 27 Jan 2012 18:44:16 +0000 (18:44 +0000)
.htaccess
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/packager/class.ws.packager.html.php
inc/ws/Util/packager/class.ws.packager.php
inc/ws/Util/packager/class.ws.packager.v1.php
inc/ws/prepend.php

index 5f9dff0ad88b7c84f054dd0ccf3adbc6c845cb51..004b8e3c1434e9953d89b022f8cefe2afac0e683 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -40,6 +40,10 @@ AddCharset UTF-8 log
        RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/fluidbook.js$ fluidbook/compile/fluidbook.js [L]\r
        RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/final/$1/$4 [L]\r
 \r
+       RewriteRule ^viewer1/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ viewer1/$1_$2_$3/index [L]\r
+       RewriteRule ^viewer1/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/fluidbook.js$ fluidbook/compile/fluidbook.js [L]\r
+       RewriteRule ^viewer1/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/finalv1/$1/$4 [L]\r
+\r
        RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ vieweru/$1_$2_$3/index [L]\r
        RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/_unprotected/index.swf [L]\r
        RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/_unprotected/player.swf [L]\r
index 6bd3efdb635b29dc3aa049586f6490b060ab88f3..ac06a442d591e5b244720a6e743a1aa5cae36f69 100644 (file)
@@ -41,7 +41,7 @@ class wsAjax extends cubeAjax {
                        $data['code_postal'] = $entreprise->code_postal;\r
                        $data['ville'] = $entreprise->ville;\r
                        $data['pays'] = $entreprise->pays;\r
-                       $data['site']=$entreprise->site;\r
+                       $data['site'] = $entreprise->site;\r
                        $data['grade'] = 0;\r
                        $daoClient = new commonDAOClient($core->con);\r
                        try {\r
@@ -206,6 +206,16 @@ class wsAjax extends cubeAjax {
                        $book = $dao->setStatus($book_id, 1);\r
                }\r
 \r
+               if ($version == 'v2') {\r
+                       $version = 'html';\r
+               } else if ($version == 'online') {\r
+                       if ($book->parametres->version == '1') {\r
+                               $version = 'v1';\r
+                       } elseif ($book->parametres->version == '2') {\r
+                               $version = 'html';\r
+                       }\r
+               }\r
+\r
                if (!wsDroits::admin()) {\r
                        if ($book->status < 1) {\r
                                $popup = commonAjax::form('downbook/' . $book_id . '/' . $version, __('Téléchargement du Fluidbook'), wsUrl::valideDownload($book_id, $version), __('Télécharger'), 2, '', '', true);\r
@@ -411,7 +421,7 @@ class wsAjax extends cubeAjax {
                        $datas['code_postal'] = $_POST['code_postal'];\r
                        $datas['ville'] = $_POST['ville'];\r
                        $datas['pays'] = $_POST['pays'];\r
-                       $datas['site']=$_POST['site'];\r
+                       $datas['site'] = $_POST['site'];\r
                        if ($_POST['rs'] == '') {\r
                                $datas['nom'] = $_POST['prenom'] . ' ' . $_POST['nom'];\r
                        } else {\r
index abe198ad78cd5af348405df5652ac28f8c0b71e7..96a073ff29d5cf2d63955b6353a12415bb3d1f50 100644 (file)
@@ -163,10 +163,19 @@ class wsUrl {
        public static function contextBookDownload($id, $droits) {\r
                global $core;\r
 \r
+               $chooseVersion = wsDroits::admin();\r
+\r
+               if ($chooseVersion) {\r
+                       $default = ' (' . __('Default') . ')';\r
+               } else {\r
+                       $default = '';\r
+               }\r
+\r
                $versions = array();\r
-               $versions['html'] = array('title' => __('Version online'), 'icon' => cubeMedia::silk('page_world.png'));\r
-               if (wsDroits::admin()) {\r
+               $versions['online'] = array('title' => __('Version online') . $default, 'icon' => cubeMedia::silk('page_world.png'));\r
+               if ($chooseVersion) {\r
                        $versions['v1'] = array('title' => __('Version online') . ' - V1', 'icon' => cubeMedia::silk('page_white_world.png'));\r
+                       $versions['v2'] = array('title' => __('Version online') . ' - V2', 'icon' => cubeMedia::silk('page_white_world.png'));\r
                }\r
                $versions['win-exe'] = array('title' => __('Version offline') . ' - ' . __('Executable Windows'), 'icon' => cubeMedia::silk('application_view_tile.png'));\r
                $versions['win-ins'] = array('title' => __('Version offline') . ' - ' . __('Installeur Auto-executable Windows'), 'icon' => cubeMedia::silk('application_view_tile.png'));\r
@@ -220,9 +229,11 @@ class wsUrl {
 \r
                if (wsDroits::admin()) {\r
                        $viewers = array('viewer' => array('title' => __('Version Flash'), 'icon' => cubeMedia::image(IMG . '/flash.png')),\r
-                               'viewerh' => array('title' => __('Version HTML5'), 'icon' => cubeMedia::image(IMG . '/html5.png')),\r
-                               'vieweru' => array('title' => __('Version Flash') . ' (' . __('debuggage') . ')', 'icon' => cubeMedia::image(IMG . '/flashbug.png')),\r
-                               'viewerhu' => array('title' => __('Version HTML5') . ' (' . __('debuggage') . ')', 'icon' => cubeMedia::image(IMG . '/html5bug.png')));\r
+                       'viewerh' => array('title' => __('Version HTML5'), 'icon' => cubeMedia::image(IMG . '/html5.png')),\r
+                       'vieweru' => array('title' => __('Version Flash') . ' (' . __('debuggage') . ')', 'icon' => cubeMedia::image(IMG . '/flashbug.png')),\r
+                       'viewerhu' => array('title' => __('Version HTML5') . ' (' . __('debuggage') . ')', 'icon' => cubeMedia::image(IMG . '/html5bug.png')),\r
+                       'viewer1' => array('title' => __('Version 1'), 'icon' => cubeMedia::image(IMG . '/flash.png'))\r
+                       );\r
                }\r
 \r
                $res = '<div class="contextMenu viewbookContextMenu" id="' . $id . '">';\r
@@ -681,6 +692,26 @@ html{height:100%}' . "\n";
                exit;\r
        }\r
 \r
+       public static function viewer1($args) {\r
+               $args = cubePage::getArgs($args);\r
+\r
+               $wmode = isset($args[1]) ? $args[1] : '';\r
+\r
+               $e = explode('_', $args[0]);\r
+               $newurl = null;\r
+               if (count($e) == 2 || $e[2] < TIME - 10) {\r
+                       $e[2] = TIME;\r
+                       http::redirect(SITE_PATH . 'viewer1/' . implode('_', $e) . '/' . $wmode);\r
+                       exit;\r
+               }\r
+\r
+               $book_id = $e[0];\r
+\r
+               $wmode = $wmode != '' ? $wmode : 'default';\r
+\r
+               echo self::commonViewer($book_id, $e[1], false, $wmode, $newurl, '1');\r
+       }\r
+\r
        public static function viewer($args) {\r
                $args = cubePage::getArgs($args);\r
 \r
@@ -704,7 +735,7 @@ html{height:100%}' . "\n";
                echo self::commonViewer($book_id, $e[1], false, $wmode, $newurl);\r
        }\r
 \r
-       public static function commonViewer($book_id, $hash, $standalone = false, $wmode = 'default', $fps = false) {\r
+       public static function commonViewer($book_id, $hash, $standalone = false, $wmode = 'default', $fps = false, $version = 2) {\r
                if (!defined('MINIMIZE_JS')) {\r
                        define('MINIMIZE_JS', false);\r
                }\r
@@ -722,6 +753,12 @@ html{height:100%}' . "\n";
                global $meta;\r
                global $jsvar;\r
 \r
+               if ($version == 2) {\r
+                       $flashVersion = '10.0.22';\r
+               } else {\r
+                       $flashVersion = '8';\r
+               }\r
+\r
                cubePage::swfobject(2);\r
 \r
                $dao = new wsDAOBook($core->con);\r
@@ -783,7 +820,7 @@ html{height:100%}' . "\n";
                $res.='} else if(isBadMobile()) {' . "\n";\r
                $res.="\t" . $redirectPDF . "\n";\r
                $res.='} else {' . "\n";\r
-               $res .= "\t" . 'swfobject.embedSWF("index.swf", "fluidbook", "100%", "100%", "10.0.22",';\r
+               $res .= "\t" . 'swfobject.embedSWF("index.swf", "fluidbook", "100%", "100%", "' . $flashVersion . '",';\r
                $res .= '"", ' . json_encode($fv) . ',';\r
                $res .= '{"allowScriptAccess":"always","quality":"high","scale":"noscale","wmode":getWmode(),"allowFullScreen":"true"},{"bgcolor":"#' . $theme->parametres->loadingBackColor . '"}';\r
                $res .= ');' . "\n";\r
index 9d66d59e0f1533a8beac025acee6cc75d3863faf..29493c3ab04c5ec05ee2985dd3b0f1b1f7a0024c 100644 (file)
@@ -698,12 +698,23 @@ class wsDAOBook extends commonDAO {
        }\r
 \r
        public function compile($book_id, $version = 3, $complete = false) {\r
-               if ($version == 3) {\r
-                       return $this->compile3($book_id, $complete);\r
-               }\r
+\r
+               $this->compile3($book_id, $complete);\r
+               $this->compile1($book_id);\r
+\r
                $this->touchCompile($book_id);\r
        }\r
 \r
+       public function compile1($book_id) {\r
+               $finalDir = WS_BOOKS . '/finalv1/' . $book_id . '/';\r
+               $packager = new wsPackagerV1($book_id, $finalDir, false);\r
+               $packager->makePackage(false);\r
+               \r
+               mkdir($finalDir,0777,true);\r
+               \r
+               fb('compile1');\r
+       }\r
+\r
        public function compile3($book_id, $complete) {\r
                $res = '';\r
 \r
@@ -896,8 +907,8 @@ class wsDAOBook extends commonDAO {
                $flexLight->addVariable('fwidth', round($size[0], 4), false, true, 'Number');\r
                $flexLight->addVariable('fheight', round($size[1], 4), false, true, 'Number');\r
                $flexLight->addVariable('pagesInDatas', $complete, false, true, 'Boolean');\r
-               $flex->addVariable('index', $index, false, true, 'JSONObject', false,false);\r
-               $flex->addVariable('textes', $textes, false, true, 'JSONObject', false,false);\r
+               $flex->addVariable('index', $index, false, true, 'JSONObject', false, false);\r
+               $flex->addVariable('textes', $textes, false, true, 'JSONObject', false, false);\r
 \r
                $rasterized = array();\r
                $sizes = array();\r
index b389d75527d12262b671250123e26fed54904ec6..3f48865746a3d57ca94de4dab816c093a785525c 100644 (file)
@@ -16,11 +16,12 @@ class wsBookParametres extends wsParametres {
                if (is_null($this->parent)) {\r
                        return;\r
                }\r
+               $this->fields['version'] = array('type' => 'combo', 'default' => '2', 'editable' => true, 'label' => __('Version'), 'datas' => array('1' => '1', '2' => '2'), 'grade' => 3);\r
                $this->fields['title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre de la publication"));\r
                $this->fields['url_link'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __("URL du lien de retour au site"));\r
                $this->fields['signature'] = array('type' => 'combo', 'default' => '1', 'editable' => true, 'label' => __('Signature'), 'grade' => 3, 'datas' => wsDroits::getSignatures());\r
                $this->forms['important'] = array('label' => __('Description de la publication'),\r
-                       'fieldsnames' => array('title', 'url_link', 'signature'));\r
+                       'fieldsnames' => array('version', 'title', 'url_link', 'signature'));\r
                // .\r
                // .\r
                $this->fields['friend'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Envoyer à un ami'));\r
@@ -217,6 +218,12 @@ class wsBookParametres extends wsParametres {
                $this->fields['widgetEnd'] = array('type' => 'integer', 'default' => 8, 'editable' => true, 'label' => __('Page de fin'), 'grade' => 3);\r
                $this->forms['widget'] = array('label' => __('Widget') . ' (' . __('Mini Fluidbook') . ')',\r
                        'fieldsnames' => array('widget', 'widgetCover', 'widgetSize', 'widgetQuality', 'widgetStart', 'widgetEnd'));\r
+\r
+               $this->fields['extras'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Extras'), 'grade' => 5);\r
+               $this->fields['v1SWF'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
+                       'label' => __('Index.swf spécifique'), 'grade' => 5, 'fileFilter' => $swfFilter);\r
+               $this->forms['v1'] = array('label' => __('Options spécifiques au fluidbook version 1'),\r
+                       'fieldsnames' => array('extras', 'v1SWF'));\r
        }\r
 \r
 }\r
index 63a26b99c522871729cac2a130968715961d2f3b..c4623b4ca46d5545b1c024c7f594af546ddc3fc8 100644 (file)
@@ -4,8 +4,8 @@ class wsPackagerHTML extends wsPackager {
 \r
        protected $origHTML;\r
 \r
-       public function __construct($book_id) {\r
-               parent::__construct($book_id);\r
+       public function __construct($book_id, $vdir, $whole) {\r
+               parent::__construct($book_id, $vdir, $whole);\r
                $this->version = 'html';\r
        }\r
 \r
@@ -152,6 +152,9 @@ class wsPackagerHTML extends wsPackager {
        }\r
 \r
        public function prepareHTML5() {\r
+               if (!$this->whole) {\r
+                       return;\r
+               }\r
                $dest = $this->vdir . 'm';\r
                mkdir($dest, 0777, true);\r
 \r
index e6a15a508053585539d571c29092470886ca0219..9cccaa660dead386b27bd38f68f44d5cd3a2579d 100644 (file)
@@ -13,6 +13,7 @@ class wsPackager {
        protected $daoBook;\r
        protected $zip;\r
        protected $workingDir;\r
+       protected $whole = true;\r
 \r
        public static function package($book_id, $version, $zip = true) {\r
                global $packager;\r
@@ -35,12 +36,14 @@ class wsPackager {
                return $packager->makePackage($zip);\r
        }\r
 \r
-       public function __construct($book_id) {\r
+       public function __construct($book_id, $vdir = null, $whole = true) {\r
                global $core;\r
 \r
                $this->book_id = $book_id;\r
 \r
+               $this->vdir = $vdir;\r
                $this->dir = WS_SHM . '/packager/' . $book_id . '/';\r
+               $this->whole = $whole;\r
 \r
                if (!file_exists($this->dir)) {\r
                        mkdir($this->dir, 0777, true);\r
@@ -135,6 +138,9 @@ class wsPackager {
        }\r
 \r
        protected function zip($zipfile = null) {\r
+               if (!$this->whole) {\r
+                       return;\r
+               }\r
                $url = $this->getURLBase('zip');\r
                $final = $this->getPathBase('zip');\r
                $rename = false;\r
@@ -161,7 +167,10 @@ class wsPackager {
        }\r
 \r
        protected function initTempDir() {\r
-               $this->vdir = $this->dir . $this->version . '/';\r
+               if (is_null($this->vdir)) {\r
+                       $this->vdir = $this->dir . $this->version . '/';\r
+               }\r
+               fb($this->vdir);\r
                $this->cleanVdir();\r
                mkdir($this->vdir . '/data', 0777, true);\r
        }\r
@@ -191,7 +200,9 @@ class wsPackager {
        }\r
 \r
        public function __destruct() {\r
-               $this->cleanVdir();\r
+               if ($this->whole) {\r
+                       $this->cleanVdir();\r
+               }\r
        }\r
 \r
 }\r
index 14fc7211281da644bd929049a0bc5f554179e432..4f0d7c839e6d013be0ece54c4c40c27a5b5764d2 100644 (file)
@@ -2,8 +2,8 @@
 
 class wsPackagerV1 extends wsPackagerHTML {
 
-       public function __construct($book_id) {
-               parent::__construct($book_id);
+       public function __construct($book_id,$vdir,$whole) {
+               parent::__construct($book_id,$vdir,$whole);
                $this->version = 'v1';
        }
 
@@ -87,8 +87,8 @@ class wsPackagerV1 extends wsPackagerHTML {
                        }
 
                        $one->addChild('page', $link['page']);
-                       $one->addChild('linkTo', $link['to']);
                        $one->addChild('linkType', $link['type']);
+                       $one->addChild('linkTo', $link['to']);
                        $one->addChild('startX', $link['left']);
                        $one->addChild('endX', $link['left'] + $link['width']);
                        $one->addChild('startY', $link['top']);
@@ -249,7 +249,7 @@ class wsPackagerV1 extends wsPackagerHTML {
                $n = explode(',', $this->book->numerotation);
                $keys = array_keys($n, $page);
                if (count($keys)) {
-                       return $keys[0];
+                       return $keys[0]+1;
                }
                return $default;
        }
index 2df598ad69ba2b4fc34d0723788fcccecc3c8524..0e6ea5844903dcaa471cb4e244d4ade521a5da25 100644 (file)
@@ -6,6 +6,7 @@ $core->url->register('maintenance', 'maintenance', '^maintenance(.*)$', array('w
 $core->url->register('editor', 'editor', '^editor/(.*)$', array('wsUrl', 'editor'));
 $core->url->register('restoreLinks', 'restoreLinks', '^restoreLinks/(.*)$', array('wsUrl', 'restoreLinks'));
 $core->url->register('viewer', 'viewer', '^viewer/(.*)$', array('wsUrl', 'viewer'));
+$core->url->register('viewer1', 'viewer1', '^viewer1/(.*)$', array('wsUrl', 'viewer1'));
 $core->url->register('vieweru', 'vieweru', '^vieweru/(.*)$', array('wsUrl', 'vieweru'));
 $core->url->register('viewerp', 'viewerp', '^viewerp/(.*)$', array('wsUrl', 'viewerp'));
 $core->url->register('viewerh', 'viewerh', '^viewerh/(.*)$', array('wsUrl', 'viewerh'));