From: vincent@cubedesigners.com Date: Fri, 28 Jan 2011 10:16:30 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1a32fd14a8813137bd33553cc2fa99e8cf432ca5;p=cubeextranet.git --- diff --git a/importWs.php b/importWs.php index 79222b71d..97161ea67 100644 --- a/importWs.php +++ b/importWs.php @@ -24,6 +24,7 @@ try { touch(ROOT . '/cache/DB_TODO'); $core->dbSync(); + cubeDb::mysqlConvert($core->con); $grades = array(0 => 1, 0.4 => 1, '0.4' => 1, 0.5 => 1, '0.5' => 1, 1 => 1, 2 => 2, 3 => 3, 4 => 5); @@ -309,11 +310,7 @@ try { while ($r->fetch()) { $c = $core->con->openCursor('documents'); $c->document_id = $r->did; - $c->file = $r->file; - $c->proprietaire = getWsUser($r->uid); $c->pages = $r->pages; - $c->trim = $r->trim; - $c->date = $r->date; $c->version = 1; $c->insert(); // TODO Copie des fichiers @@ -345,7 +342,7 @@ try { $c->lang = substr(getLangCode($r->lang), 0, 2); $c->theme = $r->tid; if (strlen($r->lang) > 2) { - $c->traductions = json_encode($allTrads[$r->lang]); + $c->traductions = json_encode($allTrads[mb_strtolower($r->lang)]); } else { $c->traductions = ''; } @@ -356,7 +353,6 @@ try { $c->compteur_visites = 20; $c->date = $r->date; $parametres = new wsBookParametres(new stdClass()); - $r->signature = $signatures[$r->tid]; $parametres->fromRecord($r); $xml = @simplexml_load_string('' . $r->extras . ''); @@ -365,6 +361,22 @@ try { } else { fb('error on extras (Fluidbook # ' . $r->bid); } + + $n = array(); + // Pages sans numéro + $offset = $r->first_page_nr-1; + for($i = 0;$i < $offset;$i++) { + $n[] = ''; + } + // Pages avec numero + for($j = 1;$j + $offset <= $r->pages;$j++) { + $n[] = $j; + } + $c->numerotation = implode(',', $n); + + $parametres->signature = $signatures[$r->tid]; + $parametres->title = $r->titre; + $parametres->visualisationMode = '0'; $c->parametres = serialize($parametres); $c->insert(); } diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index f35d5774f..35b87c7ad 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -360,9 +360,29 @@ class wsDAOBook extends commonDAO { public function setLang($book_id, $base, $traductions) { + // Cleanup user translations + $traductions = json_decode($traductions, true); + foreach($traductions as $k => $v) { + $traductions[$k] = trim($v); + } + + $daoLang = new wsDAOLang($this->con); + $lang = $daoLang->selectById($base); + // Cleanup base translations + $baseTraductions = $lang->traductions; + foreach($baseTraductions as $k => $v) { + $baseTraductions[$k] = trim($v); + } + // Then compare them. If there is no differences, we don't save translations in the book + if ($traductions == $baseTraductions) { + $t = ''; + } else { + $t = json_encode($traductions); + } + $c = $this->con->openCursor('books'); $c->lang = $base; - $c->traductions = json_encode(json_decode($traductions, true)); + $c->traductions = $t; $c->changedate = TIME; $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } @@ -564,7 +584,9 @@ class wsDAOBook extends commonDAO { $flexLight->addVariable('datas', $book->parametres->toStandardObject(), false, true, 'JSONObject'); $flexLight->addVariable('id', $book_id, false, true, 'uint'); - $flex->addVariable('traductions', $book->traductions, false, true, 'JSONObject'); + $traductions = (!count($book->traductions))?$lang->traductions:$book->traductions; + + $flex->addVariable('traductions', $traductions, false, true, 'JSONObject'); $flex->addVariable('chapters', $book->chapters, false, true, 'JSONObject'); $flex->addVariable('extras', '' . $book->extras . '', false, true, 'XML'); $flex->addVariable('numerotation', $book->numerotation, false, true, 'String'); diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index a9bbc33de..4f2ffffb7 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -46,7 +46,7 @@ class wsBookParametres extends wsParametres { $this->fields['width'] = array('type' => 'float', 'default' => '', 'editable' => false, 'label' => __('Largeur'), 'extra' => false, 'grade' => 0); $this->fields['height'] = array('type' => 'float', 'default' => '', 'editable' => false, 'label' => __('Hauteur'), 'extra' => false, 'grade' => 0); // . - $this->fields['visualisationMode'] = array('type' => 'combo', 'default' => '3', 'editable' => true, 'label' => __("Mode de visualisation"), 'extra' => false, 'grade' => 1, + $this->fields['visualisationMode'] = array('type' => 'combo', 'default' => '0', 'editable' => true, 'label' => __("Mode de visualisation"), 'extra' => false, 'grade' => 1, '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', diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 33361c30f..3e3fb2556 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -361,7 +361,7 @@ class wsDocument extends cubeMetier { public function makeMiniShot($page) { - $this->makeShotFixedWidth($page, 'p', 100, 90, 4, 'GS'); + $this->makeShotFixedWidth($page, 'p', 100, 90, 4, 'PNM'); } public function makeRealShot($page) @@ -432,7 +432,7 @@ class wsDocument extends cubeMetier { // Device $gs->setArg('-sDEVICE=jpeg'); // Dispotion & colors - $gs->setArg('-dUseCIEColor'); + // $gs->setArg('-dUseCIEColor'); $gs->setArg('-dAutoRotatePages=/None'); $gs->setArg('-dUseCropBox'); // Resolution & Quality @@ -465,12 +465,10 @@ class wsDocument extends cubeMetier { $pdftoppm->setArg('f', $page); $pdftoppm->setArg('l', $page); + $pdftoppm->setArg('-cropbox'); $pdftoppm->setArg('-freetype yes'); $pdftoppm->setArg('-aa ' . $antialiasing); $pdftoppm->setArg('-aaVector ' . $antialiasing); - if (!WINDOWS) { - $pdftoppm->setArg('-t1lib yes'); - } $pdftoppm->setArg('r', $resolution); $pdftoppm->setArg(null, $in); $pdftoppm->setArg(null, $this->out . 'ppm');