]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 5 Feb 2013 09:47:39 +0000 (09:47 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 5 Feb 2013 09:47:39 +0000 (09:47 +0000)
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/Util/class.ws.exporter.php
inc/ws/Util/html5/class.ws.html5.compiler.php

index 639d14c8191081bc881724127c7caa18d875b39f..8e0647219ffaabc19127ff8ca8399a98fe3527ce 100644 (file)
@@ -936,7 +936,7 @@ class wsAjax extends cubeAjax {
 \r
        public static function exportbookExe($args, &$x) {\r
                $exporter = new wsExporter();\r
-               $exporter->export($_POST['book_id'], $x, $_POST['action'], $_POST['version'], $_POST['destination']);\r
+               $exporter->export($_POST['book_id'], $x, $_POST['action'], $_POST['version'], $_POST['destination']['dir'], $_POST['destination']['file']);\r
 \r
                $x->addClosePopup();\r
        }\r
@@ -973,6 +973,12 @@ class wsAjax extends cubeAjax {
                        $defaultVersion = '';\r
                }\r
 \r
+               $format = false;\r
+               if ($defaultVersion != '') {\r
+                       $format = $formatInstall[$defaultVersion];\r
+               }\r
+               $displayFile = ($format !== false);\r
+\r
                if ($defaultAction != 'download') {\r
                        $daoBook = new wsDAOBook($core->con);\r
                        $book = $daoBook->selectById($book_id);\r
@@ -996,6 +1002,10 @@ class wsAjax extends cubeAjax {
                                $defaultDestination['dir'] = cubeText::str2URL($book->nom);\r
                        }\r
 \r
+                       if ($defaultDestination['file'] == '') {\r
+                               $defaultDestination['file'] = cubeText::str2URL($book->nom) . '.' . $format;\r
+                       }\r
+\r
 \r
                        switch ($defaultAction) {\r
                                case 'install_hosting':\r
@@ -1019,10 +1029,10 @@ class wsAjax extends cubeAjax {
 \r
                        $destinationFile = '';\r
                        if ($displayFile) {\r
-                               $destinationFile = form::field(array('destination[file]', 'destination'), 30, 128, $defaultDestination['file']);\r
+                               $destinationFile = form::field(array('destination[file]', 'destination'), 50, 128, $defaultDestination['file']);\r
                        }\r
 \r
-                       $res .= '<tr><td class="right"><em>' . $s . '</em></td><td>' . form::field(array('destination[dir]', 'destination'), 40, 128, $defaultDestination['dir']) . ' / ' . $destinationFile . '</td></tr>';\r
+                       $res .= '<tr><td class="right"><em>' . $s . '</em></td><td>' . form::field(array('destination[dir]', 'destination'), 50, 128, $defaultDestination['dir']) . ' / ' . $destinationFile . '</td></tr>';\r
                } else {\r
                        $res.=$version;\r
                }\r
index 25f65d022f75b2411782ad1757fdad0fc5c90820..ddace0738baca432853f5df4393121990f23e02c 100644 (file)
@@ -147,7 +147,7 @@ class wsUrl {
                        }\r
                        $res .= '<td class="bouton"><a href="' . SITE_PATH . 'stats/' . $book->book_id . '_' . $book->hash . '" class="normallink">' . $btStats . '</a></td>';\r
                        if ($book->version > 1) {\r
-                               if ($core->user->utilisateur_id == 5) {\r
+                               if ($droits->admin) {\r
                                        $res .= '<td class="bouton"><a href="#" rel="exportbook/' . $book->book_id . '" class="popup">' . $btDownload . '</a></td>';\r
                                } else {\r
                                        $res .= '<td class="bouton"><a href="#" class="openContextMenu" rel="' . $context_download_id . '" rev="' . $book->book_id . '">' . $btDownload . '</a></td>';\r
index 8264af5729770df40409ce4d392340563e570cad..cdda4fde62ffa6509b636daf89a14df96f3bf2df 100644 (file)
@@ -56,13 +56,18 @@ class wsExporter {
        }
 
        protected function _haveToZip() {
-               $yes = array('win-exe', 'mac-exe');
+               $yes = array('win-exe', 'mac-exe', 'win-cd');
                return in_array($this->version, $yes);
        }
 
        protected function _install() {
                $package = wsPackager::package($this->book_id, $this->version, $this->_haveToZip());
 
+               if (strpos($package, '/fluidbook') == 0) {
+                       $package = ROOT . $package;
+               }
+
+
                if ($this->action == 'references') {
                        $root = '/home/fluidbook/www/references/';
                        $rootURL = 'http://www.fluidbook.com/references/';
@@ -82,7 +87,7 @@ class wsExporter {
                }
 
                if (stristr($path, 'ftp://')) {
-                       $this->_lftp($package, $path, true);
+                       $this->_lftp($package, $path, false);
                } else {
                        $this->_rsync($package, $path);
                }
@@ -114,7 +119,7 @@ class wsExporter {
                }
        }
 
-       protected function _lftp($src, $dest, $passive = true, $erase = false) {
+       protected function _lftp($src, $dest, $passive = false, $erase = false) {
                $u = parse_url($dest);
 
                $file = is_file($src);
@@ -149,6 +154,7 @@ class wsExporter {
                        }
                }
 
+
                $lftp = new cubeCommandLine('lftp');
                $lftp->setArg('u', $u['user'] . ',' . $u['pass']);
                $lftp->setArg('p', $u['port']);
@@ -158,19 +164,23 @@ class wsExporter {
        }
 
        protected function _rsync($src, $dest, $erase = false) {
-               if (!file_exists($dest)) {
-                       mkdir($dest, 0777, true);
-               }
 
                if (is_file($src)) {
+                       $dir = dirname($dest);
+                       if (!file_exists($dir)) {
+                               mkdir($dir, 0777, true);
+                       }
                        copy($src, $dest);
                        return;
                }
 
+               if (!file_exists($dest)) {
+                       mkdir($dest, 0777, true);
+               }
+
+               $cp = new cubeCommandLine('rsync');
+               $cp->setPath(CONVERTER_PATH);
                if ($erase) {
-                       /**  --del -r -z -v * */
-                       $cp = new cubeCommandLine('rsync');
-                       $cp->setPath(CONVERTER_PATH);
                        $cp->setArg('del');
                }
                $cp->setArg('t');
index 144e970278c5bbb74ccb03bab41cfb7d379d36ac..c5088bb9eeb9479dc8dbda520141ef105b1c3272 100644 (file)
@@ -995,19 +995,46 @@ class wsHTML5Compiler {
                $res[] = '.link a.displayArea{-webkit-tap-highlight-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.0001) . ';}';
 
                // Bookmarks
-               fb($this->book->parametres->bookmarkCornerSize);
                if (!isset($this->book->parametres->bookmarkCornerSize)) {
                        $this->book->parametres->bookmarkCornerSize = 10;
                }
                $size = round($this->width * $this->book->parametres->bookmarkCornerSize * 0.0075);
-               fb($size);
                $res[] = '#links .bookmark{width:' . $size . 'px;height:' . $size . 'px;}';
 
                // Menus
+               $menuColor = new CubeIT_Graphics_Color($this->theme->parametres->couleurB);
+               $menuColor->setAlpha(1);
+
+               $menuMultiply = $menuColor->multiply($menuColor);
+               $menuMultiply2 = $menuMultiply->multiply($menuColor);
+
                # View
                $res[] = '.portrait .mview{width:' . $w . ';min-height:' . $h . '}';
                $res[] = '.landscape .mview{width:' . $w2 . ';min-height:' . $h . '}';
-               $res[] = '.mview{background-color:' . self::colorToCSS($this->theme->parametres->couleurB, 1) . ';color:' . self::colorToCSS($this->theme->parametres->subTextColor) . ';}';
+               $res[] = '.mview{background-color:' . $menuColor->toCSS() . ';color:' . self::colorToCSS($this->theme->parametres->subTextColor) . ';}';
+               # Topbar
+               
+               
+               $top = $menuColor->toCSS();
+               $bottom = $menuMultiply->setAlpha(0.3)->toCSS();
+               $border = $menuMultiply2->setAlpha(0.5)->toCSS();
+
+               $caption = ".mview .caption{
+       background: -moz-linear-gradient(top, $top 0%, $bottom 100%); /* FF3.6+ */
+       background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,$top), color-stop(100%,$bottom)); /* Chrome,Safari4+ */
+       background: -webkit-linear-gradient(top, $top 0%,$bottom 100%); /* Chrome10+,Safari5.1+ */
+       background: -o-linear-gradient(top, $top 0%,rgba(0,0,0,0.5) 100%); /* Opera 11.10+ */
+       background: -ms-linear-gradient(top, $top 0%,$bottom 100%); /* IE10+ */
+       background: linear-gradient(top bottom, $top 0%,$bottom 100%); /* W3C */
+       border-bottom:2px solid $border;
+       box-shadow:0 2px rgba(255,255,255,0.3);
+}
+.mview .caption:after{
+       content:'';
+       border-top:2px solid rgba(255,255,255,0.3);
+}";
+               fb($caption);
+               $res[] = $caption;
                # Index
                $ratio = $this->width / $this->height;
                $thumbh = round(100 / $ratio);
@@ -1103,48 +1130,7 @@ class wsHTML5Compiler {
        }
 
        public static function colorToCSS($color, $forceAlpha = null) {
-               if (!is_null($forceAlpha)) {
-                       if ($forceAlpha <= 0) {
-                               $a = '00';
-                       } elseif ($forceAlpha < 1) {
-                               $a = ceil($forceAlpha * 255);
-                               $a = base_convert($a, 10, 16);
-                               if (strlen($a) == 1) {
-                                       $a = '0' . $a;
-                               }
-                       } else {
-                               $a = 'FF';
-                       }
-
-                       if (strlen($color) == 6) {
-                               $color = $a . $color;
-                       } else {
-                               $color = $a . substr($color, 2, 6);
-                       }
-               }
-
-               if (strlen($color) == 6) {
-                       return '#' . $color;
-               } else {
-                       $alpha = substr($color, 0, 2);
-                       $red = substr($color, 2, 2);
-                       $green = substr($color, 4, 2);
-                       $blue = substr($color, 6, 2);
-
-                       $components = array('alpha', 'red', 'green', 'blue');
-                       foreach ($components as $k => $name) {
-                               $hex = substr($color, $k * 2, 2);
-                               $$name = intval($hex, 16);
-                       }
-                       $alpha/=255;
-                       if ($alpha == 0) {
-                               return 'transparent';
-                       } elseif ($alpha == 1) {
-                               return '#' . substr($color, 2, 6);
-                       }
-                       return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha
-                                       . ')';
-               }
+               return CubeIT_Graphics_Color::colorToCSS($color, $forceAlpha);
        }
 
 }