From fc5c492851ff7f542bf1613e2ee19fc2914e01dc Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 5 Feb 2013 09:47:39 +0000 Subject: [PATCH] --- inc/ws/Controlleur/class.ws.ajax.php | 16 +++- inc/ws/Controlleur/class.ws.url.php | 2 +- inc/ws/Util/class.ws.exporter.php | 28 ++++--- inc/ws/Util/html5/class.ws.html5.compiler.php | 76 ++++++++----------- 4 files changed, 64 insertions(+), 58 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index 639d14c81..8e0647219 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -936,7 +936,7 @@ class wsAjax extends cubeAjax { public static function exportbookExe($args, &$x) { $exporter = new wsExporter(); - $exporter->export($_POST['book_id'], $x, $_POST['action'], $_POST['version'], $_POST['destination']); + $exporter->export($_POST['book_id'], $x, $_POST['action'], $_POST['version'], $_POST['destination']['dir'], $_POST['destination']['file']); $x->addClosePopup(); } @@ -973,6 +973,12 @@ class wsAjax extends cubeAjax { $defaultVersion = ''; } + $format = false; + if ($defaultVersion != '') { + $format = $formatInstall[$defaultVersion]; + } + $displayFile = ($format !== false); + if ($defaultAction != 'download') { $daoBook = new wsDAOBook($core->con); $book = $daoBook->selectById($book_id); @@ -996,6 +1002,10 @@ class wsAjax extends cubeAjax { $defaultDestination['dir'] = cubeText::str2URL($book->nom); } + if ($defaultDestination['file'] == '') { + $defaultDestination['file'] = cubeText::str2URL($book->nom) . '.' . $format; + } + switch ($defaultAction) { case 'install_hosting': @@ -1019,10 +1029,10 @@ class wsAjax extends cubeAjax { $destinationFile = ''; if ($displayFile) { - $destinationFile = form::field(array('destination[file]', 'destination'), 30, 128, $defaultDestination['file']); + $destinationFile = form::field(array('destination[file]', 'destination'), 50, 128, $defaultDestination['file']); } - $res .= '' . $s . '' . form::field(array('destination[dir]', 'destination'), 40, 128, $defaultDestination['dir']) . ' / ' . $destinationFile . ''; + $res .= '' . $s . '' . form::field(array('destination[dir]', 'destination'), 50, 128, $defaultDestination['dir']) . ' / ' . $destinationFile . ''; } else { $res.=$version; } diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 25f65d022..ddace0738 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -147,7 +147,7 @@ class wsUrl { } $res .= '' . $btStats . ''; if ($book->version > 1) { - if ($core->user->utilisateur_id == 5) { + if ($droits->admin) { $res .= '' . $btDownload . ''; } else { $res .= '' . $btDownload . ''; diff --git a/inc/ws/Util/class.ws.exporter.php b/inc/ws/Util/class.ws.exporter.php index 8264af572..cdda4fde6 100644 --- a/inc/ws/Util/class.ws.exporter.php +++ b/inc/ws/Util/class.ws.exporter.php @@ -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'); diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index 144e97027..c5088bb9e 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -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); } } -- 2.39.5