]> _ Git - cubeextranet.git/commitdiff
wip #1719 @3
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 4 Oct 2017 17:56:50 +0000 (17:56 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 4 Oct 2017 17:56:50 +0000 (17:56 +0000)
fluidbook/icones/15/interface.svg
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/Util/html5/burgermenu/class.ws.html5.compiler.php

index a09ec3f6ad6891cea82db5298a6520aa7c0fd4a8..c8f3102d6732b93232ee69f3180da324e24fdcba 100644 (file)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" ?>\r
 <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">\r
 \r
     <symbol id="nav-share" viewBox="0 0 512 512">\r
         <path d="m160 428c-4 0-8-2-10-4-7-6-7-14 0-21 0 0 94-96 94-186 0-90-45-137-45-137-6-6-6-14 0-21 6-6 14-6 20 0 2 2 53 56 53 158 0 102-98 203-102 207-2 2-6 4-10 4z m49 29c-78 0-143-64-143-144 0-80 63-143 143-143 8 0 14 6 14 14 0 9-6 15-14 15-64 0-115 51-115 114 0 64 51 115 115 115 63 0 115-51 115-115 0-16-5-30-11-45-4-8 0-16 9-18 8-4 16 0 18 8 8 18 12 37 12 57 0 78-63 142-143 142z m158-207c0 0-2 0-2 0-19 0-33-10-43-25-15-22-13-39-7-51 11-22 39-37 62-39 31-4 41-22 41-22 4-7 10-9 16-9 6 2 10 9 10 15 0 8-4 78-28 106-10 17-31 25-49 25z m-23-41c6 8 12 12 21 12 10 0 22-4 28-14 8-10 15-33 19-53-9 4-21 8-33 10-17 0-33 10-39 20 0 4-4 11 4 25z"/>\r
     </symbol>\r
 \r
+    <symbol id="nav-home" viewBox="0 0 25 25">\r
+        <path d="M15.4,3.2H9.6c-0.4,0-0.7,0.3-0.7,0.7v7.2c0,0.4,0.3,0.7,0.7,0.7h5.8c0.4,0,0.7-0.3,0.7-0.7V3.9C16.1,3.5,15.8,3.2,15.4,3.2z M14.7,10.4h-4.4V4.6h4.4V10.4z"/>\r
+        <path d="M15.4,13.2H9.6c-0.4,0-0.7,0.3-0.7,0.7v7.2c0,0.4,0.3,0.7,0.7,0.7h5.8c0.4,0,0.7-0.3,0.7-0.7v-7.2        C16.1,13.5,15.8,13.2,15.4,13.2z M14.7,20.4h-4.4v-5.8h4.4V20.4z"/>\r
+        <path d="M24.2,3.2h-5.8c-0.4,0-0.7,0.3-0.7,0.7v7.2c0,0.4,0.3,0.7,0.7,0.7h5.8c0.4,0,0.7-0.3,0.7-0.7V3.9C24.9,3.5,24.6,3.2,24.2,3.2z M23.5,10.4h-4.4V4.6h4.4V10.4z"/>\r
+        <path d="M6.6,3.2H0.8c-0.4,0-0.7,0.3-0.7,0.7v7.2c0,0.4,0.3,0.7,0.7,0.7h5.8c0.4,0,0.7-0.3,0.7-0.7V3.9C7.3,3.5,7,3.2,6.6,3.2z M5.9,10.4H1.5V4.6h4.4V10.4z"/>\r
+        <path d="M6.6,13.2H0.8c-0.4,0-0.7,0.3-0.7,0.7v7.2c0,0.4,0.3,0.7,0.7,0.7h5.8c0.4,0,0.7-0.3,0.7-0.7v-7.2C7.3,13.5,7,13.2,6.6,13.2z M5.9,20.4H1.5v-5.8h4.4V20.4z"/>\r
+    </symbol>\r
+\r
 </svg>\r
index 9a0f505c66e129754da7db550fd52355a5bb794c..81c26ce413b8a3beefb3539f94ba301e27361efa 100644 (file)
@@ -1322,56 +1322,125 @@ class wsMaintenance {
                wsDocument::cleanSVG($test, true);
        }
 
-       public function addSearch() {
-               global $core;
-               $r = $core->con->select('SELECT book_id, parametres FROM books WHERE book_id');
-               $reset = [];
-               $error = [];
-               $skip = [];
-               while ($r->fetch()) {
-                       /** @var wsBookParametres $parametres */
-                       try {
-                               $former =
-                               $parametres = unserialize($r->parametres);
-                               $order = explode(',', $parametres->navOrder);
-                               $former = $parametres->navOrder;
-                               $order = array_map('trim', $order);
-                               if (in_array('search', $order)) {
-                                       $skip[] = $r->book_id;
-                                       continue;
-                               }
+       //      public function addSearch() {
+       //              global $core;
+       //              $r = $core->con->select('SELECT book_id, parametres FROM books WHERE book_id');
+       //              $reset = [];
+       //              $error = [];
+       //              $skip = [];
+       //              while ($r->fetch()) {
+       //                      /** @var wsBookParametres $parametres */
+       //                      try {
+       //                              $former =
+       //                              $parametres = unserialize($r->parametres);
+       //                              $order = explode(',', $parametres->navOrder);
+       //                              $former = $parametres->navOrder;
+       //                              $order = array_map('trim', $order);
+       //                              if (in_array('search', $order)) {
+       //                                      $skip[] = $r->book_id;
+       //                                      continue;
+       //                              }
+       //
+       //                              $searchLocation = 0;
+       //                              $chaptersLocation = array_search('chapters', $order);
+       //                              if ($chaptersLocation !== false) {
+       //                                      $searchLocation = $chaptersLocation + 1;
+       //                              } else {
+       //                                      $indexLocation = array_search('index', $order);
+       //                                      if ($indexLocation !== false) {
+       //                                              $searchLocation = $indexLocation + 1;
+       //                                      }
+       //                              }
+       //                              array_splice($order, $searchLocation, 0, 'search');
+       //
+       //                              $newOrder = join(', ' , $order);
+       //
+       //                              $c = $core->con->openCursor('books');
+       //                              $parametres->navOrder=$newOrder;
+       //                              $c->parametres = serialize($parametres);
+       //                              $c->changedate = TIME;
+       //                              $c->update('WHERE book_id=' . $r->book_id);
+       //                              $reset[] = $r->book_id . ' : ' . $former . ' -> ' . $newOrder;
+       //                      } catch (Exception $e) {
+       //                              $error[] = $r->book_id;
+       //                      }
+       //              }
+       //
+       //              echo 'reset : ' . implode('<br />', $reset) . '<br />';
+       //              echo 'skip : ' . implode(', ', $skip) . '<br />';
+       //              echo 'error : ' . implode(', ', $error) . '<br />';
+       //
+       //      }
+
+       public static function svgToFlash() {
+               $iconSets = array(15);
+               $names = array('nav-share' => 'nav-friend',
+                              'nav-bookmarks' => 'nav-bookmark',
+                              'nav-chapters' => 'nav-sommaire',
+                              'nav-download' => 'nav-save',
+                              'nav-fullscreen' => 'nav-fullscreen',
+                              'nav-fullscreen-exit' => 'nav-normalscreen',
+                              'nav-sound-off' => 'nav-soundoff',
+                              'nav-sound-on' => 'nav-soundon',
+               );
 
-                               $searchLocation = 0;
-                               $chaptersLocation = array_search('chapters', $order);
-                               if ($chaptersLocation !== false) {
-                                       $searchLocation = $chaptersLocation + 1;
-                               } else {
-                                       $indexLocation = array_search('index', $order);
-                                       if ($indexLocation !== false) {
-                                               $searchLocation = $indexLocation + 1;
-                                       }
+
+               foreach ($iconSets as $iconSet) {
+                       $dom = new DOMDocument();
+                       $svgFile = WS_ICONS . '/' . $iconSet . '/interface.svg';
+                       if (!$dom->loadXML(file_get_contents($svgFile))) {
+                               die('Error loading xml : ' . $svgFile);
+                       }
+
+                       $symbols = $dom->getElementsByTagName('symbol');
+
+                       foreach ($symbols as $symbol) {
+                               /* @var $symbol DOMElement */
+                               $id = $symbol->getAttribute('id');
+                               list($x, $y, $width, $height) = explode(' ', $symbol->getAttribute('viewBox'));
+
+                               $svg = '<?xml version="1.0" encoding="utf-8"?>
+<svg version="1.0" id="' . $id . '" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="' . $width . 'px" height="' . $height . 'px" viewBox="0 0 ' . $width . ' ' . $height . '" enable-background="new 0 0 ' . $width . ' ' . $height . '" xml:space="preserve">
+' . CubeIT_Util_Xml::innerXML($symbol) . '
+</svg>';
+                               $dest = $id;
+                               if (isset($names[$id])) {
+                                       $dest = $names[$id];
                                }
-                               array_splice($order, $searchLocation, 0, 'search');
+                               $tmp = CubeIT_Files::tempnam() . '.svg';
+                               file_put_contents($tmp, $svg);
+                               $png = WS_ICONS . '/' . $iconSet . '/' . $dest . '.png';
+                               $tmp1 = CubeIT_Files::tempnam() . '.png';
 
-                               $newOrder = join(', ' , $order);
+                               $cmd = "/usr/bin/convert -density 200 -resize 20x20 -background none $tmp $tmp1";
+                               echo $cmd . "\n";
+                               echo `$cmd` . "\n";
 
-                               $c = $core->con->openCursor('books');
-                               $parametres->navOrder=$newOrder;
-                               $c->parametres = serialize($parametres);
-                               $c->changedate = TIME;
-                               $c->update('WHERE book_id=' . $r->book_id);
-                               $reset[] = $r->book_id . ' : ' . $former . ' -> ' . $newOrder;
-                       } catch (Exception $e) {
-                               $error[] = $r->book_id;
+                               $cmd = "/usr/bin/convert $tmp1 -alpha extract -background white -alpha shape $png";
+                               echo $cmd . "\n";
+                               echo `$cmd` . "\n";
+
+                               unlink($tmp1);
+                               unlink($tmp);
                        }
+                       header('Content-type: text/plain');
+                       exit;
                }
-
-               echo 'reset : ' . implode('<br />', $reset) . '<br />';
-               echo 'skip : ' . implode(', ', $skip) . '<br />';
-               echo 'error : ' . implode(', ', $error) . '<br />';
-
        }
 
+       public static function iconSetToInterface() {
+               $iconSets = array(2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
+
+               $names = array('nav-share' => 'nav-friend',
+                              'nav-bookmarks' => 'nav-bookmark',
+                              'nav-chapters' => 'nav-sommaire',
+                              'nav-download' => 'nav-save',
+                              'nav-fullscreen' => 'nav-fullscreen',
+                              'nav-fullscreen-exit' => 'nav-normalscreen',
+                              'nav-sound-off' => 'nav-soundoff',
+                              'nav-sound-on' => 'nav-soundon',
+               );
+       }
 }
 
 
index 5df3a888c267cacb84d11a8557256f6b2870eda0..054dea8a64d9be680ca15b594c8593dd69f41166 100644 (file)
@@ -1027,16 +1027,9 @@ class wsHTML5Compiler {
 
                $arrowsColor = $this->theme->parametres->arrowsColor;
                // Set the icon list with the color
-               $icons = array('nav-bookmark' => $couleurI, 'nav-friend' => $couleurI, 'nav-help' => $couleurI, 'nav-index' => $couleurI, 'nav-sommaire' => $couleurI,
-                              'nav-zoomin' => $couleurI, 'nav-zoomout' => $couleurI, 'nav-fullscreen' => $couleurI,
-                              'interface-next' => $arrowsColor, 'interface-previous' => $arrowsColor,
-                              'interface-sharp-next' => $arrowsColor, 'interface-sharp-previous' => $arrowsColor,
-                              'interface-search' => $couleurI,
-                              'interface-down' => $arrowsColor, 'interface-close' => $arrowsColor,
+               $icons = array('interface-down' => $arrowsColor, 'interface-close' => $arrowsColor,
                               'interface-audio-description-on' => $arrowsColor, 'interface-audio-description-off' => $arrowsColor,
-                              'help-fingers' => $couleurI, 'help-mouse' => $couleurI, 'nav-home' => $couleurI, 'nav-archives' => $couleurI, 'nav-map' => $couleurI,
-                              'nav-tag' => $couleurI, 'nav-print' => $couleurI, 'nav-friend' => $couleurI,
-                              'share-facebook' => $couleurM, 'share-twitter' => $couleurM, 'share-email' => $couleurM, 'share-googleplus' => $couleurM, 'share-linkedin' => $couleurM, 'share-viadeo' => $couleurM,
+                              'help-fingers' => $couleurI, 'help-mouse' => $couleurI,
                               'bookmark-left-off' => $bookmarksDisabledColors, 'bookmark-left-on' => $bookmarksEnabledColors,
                               'bookmark-right-off' => $bookmarksDisabledColors, 'bookmark-right-on' => $bookmarksEnabledColors
                );
@@ -1312,13 +1305,15 @@ class wsHTML5Compiler {
                $res[] = 'footer,footer a{color:' . wsHTML5::colorToCSS($this->theme->parametres->creditsColor) . ';}';
 
                // Arrows
-               $res[] = '#next,#previous{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurA) . ';}';
+               $lessVariables['arrows-background'] = wsHTML5::colorToCSS($this->theme->parametres->couleurA);
+               $lessVariables['arrows-color'] = wsHTML5::colorToCSS($this->theme->parametres->arrowsColor);
 
                // Audio description buttons
-               $res[] = '.audio-description-button{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurA) . ';}';
-               $lessVariables['links-color'] = wsHTML5::colorToCSS($this->theme->parametres->linksColor);
+               $lessVariables['audiodescription-background'] = wsHTML5::colorToCSS($this->theme->parametres->couleurA);
+               $lessVariables['audiodescription-color'] = wsHTML5::colorToCSS($this->theme->parametres->couleurA);
 
                // Links Styles
+               $lessVariables['links-color'] = wsHTML5::colorToCSS($this->theme->parametres->linksColor);
                $res = array_merge($res, $links);
 
                // Bookmarks