]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 25 May 2011 15:39:00 +0000 (15:39 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 25 May 2011 15:39:00 +0000 (15:39 +0000)
inc/commons/class.common.core.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Metier/class.ws.book.php

index 02a7caf5bc2ff36c751f8e3d9409212a350d7741..3c4d928e39bf3d22337aed7a08b85ce39c5a5eab 100644 (file)
@@ -374,6 +374,7 @@ class commonCore extends cubeCore {
                $db->books->numerotation('text', 0, false);\r
                $db->books->changedate('integer', 0, false);\r
                $db->books->compiledate('integer', 0, false);\r
+               $db->books->version('integer',0,false,2);\r
                // Clés\r
                $db->books->primary('pk_books', 'book_id');\r
                $db->books->index('index_books_nom', 'BTREE', 'nom');\r
index e376ad592c145417bbb48b7f660991c8d0073a8c..b8db5475c42f4c8562d39fa927ba0971dd41b1bf 100644 (file)
@@ -71,6 +71,7 @@ class wsUrl {
                }\r
                if ($droits->revendeur) {\r
                        $res .= '<th>' . commonUrl::orderby(__('Status'), 'status', $settings, 'sort' . $change) . '</th>';\r
+                       $res.='<th>' . __('V') . '</th>';\r
                }\r
                $res .= str_repeat('<th class="min"></th>', $droits->creation ? 5 : 4);\r
                $res .= '</tr>';\r
@@ -113,11 +114,20 @@ class wsUrl {
                                } else if ($book->status > 1) {\r
                                        $res .= '<td>' . $core->books_status[1] . '</td>';\r
                                }\r
+                               $res.='<td>'.$book->version.'</td>';\r
+                       }\r
+                       if ($book->version > 1 || $droits->admin) {\r
+                               $res .= '<td class="bouton"><a class="popupFSBar" rel="toolbar=yes" rev="viewer_' . $book->book_id . '" href="' . SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash . '/">' . $btVoir . '</a></td>';\r
+                               $res .= '<td class="bouton"><a class="popupFSBar" rel="toolbar=yes" rev="editor_' . $book->book_id . '" href="' . SITE_PATH . 'editor/' . $book->book_id . '">' . $btEdit . '</a></td>';\r
+                       } else {\r
+                               $res.='<td></td><td></td>';\r
                        }\r
-                       $res .= '<td class="bouton"><a class="popupFSBar" rel="toolbar=yes" rev="viewer_' . $book->book_id . '" href="' . SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash . '/">' . $btVoir . '</a></td>';\r
-                       $res .= '<td class="bouton"><a class="popupFSBar" rel="toolbar=yes" rev="editor_' . $book->book_id . '" href="' . SITE_PATH . 'editor/' . $book->book_id . '">' . $btEdit . '</a></td>';\r
                        $res .= '<td class="bouton"><a href="' . SITE_PATH . 'stats/' . $book->book_id . '">' . $btStats . '</a></td>';\r
-                       $res .= '<td class="bouton"><a href="#" class="openContextMenu" rel="' . $context_download_id . '" rev="' . $book->book_id . '">' . $btDownload . '</a></td>';\r
+                       if ($book->version > 1) {\r
+                               $res .= '<td class="bouton"><a href="#" class="openContextMenu" rel="' . $context_download_id . '" rev="' . $book->book_id . '">' . $btDownload . '</a></td>';\r
+                       } else {\r
+                               $res.='<td></td>';\r
+                       }\r
                        if ($droits->creation) {\r
                                $res .= '<td class="bouton"><a href="#" rel="supprimeBook/' . $book->book_id . '" class="ajax" title="' . __('Êtes-vous certain de vouloir supprimer cette publication ?') . '">' . $btDel . '</a></td>';\r
                        }\r
@@ -365,8 +375,8 @@ html{height:100%}' . "\n";
                        $res .= '<td>' . date('Y-m-d H:i:s', $time) . '</td>';\r
                        $res .= '<td class="center">' . $infos['links'] . '</td>';\r
                        $res .= '<td class="center">' . $infos['rulers'] . '</td>';\r
-                       $res.='<td class="center">'.$infos['user'].'</td>';\r
-                       $res.='<td class="center">'.$infos['comments'].'</td>';\r
+                       $res.='<td class="center">' . $infos['user'] . '</td>';\r
+                       $res.='<td class="center">' . $infos['comments'] . '</td>';\r
                        $res .= '<td><a href="#" rel="' . $book_id . '/' . $time . '" class="restoreLink">' . __('Restaurer') . '</a></td>';\r
                        $res .= '<td><a href="' . SITE_PATH . 'exportLinksAsExcel/' . $book_id . '/' . $time . '">' . str_replace(' ', '&nbsp;', __('Export Excel')) . '</a></td>';\r
                        $res .= '</tr>';\r
@@ -765,7 +775,11 @@ html{height:100%}' . "\n";
        protected static function checkDocumentVersionOfBook($book_id) {\r
                global $core;\r
                cubePHP::neverStop();\r
-               $dao = new wsDAOBook($core->con);\r
+               $daoBook = new wsDAOBook($core->con);\r
+               $book = $daoBook->selectById($book_id);\r
+               if ($book->version == 2) {\r
+                       return;\r
+               }\r
                $pages = $dao->getPagesOfBook($book_id);\r
                $toUpdate = array();\r
                foreach ($pages as $p => $infos) {\r
@@ -784,6 +798,8 @@ html{height:100%}' . "\n";
                        $daoDoc = new wsDAODocument($core->con);\r
                        $daoDoc->setLinksFromOldFluidbook($book_id);\r
                }\r
+\r
+               $daoBook->setVersion($book_id, 2);\r
        }\r
 \r
        public static function testOldLink($args) {\r
index 14b2c84b5577752ed6c93c8327176e7f08ccc4da..c2378038672273b9fd0cf1b28fdf567dfe5054a9 100644 (file)
@@ -36,6 +36,7 @@ class wsDAOBook extends commonDAO {
                $book->facturable_id = $r->facturable_id;\r
                $book->tache = $r->tache;\r
                $book->projet = $r->projet;\r
+               $book->version=$r->version;\r
 \r
                return $book;\r
        }\r
@@ -57,6 +58,7 @@ class wsDAOBook extends commonDAO {
                $book->parametres = new wsBookParametres();\r
                $book->tache = 0;\r
                $book->pages = array();\r
+               $book->version=2;\r
                return $book;\r
        }\r
 \r
@@ -137,6 +139,7 @@ class wsDAOBook extends commonDAO {
                $c->theme = $r->theme;\r
                $c->changedate = TIME;\r
                $c->compiledate = 0;\r
+               $c->version=2;\r
                $book_id = $c->book_id = $this->getNextId();\r
                $c->insert();\r
 \r
@@ -162,6 +165,7 @@ class wsDAOBook extends commonDAO {
                $c->lang = $lang;\r
                $c->changedate = TIME;\r
                $c->compiledate = TIME;\r
+               $c->version=2;\r
                $book_id = $c->book_id = $this->getNextId();\r
                $c->insert();\r
                return $this->selectById($book_id);\r
@@ -436,6 +440,13 @@ class wsDAOBook extends commonDAO {
                $c->status = 2;\r
                $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
        }\r
+       \r
+       public function setVersion($book_id,$version){\r
+               $c=$this->con->openCursor('books');\r
+                               $c->version=$version;\r
+                               $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
+                               \r
+       }\r
 \r
        public function touch($book_id) {\r
                $c = $this->con->openCursor('books');\r
index fbc30f62710905e47cfaa5dbffac9ca313680a65..c0c4582201b8db737e51fd57e52f7f4313718687 100644 (file)
@@ -28,7 +28,7 @@ class wsBook extends cubeMetier {
        protected $specialRulers;\r
        protected $changedate;\r
        protected $compiledate;\r
-       protected $syncv1;\r
+       protected $version;\r
 \r
        public function __get($varname) {\r
                if (!property_exists($this, $varname)) {\r