]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 6 Jan 2011 14:50:44 +0000 (14:50 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 6 Jan 2011 14:50:44 +0000 (14:50 +0000)
inc/ws/Controlleur/class.ws.conversion.session.php
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Metier/class.ws.document.php

index cda50adcbc7429616f23f40826eaf5b745d34499..933340ca895aecfe3d9a2c496f41b1adf0ccbd6d 100644 (file)
@@ -43,7 +43,6 @@ class wsConversionSession {
                $docs = $dao->selectInList($this->documentsId);\r
 \r
                foreach($docs as $doc) {\r
-                       trigger_error($doc->document_id);\r
                        $this->documents[$doc->document_id] = $doc;\r
                }\r
                $inited = true;\r
@@ -63,26 +62,18 @@ class wsConversionSession {
                $dao = new wsDAODocument($core->con);\r
                $daobook = new wsDAOBook($core->con);\r
 \r
-               trigger_error(count($this->documents));\r
-\r
                foreach($this->documents as $doc) {\r
+                       $this->currentDoc = $doc;\r
+                       $this->serialize();\r
+                       if (!$this->reload) {\r
+                               $this->currentDoc->globalOperations();\r
+                       }\r
                        if ($this->documentsPages[$doc->document_id] == 'all') {\r
                                $docPages = range(1, $doc->generalInfos['pages']);\r
-                               $range = null;\r
-                               $onlyTexts = false;\r
                        } else {\r
                                $docPages = $this->documentsPages[$doc->document_id];\r
-                               $range = array();\r
-                               foreach($docPages as $p) {\r
-                                       $range[] = $p;\r
-                               }\r
-                               $range = implode(',', $range);\r
-                               $onlyTexts = true;\r
                        }\r
 \r
-                       $this->currentDoc = $doc;\r
-                       $this->serialize();\r
-                       $this->currentDoc->globalOperations($range, $onlyTexts);\r
                        $this->updateCountPages();\r
                        $this->currentDoc = $dao->updateFromObject($this->currentDoc);\r
 \r
@@ -90,7 +81,7 @@ class wsConversionSession {
                                $this->currentDocPage = $i + 1;\r
                                $this->totalDocPage = count($docPages);\r
                                $this->setProgress(($this->processedPages / $this->totalPages) * 100);\r
-                               $this->currentDoc->processOnePage($page, false);\r
+                               $this->currentDoc->processOnePage($page, true);\r
                                $this->processedPages++;\r
                        }\r
                        $doc = $dao->updateFromObject($doc);\r
index ffffb63bd16dd9b5dba37a79e852fc5510eaac1a..eb3a3d35a7bd98863cbda6a68f391219c560da60 100644 (file)
@@ -52,6 +52,7 @@ class wsFlash extends cubeFlashGateway {
                        $li->creationDate = $this->args['creationDate'];\r
                        $li->modificationDate = $this->args['modificationDate'];\r
                        $data['localInfos'] = $li;\r
+                       file_put_contents(CACHE . '/debug.txt', print_r($this->args, true));\r
                        $data['conversionInfos'] = new wsDocumentConversionInfos($this->args['resolution'], $this->args['method'], $this->args['quality'], $this->args['objects']);\r
                        $document = $dao->sauve($data);\r
                        $document->copyOriginal($infos['tmp_name']);\r
@@ -65,7 +66,7 @@ class wsFlash extends cubeFlashGateway {
        {\r
                $_SESSION['conversionSession'] = array();\r
                $_SESSION['conversionSession'][$this->args['document_id']] = 'all';\r
-               $_SESSION['conversionSessionReload'] = true;\r
+               $_SESSION['conversionSessionReload'] = false;\r
        }\r
 \r
        public function reload()\r
@@ -200,6 +201,11 @@ class wsFlash extends cubeFlashGateway {
                $r = $core->con->select($sql);\r
                while ($r->fetch()) {\r
                        $k = array_search($r->localHash, $hash);\r
+\r
+                       if (!file_exists(WS_DOCS . '/' . $r->document_id . '/original.pdf')) {\r
+                               continue;\r
+                       }\r
+\r
                        $al[$k] = true;\r
                        $f = $alreadyLoaded->addChild('file', $this->args['fileName'][$k]);\r
                        $f->addAttribute('document_id', $r->document_id);\r
@@ -223,7 +229,11 @@ class wsFlash extends cubeFlashGateway {
                $defaultNum = array();\r
                foreach($pages as $page => $info) {\r
                        $file = WS_DOCS . '/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg';\r
+                       if (!file_exists($file)) {\r
+                               continue;\r
+                       }\r
                        $dim = getimagesize($file);\r
+\r
                        $pa = $p->addChild('page');\r
                        $pa->addAttribute('page', $page);\r
                        $pa->addAttribute('document_id', $info['document_id']);\r
index 3959590c9872aa46b81d3ba24d380c9ad8fc2c14..0737e39c8b05b2e2b9ad32a8b37446ab6ea5f286 100644 (file)
@@ -214,13 +214,13 @@ class wsDocument extends cubeMetier {
                return $this->generalInfos['pages'];\r
        }\r
 \r
-       public function globalOperations($range = null, $onlyTexts = false)\r
+       public function globalOperations()\r
        {\r
                $this->getInfos();\r
                if ($this->CropAndCut()) {\r
                        $this->getInfos($this->cropped, true);\r
                }\r
-               $this->getLinksAndTexts($range, $onlyTexts);\r
+               $this->getLinksAndTexts();\r
        }\r
 \r
        public function CropAndCut()\r
@@ -278,7 +278,8 @@ class wsDocument extends cubeMetier {
        public function processOnePage($page, $force = true)\r
        {\r
                // $this->makeRealShot($page);\r
-               if ($force || $this) {\r
+               if ($force) {\r
+                       $this->addToLog('Processing page #' . $page);\r
                        $this->makeMiniShot($page);\r
                        $this->makeSWFFiles($page);\r
                }\r
@@ -298,18 +299,13 @@ class wsDocument extends cubeMetier {
                }\r
        }\r
 \r
-       public function getLinksAndTexts($range, $onlyTexts = false)\r
+       public function getLinksAndTexts()\r
        {\r
                $fwstk = new cubeCommandLine('fwstk');\r
                $fwstk->setPath(CONVERTER_PATH);\r
                $fwstk->setArg('--input ' . $this->cropped);\r
                $fwstk->setArg('--extractTexts ' . $this->out . '%s%d.txt');\r
-               if (!$onlyTexts) {\r
-                       $fwstk->setArg('--extractLinks ' . $this->out . 'p%d.csv');\r
-               }\r
-               if (!is_null($range)) {\r
-                       $fwstk->setArg('--range ' . $range);\r
-               }\r
+               $fwstk->setArg('--extractLinks ' . $this->out . 'p%d.csv');\r
                $fwstk->execute();\r
                $this->addToLog($fwstk);\r
 \r