From: vincent@cubedesigners.com Date: Tue, 13 Mar 2012 18:57:00 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=db9882d6ca4c32428256f247ea7827c3e4ec9551;p=cubeextranet.git --- diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index f2de47cad..b34dc5db2 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -118,7 +118,7 @@ class commonTools { $video.=' onended="this.play();"'; } if ($autoplay) { - $video.=' data-autoplay="autoplay"'; + $video.=' autoplay="autoplay"'; } if (($displayPoster || $ios) && isset($poster)) { $video.=' poster="' . $web . 'video.jpg"'; diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 959978fe1..5a97c0e33 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -704,10 +704,6 @@ html{height:100%}' . "\n"; $e = explode('_', $args[0]); - - - - $newurl = null; if (count($e) == 2 || $e[2] < TIME - 10) { $e[2] = TIME; @@ -715,13 +711,8 @@ html{height:100%}' . "\n"; exit; } - - $book_id = $e[0]; - - - $wmode = $wmode != '' ? $wmode : 'default'; echo self::commonViewer($book_id, $e[1], false, $wmode, $newurl, '1'); @@ -777,8 +768,18 @@ html{height:100%}' . "\n"; cubePage::swfobject(2); $dao = new wsDAOBook($core->con); - $book = $dao->selectById($book_id); + + if(!wsDroits::admin()){ + if ($book->parametres->redirectDemo != '') { + http::redirect($book->parametres->redirectDemo); + exit; + } + if ($book->parametres->disableDemo) { + commonDroits::error(); + } + } + if ($hash != 'bcf26f9cf4a795ec00b9a44f42750d58' && $book->hash != $hash) { commonDroits::error(); } diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 92040871b..228ef89dd 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -434,8 +434,8 @@ class wsDAOBook extends commonDAO { public function setStatus($book_id, $status) { $c = $this->con->openCursor('books'); - if($status<2){ - $c->tache=0; + if ($status < 2) { + $c->tache = 0; } $c->status = $status; $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); @@ -715,10 +715,11 @@ class wsDAOBook extends commonDAO { } public function compile($book_id, $version = 3, $complete = false) { - $this->compile3($book_id, $complete); + $res=$this->compile3($book_id, $complete); $this->compile1($book_id); $this->touchCompile($book_id); + return $res; } public function compile1($book_id) { @@ -1272,12 +1273,20 @@ class wsDAOBook extends commonDAO { $args .= '-' . $range['end']; } + $hash = sha1($args); + $args .= ' output ' . $finalPDF; - $pdftk = new cubeCommandLine('pdftk'); - $pdftk->setPath(CONVERTER_PATH); - $pdftk->setManualArg($args); - $pdftk->execute(); + $cached = WS_BOOKS . '/pdf/' . $hash . '.pdf'; + if (file_exists($cached)) { + copy($cached, $finalPDF); + } else { + $pdftk = new cubeCommandLine('pdftk'); + $pdftk->setPath(CONVERTER_PATH); + $pdftk->setManualArg($args); + $pdftk->execute(); + copy($finalPDF, $cached); + } } } diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 1f71ea143..76169f436 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -105,7 +105,7 @@ class wsBookParametres extends wsParametres { $this->fields['pdfComplex'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Téchargement de PDF avancé'), "hint" => __("Permet à l'utilisateur de sélectionner les pages qu'il souhaite télécharger"), 'grade' => 3); $this->fields['offlineExport'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Téléchargement des versions offline'), "hint" => __('Valable si le téléchargement avancé est activé'), 'grade' => 3); $this->forms['pdf'] = array('label' => __('Fonction de téléchargement'), - 'fieldsnames' => array('pdf','pdfName', 'pdfComplex', 'offlineExport')); + 'fieldsnames' => array('pdf', 'pdfName', 'pdfComplex', 'offlineExport')); // . $this->fields['zoomMode'] = array('type' => 'combo', 'default' => '0', 'editable' => true, 'label' => __("Mode de zoom"), 'grade' => 5, 'datas' => array(__('Normal') => '0', @@ -230,11 +230,16 @@ class wsBookParametres extends wsParametres { $this->forms['widget'] = array('label' => __('Widget') . ' (' . __('Mini Fluidbook') . ')', 'fieldsnames' => array('widget', 'widgetCover', 'widgetSize', 'widgetQuality', 'widgetStart', 'widgetEnd')); - $this->fields['extras'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Extras'), 'grade' => 5); + $this->fields['extras'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Extras'), 'grade' => 3); $this->fields['v1SWF'] = array('type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Index.swf spécifique'), 'grade' => 5, 'fileFilter' => $swfFilter); $this->forms['v1'] = array('label' => __('Options spécifiques au fluidbook version 1'), 'fieldsnames' => array('extras', 'v1SWF')); + + $this->fields['disableDemo'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Désactiver le lien de démo'), 'grade' => 5); + $this->fields['redirectDemo'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Rediriger le lien de démo vers'), 'grade' => 5); + $this->forms['demo'] = array('label' => __('Lien de démo'), + 'fieldsnames' => array('disableDemo', 'redirectDemo')); } } diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index f267c8a34..220347d93 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -7,6 +7,7 @@ class wsHTML5Compiler { protected static $jsFiles = array( 'js/libs/cube/fb.js', 'js/libs/modernizr.js', + 'js/libs/flashdetect.js', 'js/libs/jquery/jquery.js', 'js/libs/jquery/jquery.transform.js', 'js/libs/jquery/jquery.mousewheel.js', @@ -418,12 +419,23 @@ class wsHTML5Compiler { } foreach ($this->pages as $page => $infos) { foreach (self::$resolutions as $r) { - copy(WS_DOCS . '/' . $infos['document_id'] . '/html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/p' . $page . '.jpg'); - copy(WS_DOCS . '/' . $infos['document_id'] . '/html/t' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/t' . $page . '.jpg'); + $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/p' . $page . '.jpg'); + $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/html/t' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/t' . $page . '.jpg'); } - copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg'); + $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg'); } } + + protected function copy($s,$t){ + if(!file_exists($s)){ + return; + } + if(file_exists($t) && filemtime($t)>=filemtime($s) && filesize($s)==filesize($t)){ + return; + } + + copy($s,$t); + } protected function writePage($page) { $res = ''; @@ -1023,7 +1035,7 @@ class wsHTML5Compiler { public function copyLinkFile($source, $dest, $video = false) { $origDir = WS_BOOKS . '/working/' . $this->book_id . '/'; - $types = array('mp4', 'ogv', 'webm', 'jpg'); + $types = array('flv', 'mp4', 'ogv', 'webm', 'jpg'); if ($video) { wsTools::encodeWebVideos($origDir . $source, null, true); $e = explode('.', $source); @@ -1046,6 +1058,9 @@ class wsHTML5Compiler { if (!file_exists(dirname($d))) { mkdir(dirname($d), 0777, true); } + if(file_exists($d) && filemtime($d)>=filemetime($s) && filesize($d)==$filesize($s)){ + continue; + } copy($s, $d); } } diff --git a/inc/ws/Util/html5/class.ws.html5.links.php b/inc/ws/Util/html5/class.ws.html5.links.php index 25cf68806..4abb2296c 100644 --- a/inc/ws/Util/html5/class.ws.html5.links.php +++ b/inc/ws/Util/html5/class.ws.html5.links.php @@ -85,7 +85,7 @@ class wsHTML5Link { return ''; } - public function copyExternalFile($file, $video=false) { + public function copyExternalFile($file, $video = false) { $this->compiler->copyLinkFile($file, 'data/links/', $video); } @@ -102,7 +102,7 @@ class wsHTML5Link { return ''; } - public static function getUniversalLocation($loc, $css=false) { + public static function getUniversalLocation($loc, $css = false) { $datas = parse_url($loc); if (isset($datas['scheme']) && !is_null($datas['scheme'])) { @@ -197,27 +197,26 @@ class videoLink extends wsHTML5Link { $e = explode('.', $file); $ext = array_pop($e); $basename = implode('.', $e); - $w = round($this->width*$this->compiler->getCssScale()); - $h = round($this->height*$this->compiler->getCssScale()); + $w = round($this->width * $this->compiler->getCssScale()); + $h = round($this->height * $this->compiler->getCssScale()); - $res = ''; + $res.=cubeMedia::flashObject('swf/video.swf', $w, $h, $flashvars, 'swfplayer-' . $basename, '', 9, '#ffffff', '', 'true', 'noscale', 'normal'); return $res; } @@ -245,7 +244,7 @@ class webVideoLink extends videoLink { } public function getEmbed() { - return ''; + return ''; } public function getEmbedURL() { @@ -304,7 +303,7 @@ class fileLink extends normalLink { class multimediaLink extends wsHTML5Link { public function getHTMLContent() { - return cubeMedia::flashObject(wsHTML5Link::getUniversalLocation($this->to), $this->width*$this->compiler->getCssScale(), $this->height*$this->compiler->getCssScale(), array(), '', '', 9, '#ffffff', '', 'true', 'noscale', 'transparent'); + return cubeMedia::flashObject(wsHTML5Link::getUniversalLocation($this->to), $this->width * $this->compiler->getCssScale(), $this->height * $this->compiler->getCssScale(), array(), '', '', 9, '#ffffff', '', 'true', 'noscale', 'transparent'); } } diff --git a/js/tube.js b/js/tube.js index 3eb1215d7..555842bd2 100644 --- a/js/tube.js +++ b/js/tube.js @@ -38,6 +38,11 @@ function initHTML5Video(){ } $("#videohtml").show(); + if($("#videohtml").attr('autoplay')=='autoplay'){ + var video=$("#videohtml").get(0); + video.play(); + } + $(document).one('click','video',function(){ $('video').each(function(){ this.play();