From: vincent@cubedesigners.com Date: Mon, 4 Apr 2011 14:17:44 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=e558937c69382ee472dfdfe3f2f81cb2cd97e215;p=cubeextranet.git --- diff --git a/fluidbook/tools/fwstk.jar b/fluidbook/tools/fwstk.jar index 8e038c66c..84245969a 100644 Binary files a/fluidbook/tools/fwstk.jar and b/fluidbook/tools/fwstk.jar differ diff --git a/inc/ws/Controlleur/class.ws.conversion.session.php b/inc/ws/Controlleur/class.ws.conversion.session.php index 6719eb66a..8662d1b51 100644 --- a/inc/ws/Controlleur/class.ws.conversion.session.php +++ b/inc/ws/Controlleur/class.ws.conversion.session.php @@ -89,7 +89,8 @@ class wsConversionSession { $this->serialize(); if (!$this->reload) { $this->currentDoc->globalOperations(); - $dao->putLinksFromCSV($this->currentDoc->document_id); + $log=$dao->putLinksFromCSV($this->currentDoc->document_id); + $this->currentDoc->addToLog($log); } else if ($this->documentsPages[$doc->document_id] == 'all') { $this->currentDoc->globalOperations(); } diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 3f436505f..ca43df93a 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -460,7 +460,7 @@ html{height:100%}' . "\n"; $res .= ''; $res .= ''; - $res .= cubeMedia::flash2('index.swf', '100%', '100%', $fv, 'fluidbook','', 10, '#' . $theme->parametres->loadingBackColor, $alt, 'true', 'noscale', 'gpu', array('allowScriptAccess' => 'always')); + $res .= cubeMedia::flash2('index.swf', '100%', '100%', $fv, 'fluidbook', '', 10, '#' . $theme->parametres->loadingBackColor, $alt, 'true', 'noscale', 'gpu', array('allowScriptAccess' => 'always')); $js = array($webcompile . 'fluidbook.js'); $jsvar = array(); @@ -578,11 +578,21 @@ html{height:100%}' . "\n"; // cubePHP::neverStop(); $dao = new wsDAOBook($core->con); header('Content-type: text/plain'); - ob_clean(); echo $dao->compile($args[1], 3, isset($args[2])); exit; } + public static function testLinksCSV($args) + { + global $core; + commonDroits::min(5); + + $dao=new wsDAODocument($core->con); + header('Content-type: text/plain'); + ob_clean(); + echo $dao->putLinksFromCSV($args[1]); + } + protected static function checkDocumentVersionOfBook($book_id) { global $core; diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 3fb6b3da2..ef22f10fd 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -635,23 +635,34 @@ class wsDAOBook extends commonDAO { $flex->addVariable('numerotation', $book->numerotation, false, true, 'String'); $flexLight->addVariable('theme', $theme->parametres->toStandardObject(), false, true, 'JSONObject'); $flexLight->addVariable('pages', $book->parametres->pages); - $flexLight->addVariable('fwidth', round($size[0],4), false, true, 'Number'); - $flexLight->addVariable('fheight', round($size[1],4), false, true, 'Number'); + $flexLight->addVariable('fwidth', round($size[0], 4), false, true, 'Number'); + $flexLight->addVariable('fheight', round($size[1], 4), false, true, 'Number'); $flexLight->addVariable('pagesInDatas', $complete, false, true, 'Boolean'); $flex->addVariable('index', $index, false, true, 'JSONObject'); $flex->addVariable('textes', $textes, false, true, 'JSONObject'); + + fb($pages); + foreach($pages as $i => $infos) { - $swffile = WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.swf'; + $base = WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page']; + $swffile = $base . '.swf'; if (file_exists($swffile)) { $fsize = filesize($swffile); } else { $fsize = 0; } + + if ($complete) { + $flex->addSWF($swffile, 'page' . $i); + } else { + $filesToCopy['data/p' . $i. '.swf'] = $swffile; + } + if ($i == 1) { - $flexLight->addBitmap(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', 'thumb1'); + $flexLight->addBitmap($base . '.jpg', 'thumb1'); $flexLight->addVariable('size_p_' . $i, $fsize, false, true, 'Number'); } else { - $flex->addBitmap(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', 'thumb' . $i); + $flex->addBitmap($base . '.jpg', 'thumb' . $i); $flexLight->addVariable('size_p_' . $i, $fsize, false, true, 'Number'); } } @@ -663,18 +674,6 @@ class wsDAOBook extends commonDAO { $flex->addSound(WS_SOUNDS . '/' . $book->parametres->soundTheme . '/page-flip-2.mp3', 'soundPage1'); $flex->addSound(WS_SOUNDS . '/' . $book->parametres->soundTheme . '/cover-flip.mp3', 'soundCover0'); } - - if ($complete) { - foreach($pages as $i => $infos) { - $swffile = WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.swf'; - $flex->addSWF($swffile, 'page' . $i); - } - } else { - foreach($pages as $i => $infos) { - $swffile = WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.swf'; - $filesToCopy['data/p' . $infos['document_page'] . '.swf'] = $swffile; - } - } // Theme assets $themeRoot = WS_THEMES . '/' . $theme->theme_id . '/'; diff --git a/inc/ws/DAO/class.ws.dao.document.php b/inc/ws/DAO/class.ws.dao.document.php index 9b2bf4c4f..60c95ec4f 100644 --- a/inc/ws/DAO/class.ws.dao.document.php +++ b/inc/ws/DAO/class.ws.dao.document.php @@ -20,6 +20,7 @@ class wsDAODocument extends commonDAO { public function putLinksFromCSV($document_id) { + $log = array('Copie des liens du PDF vers la base de données'); $document = $this->selectById($document_id); $booleans = array('video_loop', 'video_auto_start', 'video_controls', 'video_sound_on'); @@ -32,9 +33,14 @@ class wsDAODocument extends commonDAO { for($page = 1;$page <= $document->generalInfos['pages'];$page++) { $csv = WS_DOCS . '/' . $document->document_id . '/p' . $page . '.csv'; if (!file_exists($csv)) { + $log[] = 'Links file of page ' . $page . ' not found'; continue; } - $c->update = filemtime($csv); + + $log[] = 'Links file of page ' . $page . ' found'; + + $c->update = TIME; + $c->document_page = $page; $fp = fopen($csv, 'rb'); $links = array(); while (true) { @@ -55,7 +61,7 @@ class wsDAODocument extends commonDAO { if (in_array($k, $booleans)) { $link[$col] = ($line[$k] == '1'); } else { - $link[$col] = $line[$k]; + $link[$col] = utf8_encode($line[$k]); } } else { $link[$col] = $default; @@ -65,9 +71,19 @@ class wsDAODocument extends commonDAO { $link['page'] = $page; $links[] = $link; } - $c->links = json_encode($links); - $c->insert(); + $json = json_encode($links); + $c->links = $json; + try { + $c->insert(); + } + catch(Exception $e) { + fb($e); + } + + $log[] = 'Added ' . count($links) . ' links'; } + + return implode("\n", $log); } public function setLinksAndRulers($book_id, $links, $rulers) @@ -125,29 +141,6 @@ class wsDAODocument extends commonDAO { $xml = simplexml_load_file('http://ws.fluidbook.com/books/' . $book_id . '/data/links.xml'); $links = $xml->xpath('//oneLink'); - /*res.type = type; - res.page = page; - if (page == 0 && rect.x=pageWidth && page!=totalPages){ - res.left = rect.x-pageWidth; - res.page++; - }else { - res.left = rect.x; - } - res.top = rect.y; - res.width = rect.width; - res.height = rect.height; - res.to = to; - res.target = target; - res.video_loop = video_loop; - res.video_auto_start = video_auto_start; - res.video_controls = video_controls; - res.video_sound_on = video_sound_on; - res.infobulle = infobulle; - res.numerotation = numerotation;*/ - $res = array(); $lpages = array(); foreach($links as $l) { @@ -238,7 +231,7 @@ class wsDAODocument extends commonDAO { $rulers = array(); $sql = 'SELECT *,CONCAT(document_id,\',\',document_page) AS doc_page FROM document_links WHERE (document_id,document_page) IN(' . implode(',', $couples) . ') ORDER BY `update` DESC, FIELD(doc_page,' . implode(',', $couples_order) . ') LIMIT ' . count($pages); - fb($sql); + $r = $this->con->select($sql); $i = 1; while ($r->fetch()) { diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 1b1082a8a..b9cfc2df8 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -132,7 +132,7 @@ class wsDocument extends cubeMetier { $ttf2eot->setPath(CONVERTER_PATH); $ttf2eot->setManualArg('< ' . $this->out . '/fonts/web/' . $fname . '.ttf'); $ttf2eot->execute(); - $this->addToLog($ttf2eot); + $this->addToLog($ttf2eot,false); } else { $fontforge = new cubeCommandLine('convert.pe'); $fontforge->setPath(CONVERTER_PATH);