]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 21 Dec 2012 15:43:56 +0000 (15:43 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 21 Dec 2012 15:43:56 +0000 (15:43 +0000)
inc/commons/class.common.tools.php
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.services.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Util/html5/class.ws.html5.compiler.php
inc/ws/Util/html5/class.ws.html5.links.php
js/ws.js
style/ws/style.css
typo/ws/small-r-download.png

index a9b9bb6277cb61ff66e61218b8c7bdefad052c28..7ba49c280ae11e01b3ec675c0154a3c7c4f3ccf3 100644 (file)
@@ -184,12 +184,13 @@ class commonTools {
                $res .= commonPage::bh();
                $res.='<form action="' . SITE_PATH . 'tools/makeFavicon" method="post" class="notajax" enctype="multipart/form-data">';
                $res.='<table class="liste">';
-               $res.='<tr><th colspan="2"><strong>' . __('Générer un favicon') . '</strong></th></tr>';
+               $res.='<tr><th colspan="3"><strong>' . __('Générer un favicon') . '</strong></th></tr>';
                $res.='<tr><td>' . __('Veuillez charger une image carrée (dimensions optimales : 256x256 px)') . '</td>';
-               $res.='<td><input type="file" name="file" /></td></tr>';
+               $res.='<td colspan="2"><input type="file" name="file" /></td></tr>';
                $res.='<tr class="odd"><td>' . __('Bord arrondi') . '</td>';
-               $res.='<td><input type="number" name="round" value="0" size="5" />%</td><td>Valeur</td></tr>';
-               $res.='<tr><td class="right" colspan="2"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Générer le favicon')) . '</a></td></td>';
+               $res.='<td><input type="number" name="round" value="0" size="5" />%</td><td>' . __('Valeurs typiques') . ' : <br>iOS : 17.54%<br />' . __('Aucun arrondi') . ' : 0%</td></tr>';
+               $res.='<tr><td colspan="3">' . __("L'arrondi ne sera pas appliqué aux icônes iOS, le système lui même se chargeant d'y appliquer les arrondis et les reflets") . '</td></tr>';
+               $res.='<tr class="odd"><td class="right" colspan="3"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Générer le favicon')) . '</a></td></td>';
                $res.='</table>';
                $res.='</form>';
                $res .= '</div>';
