$video.=' onended="this.play();"';
}
if ($autoplay) {
- $video.=' data-autoplay="autoplay"';
+ $video.=' autoplay="autoplay"';
}
if (($displayPoster || $ios) && isset($poster)) {
$video.=' poster="' . $web . 'video.jpg"';
\r
$e = explode('_', $args[0]);\r
\r
-\r
-\r
-\r
-\r
$newurl = null;\r
if (count($e) == 2 || $e[2] < TIME - 10) {\r
$e[2] = TIME;\r
exit;\r
}\r
\r
-\r
-\r
$book_id = $e[0];\r
\r
-\r
-\r
-\r
$wmode = $wmode != '' ? $wmode : 'default';\r
\r
echo self::commonViewer($book_id, $e[1], false, $wmode, $newurl, '1');\r
cubePage::swfobject(2);\r
\r
$dao = new wsDAOBook($core->con);\r
-\r
$book = $dao->selectById($book_id);\r
+\r
+ if(!wsDroits::admin()){\r
+ if ($book->parametres->redirectDemo != '') {\r
+ http::redirect($book->parametres->redirectDemo);\r
+ exit; \r
+ }\r
+ if ($book->parametres->disableDemo) {\r
+ commonDroits::error();\r
+ }\r
+ }\r
+\r
if ($hash != 'bcf26f9cf4a795ec00b9a44f42750d58' && $book->hash != $hash) {\r
commonDroits::error();\r
}\r
\r
public function setStatus($book_id, $status) {\r
$c = $this->con->openCursor('books');\r
- if($status<2){\r
- $c->tache=0;\r
+ if ($status < 2) {\r
+ $c->tache = 0;\r
}\r
$c->status = $status;\r
$c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
}\r
\r
public function compile($book_id, $version = 3, $complete = false) {\r
- $this->compile3($book_id, $complete);\r
+ $res=$this->compile3($book_id, $complete);\r
$this->compile1($book_id);\r
\r
$this->touchCompile($book_id);\r
+ return $res;\r
}\r
\r
public function compile1($book_id) {\r
$args .= '-' . $range['end'];\r
}\r
\r
+ $hash = sha1($args);\r
+\r
$args .= ' output ' . $finalPDF;\r
\r
- $pdftk = new cubeCommandLine('pdftk');\r
- $pdftk->setPath(CONVERTER_PATH);\r
- $pdftk->setManualArg($args);\r
- $pdftk->execute();\r
+ $cached = WS_BOOKS . '/pdf/' . $hash . '.pdf';\r
+ if (file_exists($cached)) {\r
+ copy($cached, $finalPDF);\r
+ } else {\r
+ $pdftk = new cubeCommandLine('pdftk');\r
+ $pdftk->setPath(CONVERTER_PATH);\r
+ $pdftk->setManualArg($args);\r
+ $pdftk->execute();\r
+ copy($finalPDF, $cached);\r
+ }\r
}\r
\r
}\r
$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);\r
$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);\r
$this->forms['pdf'] = array('label' => __('Fonction de téléchargement'),\r
- 'fieldsnames' => array('pdf','pdfName', 'pdfComplex', 'offlineExport'));\r
+ 'fieldsnames' => array('pdf', 'pdfName', 'pdfComplex', 'offlineExport'));\r
// .\r
$this->fields['zoomMode'] = array('type' => 'combo', 'default' => '0', 'editable' => true, 'label' => __("Mode de zoom"), 'grade' => 5,\r
'datas' => array(__('Normal') => '0',\r
$this->forms['widget'] = array('label' => __('Widget') . ' (' . __('Mini Fluidbook') . ')',\r
'fieldsnames' => array('widget', 'widgetCover', 'widgetSize', 'widgetQuality', 'widgetStart', 'widgetEnd'));\r
\r
- $this->fields['extras'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Extras'), 'grade' => 5);\r
+ $this->fields['extras'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Extras'), 'grade' => 3);\r
$this->fields['v1SWF'] = array('type' => 'freefile', 'default' => '', 'editable' => true,\r
'label' => __('Index.swf spécifique'), 'grade' => 5, 'fileFilter' => $swfFilter);\r
$this->forms['v1'] = array('label' => __('Options spécifiques au fluidbook version 1'),\r
'fieldsnames' => array('extras', 'v1SWF'));\r
+\r
+ $this->fields['disableDemo'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Désactiver le lien de démo'), 'grade' => 5);\r
+ $this->fields['redirectDemo'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Rediriger le lien de démo vers'), 'grade' => 5);\r
+ $this->forms['demo'] = array('label' => __('Lien de démo'),\r
+ 'fieldsnames' => array('disableDemo', 'redirectDemo'));\r
}\r
\r
}\r
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',
}
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 = '';
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);
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);
}
}
return '';
}
- public function copyExternalFile($file, $video=false) {
+ public function copyExternalFile($file, $video = false) {
$this->compiler->copyLinkFile($file, 'data/links/', $video);
}
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'])) {
$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 = '<video width="' . $w . '" height="' . $h . '"';
+ $res = '<div class="videoContainer">';
+ $res.='<video width="' . $w . '" height="' . $h . '"';
if ($this->video_auto_start) {
$res.=' autoplay="autoplay"';
}
- if ($this->video_controls) {
- $res.=' controls="controls"';
+ $res.=' controls="controls"';
+ if (!$this->video_controls) {
+ $res.=' onplay="hideControls(this)"';
}
if ($this->video_loop) {
- $res.=' loop="loop"';
+ $res.=' onended="this.play();"';
}
if (!$this->video_sound_on) {
$res.=' audio="muted"';
}
$res.=' poster="data/links/' . $basename . '.jpg"';
$res.='>';
-
-
-
$this->copyExternalFile($this->to, true);
$types = array('webm' => 'video/webm; codecs="vp8, vorbis"', 'ogv' => 'video/ogg; codecs="theora, vorbis"', 'mp4' => '');
foreach ($types as $ext => $type) {
}
$res.='<source src="' . wsHTML5Link::getUniversalLocation($basename . '.' . $ext) . '"' . $type . ' />';
}
- $flashvars = array('video' => wsHTML5Link::getUniversalLocation($basename . '.mp4'),
+ $flashvars = array('video' => '../'.wsHTML5Link::getUniversalLocation($file),
'poster' => wsHTML5Link::getUniversalLocation($basename . '.jpg'),
'controls' => $this->video_controls == '1',
'autoPlay' => $this->video_auto_start == '1',
'loop' => $this->video_loop);
- $res.=cubeMedia::flashObject('swf/video.swf', $w, $h, $flashvars, 'swfplayer-' . $basename, '', 9, '#ffffff', '', 'true', 'noscale', 'normal');
$res.='</video>';
+ $res.=cubeMedia::flashObject('swf/video.swf', $w, $h, $flashvars, 'swfplayer-' . $basename, '', 9, '#ffffff', '', 'true', 'noscale', 'normal');
return $res;
}
}
public function getEmbed() {
- return '<iframe width="' . $this->width*$this->compiler->getCssScale() . '" height="' . $this->height*$this->compiler->getCssScale() . '" src="' . $this->getEmbedURL() . '" frameborder="0" allowfullscreen></iframe>';
+ return '<iframe width="' . $this->width * $this->compiler->getCssScale() . '" height="' . $this->height * $this->compiler->getCssScale() . '" src="' . $this->getEmbedURL() . '" frameborder="0" allowfullscreen></iframe>';
}
public function getEmbedURL() {
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');
}
}
}
$("#videohtml").show();
+ if($("#videohtml").attr('autoplay')=='autoplay'){
+ var video=$("#videohtml").get(0);
+ video.play();
+ }
+
$(document).one('click','video',function(){
$('video').each(function(){
this.play();