]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 24 Feb 2010 08:35:50 +0000 (08:35 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 24 Feb 2010 08:35:50 +0000 (08:35 +0000)
inc/extranet/Controlleur/class.extranet.core.php
inc/ws/Controlleur/class.ws.conversion.session.php
inc/ws/Controlleur/class.ws.flash.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/DAO/class.ws.dao.document.php
inc/ws/Metier/class.ws.document.php
swf/_src/wsComposer.fla

index aeaa862dad1a97c61660ccc73ecef713a4b5cd7d..c0bc72697876108f3bc093ff0180a90fcbcc907e 100644 (file)
@@ -50,7 +50,7 @@ class extranetCore extends cubeCore {
        {\r
                // On regarde si user_email et user_password ont été postées\r
                // Si c'est le cas, on les copie dans la session\r
-               $_SESSION['errorLogin']=false;\r
+               $_SESSION['errorLogin'] = false;\r
                if (isset($_POST['user_email'])) {\r
                        $_SESSION['user_email'] = $_POST['user_email'];\r
                }\r
@@ -70,10 +70,9 @@ class extranetCore extends cubeCore {
                // Utilisateur connecté à l'interface\r
                $dao = new extranetDAOUtilisateur($this->con);\r
                $this->user = $dao->selectByLoginPassword($_SESSION['user_email'], $_SESSION['user_password']);\r
-               if($this->user==false){\r
-                       $_SESSION['errorLogin']=true;\r
+               if ($this->user == false) {\r
+                       $_SESSION['errorLogin'] = true;\r
                        return;\r
-\r
                }\r
                if ($this->user->grade == 0) {\r
                        $daoClient = new extranetDAOClient($this->con);\r
@@ -303,6 +302,10 @@ class extranetCore extends cubeCore {
                $db->documents->trim('text', 0, false);\r
                $db->documents->date('integer', 0, false);\r
                $db->documents->localInfos('text', 0, false);\r
+               $db->documents->generalInfos('text', 0, false);\r
+               $db->documents->bookmarks('text', 0, false);\r
+               $db->documents->numberSections('text', 0, false);\r
+               $db->documents->links('text', 0, false);\r
                // Clés\r
                $db->documents->primary('pk_documents', 'document_id');\r
                $db->documents->index('index_documents_file', 'BTREE', 'file');\r
@@ -426,11 +429,11 @@ class extranetCore extends cubeCore {
                $this->createView('order_timereport', 'SELECT utilisateur_id,projet AS projet_id,MAX(date) AS derniere_activite FROM timereport,taches,projets WHERE taches.tache_id=timereport.tache_id AND taches.projet=projets.projet_id AND projets.status=0 GROUP BY utilisateur_id,taches.projet ORDER BY utilisateur_id ASC,MAX(date) DESC');\r
                $this->createView('ca', 'SELECT SUM(total_ht) AS ca, YEAR(FROM_UNIXTIME(date_creation)) annee FROM factures WHERE status IN(1,2) GROUP BY annee');\r
                $this->createView('ftpaccess', 'SELECT email AS userid,password AS passwd,utilisateur_id AS uid,'\r
-                        . '\'1000\' AS gid,CONCAT(\''.FTPROOT.'\',utilisateur_id) AS homedir, \'/bin/false\' AS shell '\r
+                        . '\'1000\' AS gid,CONCAT(\'' . FTPROOT . '\',utilisateur_id) AS homedir, \'/bin/false\' AS shell '\r
                         . 'FROM utilisateurs WHERE grade=0 '\r
                         . 'UNION '\r
                         . 'SELECT email AS userid,ws_password AS passwd,utilisateur_id AS uid,'\r
-                        . '\'1000\' AS gid,CONCAT(\''.FTPROOT.'\',utilisateur_id) AS homedir, \'/bin/false\' AS shell '\r
+                        . '\'1000\' AS gid,CONCAT(\'' . FTPROOT . '\',utilisateur_id) AS homedir, \'/bin/false\' AS shell '\r
                         . 'FROM utilisateurs WHERE grade=0 AND ws_password!=\'\'');\r
                $this->createView('chiffres_categories', 'SELECT p.annee_fin AS annee, t.categorie, SUM(t.budget) AS ca '\r
                         . 'FROM projets_vue p, taches_vue t '\r
index 0a26d0308c6256eefef6ffe503c2e6b2b2aec303..61ca777618651d906efdb6cfa0207cd105285ebc 100644 (file)
@@ -53,7 +53,8 @@ class wsConversionSession {
                $this->processing = true;\r
                $this->initDocuments();\r
                $this->serialize();\r
-               $dao = new wsDAOBook($core->con);\r
+               $dao = new wsDAODocument($core->con);\r
+               $daobook = new wsDAOBook($core->con);\r
 \r
                foreach($this->documents as $doc) {\r
                        $this->currentDoc = $doc;\r
@@ -64,12 +65,8 @@ class wsConversionSession {
                                $doc->processOnePage($i);\r
                                $this->processedPages++;\r
                        }\r
-                       try {\r
-                               $dao->appendDocument($this->bookId, $doc->document_id);\r
-                       }\r
-                       catch(Exception $e) {\r
-                               file_put_contents(ROOT . '/test.txt', print_r($e->getTrace(),true));\r
-                       }\r
+                       $doc = $dao->updateFromObject($doc);\r
+                       $daobook->appendDocument($this->bookId, $doc->document_id);\r
                        $this->processedDoc++;\r
                }\r
 \r
@@ -111,6 +108,13 @@ class wsConversionSession {
                file_put_contents(self::getCachePath($this->guid), serialize($this));\r
        }\r
 \r
+       public function destroy()\r
+       {\r
+               if (file_exists(self::getCachePath($this->guid))) {\r
+                       //unlink(self::getCachePath($this->guid));\r
+               }\r
+       }\r
+\r
        public function __destruct()\r
        {\r
        }\r
index ecebd5093e71284695e22d0abab0884080239470..84cbf4f31cd24fdd99169ac47bdb6065cbba7bb7 100644 (file)
@@ -87,8 +87,14 @@ class wsFlash extends cubeFlashGateway {
        public function processConversionSessionAsync()\r
        {\r
                cubePHP::neverStop();\r
-               $conversion = wsConversionSession::openFromGUID($_POST['sessionConversionGUID']);\r
-               $conversion->process();\r
+               try {\r
+                       $conversion = wsConversionSession::openFromGUID($_POST['sessionConversionGUID']);\r
+                       $conversion->process();\r
+               }\r
+               catch(Exception $e) {\r
+                       file_put_contents(CACHE . '/conversionExceptions.txt', print_r($e, true), FILE_APPEND);\r
+               }\r
+               $conversion->destroy();\r
        }\r
 \r
        public function getConversionSessionProgress()\r
index 7ca436ae9572dd644c4d9432b30f11bec6a80650..4d38a4d21560c3f9e0fbafb3009e31de3f28c7f6 100644 (file)
@@ -164,7 +164,7 @@ class wsDAOBook extends extranetDAO {
                // Insère les pages\r
                $c = $this->con->openCursor('book_pages');\r
                $c->book_id = $book_id;\r
-               $c->document_id = $r->document_id;\r
+               $c->document_id = $document_id;\r
                for($i = 1;$i <= $r->pages;$i++) {\r
                        $c->document_page = $i;\r
                        $c->book_page = $after_page + $i;\r
index 918987093f2a5cbbb650e8bb9dc14311e3fd040c..52ef5f3554f8ab90daa02cb072d4e68eb5c4e2b4 100644 (file)
@@ -1,18 +1,20 @@
 <?php\r
 class wsDAODocument extends extranetDAO {\r
+       public static $normal = array('document_id', 'file', 'proprietaire', 'pages', 'date');\r
+       public static $complex = array('localInfos', 'bookmarks', 'generalInfos', 'numberSections', 'links', 'trim');\r
+\r
        public function singleton($r)\r
        {\r
                $document = new wsDocument();\r
-               $document->document_id = $r->document_id;\r
-               $document->init();\r
-               $document->file = $r->file;\r
-               $document->proprietaire = $r->proprietaire;\r
-               $document->pages = $r->pages;\r
-               if ($r->trim) {\r
-                       $document->trim = unserialize($r->trim);\r
+               foreach(self::$normal as $k) {\r
+                       $document->$k = $r->$k;\r
+               }\r
+               foreach(self::$complex as $k) {\r
+                       if ($r->$k != '') {\r
+                               $document->$k = unserialize($r->$k);\r
+                       }\r
                }\r
-               $document->date = $r->date;\r
-               $document->localInfos = unserialize($r->localInfos);\r
+               $document->init();\r
                return $document;\r
        }\r
 \r
@@ -53,14 +55,12 @@ class wsDAODocument extends extranetDAO {
                        $data['document_id'] = 'new';\r
                }\r
                $c = $this->con->openCursor('documents');\r
-               $c->file = $data['file'];\r
-               $c->proprietaire = $data['proprietaire'];\r
-               $c->pages = $data['pages'];\r
-               if (isset($data['localInfos'])) {\r
-                       $c->localInfos = serialize($data['localInfos']);\r
+\r
+               foreach(self::$normal as $k) {\r
+                       $c->$k = $data[$k];\r
                }\r
-               if (isset($data['trim'])) {\r
-                       $c->trim = serialize($data['trim']);\r
+               foreach(self::$complex as $k) {\r
+                       $c->$k = serialize($data[$k]);\r
                }\r
 \r
                if ($data['document_id'] == 'new') {\r
@@ -74,6 +74,40 @@ class wsDAODocument extends extranetDAO {
                $doc = $this->selectById($document_id);\r
                return $doc;\r
        }\r
+\r
+       public function updateField($document_id, $fieldName, $value)\r
+       {\r
+               $c = $this->con->openCursor('documents');\r
+               $c->$fieldName = $value;\r
+               $c->update('WHERE document_id=\'' . $this->con->escape($document_id) . '\'');\r
+       }\r
+\r
+       public function updateFromObject($document)\r
+       {\r
+               /*      protected $document_id;\r
+       protected $file;\r
+       protected $proprietaire;\r
+       protected $pages;\r
+       protected $trim;\r
+       protected $date;\r
+       protected $localInfos;\r
+       protected $generalInfos;\r
+       protected $bookmarks;\r
+       protected $numberSections;\r
+       protected $links;\r
+\r
+\r
+*/\r
+\r
+               $data = array();\r
+               foreach(self::$normal as $k) {\r
+                       $data[$k] = $document->$k;\r
+               }\r
+               foreach(self::$complex as $k) {\r
+                       $data[$k] = $document->$k;\r
+               }\r
+               return $this->sauve($data);\r
+       }\r
 }\r
 \r
 ?>
\ No newline at end of file
index e68a1315df8fc3a135a156a61d0b5ac819203074..9256aee510e2008ebba0bf1b9365f2023f608e42 100644 (file)
@@ -53,8 +53,8 @@ class wsDocument extends cubeMetier {
                        mkdir($this->out, 0755, true);\r
                }\r
                $this->log_pointer = fopen($this->log, 'a');\r
-               //$this->_memoErrorLog = ini_get('error_log');\r
-               //ini_set('error_log', $this->phperrors);\r
+               // $this->_memoErrorLog = ini_get('error_log');\r
+               // ini_set('error_log', $this->phperrors);\r
        }\r
 \r
        public function copyOriginal($tmp_file)\r
@@ -124,7 +124,7 @@ class wsDocument extends cubeMetier {
                        $k = trim($e[0]);\r
                        $v = trim($e[1]);\r
                        if ($k == 'Pages' || $k == 'NumberOfPages') {\r
-                               $this->generalInfos['pages'] = $v;\r
+                               $this->pages = $this->generalInfos['pages'] = $v;\r
                        } elseif (preg_match('|Page ([0-9]+) (.*)Box: ([0-9.]*) ([0-9.]*) ([0-9.]*) ([0-9.]*)|iu', $line, $m)) {\r
                                $this->generalInfos['page'][$m[1]][strtolower($m[2])] = array($m[3], $m[4], $m[5], $m[6]);\r
                        } elseif (preg_match('|Page ([0-9]+) size: ([0-9.]*)([\sx]+)([0-9.]*)(.*)|iu', $line, $m)) {\r
@@ -619,7 +619,7 @@ TRACE   drawlink s=http://www.ladocumentationfrancaise.fr/
                if (isset($this->log_pointer) && is_resource($this->log_pointer)) {\r
                        fclose($this->log_pointer);\r
                }\r
-               //ini_set('error_log', $this->_memoErrorLog);\r
+               // ini_set('error_log', $this->_memoErrorLog);\r
        }\r
 }\r
 \r
index 217b4a78454602bf4b838a1be9e22ebeffefcca9..96d02f4f7d00d91f0491d3991946bac103198ff4 100644 (file)
Binary files a/swf/_src/wsComposer.fla and b/swf/_src/wsComposer.fla differ