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