From: vincent@cubedesigners.com Date: Mon, 22 Feb 2010 12:23:16 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=a3fad93ee7953ba3e3f4396f65efc355784ea886;p=cubeextranet.git --- diff --git a/inc/extranet/Controlleur/class.ws.conversion.session.php b/inc/extranet/Controlleur/class.ws.conversion.session.php index e90602574..89a990b18 100644 --- a/inc/extranet/Controlleur/class.ws.conversion.session.php +++ b/inc/extranet/Controlleur/class.ws.conversion.session.php @@ -1,9 +1,13 @@ documents = $documents; + $this->documentsId = $documents; } - public function process() + public function initDocuments() { - for($i = 1;$i <= 100;$i++) { - cubePHP::sleep(0.1); - $i++; + global $core; + + $dao = new wsDAODocument($core->con); + $this->documents = $dao->selectInList($this->documentsId); + $this->totalPages = 0; + + foreach($this->documents as $doc) { + $this->totalPages += $doc->getPagesNumber; } } + public function process() + { + $this->processing = true; + $this->initDocuments(); + + $this->complete = true; + $this->processing = false; + } + public function getProgress() { return $this->progress; @@ -56,7 +74,7 @@ class wsConversionSession { public static function getCachePath($guid) { - return CACHE . '/conversionSessions/' . $guid; + return CACHE . '/conversionSessions/' . $guid . '.obj'; } } diff --git a/inc/extranet/Controlleur/class.ws.flash.php b/inc/extranet/Controlleur/class.ws.flash.php index 7d1268077..05f60190d 100644 --- a/inc/extranet/Controlleur/class.ws.flash.php +++ b/inc/extranet/Controlleur/class.ws.flash.php @@ -71,11 +71,15 @@ class wsFlash extends cubeFlashGateway { $_SESSION['sessionConversionGUID'] = $sessionConversionGUID = uniqid('conversion_', true); $session = new wsConversionSession($sessionConversionGUID); $session->setDocuments($_SESSION['conversionSession']); - $conversion->serialize(); + $session->serialize(); $http = new cubeHTTP($_SERVER['HTTP_HOST']); - $http->setDataTimeout(3); - $http->post('/flash/processConversionSessionAsync', array('user_email' => $_SESSION['user_email'], 'user_password' => $_SESSION['user_password'], 'sessionConversionGUID' => $sessionConversionGUID)); + $http->setDataTimeout(1); + try { + $http->post('/flash/processConversionSessionAsync', array('user_email' => $_SESSION['user_email'], 'user_password' => $_SESSION['user_password'], 'sessionConversionGUID' => $sessionConversionGUID)); + } + catch(Exception $e) { + } } public function processConversionSessionAsync() @@ -87,6 +91,7 @@ class wsFlash extends cubeFlashGateway { public function getConversionSessionProgress() { + set_time_limit(1); $session = wsConversionSession::openFromGUID($_SESSION['sessionConversionGUID']); $this->xml->addChild('progress', $session->getProgress()); } diff --git a/inc/extranet/DAO/class.ws.dao.document.php b/inc/extranet/DAO/class.ws.dao.document.php index 22f47793a..b3276a494 100644 --- a/inc/extranet/DAO/class.ws.dao.document.php +++ b/inc/extranet/DAO/class.ws.dao.document.php @@ -27,6 +27,12 @@ class wsDAODocument extends extranetDAO { return $this->singleton($r); } + public function selectInList($documentsId) + { + $r = $this->con->select('SELECT * FROM documents WHERE document_id IN(' . implode(',', $documentsId) . ')'); + return $this->factory($r); + } + public function cree() { $document = new wsDocument(); diff --git a/inc/extranet/Metier/class.ws.document.php b/inc/extranet/Metier/class.ws.document.php index 5f7e19999..3b3196092 100644 --- a/inc/extranet/Metier/class.ws.document.php +++ b/inc/extranet/Metier/class.ws.document.php @@ -1,4 +1,13 @@ out = ROOT . '/docs/' . $this->document_id . '/'; @@ -35,23 +47,41 @@ class wsDocument extends cubeMetier { public function getInfos() { - $pdfinfo = new cubeCommandLine('pdfinfo', null, false); - $pdfinfo->setArg('-box'); - $pdfinfo->setArg('f', 1); - $pdfinfo->setArg('l', 10000); - $pdfinfo->setArg(null, $this->in); - $pdfinfo->execute(); - $this->addToLog($pdfinfo); - - $pdftk = new cubeCommandLine('pdftk', null, true); - $pdftk->setArg(null, $this->in); - $pdftk->setArg(null, 'dump_data'); - $pdftk->execute(); - $this->addToLog($pdftk); - - $this->parseInfos($pdfinfo->output . $pdftk->output); - - file_put_contents($this->infos, $pdfinfo->output . $pdftk->output); + $pdfinfo = $this->getBasicInfos(); + $pdftk = $this->getAdvancedInfos(); + + $this->parseInfos($pdfinfo . $pdftk); + + file_put_contents($this->infos, $pdfinfo . $pdftk); + } + + public function getBasicInfos() + { + if (is_null($this->_basicInfos)) { + $pdfinfo = new cubeCommandLine('pdfinfo', null, false); + $pdfinfo->setArg('-box'); + $pdfinfo->setArg('f', 1); + $pdfinfo->setArg('l', 10000); + $pdfinfo->setArg(null, $this->in); + $pdfinfo->execute(); + $this->addToLog($pdfinfo); + + $this->_basicInfos = $pdfinfo->output; + } + return $this->_basicInfos; + } + + public function getAdvancedInfos() + { + if (is_null($this->_advancedInfos)) { + $pdftk = new cubeCommandLine('pdftk', null, true); + $pdftk->setArg(null, $this->in); + $pdftk->setArg(null, 'dump_data'); + $pdftk->execute(); + $this->addToLog($pdftk); + $this->_advancedInfos = $pdftk->output; + } + return $this->_advancedInfos; } public function parseInfos($data) @@ -103,6 +133,12 @@ class wsDocument extends cubeMetier { return $res; } + public function getPagesNumber() + { + $this->parseInfos($this->getBasicInfos()); + return $this->generalInfos['pages']; + } + public function getTexts() { $pdftotext = new cubeCommandLine('pdftotext', null, true); diff --git a/swf/_src/as3Container.fla b/swf/_src/as3Container.fla new file mode 100644 index 000000000..5ce85ebbc Binary files /dev/null and b/swf/_src/as3Container.fla differ