]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 21 Oct 2011 12:43:50 +0000 (12:43 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 21 Oct 2011 12:43:50 +0000 (12:43 +0000)
29 files changed:
fluidbook/icones/4/nav-2d.png [new file with mode: 0644]
fluidbook/icones/4/nav-3d.png [new file with mode: 0644]
fluidbook/icones/4/nav-archives.png [new file with mode: 0644]
fluidbook/icones/4/nav-basket.png [new file with mode: 0644]
fluidbook/icones/4/nav-bookmark.png [new file with mode: 0644]
fluidbook/icones/4/nav-friend.png [new file with mode: 0644]
fluidbook/icones/4/nav-fullscreen.png [new file with mode: 0644]
fluidbook/icones/4/nav-help.png [new file with mode: 0644]
fluidbook/icones/4/nav-index.png [new file with mode: 0644]
fluidbook/icones/4/nav-normal.png [new file with mode: 0644]
fluidbook/icones/4/nav-normalscreen.png [new file with mode: 0644]
fluidbook/icones/4/nav-print.png [new file with mode: 0644]
fluidbook/icones/4/nav-save.png [new file with mode: 0644]
fluidbook/icones/4/nav-sommaire.png [new file with mode: 0644]
fluidbook/icones/4/nav-soundoff.png [new file with mode: 0644]
fluidbook/icones/4/nav-soundon.png [new file with mode: 0644]
fluidbook/icones/4/nav-zoomin.png [new file with mode: 0644]
fluidbook/icones/4/nav-zoomout.png [new file with mode: 0644]
inc/commons/class.common.core.php
inc/extranet/_common.php
inc/extranet/prepend.php [new file with mode: 0644]
inc/prepend.php
inc/ws/Controlleur/class.ws.flash.php
inc/ws/DAO/class.ws.dao.document.php
inc/ws/Util/_common.php
inc/ws/Util/class.ws.links.php [new file with mode: 0644]
inc/ws/_common.php
inc/ws/prepend.php [new file with mode: 0644]
js/ws.js

diff --git a/fluidbook/icones/4/nav-2d.png b/fluidbook/icones/4/nav-2d.png
new file mode 100644 (file)
index 0000000..a8ba6d7
Binary files /dev/null and b/fluidbook/icones/4/nav-2d.png differ
diff --git a/fluidbook/icones/4/nav-3d.png b/fluidbook/icones/4/nav-3d.png
new file mode 100644 (file)
index 0000000..032e2da
Binary files /dev/null and b/fluidbook/icones/4/nav-3d.png differ
diff --git a/fluidbook/icones/4/nav-archives.png b/fluidbook/icones/4/nav-archives.png
new file mode 100644 (file)
index 0000000..a7d293a
Binary files /dev/null and b/fluidbook/icones/4/nav-archives.png differ
diff --git a/fluidbook/icones/4/nav-basket.png b/fluidbook/icones/4/nav-basket.png
new file mode 100644 (file)
index 0000000..d4c4baa
Binary files /dev/null and b/fluidbook/icones/4/nav-basket.png differ
diff --git a/fluidbook/icones/4/nav-bookmark.png b/fluidbook/icones/4/nav-bookmark.png
new file mode 100644 (file)
index 0000000..111b08b
Binary files /dev/null and b/fluidbook/icones/4/nav-bookmark.png differ
diff --git a/fluidbook/icones/4/nav-friend.png b/fluidbook/icones/4/nav-friend.png
new file mode 100644 (file)
index 0000000..23885ce
Binary files /dev/null and b/fluidbook/icones/4/nav-friend.png differ
diff --git a/fluidbook/icones/4/nav-fullscreen.png b/fluidbook/icones/4/nav-fullscreen.png
new file mode 100644 (file)
index 0000000..9b80abe
Binary files /dev/null and b/fluidbook/icones/4/nav-fullscreen.png differ
diff --git a/fluidbook/icones/4/nav-help.png b/fluidbook/icones/4/nav-help.png
new file mode 100644 (file)
index 0000000..a45edc9
Binary files /dev/null and b/fluidbook/icones/4/nav-help.png differ
diff --git a/fluidbook/icones/4/nav-index.png b/fluidbook/icones/4/nav-index.png
new file mode 100644 (file)
index 0000000..37507d9
Binary files /dev/null and b/fluidbook/icones/4/nav-index.png differ
diff --git a/fluidbook/icones/4/nav-normal.png b/fluidbook/icones/4/nav-normal.png
new file mode 100644 (file)
index 0000000..03fe202
Binary files /dev/null and b/fluidbook/icones/4/nav-normal.png differ
diff --git a/fluidbook/icones/4/nav-normalscreen.png b/fluidbook/icones/4/nav-normalscreen.png
new file mode 100644 (file)
index 0000000..0206770
Binary files /dev/null and b/fluidbook/icones/4/nav-normalscreen.png differ
diff --git a/fluidbook/icones/4/nav-print.png b/fluidbook/icones/4/nav-print.png
new file mode 100644 (file)
index 0000000..215e57a
Binary files /dev/null and b/fluidbook/icones/4/nav-print.png differ
diff --git a/fluidbook/icones/4/nav-save.png b/fluidbook/icones/4/nav-save.png
new file mode 100644 (file)
index 0000000..40f87f6
Binary files /dev/null and b/fluidbook/icones/4/nav-save.png differ
diff --git a/fluidbook/icones/4/nav-sommaire.png b/fluidbook/icones/4/nav-sommaire.png
new file mode 100644 (file)
index 0000000..ecd58a9
Binary files /dev/null and b/fluidbook/icones/4/nav-sommaire.png differ
diff --git a/fluidbook/icones/4/nav-soundoff.png b/fluidbook/icones/4/nav-soundoff.png
new file mode 100644 (file)
index 0000000..67a76fd
Binary files /dev/null and b/fluidbook/icones/4/nav-soundoff.png differ
diff --git a/fluidbook/icones/4/nav-soundon.png b/fluidbook/icones/4/nav-soundon.png
new file mode 100644 (file)
index 0000000..47bc019
Binary files /dev/null and b/fluidbook/icones/4/nav-soundon.png differ
diff --git a/fluidbook/icones/4/nav-zoomin.png b/fluidbook/icones/4/nav-zoomin.png
new file mode 100644 (file)
index 0000000..c2effa4
Binary files /dev/null and b/fluidbook/icones/4/nav-zoomin.png differ
diff --git a/fluidbook/icones/4/nav-zoomout.png b/fluidbook/icones/4/nav-zoomout.png
new file mode 100644 (file)
index 0000000..bc05b8a
Binary files /dev/null and b/fluidbook/icones/4/nav-zoomout.png differ
index 1c0ebe9c88ec70e07959e96b02d53478c00c102e..d9bc11340c80edad08ad3fa2179f69aa52922a80 100644 (file)
@@ -333,22 +333,17 @@ class commonCore extends cubeCore {
                // .\r
                // Table pages des documents\r
                $db->document_links->document_id('integer', 0, false);\r
-               $db->document_links->document_page('integer', 0, false);\r
                $db->document_links->links('text', 0, false);\r
-               $db->document_links->nb_links('integer', 0, false);\r
                $db->document_links->rulers('text', 0, false);\r
-               $db->document_links->nb_rulers('integer', 0, false);\r
-               $db->document_links->update('integer', 0, false);\r
                // Clés\r
-               $db->document_links->primary('pk_document_links', 'document_id', 'document_page', 'update');\r
-               $db->document_links->index('index_document_links_date', 'BTREE', 'update');\r
-               $db->document_links->index('index_document_links_document_id', 'BTREE', 'document_id');\r
+               $db->document_links->primary('pk_document_links', 'document_id');\r
+\r
                // .\r
                // Tables versions des liens\r
                $db->document_links_versions->document_id('integer', 0, false);\r
                $db->document_links_versions->links('text', 0, false);\r
                $db->document_links_versions->rulers('text', 0, false);\r
-               $db->document_links_versions->comments('varchar', 64, false);\r
+               $db->document_links_versions->comments('varchar', 128, false);\r
                $db->document_links_versions->user('integer', 0, false);\r
                $db->document_links_versions->update('integer', 0, false);\r
                // .\r
index 5eb1cbfeba2be4fa1d65e8f5373d603844084fc6..2bbaa67291d7a807ad07fc51e83b89e30d5a8a51 100644 (file)
@@ -6,6 +6,6 @@ require_once(dirname(__FILE__) . '/DAO/_common.php');
 \r
 $GLOBALS['ajaxClasses'][] = 'extranetAjax';\r
 \r
-$core->url->register('cleanDownload', 'cleanDownload', '^cleanDownload$', array('extranetUrl', 'cleanDownload'));\r
+\r
 \r
 ?>
\ No newline at end of file
diff --git a/inc/extranet/prepend.php b/inc/extranet/prepend.php
new file mode 100644 (file)
index 0000000..2f04b3d
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+
+$core->url->register('cleanDownload', 'cleanDownload', '^cleanDownload$', array('extranetUrl', 'cleanDownload'));
+?>
index a2b544c6c6e63b7beb6514f7d46afab84dd347f6..ffbd910d6ef5f478f6138dc77c736f92286cbed5 100644 (file)
@@ -37,6 +37,7 @@ if ($ws) {
 \r
 $GLOBALS['ajaxClasses'][] = 'commonAjax';\r
 require_once(dirname(__FILE__) . '/' . MODE . '/_common.php');\r
+require_once(dirname(__FILE__) . '/' . MODE . '/prepend.php');\r
 \r
 if (isset($_POST['q'])) {\r
        $_SESSION['q'] = $_POST['q']?$_POST['q']:null;\r
index d12254a2795a074f05ee30505eef2605a4ed9dba..650239b3dc44d457b0e5c2b9a265891059071fd5 100644 (file)
@@ -438,6 +438,9 @@ class wsFlash extends cubeFlashGateway {
 \r
        public function getLinks() {\r
                global $core;\r
+               \r
+               set_time_limit(0);\r
+               \r
                $dao = new wsDAOBook($core->con);\r
                $book = $dao->selectById($this->args['book_id']);\r
 \r
index f894effe9c03347860f8dc9039796b953ebcbcf5..2fd63fc6e8bb54297613001bf15d55d5078ff8ed 100644 (file)
@@ -43,8 +43,11 @@ class wsDAODocument extends commonDAO {
                        $docs[] = $infos['document_id'];\r
                }\r
 \r
-               $sql = 'INSERT INTO document_links_versions (document_id,links,rulers,`update`,comments,user) SELECT document_id,links,rulers,' . TIME . ',\'Links from a previous version\',' . $user . ' FROM document_links_versions WHERE `update`=' . $update . ' AND document_id IN (' . implode(',', $docs) . ')';\r
-               $this->con->execute($sql);\r
+               $r = $this->con->select('SELECT document_id,links,rulers FROM document_links_versions WHERE `update`=' . $update . ' AND document_id IN (' . implode(',', $docs) . ')');\r
+\r
+               while ($r->fetch()) {\r
+                       wsLinks::setDocumentLinks($r->document_id, $r->links, $r->rulers, $user, 'Links restored from ' . date('Y-m-d H:i:s', $update) . ' version', TIME);\r
+               }\r
        }\r
 \r
        public function putLinksFromCSV($document_id) {\r
@@ -55,10 +58,6 @@ class wsDAODocument extends commonDAO {
 \r
                $links = array();\r
 \r
-               $c = $this->con->openCursor('document_links_versions');\r
-               $c->document_id = $document->document_id;\r
-               $c->update = TIME;\r
-\r
                for ($page = 1; $page <= $document->generalInfos['pages']; $page++) {\r
                        $links[$page] = array();\r
 \r
@@ -105,10 +104,7 @@ class wsDAODocument extends commonDAO {
                        $log[] = 'Added ' . count($links) . ' links';\r
                }\r
 \r
-               $c->links = json_encode($links);\r
-               $c->comments = 'Links imported from PDF';\r
-               $c->rulers = json_encode(array());\r
-               $c->insert();\r
+               wsLinks::setDocumentLinks($document_id, json_encode($links), json_encode(array()), 0, 'Links imported from PDF', TIME);\r
 \r
                return implode("\n", $log);\r
        }\r
@@ -139,7 +135,7 @@ class wsDAODocument extends commonDAO {
                $rulers = array();\r
 \r
                foreach ($t as $page => $tt) {\r
-                       if(!is_int($page)){\r
+                       if (!is_int($page)) {\r
                                continue;\r
                        }\r
                        $infos = $pages[$page];\r
@@ -164,16 +160,8 @@ class wsDAODocument extends commonDAO {
                        }\r
                }\r
 \r
-               $c = $this->con->openCursor('document_links_versions');\r
-               $c->update = TIME;\r
-\r
                foreach ($links as $document_id => $dummy) {\r
-                       $c->document_id = $document_id;\r
-                       $c->links = json_encode($links[$document_id]);\r
-                       $c->rulers = json_encode($rulers[$document_id]);\r
-                       $c->comments = $comments;\r
-                       $c->user = $user;\r
-                       $c->insert();\r
+                       wsLinks::setDocumentLinks($document_id, json_encode($links[$document_id]), json_encode($rulers[$document_id]), $user, $comments, TIME);\r
                }\r
 \r
                $c = $this->con->openCursor('books');\r
@@ -265,17 +253,10 @@ class wsDAODocument extends commonDAO {
                        }\r
                }\r
 \r
-               $c = $this->con->openCursor('document_links_versions');\r
-               $c->update = TIME;\r
-\r
                krsort($links);\r
 \r
-               foreach ($links as $document_id => $l) {\r
-                       $c->document_id = $document_id;\r
-                       $c->links = json_encode($l);\r
-                       $c->rulers = json_encode(array());\r
-                       $c->insert();\r
-               }\r
+\r
+               wsLinks::setDocumentLinks($document_id, json_encode($l), json_encode(array()), 0, 'Import from Fluidbook V1', TIME);\r
 \r
                $c = $this->con->openCursor('books');\r
                $c->changedate = TIME;\r
@@ -283,66 +264,7 @@ class wsDAODocument extends commonDAO {
        }\r
 \r
        public function getLinksAndRulers($book_id, &$links, &$rulers, $time=null) {\r
-\r
-               if (is_null($time)) {\r
-                       $timeQuery = 'ORDER BY `update` DESC LIMIT 1';\r
-               } else {\r
-                       $timeQuery = 'AND `update`=' . $time;\r
-               }\r
-\r
-               $daoBook = new wsDAOBook($this->con);\r
-               $pages = $daoBook->getPagesOfBookAt($book_id, $time);\r
-\r
-               foreach ($pages as $p => $infos) {\r
-                       $documents[] = $infos['document_id'];\r
-               }\r
-               $documents = array_unique($documents);\r
-\r
-               $tlinks = array();\r
-               $trulers = array();\r
-\r
-               $links = array();\r
-               $rulers = array();\r
-\r
-               foreach ($documents as $d) {\r
-                       $r = $this->con->select('SELECT * FROM document_links_versions WHERE document_id=' . $d . ' ' . $timeQuery);\r
-\r
-                       if (mb_substr($r->links, 1, 1) == ':') {\r
-                               $ll = unserialize($r->links);\r
-                               $rr = unserialize($r->rulers);\r
-                       } else {\r
-                               $ll = json_decode($r->links, true);\r
-                               $rr = json_decode($r->rulers, true);\r
-                       }\r
-                       $tlinks[$d] = $ll;\r
-                       $trulers[$d] = $rr;\r
-               }\r
-\r
-               $i = 1;\r
-               foreach ($pages as $p => $infos) {\r
-                       if (isset($tlinks[$infos['document_id']][$infos['document_page']])) {\r
-                               $l = $tlinks[$infos['document_id']][$infos['document_page']];\r
-                               foreach ($l as $link) {\r
-                                       $link = (array) $link;\r
-                                       $link['page'] = $p;\r
-                                       $link['id'] = $i;\r
-                                       $links[] = $link;\r
-                               }\r
-                       }\r
-                       if (isset($trulers[$infos['document_id']][$infos['document_page']])) {\r
-                               $ru = $trulers[$infos['document_id']][$infos['document_page']];\r
-                               foreach ($ru as $ruler) {\r
-                                       $ruler['page'] = $p;\r
-                                       $rulers[] = $ruler;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               $daoBook = new wsDAOBook($this->con);\r
-               $book = $daoBook->selectById($book_id);\r
-\r
-               $rulers = array_merge($rulers, $book->specialRulers);\r
-               $links = array_merge($links, $book->specialLinks);\r
+               return wsLinks::getLinksAndRulers($book_id, $links, $rulers, $time);\r
        }\r
 \r
        public function getLinksVersions($book_id) {\r
@@ -466,94 +388,7 @@ class wsDAODocument extends commonDAO {
        }\r
 \r
        public function getLinksAsExcel($links, $rulers) {\r
-               $cols = array('document_id' => __('Document'), 'document_page' => __('Page du document'),\r
-                       'page' => __('Page de la publication'), 'left' => __('x'), 'top' => __('y'), 'width' => __('Largeur'), 'height' => __('Hauteur'),\r
-                       'type' => __('Type'), 'to' => __('Destination'), 'target' => __('Cible'),\r
-                       'infobulle' => __('Infobulle'), 'numerotation' => __('Numérotation'),\r
-                       'display_area' => __('Activer la surbrillance'),\r
-                       'video_loop' => __('Video : boucle'), 'video_auto_start' => __('Video : démarrage automatique'), 'video_controls' => __('Vidéo : afficher les contrôles'), 'video_sound_on' => __('Vidéo : activer le son'),\r
-                       'inline' => __('Vidéo : afficher dans la page'), 'video_width' => __('Vidéo : Largeur du popup'), 'video_height' => __('Vidéo : Hauteur du popup'),\r
-                       'interactive' => __('Interactivité'), 'video_service' => __('Webvideo : service'),\r
-                       'display_area' => __('Afficher le lien au rollover'),\r
-                       'extra' => __('Paramètre supplémentaire')\r
-               );\r
-\r
-               $xls = new PHPExcel();\r
-               $s = $xls->setActiveSheetIndex(0);\r
-               $s->setTitle('Links');\r
-\r
-               // Labels\r
-               $i = 0;\r
-               foreach ($cols as $id => $label) {\r
-                       $s->setCellValueByColumnAndRow($i, 1, $id);\r
-                       $s->getColumnDimensionByColumn($i)->setAutoSize(true);\r
-                       $s->getStyleByColumnAndRow($i, 1)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);\r
-                       $i++;\r
-               }\r
-               // Links\r
-               $j = 2;\r
-               foreach ($links as $l) {\r
-                       $i = 0;\r
-                       foreach ($cols as $id => $label) {\r
-                               if ($id == 'document_id' || $id == 'document_page') {\r
-                                       $infos = $pages[$l['page']];\r
-                                       $value = $infos[$id];\r
-                               } else {\r
-                                       if (is_bool($l[$id])) {\r
-                                               $l[$id] = $l[$id] ? 1 : 0;\r
-                                       }\r
-                                       if ($id == 'numerotation') {\r
-                                               if ($l[$id] == 'false') {\r
-                                                       $l[$id] = 'physical';\r
-                                               }\r
-                                       } else if ($id == 'display_area') {\r
-                                               if ($l[$id] == '') {\r
-                                                       $l[$id] = '1';\r
-                                               }\r
-                                       }\r
-                                       $value = $l[$id];\r
-                               }\r
-\r
-                               $s->setCellValueByColumnAndRow($i, $j, $value);\r
-                               $s->getStyleByColumnAndRow($i, $j)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);\r
-                               $i++;\r
-                       }\r
-                       $j++;\r
-               }\r
-               // Rulers\r
-               $s = $xls->createSheet();\r
-               $s->setTitle('Rulers');\r
-\r
-               $rcols = array('document_id', 'document_page', 'page', 'type', 'pos');\r
-               $i = 0;\r
-               // Labels\r
-               foreach ($rcols as $id) {\r
-                       $s->setCellValueByColumnAndRow($i, 1, $id);\r
-                       $s->getColumnDimensionByColumn($i)->setAutoSize(true);\r
-                       $s->getStyleByColumnAndRow($i, 1)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);\r
-                       $i++;\r
-               }\r
-\r
-               // Contents\r
-               $j = 2;\r
-               foreach ($rulers as $r) {\r
-                       $i = 0;\r
-                       foreach ($rcols as $id) {\r
-                               if ($id == 'document_id' || $id == 'document_page') {\r
-                                       $infos = $pages[$r['page']];\r
-                                       $value = $infos[$id];\r
-                               } else {\r
-                                       $value = $r[$id];\r
-                               }\r
-                               $s->setCellValueByColumnAndRow($i, $j, $value);\r
-                               $s->getStyleByColumnAndRow($i, $j)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);\r
-                               $i++;\r
-                       }\r
-                       $j++;\r
-               }\r
-\r
-               $xls->setActiveSheetIndex(0);\r
-               return $xls;\r
+               return wsLinks::linksToExcel($links, $rulers);\r
        }\r
 \r
 }\r
index 0b86df328e46e65e9c3afe5549fa4a18a797eda6..45a1b6dd87d57816665b7dfded80655f955835d1 100644 (file)
@@ -14,4 +14,5 @@ $__autoload['wsHTML5Link'] = dirname(__FILE__) . '/html5/class.ws.html5.links.ph
 $__autoload['wsPDFFontExtractor'] = dirname(__FILE__) . '/fontextractor/class.ws.pdf.fontextractor.php';\r
 $__autoload['wsPDFFont'] = dirname(__FILE__) . '/fontextractor/class.ws.pdf.font.php';\r
 $__autoload['wsSVN'] = dirname(__FILE__) . '/class.ws.svn.php';\r
+$__autoload['wsLinks'] = dirname(__FILE__) . '/class.ws.links.php';\r
 ?>
\ No newline at end of file
diff --git a/inc/ws/Util/class.ws.links.php b/inc/ws/Util/class.ws.links.php
new file mode 100644 (file)
index 0000000..a257aa9
--- /dev/null
@@ -0,0 +1,185 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of class
+ *
+ * @author Vincent
+ */
+class wsLinks {
+
+       public static function linksToExcel($links, $rulers, $pages=null) {
+               $cols = array('document_id' => __('Document'), 'document_page' => __('Page du document'),
+                       'page' => __('Page de la publication'), 'left' => __('x'), 'top' => __('y'), 'width' => __('Largeur'), 'height' => __('Hauteur'),
+                       'type' => __('Type'), 'to' => __('Destination'), 'target' => __('Cible'),
+                       'infobulle' => __('Infobulle'), 'numerotation' => __('Numérotation'),
+                       'display_area' => __('Activer la surbrillance'),
+                       'video_loop' => __('Video : boucle'), 'video_auto_start' => __('Video : démarrage automatique'), 'video_controls' => __('Vidéo : afficher les contrôles'), 'video_sound_on' => __('Vidéo : activer le son'),
+                       'inline' => __('Vidéo : afficher dans la page'), 'video_width' => __('Vidéo : Largeur du popup'), 'video_height' => __('Vidéo : Hauteur du popup'),
+                       'interactive' => __('Interactivité'), 'video_service' => __('Webvideo : service'),
+                       'display_area' => __('Afficher le lien au rollover'),
+                       'extra' => __('Paramètre supplémentaire')
+               );
+
+               $xls = new PHPExcel();
+               $s = $xls->setActiveSheetIndex(0);
+               $s->setTitle('Links');
+
+               // Labels
+               $i = 0;
+               foreach ($cols as $id => $label) {
+                       $s->setCellValueByColumnAndRow($i, 1, $id);
+                       $s->getColumnDimensionByColumn($i)->setAutoSize(true);
+                       $s->getStyleByColumnAndRow($i, 1)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
+                       $i++;
+               }
+               // Links
+               $j = 2;
+               foreach ($links as $l) {
+                       $i = 0;
+                       foreach ($cols as $id => $label) {
+                               if (!is_null($pages) && ($id == 'document_id' || $id == 'document_page')) {
+                                       $infos = $pages[$l['page']];
+                                       $value = $infos[$id];
+                               } else {
+                                       if (is_bool($l[$id])) {
+                                               $l[$id] = $l[$id] ? 1 : 0;
+                                       }
+                                       if ($id == 'numerotation') {
+                                               if ($l[$id] == 'false') {
+                                                       $l[$id] = 'physical';
+                                               }
+                                       }
+                                       $value = $l[$id];
+                               }
+
+                               $s->setCellValueByColumnAndRow($i, $j, $value);
+                               $s->getStyleByColumnAndRow($i, $j)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+                               $i++;
+                       }
+                       $j++;
+               }
+               // Rulers
+               $s = $xls->createSheet();
+               $s->setTitle('Rulers');
+
+               $rcols = array('document_id', 'document_page', 'page', 'type', 'pos');
+               $i = 0;
+               // Labels
+               foreach ($rcols as $id) {
+                       $s->setCellValueByColumnAndRow($i, 1, $id);
+                       $s->getColumnDimensionByColumn($i)->setAutoSize(true);
+                       $s->getStyleByColumnAndRow($i, 1)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
+                       $i++;
+               }
+
+               // Contents
+               $j = 2;
+               foreach ($rulers as $r) {
+                       $i = 0;
+                       foreach ($rcols as $id) {
+                               if (!is_null($pages) && ($id == 'document_id' || $id == 'document_page')) {
+                                       $infos = $pages[$r['page']];
+                                       $value = $infos[$id];
+                               } else {
+                                       $value = $r[$id];
+                               }
+                               $s->setCellValueByColumnAndRow($i, $j, $value);
+                               $s->getStyleByColumnAndRow($i, $j)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+                               $i++;
+                       }
+                       $j++;
+               }
+
+               $xls->setActiveSheetIndex(0);
+               return $xls;
+       }
+
+       public static function setDocumentLinks($document_id, $links, $rulers, $user, $comments, $time) {
+               global $core;
+               $c = $core->con->openCursor('document_links_versions');
+               $c1 = $core->con->openCursor('document_links');
+               $c1->document_id=$c->document_id=$document_id;
+               $c1->links = $c->links = $links;
+               $c1->rulers = $c->rulers = $rulers;
+               $c->comments = $comments;
+               $c->user = $user;
+               $c->update = $time;
+               $c->insert();
+
+               $core->con->execute('DELETE FROM document_links WHERE document_id=' . $document_id);
+               $c1->insert();
+       }
+       
+       public static function getLinksAndRulers($book_id, &$links, &$rulers, $time=null) {
+
+               global $core;
+               
+               if (is_null($time)) {
+                       $timeQuery = 'ORDER BY `update` DESC LIMIT 1';
+               } else {
+                       $timeQuery = 'AND `update`=' . $time;
+               }
+
+               $daoBook = new wsDAOBook($core->con);
+               $pages = $daoBook->getPagesOfBookAt($book_id, $time);
+
+               foreach ($pages as $p => $infos) {
+                       $documents[] = $infos['document_id'];
+               }
+               $documents = array_unique($documents);
+
+               $tlinks = array();
+               $trulers = array();
+
+               $links = array();
+               $rulers = array();
+
+               foreach ($documents as $d) {
+                       $r = $core->con->select('SELECT * FROM document_links_versions WHERE document_id=' . $d . ' ' . $timeQuery);
+
+                       if (mb_substr($r->links, 1, 1) == ':') {
+                               $ll = unserialize($r->links);
+                               $rr = unserialize($r->rulers);
+                       } else {
+                               $ll = json_decode($r->links, true);
+                               $rr = json_decode($r->rulers, true);
+                       }
+                       $tlinks[$d] = $ll;
+                       $trulers[$d] = $rr;
+               }
+
+               $i = 1;
+               foreach ($pages as $p => $infos) {
+                       if (isset($tlinks[$infos['document_id']][$infos['document_page']])) {
+                               $l = $tlinks[$infos['document_id']][$infos['document_page']];
+                               foreach ($l as $link) {
+                                       $link = (array) $link;
+                                       $link['page'] = $p;
+                                       $link['id'] = $i;
+                                       $links[] = $link;
+                               }
+                       }
+                       if (isset($trulers[$infos['document_id']][$infos['document_page']])) {
+                               $ru = $trulers[$infos['document_id']][$infos['document_page']];
+                               foreach ($ru as $ruler) {
+                                       $ruler['page'] = $p;
+                                       $rulers[] = $ruler;
+                               }
+                       }
+               }
+
+               $daoBook = new wsDAOBook($core->con);
+               $book = $daoBook->selectById($book_id);
+
+               $rulers = array_merge($rulers, $book->specialRulers);
+               $links = array_merge($links, $book->specialLinks);
+       }
+
+}
+
+?>
index e66a211d410dbbe9032c09e6ec40eb88d6e5576f..16e1a2ccbcc3ab4b70e952b6bed30e8eef1d98ae 100644 (file)
@@ -8,23 +8,5 @@ require_once(dirname(__FILE__) . '/Util/_common.php');
 \r
 $GLOBALS['ajaxClasses'][] = 'wsAjax';\r
 \r
-$core->url->register('flash', 'flash', '^flash(.*)$', array('wsFlash', 'in'));\r
-$core->url->register('services', 'services', '^services(.*)$', array('wsServices', 'in'));\r
-$core->url->register('maintenance', 'maintenance', '^maintenance(.*)$', array('wsMaintenance', 'in'));\r
-$core->url->register('editor', 'editor', '^editor/(.*)$', array('wsUrl', 'editor'));\r
-$core->url->register('restoreLinks', 'restoreLinks', '^restoreLinks/(.*)$', array('wsUrl', 'restoreLinks'));\r
-$core->url->register('viewer', 'viewer', '^viewer/(.*)$', array('wsUrl', 'viewer'));\r
-$core->url->register('vieweru', 'vieweru', '^vieweru/(.*)$', array('wsUrl', 'vieweru'));\r
-$core->url->register('viewerp', 'viewerp', '^viewerp/(.*)$', array('wsUrl', 'viewerp'));\r
-$core->url->register('viewerh', 'viewerh', '^viewerh/(.*)$', array('wsUrl', 'viewerh'));\r
-$core->url->register('viewerhu', 'viewerhu', '^viewerhu/(.*)$', array('wsUrl', 'viewerhu'));\r
-$core->url->register('viewerht', 'viewerht', '^viewerht/(.*)$', array('wsUrl', 'viewerht'));\r
 \r
-if (DEV) {\r
-       $tools = ROOT . '/../inc/tools/';\r
-       cubePHP::appendEnv('PATH', $tools);\r
-       cubePHP::appendEnv('PATH', $tools . 'gs8.70/bin/');\r
-       cubePHP::appendEnv('PATH', $tools . 'gs8.70/lib/');\r
-       cubePHP::setEnv('GS_FONTPATH', FONT_PATH);\r
-}\r
 ?>
\ No newline at end of file
diff --git a/inc/ws/prepend.php b/inc/ws/prepend.php
new file mode 100644 (file)
index 0000000..2df598a
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+$core->url->register('flash', 'flash', '^flash(.*)$', array('wsFlash', 'in'));
+$core->url->register('services', 'services', '^services(.*)$', array('wsServices', 'in'));
+$core->url->register('maintenance', 'maintenance', '^maintenance(.*)$', array('wsMaintenance', 'in'));
+$core->url->register('editor', 'editor', '^editor/(.*)$', array('wsUrl', 'editor'));
+$core->url->register('restoreLinks', 'restoreLinks', '^restoreLinks/(.*)$', array('wsUrl', 'restoreLinks'));
+$core->url->register('viewer', 'viewer', '^viewer/(.*)$', array('wsUrl', 'viewer'));
+$core->url->register('vieweru', 'vieweru', '^vieweru/(.*)$', array('wsUrl', 'vieweru'));
+$core->url->register('viewerp', 'viewerp', '^viewerp/(.*)$', array('wsUrl', 'viewerp'));
+$core->url->register('viewerh', 'viewerh', '^viewerh/(.*)$', array('wsUrl', 'viewerh'));
+$core->url->register('viewerhu', 'viewerhu', '^viewerhu/(.*)$', array('wsUrl', 'viewerhu'));
+$core->url->register('viewerht', 'viewerht', '^viewerht/(.*)$', array('wsUrl', 'viewerht'));
+
+if (DEV) {
+       $tools = ROOT . '/../inc/tools/';
+       cubePHP::appendEnv('PATH', $tools);
+       cubePHP::appendEnv('PATH', $tools . 'gs8.70/bin/');
+       cubePHP::appendEnv('PATH', $tools . 'gs8.70/lib/');
+       cubePHP::setEnv('GS_FONTPATH', FONT_PATH);
+}
+?>
index 431c9727f15f5940d9e2873c9a8fc37686dcc64b..b2a7f5ff2006b60fcabaf3aaca084769150958fe 100644 (file)
--- a/js/ws.js
+++ b/js/ws.js
@@ -36,7 +36,7 @@ function load_ws(){
                        url             :       SITE_PATH+'ajax/'+$(this).attr('action'),\r
                        success :       function(data){\r
                                window.opener.document.getElementById("composerSwf").reloadLinks();\r
-                               //window.close();       \r
+                               window.close(); \r
                        }\r
                });\r
                return false;\r