From 8f353450dcfb281e4e9ae1fd8bcbef8a887f1582 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 5 Apr 2012 15:27:36 +0000 Subject: [PATCH] --- fluidbook/compile/index.html | 21 +++--- inc/commons/class.common.tools.php | 11 +++ inc/ws/Controlleur/class.ws.url.php | 2 +- inc/ws/Metier/class.ws.book.parametres.php | 3 +- inc/ws/Util/html5/class.ws.html5.compiler.php | 9 ++- .../Util/packager/class.ws.packager.html.php | 68 +++++++++++++++++-- js/browserInfos.js | 8 +++ 7 files changed, 101 insertions(+), 21 deletions(-) diff --git a/fluidbook/compile/index.html b/fluidbook/compile/index.html index c15cdc46c..2925fffee 100644 --- a/fluidbook/compile/index.html +++ b/fluidbook/compile/index.html @@ -1,18 +1,19 @@ - - + + - - - - - - - + + + + + + + $favicon $robots $facebook + $description $title - + diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index d9470ff5b..70cdc7ed4 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -148,6 +148,14 @@ class commonTools { $res = commonPage::barre(); $res .= commonPage::tMain(); $res .= commonPage::bh(); + $res.=''; $res.=''; $res.=''; $res.=''; @@ -158,6 +166,9 @@ class commonTools { $res.='H264 :
'; $res.='WEBM :
'; $res.=''; + $res.=''; + $res.=''; + $res.=''; $res.='
' . __('Informations concernant votre navigateur') . '
' . __('Navigateur') . '' . $_SERVER['HTTP_USER_AGENT'] . '
' . __("Orientation de l'écran") . ''.__('Portrait').''.__('Paysage').'
' . __("Largeur de l'écran") . '
' . __("Hauteur de l'écran") . '
'; $res .= ''; $res .= commonPage::bf(); diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 01cbf7de6..e1f0552c5 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -391,7 +391,7 @@ class wsUrl { $s->setTitle(cubeText::str2URL($lang_name)); - $tab = cubeLang::getTranslationsList(PLAYER_SOURCES, array('php', 'as'), array(), $lang->traductions); + $tab = cubeLang::getTranslationsList(array(PLAYER_SOURCES, WS_COMPILE_ASSETS . '/_html5/js'), array('php', 'as','js'), array(), $lang->traductions); $s->setCellValueByColumnAndRow(0, 1, 'ID', true); $s->setCellValueByColumnAndRow(1, 1, $ref_name, true); diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 722dad6c0..7170434ef 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -226,9 +226,10 @@ class wsBookParametres extends wsParametres { $this->fields['seoVersion'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Générer une version pour les moteurs de recherche')); $this->fields['seoRobots'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Autoriser le parcours par les moteurs de recherche')); + $this->fields['seoDescription'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Meta tag Description')); $this->forms['seo'] = array('label' => __('Optimisation pour les moteurs de recherche'), - 'fieldsnames' => array('seoVersion', 'seoRobots')); + 'fieldsnames' => array('seoVersion', 'seoRobots', 'seoDescription')); $this->fields['plv'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Activer le mode PLV'), 'grade' => 3); $this->fields['plvTimer'] = array('type' => 'integer', 'min' => 1, 'max' => 60, 'default' => 5, 'editable' => true, 'label' => __('Temps'), 'grade' => 3); diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index 176cf8c92..1afc73eab 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -287,7 +287,7 @@ class wsHTML5Compiler { } $style = array(); foreach ($sheets as $sheet) { - $style[] = ''; + $style[] = ''; } $style = implode("\n\t\t", $style); @@ -295,7 +295,12 @@ class wsHTML5Compiler { $script = ''; - $vars = array('titre', 'credits', 'ga', 'style', 'script', 'pagesContents'); + $description = ''; + if ($this->book->parametres->seoDescription) { + $description = ''; + } + + $vars = array('titre', 'credits', 'ga', 'style', 'script', 'pagesContents', 'description'); foreach ($vars as $v) { $html = str_replace('', $$v, $html); } diff --git a/inc/ws/Util/packager/class.ws.packager.html.php b/inc/ws/Util/packager/class.ws.packager.html.php index 1548366ba..17e1abac4 100644 --- a/inc/ws/Util/packager/class.ws.packager.html.php +++ b/inc/ws/Util/packager/class.ws.packager.html.php @@ -62,7 +62,7 @@ class wsPackagerHTML extends wsPackager { $favicon = ''; if ($this->theme->parametres->favicon != '') { - $favicon = ''; + $favicon = ''; } $redirectPDF = 'window.location="data/document.pdf";'; @@ -85,23 +85,29 @@ class wsPackagerHTML extends wsPackager { $robots = ''; if (!$seoRobot) { - $robots = ''; + $robots = ''; + } + + $description = ''; + if ($this->book->parametres->seoDescription) { + $description = ''; } // Stuffs to replace in html $toReplace = array('lang' => strtolower($this->book->lang), - 'title' => self::escape($this->book->parametres->title), 'ga' => $ga, 'facebook' => $facebook, 'bgcolor' => $this->theme->parametres->loadingBackColor, 'redirectMobile' => $redirectMobile, 'redirectPDF' => $redirectPDF, 'junk' => TIME, + 'description' => $description, 'robots' => $robots, 'favicon' => $favicon, 'flashversion' => $this->getMinFlashVersion(), 'fv' => json_encode($this->getFlashvars())); + $this->origHTML = file_get_contents($this->vdir . '/index.html'); $this->origHTML = $this->replaceHTML($toReplace); @@ -115,8 +121,11 @@ class wsPackagerHTML extends wsPackager { $redirectScript = ''; if ($page == 1) { $dest = 'index.html'; + $title = $this->book->parametres->title; } else { - $dest = 'pages/page' . $page . '.html'; + $label = $this->_getLabelOfPage($page); + $title = $label . ' - ' . $this->book->parametres->title; + $dest = 'pages/' . $page . '-' . cubeText::str2URL($label) . '.html'; $pathToIndex = '../index.swf'; $pathToGetflash = '../getflash.gif'; $redirectScript = ''; @@ -142,6 +151,7 @@ class wsPackagerHTML extends wsPackager { $data = str_replace('$alt', $alt, $this->origHTML); $data = str_replace('$pathToIndex', $pathToIndex, $data); + $data = str_replace('$title', $this->escape($title), $data); $data = str_replace('$pathToGetflash', $pathToGetflash, $data); $data = str_replace('$redirectScript', $redirectScript, $data); @@ -203,6 +213,7 @@ class wsPackagerHTML extends wsPackager { protected function makeHTMLNav($root) { $res = ''; return $res; } + protected function _getLabelOfPage($page) { + if($page==1){ + return $this->book->parametres->title; + } + + $chapters = $this->book->chapters; + $virtual = $this->_getVirtualPage($page); + + + + $candidates = array(); + foreach ($chapters as $c) { + if ($c->page == $virtual) { + $candidates[] = $c; + } + } + if (!count($candidates)) { + return $this->_getLabelOfPage($page-1); + } + + usort($candidates, array($this, '_sortCandidates')); + $c=array_shift($candidates); + return $c->label; + } + + protected function _sortCandidates($a, $b) { + if ($a->level > $b->level) { + return 1; + } else if ($a->level < $b->level) { + return -1; + } else { + return 0; + } + } + + protected function _getVirtualPage($page) { + $num = explode(',',$this->book->numerotation); + if (isset($num[$page - 1])) { + return $num[$page - 1]; + } + return 1; + } + protected function escape($txt) { return htmlentities($txt, ENT_COMPAT, 'UTF-8'); } diff --git a/js/browserInfos.js b/js/browserInfos.js index a218e26c1..9f7f1883a 100644 --- a/js/browserInfos.js +++ b/js/browserInfos.js @@ -11,6 +11,14 @@ function load_browser_infos(){ $('.f').each(function(){ $(this).html(getModernizrValue($(this).attr('data-feature'))); }); + + $(window).resize(infosResize); + infosResize(); +} + +function infosResize(){ + $("#swidth").html(screen.width); + $("#sheight").html(screen.height); } function getModernizrValue(f){ -- 2.39.5