@@ -555,7 +556,6 @@ class commonTools {
                $openssl->setArg('-outform', 'PEM');
                $openssl->execute();
 
-
                // Generate p12 file
                $openssl = new cubeCommandLine('openssl');
                $openssl->setPath(CONVERTER_PATH);
index bcc5d3576e66b7da015f5535710244836e341974..4b60bf24493689e34114a8da0d2ce630dec3ab06 100644 (file)
@@ -884,6 +884,57 @@ class wsAjax extends cubeAjax {
                $dao->setLinksAndRulers($book_id, json_encode($links), json_encode($rulers), 'Import from excel', $core->user->utilisateur_id);\r
        }\r
 \r
+       public static function offsetLinks($args, &$x) {\r
+               global $core;\r
+               $book_id = $args[1];\r
+               $offset = $_POST['offset'];\r
+               $from = $_POST['from'];\r
+               $internal = isset($_POST['internal']);\r
+\r
+               if ($internal) {\r
+                       $daoBook = new wsDAOBook($core->con);\r
+                       $book = $daoBook->selectById($book_id);\r
+                       $numerotation = explode(',', $book->numerotation);\r
+               }\r
+\r
+\r
+               $dao = new wsDAODocument($core->con);\r
+               $dao->getLinksAndRulers($book_id, $links, $rulers);\r
+               $rlinks = array();\r
+               foreach ($links as $k => $link) {\r
+                       if ($link['page'] >= $from) {\r
+                               $link['page']+=$offset;\r
+                       }\r
+                       if ($internal && $link['type'] == 5) {\r
+                               if ($link['numerotation'] == 'physical') {\r
+                                       if ($link['to'] >= $from) {\r
+                                               $link['to']+=$offset;\r
+                                       }\r
+                               } else {\r
+                                       $ph = array_search($link['to'], $numerotation) + 1;\r
+                                       if ($ph >= $from) {\r
+                                               $ph+=$offset;\r
+                                               $vi = $numerotation[($ph-1)];\r
+                                               $link['to'] = $vi;\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       $rlinks[$k] = $link;\r
+               }\r
+\r
+               $rrulers = array();\r
+               foreach ($rulers as $k => $ruler) {\r
+                       if ($ruler['page'] > $from) {\r
+                               $ruler['page']+=$offset;\r
+                       }\r
+                       $rrulers[$k] = $ruler;\r
+               }\r
+\r
+               $dao->setLinksAndRulers($book_id, $rlinks, $rrulers, 'Offset ' . $offset . ' pages from page # ' . $from, $core->user->utilisateur_id);\r
+               $x->addReload();\r
+       }\r
+\r
 }\r
 \r
 ?>
\ No newline at end of file
index 9e9ad6437a17c8af74ad402a7d4e9d07d915e780..01d3d38980f85e8b74fdc1bf873732bb0e4b2c01 100644 (file)
@@ -45,9 +45,15 @@ class wsServices extends cubeFlashGateway {
                }\r
 \r
                $bookmarks = json_decode(base64_decode($this->args['bookmarks']), true);\r
+               fb($bookmarks);\r
                $files = array();\r
                foreach ($bookmarks as $b) {\r
-                       $file = $this->getPDFComplex($this->args['id'], $b['page'] . '-' . $b['page'] + $b['nb']);\r
+                       $range = $b['page'];\r
+                       if ($b['nb'] > 1) {\r
+                               $range.='-' . ($b['page'] + $b['nb'] - 1);\r
+                       }\r
+\r
+                       $file = $this->getPDFComplex($this->args['id'], $range);\r
                        $files[] = array('name' => $b['name'], 'file' => $file['file']);\r
                }\r
 \r
@@ -369,8 +375,6 @@ class wsServices extends cubeFlashGateway {
                $mail->to = 'chequieravantages@gmail.com';\r
                $body = '';\r
 \r
-\r
-\r
                foreach ($fields as $k => $f) {\r
                        $body.=$k . ' : ' . $this->args[$f] . "\r\n";\r
                        $datas[$f] = $this->args[$f];\r
index 02a5642a43e6faa1232c44a649cceb9e6c181d95..71045dd4d04aec6dd45a4d872f6559697ecef51d 100644 (file)
@@ -527,12 +527,30 @@ html{height:100%}' . "\n";
                $res .= '</head>';\r
                $res .= '<body onload="this.focus();">';\r
                $res .= '<div id="restoreLinks">';\r
-               $res.='<div class="center" style="padding:15px;">';\r
+               $res.='<div>';\r
+               $res.='<h2>' . __('Import') . '</h2>';\r
+               $res.='<div class="center">';\r
                $res.='<form action="importLinksAsExcel/' . $book_id . '" method="post" enctype="multipart/form-data" class="notajax" id="importLinksAsExcel">';\r
                $res.=__("Importer des liens à partir d'un fichier Excel") . ' : <input type="file" name="file" accept="*.xlsx" />';\r
                $res.='<input type="submit" value="' . __('Importer') . '" />';\r
                $res.='</form>';\r
                $res.='</div>';\r
+               $res.='</div>';\r
+               $res.='<hr />';\r
+\r
+               $res.='<div id="linksOffset">';\r
+               $res.='<h2>' . __('Décalage de pages') . '</h2>';\r
+               $res.='<form action="offsetLinks/' . $book_id . '" method="post" id="offsetLinks">';\r
+               $offset = form::field('offset', 3, 5);\r
+               $from = form::field('from', 3, 5);\r
+               $res.=sprintf(__('Décaler les liens de %s pages à partir de la page %s'), $offset, $from) . '<br />';\r
+               $res.='<label>' . form::checkbox('internal', 1, true) . ' ' . __('Appliquer le décalages sur les numéros de pages dans les liens internes') . '</label><br />';\r
+               $res.='<input type="submit" value="' . __('Procéder au décalage') . '" />';\r
+               $res.='</form>';\r
+               $res.='</div>';\r
+               $res.='<hr />';\r
+\r
+               $res.='<h2>' . __('Historique') . '</h2>';\r
                $res .= '<table class="liste" style="width:100%;min-width:0;">';\r
                $res .= '<tr>';\r
                $res .= '<th>' . __('Date') . '</th>';\r
@@ -772,6 +790,7 @@ html{height:100%}' . "\n";
 \r
                $dao = new wsDAOBook($core->con);\r
 \r
+               $dir = '';\r
                if ($version == 'a') {\r
                        $version = '';\r
                        $dir = 'a';\r
@@ -782,6 +801,7 @@ html{height:100%}' . "\n";
                        commonDroits::error();\r
                }\r
 \r
+\r
                echo file_get_contents(WS_BOOKS . '/html5' . $dir . '/' . $book_id . '/index' . $version . '.html');\r
                exit;\r
        }\r
index 0594a202b8aaef2374a2d1ed798c0046769ad8a2..16092c2287e55b66b8b90ebcf7a8ee1d802e4769 100644 (file)
@@ -622,7 +622,7 @@ class wsDAOBook extends commonDAO {
                        }\r
                } else if ($version == 'html5') {\r
                        // HTML5\r
-                       $checks = array($book->changedate, cubeFiles::filemtimeRecursive(WS_COMPILE_ASSETS . '/_html5'), cubeFiles::filemtimeRecursive(ROOT . '/inc/ws/Util/html5'));\r
+                       $checks = array($book->changedate, cubeFiles::filemtimeRecursive(WS_BOOKS . '/working/' . $book->book_id), cubeFiles::filemtimeRecursive(WS_COMPILE_ASSETS . '/_html5'), cubeFiles::filemtimeRecursive(ROOT . '/inc/ws/Util/html5'));\r
                        foreach ($checks as $check) {\r
                                if ($check > $book->compilehtml5date) {\r
                                        return false;\r
index 2d47d3174bfa5acb5841bf0d341b68bc14288d95..74c744e8d19575e397d77cf94323537a2dfa6091 100644 (file)
@@ -71,6 +71,7 @@ class wsHTML5Compiler {
        );
        public $pluginCSS = array();
        public $pluginJs = array();
+       public $htmlmultimedia = array();
        protected $cssX = array();
        protected $cssY = array();
        protected $cssWidths = array();
@@ -81,7 +82,8 @@ class wsHTML5Compiler {
        protected $numerotation;
        protected $fontDocs = array();
        protected $dir;
-       protected $vdir;
+       public $vdir;
+       public $wdir;
 
        /**
         *
@@ -148,6 +150,7 @@ class wsHTML5Compiler {
                        $this->dir = $dir;
                }
                $this->vdir = $this->dir;
+               $this->wdir = WS_BOOKS . '/working/' . $this->book_id . '/';
 
                // Clean the folder
                `rm -rf $this->vdir`;
@@ -513,12 +516,12 @@ class wsHTML5Compiler {
        }
 
        protected function writePrint() {
-               $res='';
-               /*$res .= '<div id="printpages">';
-               for ($i = 1; $i <= $this->book->parametres->pages; $i++) {
-                       $res.='<div class="printpage"><img src="data/background/150/t' . $i . '.jpg" alt="" /></div>';
-               }
-               $res.='</div>';*/
+               $res = '';
+               /* $res .= '<div id="printpages">';
+                 for ($i = 1; $i <= $this->book->parametres->pages; $i++) {
+                 $res.='<div class="printpage"><img src="data/background/150/t' . $i . '.jpg" alt="" /></div>';
+                 }
+                 $res.='</div>'; */
                return $res;
        }
 
@@ -597,6 +600,7 @@ class wsHTML5Compiler {
 
                $allpages = range(0, $this->book->parametres->pages + 1);
                $allpages[] = 'aftersearch';
+               $allpages[] = 'background';
 
                $this->config->links = array();
 
@@ -682,6 +686,7 @@ class wsHTML5Compiler {
                $this->config->coquilletteBack = $this->colorToCSS($this->theme->parametres->couleurA);
                $this->config->coquilletteFront = $this->colorToCSS($this->theme->parametres->arrowsColor);
                $this->config->videoFormats = $this->getVideosFormats(false);
+               $this->config->htmlmultimedia = $this->htmlmultimedia;
                foreach ($this->additionalConfig as $k => $v) {
                        $this->config->$k = $v;
                }
@@ -968,7 +973,7 @@ class wsHTML5Compiler {
                        return;
                }
 
-               $origDir = WS_BOOKS . '/working/' . $this->book_id . '/';
+               $origDir = $this->wdir;
                $types = $this->getVideosFormats();
                if ($video) {
                        wsTools::encodeWebVideos($origDir . $source, null, true);
index a243977c40b4ace9304a5c6437b9a5c4411324a4..64d616d844bb22d970e56a31a7f3e4f88c2730ea 100644 (file)
@@ -64,6 +64,16 @@ class wsHTML5Link {
                                return new imageLink($id, $init, $compiler);
                        case 16:
                                return new fileLink($id, $init, $compiler);
+                       case 17:
+                               //return new audioLink($id,$init,$compiler);
+                               break;
+                       case 18:
+                       case 19:
+                               break;
+                       case 20:
+                               break;
+                       case 21:
+                               return new htmlMultimediaLink($id, $init, $compiler);
                        default:
                                return null;
                }
@@ -101,6 +111,19 @@ class wsHTML5Link {
                $this->compiler->copyLinkFile($file, 'data/links/', $video);
        }
 
+       public function unzipFile($file) {
+               $fdir = 'data/links/' . $this->id;
+               $dir = $this->compiler->vdir . '/' . $fdir;
+               if (!file_exists($dir)) {
+                       mkdir($dir, 0777, true);
+               }
+               $unzip = new cubeCommandLine('unzip');
+               $unzip->setArg(null, $this->compiler->wdir . '/' . $file);
+               $unzip->setArg('d', $dir);
+               $unzip->execute();
+               return array('dir' => $dir, 'fdir' => $fdir);
+       }
+
        public function getCSSContainer() {
 
 
@@ -367,6 +390,40 @@ class multimediaLink extends wsHTML5Link {
 
 }
 
+class htmlMultimediaLink extends wsHTML5Link {
+
+       public function getHTMLContent() {
+               $d = $this->unzipFile($this->to);
+               $w = $this->width * $this->compiler->getCssScale();
+               $h = $this->height * $this->compiler->getCssScale();
+
+               $dr = opendir($d['dir']);
+               while ($file = readdir($dr)) {
+                       if ($file == '.' || $file == '..') {
+                               continue;
+                       }
+
+                       $ext = files::getExtension($file);
+
+                       if ($ext == 'js') {
+                               $this->compiler->pluginJs[] = $d['fdir'] . '/' . $file;
+                               $e = explode('.', $file);
+                               $name = $e[0];
+                               $code = '$("#l_' . $this->id . '").' . $name . '();';
+                               $this->compiler->htmlmultimedia[] = $code;
+                       } else if ($ext == 'css') {
+                               $this->compiler->pluginCSS[] = $d['fdir'] . '/' . $file;
+                       } else if ($ext == 'html') {
+                               $res = file_get_contents($d['dir'] . '/' . $file);
+                               unlink($d['dir'] . '/' . $file);
+                       }
+               }
+
+               return $res;
+       }
+
+}
+
 class webVideoPopupLink extends videoPopupLink {
 
        public function getURL() {
index b076075d0ef7aac408a12875266b68e150de5bfe..ebb157af4e0d4a853dab157fe02dd84c2441f846 100644 (file)
--- a/js/ws.js
+++ b/js/ws.js
@@ -30,7 +30,7 @@ function load_ws(){
                });\r
        }\r
        \r
-       $("#importLinksAsExcel").submit(function(){\r
+       $("#importLinksAsExcel,#offsetLinks").submit(function(){\r
                $(this).ajaxSubmit({\r
                        url             :       SITE_PATH+'ajax/'+$(this).attr('action'),\r
                        success :       function(data){\r
@@ -41,6 +41,8 @@ function load_ws(){
                return false;\r
        });\r
 \r
+\r
+\r
        $(".restoreLink").click(restoreLink);\r
        \r
        $(".hide_new_value").change(function(){\r
index 2956a4ba96d296e0499c1b506c76d87d983cdcfb..d5c8382a48182a01b7582fc8e998a1093cb91eca 100644 (file)
@@ -489,4 +489,16 @@ th.stats_col{
 \r
 #accepteDemandes{\r
        padding:10px;\r
+}\r
+\r
+#restoreLinks{\r
+       margin:10px;\r
+}\r
+\r
+#restoreLinks hr{\r
+       margin:10px 0;\r
+}\r
+\r
+#restoreLinks h2{\r
+       margin:5px 0 10px 0;\r
 }
\ No newline at end of file
index aa19876036b72e1134a4d9c90ef92c70e9a0ff14..5273f250a9aa78271e7ecc9535afc8e37bc12566 100644 (file)
Binary files a/typo/ws/small-r-download.png and b/typo/ws/small-r-download.png differ