From: vincent@cubedesigners.com Date: Thu, 6 Jan 2011 14:50:44 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=30939524991536b59f5ca394e5234a7348d65858;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.conversion.session.php b/inc/ws/Controlleur/class.ws.conversion.session.php index cda50adcb..933340ca8 100644 --- a/inc/ws/Controlleur/class.ws.conversion.session.php +++ b/inc/ws/Controlleur/class.ws.conversion.session.php @@ -43,7 +43,6 @@ class wsConversionSession { $docs = $dao->selectInList($this->documentsId); foreach($docs as $doc) { - trigger_error($doc->document_id); $this->documents[$doc->document_id] = $doc; } $inited = true; @@ -63,26 +62,18 @@ class wsConversionSession { $dao = new wsDAODocument($core->con); $daobook = new wsDAOBook($core->con); - trigger_error(count($this->documents)); - foreach($this->documents as $doc) { + $this->currentDoc = $doc; + $this->serialize(); + if (!$this->reload) { + $this->currentDoc->globalOperations(); + } if ($this->documentsPages[$doc->document_id] == 'all') { $docPages = range(1, $doc->generalInfos['pages']); - $range = null; - $onlyTexts = false; } else { $docPages = $this->documentsPages[$doc->document_id]; - $range = array(); - foreach($docPages as $p) { - $range[] = $p; - } - $range = implode(',', $range); - $onlyTexts = true; } - $this->currentDoc = $doc; - $this->serialize(); - $this->currentDoc->globalOperations($range, $onlyTexts); $this->updateCountPages(); $this->currentDoc = $dao->updateFromObject($this->currentDoc); @@ -90,7 +81,7 @@ class wsConversionSession { $this->currentDocPage = $i + 1; $this->totalDocPage = count($docPages); $this->setProgress(($this->processedPages / $this->totalPages) * 100); - $this->currentDoc->processOnePage($page, false); + $this->currentDoc->processOnePage($page, true); $this->processedPages++; } $doc = $dao->updateFromObject($doc); diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index ffffb63bd..eb3a3d35a 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -52,6 +52,7 @@ class wsFlash extends cubeFlashGateway { $li->creationDate = $this->args['creationDate']; $li->modificationDate = $this->args['modificationDate']; $data['localInfos'] = $li; + file_put_contents(CACHE . '/debug.txt', print_r($this->args, true)); $data['conversionInfos'] = new wsDocumentConversionInfos($this->args['resolution'], $this->args['method'], $this->args['quality'], $this->args['objects']); $document = $dao->sauve($data); $document->copyOriginal($infos['tmp_name']); @@ -65,7 +66,7 @@ class wsFlash extends cubeFlashGateway { { $_SESSION['conversionSession'] = array(); $_SESSION['conversionSession'][$this->args['document_id']] = 'all'; - $_SESSION['conversionSessionReload'] = true; + $_SESSION['conversionSessionReload'] = false; } public function reload() @@ -200,6 +201,11 @@ class wsFlash extends cubeFlashGateway { $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); @@ -223,7 +229,11 @@ class wsFlash extends cubeFlashGateway { $defaultNum = array(); foreach($pages as $page => $info) { $file = WS_DOCS . '/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg'; + if (!file_exists($file)) { + continue; + } $dim = getimagesize($file); + $pa = $p->addChild('page'); $pa->addAttribute('page', $page); $pa->addAttribute('document_id', $info['document_id']); diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 3959590c9..0737e39c8 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -214,13 +214,13 @@ class wsDocument extends cubeMetier { return $this->generalInfos['pages']; } - public function globalOperations($range = null, $onlyTexts = false) + public function globalOperations() { $this->getInfos(); if ($this->CropAndCut()) { $this->getInfos($this->cropped, true); } - $this->getLinksAndTexts($range, $onlyTexts); + $this->getLinksAndTexts(); } public function CropAndCut() @@ -278,7 +278,8 @@ class wsDocument extends cubeMetier { public function processOnePage($page, $force = true) { // $this->makeRealShot($page); - if ($force || $this) { + if ($force) { + $this->addToLog('Processing page #' . $page); $this->makeMiniShot($page); $this->makeSWFFiles($page); } @@ -298,18 +299,13 @@ class wsDocument extends cubeMetier { } } - public function getLinksAndTexts($range, $onlyTexts = false) + public function getLinksAndTexts() { $fwstk = new cubeCommandLine('fwstk'); $fwstk->setPath(CONVERTER_PATH); $fwstk->setArg('--input ' . $this->cropped); $fwstk->setArg('--extractTexts ' . $this->out . '%s%d.txt'); - if (!$onlyTexts) { - $fwstk->setArg('--extractLinks ' . $this->out . 'p%d.csv'); - } - if (!is_null($range)) { - $fwstk->setArg('--range ' . $range); - } + $fwstk->setArg('--extractLinks ' . $this->out . 'p%d.csv'); $fwstk->execute(); $this->addToLog($fwstk);