]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 9 Aug 2011 17:21:41 +0000 (17:21 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 9 Aug 2011 17:21:41 +0000 (17:21 +0000)
inc/ws/Controlleur/class.ws.conversion.session.php
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Metier/class.ws.document.php

index 6334b94fd12144a78731bb48cce4dbb5920bb810..c68f68a5a51d78a1939be7389b7fc616c0a2a845 100644 (file)
@@ -1,6 +1,7 @@
 <?php\r
 \r
 class wsConversionSession {\r
+\r
        protected $documentsId = array();\r
        protected $documentsPages = array();\r
        protected $documents = array();\r
@@ -18,62 +19,53 @@ class wsConversionSession {
        protected $processedDoc = 0;\r
        protected $bookId = null;\r
        public $reload = false;\r
-\r
        protected $nb_threads = 8;\r
        protected $threads;\r
 \r
-       public function __construct($guid)\r
-       {\r
+       public function __construct($guid) {\r
                $this->guid = $guid;\r
        }\r
 \r
-       public function getGUID()\r
-       {\r
+       public function getGUID() {\r
                return $this->guid;\r
        }\r
 \r
-       public function setDocuments($documents)\r
-       {\r
+       public function setDocuments($documents) {\r
                $this->documentsId = array_keys($documents);\r
                $this->documentsPages = $documents;\r
        }\r
 \r
-       public function setBook($book_id)\r
-       {\r
+       public function setBook($book_id) {\r
                $this->bookId = $book_id;\r
        }\r
 \r
-       public function initDocuments()\r
-       {\r
+       public function initDocuments() {\r
                global $core;\r
 \r
                $dao = new wsDAODocument($core->con);\r
                $docs = $dao->selectInList($this->documentsId);\r
 \r
-               foreach($docs as $doc) {\r
+               foreach ($docs as $doc) {\r
                        $this->documents[$doc->document_id] = $doc;\r
                }\r
                $inited = true;\r
        }\r
 \r
-       public function getDocumentById($id)\r
-       {\r
+       public function getDocumentById($id) {\r
                return $this->documents[$id];\r
        }\r
 \r
-       protected function initThreads()\r
-       {\r
+       protected function initThreads() {\r
                if (!cubeThread::available() || $this->nb_threads <= 1) {\r
                        return;\r
                }\r
                $this->threads = array();\r
-               for ($i = 0;$i < $this->nb_threads;$i++) {\r
+               for ($i = 0; $i < $this->nb_threads; $i++) {\r
                        $this->threads[] = new cubeThread();\r
                }\r
        }\r
 \r
-       public function process()\r
-       {\r
+       public function process() {\r
                global $core;\r
 \r
                $this->initThreads();\r
@@ -84,7 +76,7 @@ class wsConversionSession {
                $dao = new wsDAODocument($core->con);\r
                $daoBook = new wsDAOBook($core->con);\r
 \r
-               foreach($this->documents as $doc) {\r
+               foreach ($this->documents as $doc) {\r
                        $this->currentDoc = $doc;\r
                        $this->serialize();\r
                        if (!$this->reload) {\r
@@ -102,7 +94,7 @@ class wsConversionSession {
                        $this->currentDoc = $dao->updateFromObject($this->currentDoc);\r
                        $doc_serialized = serialize($this->currentDoc);\r
 \r
-                       foreach($docPages as $i => $page) {\r
+                       foreach ($docPages as $i => $page) {\r
                                $this->currentDocPage = $i + 1;\r
                                $this->totalDocPage = count($docPages);\r
 \r
@@ -122,7 +114,7 @@ class wsConversionSession {
                        }\r
 \r
                        if (cubeThread::available() && $this->nb_threads > 1) {\r
-                               foreach($this->threads as $t) {\r
+                               foreach ($this->threads as $t) {\r
                                        while ($t->isAlive()) {\r
                                                usleep(100000);\r
                                        }\r
@@ -137,9 +129,9 @@ class wsConversionSession {
                                // n'est pas en train de recharger le fluidbook\r
                                $daoBook->appendDocument($this->bookId, $this->currentDoc->document_id);\r
                        }\r
-                       \r
-                       if(!$this->reload){\r
-                               $log=$dao->putLinksFromCSV($this->currentDoc->document_id);\r
+\r
+                       if (!$this->reload) {\r
+                               $log = $dao->putLinksFromCSV($this->currentDoc->document_id);\r
                                $this->currentDoc->addToLog($log);\r
                        }\r
                        $this->processedDoc++;\r
@@ -154,16 +146,14 @@ class wsConversionSession {
                $this->setProgress(100);\r
        }\r
 \r
-       public static function processPage($doc_serialized, $page)\r
-       {\r
+       public static function processPage($doc_serialized, $page) {\r
                $doc = unserialize($doc_serialized);\r
                $doc->processOnePage($page, true);\r
        }\r
 \r
-       public function updateCountPages()\r
-       {\r
+       public function updateCountPages() {\r
                $this->totalPages = 0;\r
-               foreach($this->documentsPages as $id => $pages) {\r
+               foreach ($this->documentsPages as $id => $pages) {\r
                        if ($pages == 'all') {\r
                                $doc = $this->getDocumentById($id);\r
                                $this->totalPages += $doc->generalInfos['pages'];\r
@@ -174,8 +164,7 @@ class wsConversionSession {
                $this->totalDoc = count($this->documents);\r
        }\r
 \r
-       public function getProgress()\r
-       {\r
+       public function getProgress() {\r
                return array("progress" => $this->progress,\r
                        'currentDoc' => $this->currentDoc->file,\r
                        'totalDoc' => $this->totalDoc,\r
@@ -186,40 +175,34 @@ class wsConversionSession {
                        'processedDoc' => max($this->processedDoc + 1, $this->totalDoc));\r
        }\r
 \r
-       public function setProgress($i)\r
-       {\r
+       public function setProgress($i) {\r
                $this->progress = $i;\r
                $this->serialize();\r
        }\r
 \r
-       public function getTotalPages()\r
-       {\r
+       public function getTotalPages() {\r
                return $this->totalPages;\r
        }\r
 \r
-       public function getProcessedPages()\r
-       {\r
+       public function getProcessedPages() {\r
                return $this->processedPages;\r
        }\r
 \r
-       public function serialize()\r
-       {\r
+       public function serialize() {\r
                file_put_contents(self::getCachePath($this->guid), serialize($this));\r
        }\r
 \r
-       public function destroy()\r
-       {\r
+       public function destroy() {\r
                if (file_exists(self::getCachePath($this->guid))) {\r
                        // unlink(self::getCachePath($this->guid));\r
                }\r
        }\r
 \r
-       public function __destruct()\r
-       {\r
+       public function __destruct() {\r
+               \r
        }\r
 \r
-       public static function openFromGUID($guid)\r
-       {\r
+       public static function openFromGUID($guid) {\r
                $serializedObject = self::getCachePath($guid);\r
                if (file_exists($serializedObject)) {\r
                        return unserialize(file_get_contents($serializedObject));\r
@@ -228,10 +211,10 @@ class wsConversionSession {
                }\r
        }\r
 \r
-       public static function getCachePath($guid)\r
-       {\r
+       public static function getCachePath($guid) {\r
                return CACHE . '/conversionSessions/' . $guid . '.obj';\r
        }\r
+\r
 }\r
 \r
 ?>
\ No newline at end of file
index 6d07dc57ccf38b7b08f6e21d4dbc082d80496d23..d9a59289d643588fcc2e35df942c403c32105482 100644 (file)
 <?php\r
 \r
 class wsFlash extends cubeFlashGateway {\r
-       const CNAME = __CLASS__;\r
-\r
-       public static function in($args) {\r
-               global $core;\r
-               $args = cubePage::getArgs($args);\r
-               $n = self::CNAME;\r
-               $gateway = new $n($core->con, $args);\r
-\r
-               $droits = wsDroits::getDroits();\r
-               $gateway->addAttribute('creation', $droits->creation ? '1' : '0');\r
-               $gateway->addAttribute('revendeur', $droits->revendeur ? '1' : '0');\r
-               $gateway->addAttribute('admin', $droits->admin ? '1' : '0');\r
-               $gateway->addAttribute('grade', $core->user->ws_grade);\r
-       }\r
-\r
-       public function saveConversionSettings() {\r
-               global $core;\r
-               $dao = new commonDAOUtilisateur($core->con);\r
-               $datas = array('resolution' => $this->args['resolution'],\r
-                       'objects' => $this->args['objects'],\r
-                       'method' => $this->args['method'],\r
-                       'quality' => $this->args['quality']);\r
-               $dao->sauveWSSettings($core->user->utilisateur_id, $datas);\r
-       }\r
-\r
-       public function getConversionSettings() {\r
-               global $core;\r
-               $this->xml->addChild('resolution', $core->user->ws_settings['resolution']);\r
-               $this->xml->addChild('quality', $core->user->ws_settings['quality']);\r
-               $this->xml->addChild('method', $core->user->ws_settings['method']);\r
-               $this->xml->addChild('objects', $core->user->ws_settings['objects']);\r
-       }\r
-\r
-       public function uploadDocument() {\r
-               cubePHP::neverStop();\r
-               global $core;\r
-               if (!isset($_SESSION['conversionSession'])) {\r
-                       $_SESSION['conversionSession'] = array();\r
-               }\r
-               $dao = new wsDAODocument($core->con);\r
-               foreach ($_FILES as $varname => $infos) {\r
-                       if ($infos['error']) {\r
-                               continue;\r
-                       }\r
-                       // Initialisation du document\r
-                       $data = array();\r
-                       $data['proprietaire'] = $core->user->utilisateur_id;\r
-                       $data['pages'] = 0;\r
-                       $data['version'] = 2;\r
-                       $data['file'] = cubeFiles::tidyName($infos['name']);\r
-                       $li = new wsDocumentLocalInfos($this);\r
-                       $li->fileName = $this->args['fileName'];\r
-                       $li->fileSize = $this->args['fileSize'];\r
-                       $li->creationDate = $this->args['creationDate'];\r
-                       $li->modificationDate = $this->args['modificationDate'];\r
-                       $data['localInfos'] = $li;\r
-                       $data['conversionInfos'] = new wsDocumentConversionInfos($this->args['resolution'], $this->args['method'], $this->args['quality'], $this->args['objects']);\r
-                       $document = $dao->sauve($data);\r
-                       $document->copyOriginalFromUpload($infos['tmp_name']);\r
-                       $this->xml->addChild('document_id', $document->document_id);\r
-                       $_SESSION['conversionSession'][$document->document_id] = 'all';\r
-                       $_SESSION['conversionSessionReload'] = false;\r
-               }\r
-       }\r
-\r
-       public function addDocument() {\r
-               $_SESSION['conversionSession'] = array();\r
-               $_SESSION['conversionSession'][$this->args['document_id']] = 'all';\r
-               $_SESSION['conversionSessionReload'] = false;\r
-       }\r
-\r
-       public function reload() {\r
-               global $core;\r
-\r
-               if ($this->args['reloadDocs'] == '1') {\r
-                       foreach ($this->args['documents'] as $document_id => $pages) {\r
-                               $this->args['documents'][$document_id] = 'all';\r
-                       }\r
-               }\r
-\r
-               $dao = new wsDAODocument($core->con);\r
-               $_SESSION['conversionSession'] = $this->args['documents'];\r
-               $_SESSION['conversionSessionReload'] = true;\r
-               foreach ($this->args['documents'] as $id => $pages) {\r
-                       $doc = $dao->selectById($id);\r
-                       $doc->conversionInfos->updatePages($pages, $this->args['resolution'], $this->args['quality'], $this->args['method'], $this->args['objects']);\r
-                       $dao->updateFromObject($doc);\r
-               }\r
-       }\r
-\r
-       public function processConversionSession() {\r
-               $_SESSION['sessionConversionGUID'] = $sessionConversionGUID = uniqid('conversion_', true);\r
-               $session = new wsConversionSession($sessionConversionGUID);\r
-               $session->reload = $_SESSION['conversionSessionReload'];\r
-               $session->setDocuments($_SESSION['conversionSession']);\r
-               $session->setBook($this->args['book_id']);\r
-               unset($_SESSION['conversionSession']);\r
-               unset($_SESSION['conversionSessionReload']);\r
-               $session->serialize();\r
-\r
-               $php = new cubeCommandLine('php');\r
-               $php->setPath(CONVERTER_PATH);\r
-               $php->setArg('f', ROOT . '/index.php');\r
-               $php->setManualArg('--');\r
-               $php->setArg('user_email', $_SESSION['user_email']);\r
-               $php->setArg('user_password', $_SESSION['user_password']);\r
-               $php->setArg('sessionConversionGUID', $sessionConversionGUID);\r
-               $php->setArg('PATH_INFO', '/flash/processConversionSessionAsync');\r
-               $php->setArg('HTTP_HOST', $_SERVER['HTTP_HOST']);\r
-               $php->setNohup(true);\r
-               $php->execute('exec');\r
-\r
-               $this->xml->addChild('command', html::escapeHTML($php->command));\r
-               exit;\r
-       }\r
-\r
-       public function processConversionSessionAsync() {\r
-               cubePHP::neverStop();\r
-               try {\r
-                       $conversion = wsConversionSession::openFromGUID($_REQUEST['sessionConversionGUID']);\r
-                       $conversion->process();\r
-               } catch (Exception $e) {\r
-                       file_put_contents(CACHE . '/conversionExceptions.txt', print_r($e, true), FILE_APPEND);\r
-               }\r
-               $conversion->destroy();\r
-       }\r
-\r
-       public function getConversionSessionProgress() {\r
-               set_time_limit(1);\r
-               $session = wsConversionSession::openFromGUID($_SESSION['sessionConversionGUID']);\r
-               $p = $session->getProgress();\r
-               $this->xml->addChild('progress', $p['progress']);\r
-               $this->xml->addChild('processedDoc', $p['processedDoc']);\r
-               $this->xml->addChild('totalDoc', $p['totalDoc']);\r
-               $this->xml->addChild('currentDoc', $p['currentDoc']);\r
-               $this->xml->addChild('currentDocPage', $p['currentDocPage']);\r
-               $this->xml->addChild('totalDocPage', $p['totalDocPage']);\r
-       }\r
-\r
-       public function uploadThemeFile() {\r
-               foreach ($_FILES as $varname => $infos) {\r
-                       if ($infos['error']) {\r
-                               continue;\r
-                       }\r
-                       $fname = cubeFiles::tidyName($infos['name']);\r
-                       $dest = '/' . $this->args['theme_id'] . '/' . $fname;\r
-\r
-                       if (!file_exists(WS_THEMES . '/' . $this->args['theme_id'])) {\r
-                               mkdir(WS_THEMES . '/' . $this->args['theme_id'], 0755, true);\r
-                       }\r
-\r
-                       move_uploaded_file($infos['tmp_name'], WS_THEMES . $dest);\r
-                       $this->xml->addChild('file', $fname);\r
-                       return;\r
-               }\r
-       }\r
-\r
-       public function uploadLinkContent() {\r
-               foreach ($_FILES as $varname => $infos) {\r
-                       if ($infos['error']) {\r
-                               continue;\r
-                       }\r
-\r
-                       if (isset($_POST['dir'])) {\r
-                               $dir = trim($_POST['dir'], '/\\ ');\r
-                       } else {\r
-                               $dir = '';\r
-                       }\r
-\r
-                       if ($dir != '') {\r
-                               $dir = $dir . '/';\r
-                       }\r
-\r
-                       $fname = cubeFiles::tidyName($infos['name']);\r
-                       $dir = WS_BOOKS . '/working/' . $this->args['book_id'] . '/' . $dir;\r
-                       if (!file_exists($dir)) {\r
-                               mkdir($dir, 0777, true);\r
-                       }\r
-                       $dest = $dir . $fname;\r
-                       move_uploaded_file($infos['tmp_name'], $dest);\r
-                       if (in_array(strtolower(files::getExtension($dest)), array('flv', 'f4v', 'mp4'))) {\r
-                               // convert uploaded file as webvideo (ogv and mp4)\r
-                               wsTools::encodeWebVideos($dest, null, true, false);\r
-                       }\r
-                       $this->xml->addChild('file', $fname);\r
-                       return;\r
-               }\r
-       }\r
-\r
-       public function testDocuments() {\r
-               global $core;\r
-\r
-               $toload = $this->xml->addChild('toLoad');\r
-               $alreadyLoaded = $this->xml->addChild('alreadyLoaded');\r
-\r
-               $hash = array();\r
-\r
-               foreach ($this->args['fileName'] as $k => $name) {\r
-                       $o = new wsDocumentLocalInfos();\r
-                       $o->fileName = $name;\r
-                       $o->fileSize = intval($this->args['fileSize'][$k]);\r
-                       $o->modificationDate = intval($this->args['modificationDate'][$k]);\r
-                       $o->creationDate = intval($this->args['creationDate'][$k]);\r
-\r
-                       $hash[$k] = md5(serialize($o));\r
-               }\r
-\r
-               $in = array();\r
-               foreach ($hash as $h) {\r
-                       $in[] = "'" . $h . "'";\r
-               }\r
-\r
-               $sql = 'SELECT document_id,localHash FROM documents WHERE localHash';\r
-               if (count($in) == 1) {\r
-                       $sql .= ' = ' . implode(',', $in);\r
-               } else {\r
-                       $sql .= ' IN (' . implode(',', $in) . ')';\r
-               }\r
-\r
-               $al = array();\r
-               $r = $core->con->select($sql);\r
-               while ($r->fetch()) {\r
-                       $k = array_search($r->localHash, $hash);\r
-\r
-                       if (!file_exists(WS_DOCS . '/' . $r->document_id . '/original.pdf')) {\r
-                               continue;\r
-                       }\r
-\r
-                       $al[$k] = true;\r
-                       $f = $alreadyLoaded->addChild('file', $this->args['fileName'][$k]);\r
-                       $f->addAttribute('document_id', $r->document_id);\r
-               }\r
-\r
-               foreach ($this->args['fileName'] as $k => $name) {\r
-                       if (!isset($al[$k])) {\r
-                               $toload->addChild('file', $name);\r
-                       }\r
-               }\r
-       }\r
-\r
-       public function getPagesOfBook() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $book = $dao->selectById($this->args['book_id']);\r
-               $pages = $dao->getPagesOfBook($this->args['book_id']);\r
-               $p = $this->xml->addChild('pages');\r
-               $docs = array();\r
-               $defaultNum = array();\r
-               foreach ($pages as $page => $info) {\r
-                       $file = WS_DOCS . '/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg';\r
-                       if (!file_exists($file)) {\r
-                               $dim = array(0, 0);\r
-                               $info['resolution'] = 150;\r
-                               $info['method'] = 1;\r
-                               $info['objects'] = 1800;\r
-                               $info['quality'] = 85;\r
-                       } else {\r
-                               $dim = getimagesize($file);\r
-                       }\r
-\r
-\r
-\r
-                       $pa = $p->addChild('page');\r
-                       $pa->addAttribute('page', $page);\r
-                       $pa->addAttribute('document_id', $info['document_id']);\r
-                       $pa->addAttribute('document_page', $info['document_page']);\r
-                       $pa->addAttribute('width', $dim[0]);\r
-                       $pa->addAttribute('height', $dim[1]);\r
-                       $pa->addAttribute('resolution', $info['resolution']);\r
-                       $pa->addAttribute('quality', $info['quality']);\r
-                       $pa->addAttribute('methode', $info['method']);\r
-                       $pa->addAttribute('objects', $info['objects']);\r
-                       $docs[] = $info['document_id'];\r
-                       $defaultNum[] = $info['defaultNum'];\r
-               }\r
-               $docs = array_unique($docs);\r
-               $p->addAttribute('documents', implode(',', $docs));\r
-               if (is_null($book->numerotation) || !$book->numerotation || $book->numerotation == 'null') {\r
-                       $this->xml->addChild('numerotation', implode(',', $defaultNum));\r
-               } else {\r
-                       $this->xml->addChild('numerotation', $book->numerotation);\r
-               }\r
-       }\r
-\r
-       public function getTheme() {\r
-               global $core;\r
-               $dao = new wsDAOTheme($core->con);\r
-               if (isset($this->args['theme_id'])) {\r
-                       $theme = $dao->selectById($this->args['theme_id']);\r
-               } else {\r
-                       $theme = $dao->getThemeOfBook($this->args['book_id']);\r
-               }\r
-               $this->_themeToXML($theme);\r
-       }\r
-\r
-       public function saveTheme() {\r
-               global $core;\r
-               $dao = new wsDAOTheme($core->con);\r
-               $dao->sauve($this->args);\r
-       }\r
-\r
-       public function getAllThemes() {\r
-               global $core;\r
-\r
-               if (isset($this->args['book_id'])) {\r
-                       $dao = new wsDAOBook($core->con);\r
-                       $book = $dao->selectById($this->args['book_id']);\r
-               } else {\r
-                       $this->args['book_id'] = 0;\r
-               }\r
-\r
-               $dao = new wsDAOTheme($core->con);\r
-               $themes = $dao->getAllThemes($core->user, 'ORDER BY FIELD (theme_id,' . $this->args['book_id'] . ',1) DESC, theme_id DESC', true);\r
-               foreach ($themes as $theme) {\r
-                       $t = $this->xml->addChild('theme');\r
-                       $t->addAttribute('id', $theme->theme_id);\r
-                       $t->addAttribute('nom', $theme->nom);\r
-                       if (isset($book) && $theme->theme_id == $book->theme) {\r
-                               $t->addAttribute('selected', '1');\r
-                               $mine = true;\r
-                       } else {\r
-                               $mine = false;\r
-                       }\r
-                       if (wsDroits::revendeur() && wsDroits::creation()) {\r
-                               $right = 'w';\r
-                       } else {\r
-                               $right = 'r';\r
-                       }\r
-                       $t->addAttribute('right', $right);\r
-                       $t->addAttribute('proprietaire', $theme->proprietaire_nom);\r
-                       $t->addAttribute('books', max(($theme->nbBooks) - ($mine ? 1 : 0), 0));\r
-               }\r
-       }\r
-\r
-       public function deleteTheme() {\r
-               global $core;\r
-\r
-               $dao = new wsDAOTheme($core->con);\r
-               $dao->delete($this->args['theme_id']);\r
-       }\r
-\r
-       public function renameTheme() {\r
-               global $core;\r
-\r
-               $dao = new wsDAOTheme($core->con);\r
-               $dao->rename($this->args['theme_id'], $this->args['text']);\r
-       }\r
-\r
-       public function duplicateTheme() {\r
-               global $core;\r
-               $dao = new wsDAOTheme($core->con);\r
-               $theme = $dao->duplicate($this->args['theme_id'], $core->user->utilisateur_id);\r
-               $this->xml->addChild('theme_id', $theme->theme_id);\r
-               if (isset($this->args['book_id'])) {\r
-                       $dao = new wsDAOBook($core->con);\r
-                       $data = array('book_id' => $this->args['book_id'], 'theme' => $theme->theme_id);\r
-                       $dao->sauve($core->user->utilisateur_id, $data);\r
-               }\r
-       }\r
-\r
-       public function setTheme() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $dao->setTheme($this->args['book_id'], $this->args['theme']);\r
-       }\r
-\r
-       public function postThemeShot() {\r
-               file_put_contents(WS_THEMES . '/' . $this->args['theme_id'] . '.jpg', base64_decode($this->args['data']));\r
-       }\r
-\r
-       public function getAllIcones() {\r
-               global $core;\r
-               $dao = new wsDAOIcone($core->con);\r
-               $icones = $dao->selectAll('ORDER BY icone_id DESC');\r
-               foreach ($icones as $icone) {\r
-                       $i = $this->xml->addChild('icone');\r
-                       $i->addAttribute('id', $icone->icone_id);\r
-                       $i->addAttribute('nom', $icone->nom);\r
-                       $i->addAttribute('path', ICONS . $icone->icone_id . '.png');\r
-               }\r
-       }\r
-\r
-       protected function _themeToXML($theme) {\r
-               $t = $this->xml->addChild('theme');\r
-               $t->addAttribute('theme_id', $theme->theme_id);\r
-               $t->addAttribute('icones_id', $theme->icones);\r
-               foreach ($theme->parametres as $k => $v) {\r
-                       $t->addChild($k, $v);\r
-               }\r
-       }\r
-\r
-       public function getThemeForms() {\r
-               global $core;\r
-               $dao = new wsDAOTheme($core->con);\r
-               $theme = $dao->selectById($this->args['theme_id']);\r
-\r
-               foreach ($theme->parametres->getForms() as $name) {\r
-                       $f = $this->xml->addChild('form', json_encode($theme->parametres->getForm($name)));\r
-                       $f->addAttribute('name', $name);\r
-               }\r
-       }\r
-\r
-       public function getFluidbookForms() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $book = $dao->selectById($this->args['book_id']);\r
-               foreach ($book->parametres->getForms() as $name) {\r
-                       $f = $this->xml->addChild('form', html::escapeHTML(json_encode($book->parametres->getForm($name))));\r
-                       $f->addAttribute('name', $name);\r
-               }\r
-       }\r
-\r
-       public function saveSettings() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $dao->setSettings($this->args['book_id'], $this->args['settings']);\r
-       }\r
-\r
-       public function setChapters() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $dao->setChapters($this->args['book_id'], $this->args['chapters']);\r
-       }\r
-\r
-       public function getChapters() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $book = $dao->selectById($this->args['book_id']);\r
-               $this->xml->addChild('chapters', html::escapeHTML(json_encode($book->chapters)));\r
-       }\r
-\r
-       public function getLinks() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $book = $dao->selectById($this->args['book_id']);\r
-\r
-               $pages = $dao->getPagesOfBook($this->args['book_id']);\r
-               $nb_pages = count($pages);\r
-               $this->xml->addChild('pages', $nb_pages);\r
-               $this->xml->addChild('numerotation', $book->numerotation);\r
-\r
-               $daoDoc = new wsDAODocument($core->con);\r
-               $firstDoc = $daoDoc->selectById($pages[1]['document_id']);\r
-               $size = $firstDoc->generalInfos['size'];\r
-               $daoDoc->getLinksAndRulers($this->args['book_id'], $links, $rulers);\r
-\r
-               $this->xml->addChild('width', $size[0]);\r
-               $this->xml->addChild('height', $size[1]);\r
-               $this->xml->addChild('links', html::escapeHTML(json_encode($links)));\r
-               $this->xml->addChild('rulers', json_encode($rulers));\r
-\r
-               $daoTheme = new wsDAOTheme($this->con);\r
-               $theme = $daoTheme->getThemeOfBook($this->args['book_id'], true);\r
-\r
-               $specials = array('backgroundImage' => 'background', 'topBar' => 'topbar', 'afterSearch' => 'aftersearch');\r
-\r
-               foreach ($specials as $tparam => $sname) {\r
-                       $this->_addSpecialInfos($theme, $tparam, $sname);\r
-               }\r
-       }\r
-\r
-       protected function _addSpecialInfos($theme, $param, $specialName) {\r
-               if ($theme->parametres->$param != '') {\r
-                       $themeRoot = WS_THEMES . '/' . $theme->theme_id . '/';\r
-                       $dim = getimagesize($themeRoot . $theme->parametres->$param);\r
-                       $b = $this->xml->addChild($specialName);\r
-                       $b->addChild('width', $dim[0]);\r
-                       $b->addChild('height', $dim[1]);\r
-                       $b->addChild('url', 'http://' . $_SERVER['HTTP_HOST'] . WEBROOT . '/fluidbook/themes/' . $theme->theme_id . '/' . $theme->parametres->$param);\r
-               }\r
-       }\r
-\r
-       public function saveLinks() {\r
-               global $core;\r
-\r
-               $comments = isset($this->args['comments']) ? $this->args['comments'] : 'Saved from editor';\r
-\r
-               $dao = new wsDAODocument($core->con);\r
-               $dao->setLinksAndRulers($this->args['book_id'], $this->args['links'], $this->args['rulers'], $comments, $core->user->utilisateur_id);\r
-\r
-               $daoBook = new wsDAOBook($core->con);\r
-               $daoBook->setSpecialLinksAndRulers($this->args['book_id'], $this->args['specialLinks'], $this->args['specialRulers']);\r
-\r
-               if (isset($this->args['getLinks'])) {\r
-                       $this->getLinks();\r
-               }\r
-       }\r
-\r
-       public function formatSize($val) {\r
-               $str = files::size($val);\r
-               $str = str_replace('.', __(','), $str);\r
-               $str = str_replace('B', __('o'), $str);\r
-               return $str;\r
-       }\r
-\r
-       public function getExtras() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $book = $dao->selectById($this->args['book_id']);\r
-               if ($book->extras != '') {\r
-                       $tidy = cubeXML::tidy('<extras>' . $book->extras . '</extras>');\r
-                       $tidy = str_replace('<extras>', '', $tidy);\r
-                       $tidy = str_replace('</extras>', '', $tidy);\r
-                       $tidy = str_replace('<?xml version="1.0"?>', '', $tidy);\r
-                       $tidy = trim($tidy);\r
-                       $e = explode("\n", $tidy);\r
-                       foreach ($e as $k => $v) {\r
-                               if (substr($v, 0, 2) == '  ') {\r
-                                       $v = substr($v, 2);\r
-                               }\r
-                               $e[$k] = $v;\r
-                       }\r
-\r
-                       $extras = implode("\n", $e);\r
-               } else {\r
-                       $extras = '';\r
-               }\r
-\r
-               $this->xml->addChild('extras', $extras);\r
-       }\r
-\r
-       public function saveExtras() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $res = $dao->setExtras($this->args['book_id'], $this->args['extras']);\r
-               $this->xml->addChild('ok', $res ? '1' : '0');\r
-       }\r
-\r
-       public function getBookInfos() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $book = $dao->selectById($this->args['book_id']);\r
-               $pages = $dao->getPagesOfBook($this->args['book_id']);\r
-               $daoDoc = new wsDAODocument($core->con);\r
-               $nb_pages = count($pages);\r
-               $this->xml->addChild('pages', $nb_pages);\r
-               $total_size = 0;\r
-               foreach ($pages as $page => $info) {\r
-                       $file = WS_DOCS . '/' . $info['document_id'] . '/p' . $info['document_page'] . '.swf';\r
-                       $total_size += filesize($file);\r
-               }\r
-               $average_size = $total_size / $nb_pages;\r
-               $total = self::formatSize($total_size);\r
-               $average = self::formatSize($average_size);\r
-               $firstDoc = $daoDoc->selectById($pages[1]['document_id']);\r
-               $size = $firstDoc->generalInfos['size'];\r
-               $this->xml->addChild('width', $size[0]);\r
-               $this->xml->addChild('height', $size[1]);\r
-               $res = __('Nombre de pages') . ' : ' . "\n";\r
-               $res .= $nb_pages . ' ' . __('pages') . "\n";\r
-               $res .= "\n";\r
-               $res .= __('Dimensions') . ' : ' . "\n";\r
-               $res .= round($size[0], 3) . ' x ' . round($size[1], 3) . ' pts' . "\n";\r
-               $res .= "\n";\r
-               $res .= __('Taille totale des pages') . ' : ' . "\n";\r
-               $res .= $total . "\n";\r
-               $res .= "\n";\r
-               $res .= __('Taille moyenne des pages') . ' : ' . "\n";\r
-               $res .= $average . "\n";\r
-               $res .= "\n";\r
-               /* $res .= __('Taille du PDF') . ' : ' . "\n";\r
-                 $res .= '7898 Ko' . "\n";\r
-                 $res .= "\n";\r
-                 $res .= __('Qualité de conversion') . ' : ' . "\n";\r
-                 $res .= '150dpi (qualité 85%)' . "\n"; */\r
-               $this->xml->addChild('infos', $res);\r
-       }\r
-\r
-       public function getLangs() {\r
-               global $core;\r
-               if (isset($this->args['book_id'])) {\r
-                       $dao = new wsDAOBook($core->con);\r
-                       $book = $dao->selectById($this->args['book_id']);\r
-                       $book->traductions = wsLang::checkTranslations($book->traductions);\r
-                       if ($book->traductions != array()) {\r
-                               $bookLang = $this->xml->addChild('book_lang', json_encode($book->traductions));\r
-                       }\r
-               }\r
-\r
-               $dao = new wsDAOLang($core->con);\r
-               $langs = $dao->selectAll();\r
-               foreach ($langs as $lang) {\r
-                       $nom = cubeLang::getNameByCode($lang->lang_id, $core->user->lang);\r
-                       $l = $this->xml->addChild('lang', json_encode($lang->traductions));\r
-                       $l->addAttribute('id', $lang->lang_id);\r
-                       $l->addAttribute('nom', $nom);\r
-                       if (isset($book) && $book->lang == $lang->lang_id) {\r
-                               if (!isset($bookLang)) {\r
-                                       $l->addAttribute('selected', '1');\r
-                               } else {\r
-                                       $bookLang->addAttribute('id', $lang->lang_id);\r
-                                       $bookLang->addAttribute('nom', $nom . ' (' . __('modifié') . ')');\r
-                                       $bookLang->addAttribute('selected', '1');\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       public function saveLang() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $dao->setLang($this->args['book_id'], $this->args['lang_id'], $this->args['traductions']);\r
-       }\r
-\r
-       public function saveComposition() {\r
-               global $core;\r
-               $dao = new wsDAOBook($core->con);\r
-               $dao->setComposition($this->args['book_id'], json_decode($this->args['pages']));\r
-       }\r
-\r
-       public function getTexts() {\r
-               $this->xml->addChild('texts', json_encode($GLOBALS['__l10n']));\r
-       }\r
-\r
-       public function copyLinks() {\r
-               global $core;\r
-               $daoDocument = new wsDAODocument($core->con);\r
-               $daoDocument->copyLinks($this->args['fromDoc'], $this->args['toDoc']);\r
-       }\r
-\r
-       public function compile() {\r
-               global $core;\r
-               wsSecureSWF::checkProtectedSWF();\r
-               $dao = new wsDAOBook($core->con);\r
-               if (!$dao->isUpToDate($this->args['book_id'])) {\r
-                       $log = $dao->compile($this->args['book_id'], 3);\r
-                       $log = str_replace('&amp;', '&', $log);\r
-                       $log = str_replace('&', '&amp;', $log);\r
-                       // $this->xml->addChild('log', $log);\r
-               }\r
-               $book = $dao->selectById($this->args['book_id']);\r
-               $viewer = 'viewer';\r
-               if (wsDroits::admin()) {\r
-                       $viewer = 'vieweru';\r
-               }\r
-\r
-               $absoluteURL = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $viewer . '/' . $book->book_id . '_' . $book->hash . '_' . TIME . '/';\r
-               $this->xml->addChild('compiledBook', $absoluteURL . 'index.swf?base=' . $absoluteURL);\r
-       }\r
+    const CNAME = __CLASS__;\r
+\r
+    public static function in($args) {\r
+        global $core;\r
+        $args = cubePage::getArgs($args);\r
+        $n = self::CNAME;\r
+        $gateway = new $n($core->con, $args);\r
+\r
+        $droits = wsDroits::getDroits();\r
+        $gateway->addAttribute('creation', $droits->creation ? '1' : '0');\r
+        $gateway->addAttribute('revendeur', $droits->revendeur ? '1' : '0');\r
+        $gateway->addAttribute('admin', $droits->admin ? '1' : '0');\r
+        $gateway->addAttribute('grade', $core->user->ws_grade);\r
+    }\r
+\r
+    public function saveConversionSettings() {\r
+        global $core;\r
+        $dao = new commonDAOUtilisateur($core->con);\r
+        $datas = array('resolution' => $this->args['resolution'],\r
+            'objects' => $this->args['objects'],\r
+            'method' => $this->args['method'],\r
+            'quality' => $this->args['quality']);\r
+        $dao->sauveWSSettings($core->user->utilisateur_id, $datas);\r
+    }\r
+\r
+    public function getConversionSettings() {\r
+        global $core;\r
+        $this->xml->addChild('resolution', $core->user->ws_settings['resolution']);\r
+        $this->xml->addChild('quality', $core->user->ws_settings['quality']);\r
+        $this->xml->addChild('method', $core->user->ws_settings['method']);\r
+        $this->xml->addChild('objects', $core->user->ws_settings['objects']);\r
+    }\r
+\r
+    public function uploadDocument() {\r
+        cubePHP::neverStop();\r
+        global $core;\r
+        if (!isset($_SESSION['conversionSession'])) {\r
+            $_SESSION['conversionSession'] = array();\r
+        }\r
+        $dao = new wsDAODocument($core->con);\r
+        foreach ($_FILES as $varname => $infos) {\r
+            if ($infos['error']) {\r
+                continue;\r
+            }\r
+            // Initialisation du document\r
+            $data = array();\r
+            $data['proprietaire'] = $core->user->utilisateur_id;\r
+            $data['pages'] = 0;\r
+            $data['version'] = 2;\r
+            $data['file'] = cubeFiles::tidyName($infos['name']);\r
+            $li = new wsDocumentLocalInfos($this);\r
+            $li->fileName = $this->args['fileName'];\r
+            $li->fileSize = $this->args['fileSize'];\r
+            $li->creationDate = $this->args['creationDate'];\r
+            $li->modificationDate = $this->args['modificationDate'];\r
+            $data['localInfos'] = $li;\r
+            $data['conversionInfos'] = new wsDocumentConversionInfos($this->args['resolution'], $this->args['method'], $this->args['quality'], $this->args['objects']);\r
+            $document = $dao->sauve($data);\r
+            $document->copyOriginalFromUpload($infos['tmp_name']);\r
+            $this->xml->addChild('document_id', $document->document_id);\r
+            $_SESSION['conversionSession'][$document->document_id] = 'all';\r
+            $_SESSION['conversionSessionReload'] = false;\r
+        }\r
+    }\r
+\r
+    public function addDocument() {\r
+        $_SESSION['conversionSession'] = array();\r
+        $_SESSION['conversionSession'][$this->args['document_id']] = 'all';\r
+        $_SESSION['conversionSessionReload'] = false;\r
+    }\r
+\r
+    public function reload() {\r
+        global $core;\r
+\r
+        if ($this->args['reloadDocs'] == '1') {\r
+            foreach ($this->args['documents'] as $document_id => $pages) {\r
+                $this->args['documents'][$document_id] = 'all';\r
+            }\r
+        }\r
+\r
+        $dao = new wsDAODocument($core->con);\r
+        $_SESSION['conversionSession'] = $this->args['documents'];\r
+        $_SESSION['conversionSessionReload'] = true;\r
+        foreach ($this->args['documents'] as $id => $pages) {\r
+            $doc = $dao->selectById($id);\r
+            $doc->conversionInfos->updatePages($pages, $this->args['resolution'], $this->args['quality'], $this->args['method'], $this->args['objects']);\r
+            $dao->updateFromObject($doc);\r
+        }\r
+    }\r
+\r
+    public function processConversionSession() {\r
+        $_SESSION['sessionConversionGUID'] = $sessionConversionGUID = uniqid('conversion_', true);\r
+        $session = new wsConversionSession($sessionConversionGUID);\r
+        $session->reload = $_SESSION['conversionSessionReload'];\r
+        $session->setDocuments($_SESSION['conversionSession']);\r
+        $session->setBook($this->args['book_id']);\r
+        unset($_SESSION['conversionSession']);\r
+        unset($_SESSION['conversionSessionReload']);\r
+        $session->serialize();\r
+\r
+        $php = new cubeCommandLine('php');\r
+        $php->setPath(CONVERTER_PATH);\r
+        $php->setArg('f', ROOT . '/index.php');\r
+        $php->setManualArg('--');\r
+        $php->setArg('user_email', $_SESSION['user_email']);\r
+        $php->setArg('user_password', $_SESSION['user_password']);\r
+        $php->setArg('sessionConversionGUID', $sessionConversionGUID);\r
+        $php->setArg('PATH_INFO', '/flash/processConversionSessionAsync');\r
+        $php->setArg('HTTP_HOST', $_SERVER['HTTP_HOST']);\r
+        $php->setNohup(true);\r
+        $php->execute('exec');\r
+\r
+        $this->xml->addChild('command', html::escapeHTML($php->command));\r
+        exit;\r
+    }\r
+\r
+    public function processConversionSessionAsync() {\r
+        cubePHP::neverStop();\r
+        try {\r
+            $conversion = wsConversionSession::openFromGUID($_REQUEST['sessionConversionGUID']);\r
+            $conversion->process();\r
+        } catch (Exception $e) {\r
+            file_put_contents(CACHE . '/conversionExceptions.txt', print_r($e, true), FILE_APPEND);\r
+        }\r
+        $conversion->destroy();\r
+    }\r
+\r
+    public function getConversionSessionProgress() {\r
+        set_time_limit(1);\r
+        $session = wsConversionSession::openFromGUID($_SESSION['sessionConversionGUID']);\r
+        $p = $session->getProgress();\r
+        $this->xml->addChild('progress', $p['progress']);\r
+        $this->xml->addChild('processedDoc', $p['processedDoc']);\r
+        $this->xml->addChild('totalDoc', $p['totalDoc']);\r
+        $this->xml->addChild('currentDoc', $p['currentDoc']);\r
+        $this->xml->addChild('currentDocPage', $p['currentDocPage']);\r
+        $this->xml->addChild('totalDocPage', $p['totalDocPage']);\r
+    }\r
+\r
+    public function uploadThemeFile() {\r
+        foreach ($_FILES as $varname => $infos) {\r
+            if ($infos['error']) {\r
+                continue;\r
+            }\r
+            $fname = cubeFiles::tidyName($infos['name']);\r
+            $dest = '/' . $this->args['theme_id'] . '/' . $fname;\r
+\r
+            if (!file_exists(WS_THEMES . '/' . $this->args['theme_id'])) {\r
+                mkdir(WS_THEMES . '/' . $this->args['theme_id'], 0755, true);\r
+            }\r
+\r
+            move_uploaded_file($infos['tmp_name'], WS_THEMES . $dest);\r
+            $this->xml->addChild('file', $fname);\r
+            return;\r
+        }\r
+    }\r
+\r
+    public function uploadLinkContent() {\r
+        foreach ($_FILES as $varname => $infos) {\r
+            if ($infos['error']) {\r
+                continue;\r
+            }\r
+\r
+            if (isset($_POST['dir'])) {\r
+                $dir = trim($_POST['dir'], '/\\ ');\r
+            } else {\r
+                $dir = '';\r
+            }\r
+\r
+            if ($dir != '') {\r
+                $dir = $dir . '/';\r
+            }\r
+\r
+            $fname = cubeFiles::tidyName($infos['name']);\r
+            $dir = WS_BOOKS . '/working/' . $this->args['book_id'] . '/' . $dir;\r
+            if (!file_exists($dir)) {\r
+                mkdir($dir, 0777, true);\r
+            }\r
+            $dest = $dir . $fname;\r
+            move_uploaded_file($infos['tmp_name'], $dest);\r
+            if (in_array(strtolower(files::getExtension($dest)), array('flv', 'f4v', 'mp4'))) {\r
+                // convert uploaded file as webvideo (ogv and mp4)\r
+                wsTools::encodeWebVideos($dest, null, true, false);\r
+            }\r
+            $this->xml->addChild('file', $fname);\r
+            return;\r
+        }\r
+    }\r
+\r
+    public function testDocuments() {\r
+        global $core;\r
+\r
+        $toload = $this->xml->addChild('toLoad');\r
+        $alreadyLoaded = $this->xml->addChild('alreadyLoaded');\r
+\r
+        $hash = array();\r
+\r
+        foreach ($this->args['fileName'] as $k => $name) {\r
+            $o = new wsDocumentLocalInfos();\r
+            $o->fileName = $name;\r
+            $o->fileSize = intval($this->args['fileSize'][$k]);\r
+            $o->modificationDate = intval($this->args['modificationDate'][$k]);\r
+            $o->creationDate = intval($this->args['creationDate'][$k]);\r
+\r
+            $hash[$k] = md5(serialize($o));\r
+        }\r
+\r
+        $in = array();\r
+        foreach ($hash as $h) {\r
+            $in[] = "'" . $h . "'";\r
+        }\r
+\r
+        $sql = 'SELECT document_id,localHash FROM documents WHERE localHash';\r
+        if (count($in) == 1) {\r
+            $sql .= ' = ' . implode(',', $in);\r
+        } else {\r
+            $sql .= ' IN (' . implode(',', $in) . ')';\r
+        }\r
+\r
+        $al = array();\r
+        $r = $core->con->select($sql);\r
+        while ($r->fetch()) {\r
+            $k = array_search($r->localHash, $hash);\r
+\r
+            if (!file_exists(WS_DOCS . '/' . $r->document_id . '/original.pdf')) {\r
+                continue;\r
+            }\r
+\r
+            $al[$k] = true;\r
+            $f = $alreadyLoaded->addChild('file', $this->args['fileName'][$k]);\r
+            $f->addAttribute('document_id', $r->document_id);\r
+        }\r
+\r
+        foreach ($this->args['fileName'] as $k => $name) {\r
+            if (!isset($al[$k])) {\r
+                $toload->addChild('file', $name);\r
+            }\r
+        }\r
+    }\r
+\r
+    public function getPagesOfBook() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $book = $dao->selectById($this->args['book_id']);\r
+        $pages = $dao->getPagesOfBook($this->args['book_id']);\r
+        $p = $this->xml->addChild('pages');\r
+        $docs = array();\r
+        $defaultNum = array();\r
+        foreach ($pages as $page => $info) {\r
+            $file = WS_DOCS . '/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg';\r
+            if (!file_exists($file)) {\r
+                $dim = array(0, 0);\r
+                $info['resolution'] = 150;\r
+                $info['method'] = 1;\r
+                $info['objects'] = 1800;\r
+                $info['quality'] = 85;\r
+            } else {\r
+                $dim = getimagesize($file);\r
+            }\r
+\r
+\r
+\r
+            $pa = $p->addChild('page');\r
+            $pa->addAttribute('page', $page);\r
+            $pa->addAttribute('document_id', $info['document_id']);\r
+            $pa->addAttribute('document_page', $info['document_page']);\r
+            $pa->addAttribute('width', $dim[0]);\r
+            $pa->addAttribute('height', $dim[1]);\r
+            $pa->addAttribute('resolution', $info['resolution']);\r
+            $pa->addAttribute('quality', $info['quality']);\r
+            $pa->addAttribute('methode', $info['method']);\r
+            $pa->addAttribute('objects', $info['objects']);\r
+            $docs[] = $info['document_id'];\r
+            $defaultNum[] = $info['defaultNum'];\r
+        }\r
+        $docs = array_unique($docs);\r
+        $p->addAttribute('documents', implode(',', $docs));\r
+        if (is_null($book->numerotation) || !$book->numerotation || $book->numerotation == 'null') {\r
+            $this->xml->addChild('numerotation', implode(',', $defaultNum));\r
+        } else {\r
+            $this->xml->addChild('numerotation', $book->numerotation);\r
+        }\r
+    }\r
+\r
+    public function getTheme() {\r
+        global $core;\r
+        $dao = new wsDAOTheme($core->con);\r
+        if (isset($this->args['theme_id'])) {\r
+            $theme = $dao->selectById($this->args['theme_id']);\r
+        } else {\r
+            $theme = $dao->getThemeOfBook($this->args['book_id']);\r
+        }\r
+        $this->_themeToXML($theme);\r
+    }\r
+\r
+    public function saveTheme() {\r
+        global $core;\r
+        $dao = new wsDAOTheme($core->con);\r
+        $dao->sauve($this->args);\r
+    }\r
+\r
+    public function getAllThemes() {\r
+        global $core;\r
+\r
+        if (isset($this->args['book_id'])) {\r
+            $dao = new wsDAOBook($core->con);\r
+            $book = $dao->selectById($this->args['book_id']);\r
+        } else {\r
+            $this->args['book_id'] = 0;\r
+        }\r
+\r
+        $dao = new wsDAOTheme($core->con);\r
+        $themes = $dao->getAllThemes($core->user, 'ORDER BY FIELD (theme_id,' . $this->args['book_id'] . ',1) DESC, theme_id DESC', true);\r
+        foreach ($themes as $theme) {\r
+            $t = $this->xml->addChild('theme');\r
+            $t->addAttribute('id', $theme->theme_id);\r
+            $t->addAttribute('nom', $theme->nom);\r
+            if (isset($book) && $theme->theme_id == $book->theme) {\r
+                $t->addAttribute('selected', '1');\r
+                $mine = true;\r
+            } else {\r
+                $mine = false;\r
+            }\r
+            if (wsDroits::revendeur() && wsDroits::creation()) {\r
+                $right = 'w';\r
+            } else {\r
+                $right = 'r';\r
+            }\r
+            $t->addAttribute('right', $right);\r
+            $t->addAttribute('proprietaire', $theme->proprietaire_nom);\r
+            $t->addAttribute('books', max(($theme->nbBooks) - ($mine ? 1 : 0), 0));\r
+        }\r
+    }\r
+\r
+    public function deleteTheme() {\r
+        global $core;\r
+\r
+        $dao = new wsDAOTheme($core->con);\r
+        $dao->delete($this->args['theme_id']);\r
+    }\r
+\r
+    public function renameTheme() {\r
+        global $core;\r
+\r
+        $dao = new wsDAOTheme($core->con);\r
+        $dao->rename($this->args['theme_id'], $this->args['text']);\r
+    }\r
+\r
+    public function duplicateTheme() {\r
+        global $core;\r
+        $dao = new wsDAOTheme($core->con);\r
+        $theme = $dao->duplicate($this->args['theme_id'], $core->user->utilisateur_id);\r
+        $this->xml->addChild('theme_id', $theme->theme_id);\r
+        if (isset($this->args['book_id'])) {\r
+            $dao = new wsDAOBook($core->con);\r
+            $data = array('book_id' => $this->args['book_id'], 'theme' => $theme->theme_id);\r
+            $dao->sauve($core->user->utilisateur_id, $data);\r
+        }\r
+    }\r
+\r
+    public function setTheme() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $dao->setTheme($this->args['book_id'], $this->args['theme']);\r
+    }\r
+\r
+    public function postThemeShot() {\r
+        file_put_contents(WS_THEMES . '/' . $this->args['theme_id'] . '.jpg', base64_decode($this->args['data']));\r
+    }\r
+\r
+    public function getAllIcones() {\r
+        global $core;\r
+        $dao = new wsDAOIcone($core->con);\r
+        $icones = $dao->selectAll('ORDER BY icone_id DESC');\r
+        foreach ($icones as $icone) {\r
+            $i = $this->xml->addChild('icone');\r
+            $i->addAttribute('id', $icone->icone_id);\r
+            $i->addAttribute('nom', $icone->nom);\r
+            $i->addAttribute('path', ICONS . $icone->icone_id . '.png');\r
+        }\r
+    }\r
+\r
+    protected function _themeToXML($theme) {\r
+        $t = $this->xml->addChild('theme');\r
+        $t->addAttribute('theme_id', $theme->theme_id);\r
+        $t->addAttribute('icones_id', $theme->icones);\r
+        foreach ($theme->parametres as $k => $v) {\r
+            $t->addChild($k, $v);\r
+        }\r
+    }\r
+\r
+    public function getThemeForms() {\r
+        global $core;\r
+        $dao = new wsDAOTheme($core->con);\r
+        $theme = $dao->selectById($this->args['theme_id']);\r
+\r
+        foreach ($theme->parametres->getForms() as $name) {\r
+            $f = $this->xml->addChild('form', json_encode($theme->parametres->getForm($name)));\r
+            $f->addAttribute('name', $name);\r
+        }\r
+    }\r
+\r
+    public function getFluidbookForms() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $book = $dao->selectById($this->args['book_id']);\r
+        foreach ($book->parametres->getForms() as $name) {\r
+            $f = $this->xml->addChild('form', html::escapeHTML(json_encode($book->parametres->getForm($name))));\r
+            $f->addAttribute('name', $name);\r
+        }\r
+    }\r
+\r
+    public function saveSettings() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $dao->setSettings($this->args['book_id'], $this->args['settings']);\r
+    }\r
+\r
+    public function setChapters() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $dao->setChapters($this->args['book_id'], $this->args['chapters']);\r
+    }\r
+\r
+    public function getChapters() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $book = $dao->selectById($this->args['book_id']);\r
+        $this->xml->addChild('chapters', html::escapeHTML(json_encode($book->chapters)));\r
+    }\r
+\r
+    public function getLinks() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $book = $dao->selectById($this->args['book_id']);\r
+\r
+        $pages = $dao->getPagesOfBook($this->args['book_id']);\r
+        $nb_pages = count($pages);\r
+        $this->xml->addChild('pages', $nb_pages);\r
+        $this->xml->addChild('numerotation', $book->numerotation);\r
+\r
+        $daoDoc = new wsDAODocument($core->con);\r
+        $firstDoc = $daoDoc->selectById($pages[1]['document_id']);\r
+        $size = $firstDoc->generalInfos['size'];\r
+        $daoDoc->getLinksAndRulers($this->args['book_id'], $links, $rulers);\r
+\r
+        $this->xml->addChild('width', $size[0]);\r
+        $this->xml->addChild('height', $size[1]);\r
+        $this->xml->addChild('links', html::escapeHTML(json_encode($links)));\r
+        $this->xml->addChild('rulers', json_encode($rulers));\r
+\r
+        $daoTheme = new wsDAOTheme($this->con);\r
+        $theme = $daoTheme->getThemeOfBook($this->args['book_id'], true);\r
+\r
+        $specials = array('backgroundImage' => 'background', 'topBar' => 'topbar', 'afterSearch' => 'aftersearch');\r
+\r
+        foreach ($specials as $tparam => $sname) {\r
+            $this->_addSpecialInfos($theme, $tparam, $sname);\r
+        }\r
+    }\r
+\r
+    protected function _addSpecialInfos($theme, $param, $specialName) {\r
+        if ($theme->parametres->$param != '') {\r
+            $themeRoot = WS_THEMES . '/' . $theme->theme_id . '/';\r
+            $dim = getimagesize($themeRoot . $theme->parametres->$param);\r
+            $b = $this->xml->addChild($specialName);\r
+            $b->addChild('width', $dim[0]);\r
+            $b->addChild('height', $dim[1]);\r
+            $b->addChild('url', 'http://' . $_SERVER['HTTP_HOST'] . WEBROOT . '/fluidbook/themes/' . $theme->theme_id . '/' . $theme->parametres->$param);\r
+        }\r
+    }\r
+\r
+    public function saveLinks() {\r
+        global $core;\r
+\r
+        $comments = isset($this->args['comments']) ? $this->args['comments'] : 'Saved from editor';\r
+\r
+        $dao = new wsDAODocument($core->con);\r
+        $dao->setLinksAndRulers($this->args['book_id'], $this->args['links'], $this->args['rulers'], $comments, $core->user->utilisateur_id);\r
+\r
+        $daoBook = new wsDAOBook($core->con);\r
+        $daoBook->setSpecialLinksAndRulers($this->args['book_id'], $this->args['specialLinks'], $this->args['specialRulers']);\r
+\r
+        if (isset($this->args['getLinks'])) {\r
+            $this->getLinks();\r
+        }\r
+    }\r
+\r
+    public function formatSize($val) {\r
+        $str = files::size($val);\r
+        $str = str_replace('.', __(','), $str);\r
+        $str = str_replace('B', __('o'), $str);\r
+        return $str;\r
+    }\r
+\r
+    public function getExtras() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $book = $dao->selectById($this->args['book_id']);\r
+        if ($book->extras != '') {\r
+            $tidy = cubeXML::tidy('<extras>' . $book->extras . '</extras>');\r
+            $tidy = str_replace('<extras>', '', $tidy);\r
+            $tidy = str_replace('</extras>', '', $tidy);\r
+            $tidy = str_replace('<?xml version="1.0"?>', '', $tidy);\r
+            $tidy = trim($tidy);\r
+            $e = explode("\n", $tidy);\r
+            foreach ($e as $k => $v) {\r
+                if (substr($v, 0, 2) == '  ') {\r
+                    $v = substr($v, 2);\r
+                }\r
+                $e[$k] = $v;\r
+            }\r
+\r
+            $extras = implode("\n", $e);\r
+        } else {\r
+            $extras = '';\r
+        }\r
+\r
+        $this->xml->addChild('extras', $extras);\r
+    }\r
+\r
+    public function saveExtras() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $res = $dao->setExtras($this->args['book_id'], $this->args['extras']);\r
+        $this->xml->addChild('ok', $res ? '1' : '0');\r
+    }\r
+\r
+    public function getBookInfos() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $book = $dao->selectById($this->args['book_id']);\r
+        $pages = $dao->getPagesOfBook($this->args['book_id']);\r
+        $daoDoc = new wsDAODocument($core->con);\r
+        $nb_pages = count($pages);\r
+        $this->xml->addChild('pages', $nb_pages);\r
+        $total_size = 0;\r
+        foreach ($pages as $page => $info) {\r
+            $file = WS_DOCS . '/' . $info['document_id'] . '/p' . $info['document_page'] . '.swf';\r
+            $total_size += filesize($file);\r
+        }\r
+        $average_size = $total_size / $nb_pages;\r
+        $total = self::formatSize($total_size);\r
+        $average = self::formatSize($average_size);\r
+        $firstDoc = $daoDoc->selectById($pages[1]['document_id']);\r
+        $size = $firstDoc->generalInfos['size'];\r
+        $this->xml->addChild('width', $size[0]);\r
+        $this->xml->addChild('height', $size[1]);\r
+        $res = __('Nombre de pages') . ' : ' . "\n";\r
+        $res .= $nb_pages . ' ' . __('pages') . "\n";\r
+        $res .= "\n";\r
+        $res .= __('Dimensions') . ' : ' . "\n";\r
+        $res .= round($size[0], 3) . ' x ' . round($size[1], 3) . ' pts' . "\n";\r
+        $res .= "\n";\r
+        $res .= __('Taille totale des pages') . ' : ' . "\n";\r
+        $res .= $total . "\n";\r
+        $res .= "\n";\r
+        $res .= __('Taille moyenne des pages') . ' : ' . "\n";\r
+        $res .= $average . "\n";\r
+        $res .= "\n";\r
+        /* $res .= __('Taille du PDF') . ' : ' . "\n";\r
+          $res .= '7898 Ko' . "\n";\r
+          $res .= "\n";\r
+          $res .= __('Qualité de conversion') . ' : ' . "\n";\r
+          $res .= '150dpi (qualité 85%)' . "\n"; */\r
+        $this->xml->addChild('infos', $res);\r
+    }\r
+\r
+    public function getLangs() {\r
+        global $core;\r
+        if (isset($this->args['book_id'])) {\r
+            $dao = new wsDAOBook($core->con);\r
+            $book = $dao->selectById($this->args['book_id']);\r
+            $book->traductions = wsLang::checkTranslations($book->traductions);\r
+            if ($book->traductions != array()) {\r
+                $bookLang = $this->xml->addChild('book_lang', json_encode($book->traductions));\r
+            }\r
+        }\r
+\r
+        $dao = new wsDAOLang($core->con);\r
+        $langs = $dao->selectAll();\r
+        foreach ($langs as $lang) {\r
+            $nom = cubeLang::getNameByCode($lang->lang_id, $core->user->lang);\r
+            $l = $this->xml->addChild('lang', json_encode($lang->traductions));\r
+            $l->addAttribute('id', $lang->lang_id);\r
+            $l->addAttribute('nom', $nom);\r
+            if (isset($book) && $book->lang == $lang->lang_id) {\r
+                if (!isset($bookLang)) {\r
+                    $l->addAttribute('selected', '1');\r
+                } else {\r
+                    $bookLang->addAttribute('id', $lang->lang_id);\r
+                    $bookLang->addAttribute('nom', $nom . ' (' . __('modifié') . ')');\r
+                    $bookLang->addAttribute('selected', '1');\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    public function saveLang() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $dao->setLang($this->args['book_id'], $this->args['lang_id'], $this->args['traductions']);\r
+    }\r
+\r
+    public function saveComposition() {\r
+        global $core;\r
+        $dao = new wsDAOBook($core->con);\r
+        $dao->setComposition($this->args['book_id'], json_decode($this->args['pages']));\r
+    }\r
+\r
+    public function getTexts() {\r
+        $this->xml->addChild('texts', json_encode($GLOBALS['__l10n']));\r
+    }\r
+\r
+    public function copyLinks() {\r
+        global $core;\r
+        $daoDocument = new wsDAODocument($core->con);\r
+        $daoDocument->copyLinks($this->args['fromDoc'], $this->args['toDoc']);\r
+    }\r
+\r
+    public function compile() {\r
+        global $core;\r
+        wsSecureSWF::checkProtectedSWF();\r
+        $dao = new wsDAOBook($core->con);\r
+        if (!$dao->isUpToDate($this->args['book_id'])) {\r
+            $log = $dao->compile($this->args['book_id'], 3);\r
+            $log = str_replace('&amp;', '&', $log);\r
+            $log = str_replace('&', '&amp;', $log);\r
+            // $this->xml->addChild('log', $log);\r
+        }\r
+        $book = $dao->selectById($this->args['book_id']);\r
+        $viewer = 'viewer';\r
+        if (wsDroits::admin()) {\r
+            $viewer = 'vieweru';\r
+        }\r
+\r
+        $absoluteURL = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $viewer . '/' . $book->book_id . '_' . $book->hash . '_' . TIME . '/';\r
+        $this->xml->addChild('compiledBook', $absoluteURL . 'index.swf?base=' . $absoluteURL);\r
+    }\r
 \r
 }\r
 \r
index dc73c6241c0718e767657095122bdf2a37ddaf3b..eb34d29bb35fa7de64bcfa243a3e8b91a3db2b52 100644 (file)
 \r
 class wsBookParametres extends wsParametres {\r
 \r
-       public function __construct($parent) {\r
-               parent::__construct($parent);\r
-       }\r
+    public function __construct($parent) {\r
+        parent::__construct($parent);\r
+    }\r
 \r
-       /**\r
-        * wsBookParametres::initFields()\r
-        *\r
-        * @return\r
-        */\r
-       protected function initFields() {\r
-               parent::initFields();\r
-               if (is_null($this->parent)) {\r
-                       return;\r
-               }\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
-               // .\r
-               // .\r
-               $this->fields['friend'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Envoyer à un ami'));\r
-               $this->fields['email_title'] = array('type' => 'text', 'default' => __('%name% vous invite à découvrir %title%'), 'editable' => true, 'label' => __("Titre de l'email") . ' "' . __('Envoyer à un ami') . '"');\r
-               $this->fields['email_body'] = array('type' => 'textarea', 'default' => __('Veuillez cliquer sur le lien suivant : %link%'), 'editable' => true, 'label' => __("Corps de l'email") . ' "' . __('Envoyer à un ami') . '"');\r
-               $this->fields['email_editable'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Permettre au lecteur de modifier le corps de l'email"));\r
-               $this->fields['askAcknowledge'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Demander au destinataire un accusé de réception"), 'grade' => 3);\r
-               $this->fields['facebook'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Facebook'));\r
-               $this->fields['facebook_title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre facebook"), 'hint' => __('Titre proposé sur la fonction de partage facebook (par défaut, titre de la publication)'));\r
-               $this->fields['facebook_description'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Description facebook"), 'grade' => 1, 'hint' => __('Description proposée sur la fonction de partage facebook (par défaut, vide)'));\r
-               $this->fields['twitter'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Twitter'));\r
-               $this->fields['twitter_description'] = array('type' => 'textarea', 'default' => '%title% : %short%', 'editable' => true, 'label' => __("Contenu Twitter"), 'hint' => __('Contenu du Twit'));\r
-               $this->forms['share'] = array('label' => __('Fonctions de partage'),\r
-                       'fieldsnames' => array('friend', 'email_title', 'email_body', 'email_editable', 'askAcknowledge', '|',\r
-                               'facebook', 'facebook_title', 'facebook_description', '|',\r
-                               'twitter', 'twitter_description'));\r
-               // .\r
-               $this->fields['pages'] = array('type' => 'integer', 'default' => '', 'editable' => false, 'label' => __('Nombre de pages'));\r
-               $this->fields['width'] = array('type' => 'float', 'default' => '', 'editable' => false, 'label' => __('Largeur'));\r
-               $this->fields['height'] = array('type' => 'float', 'default' => '', 'editable' => false, 'label' => __('Hauteur'));\r
-               // .\r
-               $this->fields['visualisationMode'] = array('type' => 'combo', 'default' => '0', 'editable' => true, 'label' => __("Mode de visualisation 3D"),\r
-                       'datas' => array(__('Mode 3D') => '0',\r
-                               __('Mode 2D (caméra fixe et pages à plat)') => '1',\r
-                               __("Laisser le choix à l'utilisateur (mode 3D par défaut)") => '2',\r
-                               __("Laisser le choix à l'utilisateur (mode 2D par défaut)") => '3'));\r
-               $this->fields['viewMode'] = array('type' => 'combo', 'default' => '3', 'editable' => true, 'label' => __("Mode de visualisation (beta)"),\r
-                       'datas' => array(__('Classique') => '0',\r
-                               __("Diaporama") => '1'), 'grade' => 5);\r
-               $this->fields['pagesBaseAngle'] = array('type' => 'integer', 'default' => '2', 'editable' => true, 'label' => __('Angle de base entre les pages'), 'grade' => 3,\r
-                       'hint' => __("0 : Publication à plat") . "\n" . __('2 : Valeur par défaut'));\r
-               $this->fields['extraXSpace'] = array('type' => 'integer', 'default' => '0', 'editable' => true, 'label' => __('Marge supplémentaire horizontale'), 'grade' => 3);\r
-               $this->fields['extraYSpace'] = array('type' => 'integer', 'default' => '0', 'editable' => true, 'label' => __('Marge supplémentaire verticale'), 'grade' => 3);\r
-               $this->forms['3d_mode'] = array('label' => __('Options de visualisation'),\r
-                       'fieldsnames' => array('visualisationMode', 'pagesBaseAngle', '|', 'extraXSpace', 'extraYSpace', '|', 'viewMode'));\r
+    /**\r
+     * wsBookParametres::initFields()\r
+     *\r
+     * @return\r
+     */\r
+    protected function initFields() {\r
+        parent::initFields();\r
+        if (is_null($this->parent)) {\r
+            return;\r
+        }\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
+        // .\r
+        // .\r
+        $this->fields['friend'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Envoyer à un ami'));\r
+        $this->fields['email_title'] = array('type' => 'text', 'default' => __('%name% vous invite à découvrir %title%'), 'editable' => true, 'label' => __("Titre de l'email") . ' "' . __('Envoyer à un ami') . '"');\r
+        $this->fields['email_body'] = array('type' => 'textarea', 'default' => __('Veuillez cliquer sur le lien suivant : %link%'), 'editable' => true, 'label' => __("Corps de l'email") . ' "' . __('Envoyer à un ami') . '"');\r
+        $this->fields['email_editable'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Permettre au lecteur de modifier le corps de l'email"));\r
+        $this->fields['askAcknowledge'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Demander au destinataire un accusé de réception"), 'grade' => 3);\r
+        $this->fields['facebook'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Facebook'));\r
+        $this->fields['facebook_title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre facebook"), 'hint' => __('Titre proposé sur la fonction de partage facebook (par défaut, titre de la publication)'));\r
+        $this->fields['facebook_description'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Description facebook"), 'grade' => 1, 'hint' => __('Description proposée sur la fonction de partage facebook (par défaut, vide)'));\r
+        $this->fields['twitter'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Twitter'));\r
+        $this->fields['twitter_description'] = array('type' => 'textarea', 'default' => '%title% : %short%', 'editable' => true, 'label' => __("Contenu Twitter"), 'hint' => __('Contenu du Twit'));\r
+        $this->forms['share'] = array('label' => __('Fonctions de partage'),\r
+            'fieldsnames' => array('friend', 'email_title', 'email_body', 'email_editable', 'askAcknowledge', '|',\r
+                'facebook', 'facebook_title', 'facebook_description', '|',\r
+                'twitter', 'twitter_description'));\r
+        // .\r
+        $this->fields['pages'] = array('type' => 'integer', 'default' => '', 'editable' => false, 'label' => __('Nombre de pages'));\r
+        $this->fields['width'] = array('type' => 'float', 'default' => '', 'editable' => false, 'label' => __('Largeur'));\r
+        $this->fields['height'] = array('type' => 'float', 'default' => '', 'editable' => false, 'label' => __('Hauteur'));\r
+        // .\r
+        $this->fields['visualisationMode'] = array('type' => 'combo', 'default' => '0', 'editable' => true, 'label' => __("Mode de visualisation 3D"),\r
+            'datas' => array(__('Mode 3D') => '0',\r
+                __('Mode 2D (caméra fixe et pages à plat)') => '1',\r
+                __("Laisser le choix à l'utilisateur (mode 3D par défaut)") => '2',\r
+                __("Laisser le choix à l'utilisateur (mode 2D par défaut)") => '3'));\r
+        $this->fields['viewMode'] = array('type' => 'combo', 'default' => '3', 'editable' => true, 'label' => __("Mode de visualisation (beta)"),\r
+            'datas' => array(__('Classique') => '0',\r
+                __("Diaporama") => '1'), 'grade' => 5);\r
+        $this->fields['pagesBaseAngle'] = array('type' => 'integer', 'default' => '2', 'editable' => true, 'label' => __('Angle de base entre les pages'), 'grade' => 3,\r
+            'hint' => __("0 : Publication à plat") . "\n" . __('2 : Valeur par défaut'));\r
+        $this->fields['extraXSpace'] = array('type' => 'integer', 'default' => '0', 'editable' => true, 'label' => __('Marge supplémentaire horizontale'), 'grade' => 3);\r
+        $this->fields['extraYSpace'] = array('type' => 'integer', 'default' => '0', 'editable' => true, 'label' => __('Marge supplémentaire verticale'), 'grade' => 3);\r
+        $this->forms['3d_mode'] = array('label' => __('Options de visualisation'),\r
+            'fieldsnames' => array('visualisationMode', 'pagesBaseAngle', '|', 'extraXSpace', 'extraYSpace', '|', 'viewMode'));\r
 \r
-               $this->fields['print'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Activer l'impression"));\r
-               $this->fields['bookmark'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer les marques-pages'));\r
-               $this->fields['fullscreen'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer le mode plein-écran'));\r
-               $this->fields['help'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Activer l'aide"));\r
-               $this->fields['navOrder'] = array('type' => 'textarea', 'default' => 'index, chapters, print, friend, bookmark, pdf, archives, basket, fullscreen, sound, 3d, help', 'editable' => true, 'label' => __('Ordre des icônes dans la nav'), 'grade' => 5);\r
-               $this->forms['general'] = array('label' => __('Fonctionnalités générales'),\r
-                       'fieldsnames' => array('print', 'bookmark', 'fullscreen', 'help', 'navOrder', 'pages', 'width', 'height'));\r
-               // .\r
-               // \r
-               $this->fields['search'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer le moteur de recherche'));\r
-               $this->fields['ignoreSearch'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Mots à ignorer'),\r
-                       'hint' => __('Liste des mots à ignorer séparés par des virgules'), 'grade' => 5);\r
-               $this->forms['search'] = array('label' => __('Moteur de recherche'),\r
-                       'fieldsnames' => array('search', 'ignoreSearch'));\r
+        $this->fields['print'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Activer l'impression"));\r
+        $this->fields['bookmark'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer les marques-pages'));\r
+        $this->fields['fullscreen'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer le mode plein-écran'));\r
+        $this->fields['help'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Activer l'aide"));\r
+        $this->fields['navOrder'] = array('type' => 'textarea', 'default' => 'index, chapters, print, friend, bookmark, pdf, archives, basket, fullscreen, sound, 3d, help', 'editable' => true, 'label' => __('Ordre des icônes dans la nav'), 'grade' => 5);\r
+        $this->forms['general'] = array('label' => __('Fonctionnalités générales'),\r
+            'fieldsnames' => array('print', 'bookmark', 'fullscreen', 'help', 'navOrder', 'pages', 'width', 'height'));\r
+        // .\r
+        // \r
+        $this->fields['search'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer le moteur de recherche'));\r
+        $this->fields['ignoreSearch'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Mots à ignorer'),\r
+            'hint' => __('Liste des mots à ignorer séparés par des virgules'), 'grade' => 5);\r
+        $this->forms['search'] = array('label' => __('Moteur de recherche'),\r
+            'fieldsnames' => array('search', 'ignoreSearch'));\r
 \r
-               $this->fields['soundTheme'] = array('type' => 'combo', 'default' => 'classic', 'editable' => true, 'label' => __("Thème sonore"),\r
-                       'datas' => array(__('Pas de son') => '',\r
-                               __('Classique') => 'classic',\r
-                               __("Papier épais") => 'heavy',\r
-                               __("Papier fin") => 'light'));\r
-               $this->fields['soundOn'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Activer les effets sonores à l'ouverture"));\r
-               $this->forms['sound'] = array('label' => __('Effets sonores'),\r
-                       'fieldsnames' => array('soundTheme', 'soundOn'));\r
-               // .\r
-               $this->fields['preload'] = array('type' => 'integer', 'default' => 16, 'editable' => true, 'label' => __('Nombre de pages à précharger'), 'grade' => 3);\r
-               $this->forms['general_settings'] = array('label' => __('Paramètres généraux'),\r
-                       'fieldsnames' => array('preload'));\r
-               // .\r
-               $this->fields['pdf'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Activer les fonctions de téléchargement"));\r
-               $this->fields['pdfComplex'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Téchargement de PDF avancé'), 'grade' => 3);\r
-               $this->fields['offlineExport'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Téléchargement des versions offline'), 'grade' => 3);\r
-               $this->forms['pdf'] = array('label' => __('Fonction de téléchargement'),\r
-                       'fieldsnames' => array('pdf', 'pdfComplex', 'offlineExport'));\r
-               // .\r
-               $this->fields['zoomMode'] = array('type' => 'combo', 'default' => '0', 'editable' => true, 'label' => __("Mode de zoom"), 'grade' => 5,\r
-                       'datas' => array(__('Normal') => '0',\r
-                               __('Une page') => '1',\r
-                               __('Zoom désactivé') => '2'));\r
-               $this->fields['zoom'] = array('type' => 'integer', 'default' => 200, 'editable' => true, 'label' => __('Zoom par défaut (atteint au clic)'));\r
-               $this->fields['zoomw'] = array('type' => 'integer', 'default' => 300, 'editable' => true, 'label' => __("Zoom maximal (atteint à l'aide de la molette)"));\r
-               $this->forms['zoom'] = array('label' => __('Zoom'),\r
-                       'fieldsnames' => array('zoomMode', '|', 'zoom', 'zoomw'));\r
-               // .\r
-               $this->fields['stats'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer les statistiques Fluidbook'), 'grade' => 3);\r
-               $this->fields['stats_score'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Afficher les scores dans les rapports'), 'grade' => 5);\r
-               $this->fields['googleAnalytics'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Code Google Analytics'), 'size' => 10);\r
-               $this->forms['stats'] = array('label' => __('Statistiques'),\r
-                       'fieldsnames' => array('stats', 'stats_score', '|', 'googleAnalytics'));\r
-               // .\r
-               $swfFilter = new stdClass();\r
-               $swfFilter->name = __('Animation SWF') . ' (*.swf)';\r
-               $swfFilter->extensions = '*.swf';\r
+        $this->fields['soundTheme'] = array('type' => 'combo', 'default' => 'classic', 'editable' => true, 'label' => __("Thème sonore"),\r
+            'datas' => array(__('Pas de son') => '',\r
+                __('Classique') => 'classic',\r
+                __("Papier épais") => 'heavy',\r
+                __("Papier fin") => 'light'));\r
+        $this->fields['soundOn'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Activer les effets sonores à l'ouverture"));\r
+        $this->forms['sound'] = array('label' => __('Effets sonores'),\r
+            'fieldsnames' => array('soundTheme', 'soundOn'));\r
+        // .\r
+        $this->fields['preload'] = array('type' => 'integer', 'default' => 16, 'editable' => true, 'label' => __('Nombre de pages à précharger'), 'grade' => 3);\r
+        $this->forms['general_settings'] = array('label' => __('Paramètres généraux'),\r
+            'fieldsnames' => array('preload'));\r
+        // .\r
+        $this->fields['pdf'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Activer les fonctions de téléchargement"));\r
+        $this->fields['pdfComplex'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Téchargement de PDF avancé'), 'grade' => 3);\r
+        $this->fields['offlineExport'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Téléchargement des versions offline'), 'grade' => 3);\r
+        $this->forms['pdf'] = array('label' => __('Fonction de téléchargement'),\r
+            'fieldsnames' => array('pdf', 'pdfComplex', 'offlineExport'));\r
+        // .\r
+        $this->fields['zoomMode'] = array('type' => 'combo', 'default' => '0', 'editable' => true, 'label' => __("Mode de zoom"), 'grade' => 5,\r
+            'datas' => array(__('Normal') => '0',\r
+                __('Une page') => '1',\r
+                __('Zoom désactivé') => '2'));\r
+        $this->fields['zoom'] = array('type' => 'integer', 'default' => 200, 'editable' => true, 'label' => __('Zoom par défaut (atteint au clic)'));\r
+        $this->fields['zoomw'] = array('type' => 'integer', 'default' => 300, 'editable' => true, 'label' => __("Zoom maximal (atteint à l'aide de la molette)"));\r
+        $this->forms['zoom'] = array('label' => __('Zoom'),\r
+            'fieldsnames' => array('zoomMode', '|', 'zoom', 'zoomw'));\r
+        // .\r
+        $this->fields['stats'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer les statistiques Fluidbook'), 'grade' => 3);\r
+        $this->fields['stats_score'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Afficher les scores dans les rapports'), 'grade' => 5);\r
+        $this->fields['googleAnalytics'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Code Google Analytics'), 'size' => 10);\r
+        $this->forms['stats'] = array('label' => __('Statistiques'),\r
+            'fieldsnames' => array('stats', 'stats_score', '|', 'googleAnalytics'));\r
+        // .\r
+        $swfFilter = new stdClass();\r
+        $swfFilter->name = __('Animation SWF') . ' (*.swf)';\r
+        $swfFilter->extensions = '*.swf';\r
 \r
-               $basketFilter = new stdClass();\r
-               $basketFilter->name = __('Liste de produits') . ' (*.xml)';\r
-               $basketFilter->extensions = '*.xml';\r
+        $basketFilter = new stdClass();\r
+        $basketFilter->name = __('Liste de produits') . ' (*.xml)';\r
+        $basketFilter->extensions = '*.xml';\r
 \r
-               $imageFilter = new stdClass();\r
-               $imageFilter->name = __('Images') . ' (*.jpg, *.png)';\r
-               $imageFilter->extensions = '*.jpg;*.jpeg;*.png';\r
+        $imageFilter = new stdClass();\r
+        $imageFilter->name = __('Images') . ' (*.jpg, *.png)';\r
+        $imageFilter->extensions = '*.jpg;*.jpeg;*.png';\r
 \r
-               $epsFilter = new stdClass();\r
-               $epsFilter->name = __('Fichier vectoriel') . ' (*.ai, *.eps)';\r
-               $epsFilter->extensions = '*.ai;*.eps';\r
+        $epsFilter = new stdClass();\r
+        $epsFilter->name = __('Fichier vectoriel') . ' (*.ai, *.eps)';\r
+        $epsFilter->extensions = '*.ai;*.eps';\r
 \r
-               $this->fields['displayChaptersIcon'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Affiche l'icône du sommaire"), 'grade' => 1);\r
-               $this->fields['chaptersPage'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Faire pointer le sommaire sur la page'), 'grade' => 3, 'hint' => __('Laisser vide pour utiliser le sommaire classique'), 'size' => 5);\r
-               $this->fields['displayChaptersAtStart'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Afficher le sommaire au chargement de la publication"), 'grade' => 3);\r
-               $this->fields['chaptersColumns'] = array('type' => 'integer', 'default' => 1, 'editable' => true, 'label' => __('Afficher le sommaire sur x colonne(s)'), 'grade' => 3);\r
-               $this->fields['chaptersColMaxWidth'] = array('type' => 'integer', 'default' => 300, 'editable' => true, 'label' => __("Largeur max d'une colonne"), 'grade' => 3);\r
-               $this->fields['externalChapters'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
-                       'label' => __('Sommaire personnalisé'), 'grade' => 3, 'fileFilter' => $swfFilter, 'hint' => __('Laisser vide pour utiliser le sommaire classique'));\r
-               $this->fields['fullExternalChapters'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Sommaire totalement personnalisé"), 'grade' => 3, 'hint' => __('Supprime la flèche de fermeture, titre prédéfini et couleur de fond'));\r
-               $this->fields['ongletsXML'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('XML de configuration des onglets'), 'grade' => 5);\r
-               $this->fields['ongletsSWF'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
-                       'label' => __('SWF pour onglets personnalisés'), 'grade' => 3, 'fileFilter' => $swfFilter);\r
-               $this->fields['chaptersPosition'] = array('type' => 'combo', 'default' => 'center', 'editable' => true, 'label' => __("Position du sommaire"),\r
-                       'datas' => array(__('Centré') => 'center',\r
-                               __("Aligné sur l'icône") => 'chaptersIcon'));\r
+        $this->fields['displayChaptersIcon'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Affiche l'icône du sommaire"), 'grade' => 1);\r
+        $this->fields['chaptersPage'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Faire pointer le sommaire sur la page'), 'grade' => 3, 'hint' => __('Laisser vide pour utiliser le sommaire classique'), 'size' => 5);\r
+        $this->fields['displayChaptersAtStart'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Afficher le sommaire au chargement de la publication"), 'grade' => 3);\r
+        $this->fields['chaptersColumns'] = array('type' => 'integer', 'default' => 1, 'editable' => true, 'label' => __('Afficher le sommaire sur x colonne(s)'), 'grade' => 3);\r
+        $this->fields['chaptersColMaxWidth'] = array('type' => 'integer', 'default' => 300, 'editable' => true, 'label' => __("Largeur max d'une colonne"), 'grade' => 3);\r
+        $this->fields['externalChapters'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
+            'label' => __('Sommaire personnalisé'), 'grade' => 3, 'fileFilter' => $swfFilter, 'hint' => __('Laisser vide pour utiliser le sommaire classique'));\r
+        $this->fields['fullExternalChapters'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Sommaire totalement personnalisé"), 'grade' => 3, 'hint' => __('Supprime la flèche de fermeture, titre prédéfini et couleur de fond'));\r
+        $this->fields['ongletsXML'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('XML de configuration des onglets'), 'grade' => 5);\r
+        $this->fields['ongletsSWF'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
+            'label' => __('SWF pour onglets personnalisés'), 'grade' => 3, 'fileFilter' => $swfFilter);\r
+        $this->fields['chaptersPosition'] = array('type' => 'combo', 'default' => 'center', 'editable' => true, 'label' => __("Position du sommaire"),\r
+            'datas' => array(__('Centré') => 'center',\r
+                __("Aligné sur l'icône") => 'chaptersIcon'));\r
 \r
-               $this->forms['sommaire'] = array('label' => __('Sommaire'),\r
-                       'fieldsnames' => array('displayChaptersIcon', 'displayChaptersAtStart', 'chaptersPage', 'chaptersPosition', '|', 'chaptersColMaxWidth', 'chaptersColumns', '|', 'externalChapters', 'fullExternalChapters', '|', 'ongletsSWF', 'ongletsXML'));\r
-               // .\r
-               $this->fields['permanentLinks'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Liens visibles en permanence'), 'grade' => 3);\r
-               $this->forms['multimedia'] = array('label' => __('Liens et multimédia'),\r
-                       'fieldsnames' => array('permanentLinks'));\r
-               // .\r
-               $this->fields['externalArchives'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
-                       'label' => __('Archives'), 'grade' => 3, 'fileFilter' => $swfFilter);\r
+        $this->forms['sommaire'] = array('label' => __('Sommaire'),\r
+            'fieldsnames' => array('displayChaptersIcon', 'displayChaptersAtStart', 'chaptersPage', 'chaptersPosition', '|', 'chaptersColMaxWidth', 'chaptersColumns', '|', 'externalChapters', 'fullExternalChapters', '|', 'ongletsSWF', 'ongletsXML'));\r
+        // .\r
+        $this->fields['permanentLinks'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Liens visibles en permanence'), 'grade' => 3);\r
+        $this->fields['linkBlinkTime'] = array('type' => 'float', 'default' => 1.0, 'editable' => true, 'label' => __("Temps d'apparition du lien à l'ouverture de la page (en secondes)"));\r
+        $this->forms['multimedia'] = array('label' => __('Liens et multimédia'),\r
+            'fieldsnames' => array('permanentLinks', 'linkBlinkTime'));\r
+        // .\r
+        $this->fields['externalArchives'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
+            'label' => __('Archives'), 'grade' => 3, 'fileFilter' => $swfFilter);\r
 \r
-               $this->forms['archives'] = array('label' => __('Archives'),\r
-                       'fieldsnames' => array('externalArchives'));\r
-               // .\r
-               $this->fields['basket'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Panier activé'), 'grade' => 5);\r
-               $this->fields['basketManager'] = array('type' => 'combo', 'default' => 'classic', 'editable' => true, 'label' => __("Manager de panier"),\r
-                       'datas' => array(__('Classic') => 'com.fluidbook.player.basket.BasketManager',\r
-                               __('Essilor') => 'com.fluidbook.player.basket.custom.essilor.EssilorBasketManager',\r
-                               __('Essilor Recap') => 'com.fluidbook.player.basket.cursor.essilorrecap.EssilorRecapBasketManager'), 'grade' => 5);\r
-               $this->fields['basketReferences'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
-                       'label' => __('Références produits'), 'grade' => 5, 'fileFilter' => $basketFilter, 'hint' => __('Fichier contenant les références produits'), 'dir' => 'commerce');\r
-               $this->fields['basketImages'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
-                       'label' => __('Images des produits'), 'grade' => 5, 'fileFilter' => $imageFilter, 'hint' => __('Chaque image doit avoir pour nom exact la référence du produit'),\r
-                       'multiple' => true, 'dir' => 'commerce');\r
-               $this->fields['basketPDFBackground'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
-                       'label' => __('Fond du PDF (bon de commande)'), 'grade' => 5, 'fileFilter' => $epsFilter, 'hint' => __('Fond du bon de commande'), 'dir' => 'commerce');\r
+        $this->forms['archives'] = array('label' => __('Archives'),\r
+            'fieldsnames' => array('externalArchives'));\r
+        // .\r
+        $this->fields['basket'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Panier activé'), 'grade' => 5);\r
+        $this->fields['basketManager'] = array('type' => 'combo', 'default' => 'classic', 'editable' => true, 'label' => __("Manager de panier"),\r
+            'datas' => array(__('Classic') => 'com.fluidbook.player.basket.BasketManager',\r
+                __('Essilor') => 'com.fluidbook.player.basket.custom.essilor.EssilorBasketManager',\r
+                __('Essilor Recap') => 'com.fluidbook.player.basket.cursor.essilorrecap.EssilorRecapBasketManager'), 'grade' => 5);\r
+        $this->fields['basketReferences'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
+            'label' => __('Références produits'), 'grade' => 5, 'fileFilter' => $basketFilter, 'hint' => __('Fichier contenant les références produits'), 'dir' => 'commerce');\r
+        $this->fields['basketImages'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
+            'label' => __('Images des produits'), 'grade' => 5, 'fileFilter' => $imageFilter, 'hint' => __('Chaque image doit avoir pour nom exact la référence du produit'),\r
+            'multiple' => true, 'dir' => 'commerce');\r
+        $this->fields['basketPDFBackground'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
+            'label' => __('Fond du PDF (bon de commande)'), 'grade' => 5, 'fileFilter' => $epsFilter, 'hint' => __('Fond du bon de commande'), 'dir' => 'commerce');\r
 \r
-               $this->forms['basket'] = array('label' => __('Panier'),\r
-                       'fieldsnames' => array('basket', 'basketManager', 'basketReferences', 'basketImages', 'basketPDFBackground'));\r
-               // .\r
-               $this->fields['offlineLink'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __("URL du Fluidbook"), 'hint' => 'URL du fluidbook utilisée pour la version Offline (CD-ROM, clé USB, Exécutables)');\r
-               $this->forms['offline'] = array('label' => __('Version offline'),\r
-                       'fieldsnames' => array('offlineLink'));\r
-               // Paramètres non implémentés\r
-               /*\r
-                 // $this->fields['attachPDFInEmail'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Joindre le fichier PDF de la page en cours à l'email"),  'grade' => 4);\r
-                 // $this->fields['attachmentName'] = array('type' => 'text', 'default' => '', 'editable' => false, 'label' => __('Nom de la pièce jointe'),  'grade' => 4);\r
-                 // $this->fields['addThis'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Identifiant addThis"), 'grade' => 4);\r
-                 // $this->fields['addThisOptions'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Paramètres addThis"), 'grade' => 4);\r
-                 $this->fields['reading_dir'] = array('type' => 'combo',\r
-                 'datas' => array(__('De la gauche vers la droite') => 'ltr', __('De la droite vers la gauche') => 'rtl'),\r
-                 'default' => 'ltr', 'editable' => true, 'label' => __('Sens de lecture'), 'grade' => 3);\r
-                 $this->fields['stats_score'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Affiche le score dans les statistiques'), 'grade' => 3);\r
-                 $this->fields['optimizepdf'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Optimiser le PDF'), 'grade' => 4, 'hint' => "Permet de réduire la taille du document PDF");\r
-                 $this->fields['chaptersPosition'] = array('type' => 'combo',\r
-                 'datas' => array(__('Centré') => 'center' , __("Calé sur l'icône") => 'icon', __('Calé sur la gauche') => 'left'),\r
-                 'default' => 'center', 'editable' => true, 'label' => __('Positionnement du sommaire'), 'grade' => 4);\r
-                 $this->fields['playVideoAtStart'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Jouer les vidéos à l'affichage de la page"),  'grade' => 4);\r
-                 $this->fields['statsWeborama'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Statistiques Weborama'), 'size' => 10,  'grade' => 1);\r
-                 $this->fields['zoomAreas'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Activer le zoom sur les liens ''Plus d'infos''"),  'grade' => 4);\r
-                 // .\r
-                 $this->fields['extraSubMenu'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Sous-menu supplémentaire'),  'grade' => 4);\r
-                 $this->fields['extraSMsizeX'] = array('type' => 'integer', 'default' => '', 'editable' => false, 'label' => __('Largeur du sous-menu supplémentaire'),  'grade' => 4);\r
-                 $this->fields['extraSMsizeY'] = array('type' => 'integer', 'default' => '', 'editable' => false, 'label' => __('Hauteur du sous-menu supplémentaire'),  'grade' => 4);\r
-                 $this->fields['extraName'] = array('type' => 'text', 'default' => '', 'editable' => false, 'label' => __('Nom du sous-menu supplémentaire'),  'grade' => 4);\r
-                 $this->fields['extraFileName'] = array('type' => 'text', 'default' => '', 'editable' => false, 'label' => __('Fichier du sous-menu supplémentaire'),  'grade' => 4);\r
-                 // .\r
-                 $this->fields['backClipName'] = array('type' => 'text', 'default' => '', 'editable' => false, 'label' => __('Fichier du fond animé'),  'grade' => 4);\r
-                 $this->fields['extraXSpace'] = array('type' => 'integer', 'default' => '0', 'editable' => false, 'label' => __('Largeur du décalage des flèches'),  'grade' => 4); */\r
-       }\r
+        $this->forms['basket'] = array('label' => __('Panier'),\r
+            'fieldsnames' => array('basket', 'basketManager', 'basketReferences', 'basketImages', 'basketPDFBackground'));\r
+        // .\r
+        $this->fields['offlineLink'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __("URL du Fluidbook"), 'hint' => 'URL du fluidbook utilisée pour la version Offline (CD-ROM, clé USB, Exécutables)');\r
+        $this->forms['offline'] = array('label' => __('Version offline'),\r
+            'fieldsnames' => array('offlineLink'));\r
+        // Paramètres non implémentés\r
+        /*\r
+          // $this->fields['attachPDFInEmail'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Joindre le fichier PDF de la page en cours à l'email"),  'grade' => 4);\r
+          // $this->fields['attachmentName'] = array('type' => 'text', 'default' => '', 'editable' => false, 'label' => __('Nom de la pièce jointe'),  'grade' => 4);\r
+          // $this->fields['addThis'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Identifiant addThis"), 'grade' => 4);\r
+          // $this->fields['addThisOptions'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Paramètres addThis"), 'grade' => 4);\r
+          $this->fields['reading_dir'] = array('type' => 'combo',\r
+          'datas' => array(__('De la gauche vers la droite') => 'ltr', __('De la droite vers la gauche') => 'rtl'),\r
+          'default' => 'ltr', 'editable' => true, 'label' => __('Sens de lecture'), 'grade' => 3);\r
+          $this->fields['stats_score'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Affiche le score dans les statistiques'), 'grade' => 3);\r
+          $this->fields['optimizepdf'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Optimiser le PDF'), 'grade' => 4, 'hint' => "Permet de réduire la taille du document PDF");\r
+          $this->fields['chaptersPosition'] = array('type' => 'combo',\r
+          'datas' => array(__('Centré') => 'center' , __("Calé sur l'icône") => 'icon', __('Calé sur la gauche') => 'left'),\r
+          'default' => 'center', 'editable' => true, 'label' => __('Positionnement du sommaire'), 'grade' => 4);\r
+          $this->fields['playVideoAtStart'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Jouer les vidéos à l'affichage de la page"),  'grade' => 4);\r
+          $this->fields['statsWeborama'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Statistiques Weborama'), 'size' => 10,  'grade' => 1);\r
+          $this->fields['zoomAreas'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Activer le zoom sur les liens ''Plus d'infos''"),  'grade' => 4);\r
+          // .\r
+          $this->fields['extraSubMenu'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Sous-menu supplémentaire'),  'grade' => 4);\r
+          $this->fields['extraSMsizeX'] = array('type' => 'integer', 'default' => '', 'editable' => false, 'label' => __('Largeur du sous-menu supplémentaire'),  'grade' => 4);\r
+          $this->fields['extraSMsizeY'] = array('type' => 'integer', 'default' => '', 'editable' => false, 'label' => __('Hauteur du sous-menu supplémentaire'),  'grade' => 4);\r
+          $this->fields['extraName'] = array('type' => 'text', 'default' => '', 'editable' => false, 'label' => __('Nom du sous-menu supplémentaire'),  'grade' => 4);\r
+          $this->fields['extraFileName'] = array('type' => 'text', 'default' => '', 'editable' => false, 'label' => __('Fichier du sous-menu supplémentaire'),  'grade' => 4);\r
+          // .\r
+          $this->fields['backClipName'] = array('type' => 'text', 'default' => '', 'editable' => false, 'label' => __('Fichier du fond animé'),  'grade' => 4);\r
+          $this->fields['extraXSpace'] = array('type' => 'integer', 'default' => '0', 'editable' => false, 'label' => __('Largeur du décalage des flèches'),  'grade' => 4); */\r
+    }\r
 \r
 }\r
 \r
index db68cf141924d37fd400b3ea6286cecbe9f6f21f..fb9e444b092ea9bb5026bf806b51a7d8ce9931d9 100644 (file)
@@ -561,7 +561,7 @@ class wsDocument extends cubeMetier {
                return $this->autocrop || $this->manualcrop || $this->autocut || $this->manualcut;\r
        }\r
 \r
-       public function makeSWFFiles($page, $resolution = null, $quality = null, $storeAllChars = null, $maxObjects = 1800, $method = null) {\r
+       public function makeSWFFiles($page, $resolution = null, $quality = null, $storeAllChars = null, $maxObjects = null, $method = null) {\r
                $conversionSettings = $this->conversionInfos->pages[$page];\r
                if (is_null($storeAllChars)) {\r
                        $storeAllChars = true;\r