]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 5 Jan 2011 16:53:59 +0000 (16:53 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 5 Jan 2011 16:53:59 +0000 (16:53 +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.document.php
inc/ws/Metier/class.ws.document.localinfos.php
inc/ws/Metier/class.ws.document.php

index ee835ed1602e0b6caf8873522d72fd2547faef11..365ec2d0e6d517a6734d62ebe01ac3112e915cd3 100644 (file)
@@ -317,10 +317,12 @@ class extranetCore extends cubeCore {
                $db->documents->bookmarks('text', 0, false);\r
                $db->documents->numberSections('text', 0, false);\r
                $db->documents->links('text', 0, false);\r
+               $db->documents->localHash('varchar', 64, false);\r
                // Clés\r
                $db->documents->primary('pk_documents', 'document_id');\r
                $db->documents->index('index_documents_file', 'BTREE', 'file');\r
                $db->documents->index('index_documents_date', 'BTREE', 'date');\r
+               $db->documents->index('index_documents_localHash', 'BTREE', 'localHash');\r
                $db->documents->reference('fk_documents_proprietaire', 'proprietaire', 'utilisateurs', 'utilisateur_id');\r
                // .\r
                // Table pages des documents\r
index 6ceb8cd44a5a578ae3d1a2c4e4b47d9a018682c9..cace59595b22e4a2bec708459ddefceba443a802 100644 (file)
@@ -105,10 +105,8 @@ class wsConversionSession {
                        if ($pages == 'all') {\r
                                $doc = $this->getDocumentById($id);\r
                                $this->totalPages += $doc->generalInfos['pages'];\r
-                               trigger_error('all : ' . $doc->generalInfos['pages']);\r
                        } else {\r
                                $this->totalPages += count($pages);\r
-                               trigger_error($pages);\r
                        }\r
                }\r
                $this->totalDoc = count($this->documents);\r
index 901b2ac19ea8099810a04feac13c7ceee249178c..e36cd5e809362a8acbdc3e7b9ed9aa6d249c6523 100644 (file)
@@ -61,6 +61,13 @@ class wsFlash extends cubeFlashGateway {
                }\r
        }\r
 \r
+       public function addDocument()\r
+       {\r
+               $_SESSION['conversionSession'] = array();\r
+               $_SESSION['conversionSession'][$this->args['document_id']] = 'all';\r
+               $_SESSION['conversionSessionReload'] = true;\r
+       }\r
+\r
        public function reload()\r
        {\r
                global $core;\r
@@ -134,11 +141,48 @@ class wsFlash extends cubeFlashGateway {
 \r
        public function testDocuments()\r
        {\r
+               global $core;\r
+\r
                $toload = $this->xml->addChild('toLoad');\r
                $alreadyLoaded = $this->xml->addChild('alreadyLoaded');\r
 \r
+               $hash = array();\r
+\r
                foreach($this->args['fileName'] as $k => $name) {\r
-                       $toload->addChild('file', $name);\r
+                       $o = new wsDocumentLocalInfos();\r
+                       $o->fileName = $name;\r
+                       $o->fileSize = intval($this->args['fileSize'][$k]);\r
+                       $o->modificationDate = intval($this->args['modificationDate'][$k]);\r
+                       $o->creationDate = intval($this->args['creationDate'][$k]);\r
+\r
+                       $hash[$k] = md5(serialize($o));\r
+               }\r
+\r
+               $in = array();\r
+               foreach($hash as $h) {\r
+                       $in[] = "'" . $h . "'";\r
+               }\r
+\r
+               $sql = 'SELECT document_id,localHash FROM documents WHERE localHash';\r
+               if (count($in) == 1) {\r
+                       $sql .= ' = ' . implode(',', $in);\r
+               } else {\r
+                       $sql .= ' IN (' . implode(',', $in) . ')';\r
+               }\r
+\r
+               $al = array();\r
+               $r = $core->con->select($sql);\r
+               while ($r->fetch()) {\r
+                       $k = array_search($r->localHash, $hash);\r
+                       $al[$k] = true;\r
+                       $f = $alreadyLoaded->addChild('file', $this->args['fileName'][$k]);\r
+                       $f->addAttribute('document_id', $r->document_id);\r
+               }\r
+\r
+               foreach($this->args['fileName'] as $k => $name) {\r
+                       if (!isset($al[$k])) {\r
+                               $toload->addChild('file', $name);\r
+                       }\r
                }\r
        }\r
 \r
index 70fef51f2cad6d680fc1b4f1724c73e188f3679f..8e476223d3c1c346918664c8ab074f186d6be796 100644 (file)
@@ -1,7 +1,7 @@
 <?php\r
 class wsDAODocument extends extranetDAO {\r
        public static $normal = array('document_id', 'file', 'proprietaire', 'pages', 'date', 'numberSections');\r
-       public static $complex = array('localInfos', 'bookmarks', 'generalInfos','conversionInfos', 'trim');\r
+       public static $complex = array('localInfos', 'bookmarks', 'generalInfos', 'conversionInfos', 'trim');\r
 \r
        public function singleton($r)\r
        {\r
@@ -72,6 +72,9 @@ class wsDAODocument extends extranetDAO {
                                $c->$k = serialize($data[$k]);\r
                        }\r
                }\r
+               if (isset($data['localInfos'])) {\r
+                       $c->localHash = md5($c->localInfos);\r
+               }\r
 \r
                if ($data['document_id'] == 'new') {\r
                        $document_id = $c->document_id = $this->getNextId();\r
index dbf97a49d99a27efb062d5851f7a8295be656ec5..2020fd960eb4f0a197548ee6c2210d1b299cf76b 100644 (file)
@@ -1,13 +1,9 @@
 <?php\r
-class wsDocumentLocalInfos extends wsParametres {\r
-       public function initFields()\r
-       {\r
-               parent::initFields();\r
-               $this->fields['fileName'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Nom du fichier"), 'extra' => false, 'grade' => 0);\r
-               $this->fields['fileSize'] = array('type' => 'integer', 'default' => '', 'editable' => true, 'label' => __("Couleur des sous-menus"), 'extra' => false, 'grade' => 0);\r
-               $this->fields['modificationDate'] = array('type' => 'date', 'default' => TIME, 'editable' => true, 'label' => __("Date de dernière modification"), 'extra' => false, 'grade' => 0);\r
-               $this->fields['creationDate'] = array('type' => 'date', 'default' => TIME, 'editable' => true, 'label' => __("Date de dernière modification"), 'extra' => false, 'grade' => 0);\r
-       }\r
+class wsDocumentLocalInfos {\r
+       public $fileName;\r
+       public $fileSize;\r
+       public $modificationDate;\r
+       public $creationDate;\r
 }\r
 \r
 ?>
\ No newline at end of file
index 5d82480d5018831d2c324bf415a7e546866e5446..48c60cc6a099618a5a4894b9158be04a4b752307 100644 (file)
@@ -21,6 +21,7 @@ class wsDocument extends cubeMetier {
        protected $bookmarks;\r
        protected $numberSections;\r
        protected $links;\r
+       protected $localHash;\r
        // Crop & cut\r
        protected $autocrop;\r
        protected $manualcrop;\r
@@ -758,6 +759,7 @@ disablelinks                Disable links.
                fwrite($pointer, $c);\r
        }\r
 \r
+\r
        public function __destruct()\r
        {\r
                if (isset($this->common_log_pointer) && is_resource($this->common_log_pointer)) {\r