From d40899cfef0ec6a75af3e311e05c0b1519c00527 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 19 Oct 2011 16:17:42 +0000 Subject: [PATCH] --- fluidbook/compile/_js/fluidbook.js | 3 +- fluidbook/compile/index.html | 12 ++++-- inc/ws/Controlleur/class.ws.ajax.php | 20 +++++++++ inc/ws/DAO/class.ws.dao.document.php | 3 ++ inc/ws/Metier/class.ws.book.parametres.php | 5 +++ inc/ws/Util/html5/class.ws.html5.compiler.php | 2 +- .../Util/packager/class.ws.packager.html.php | 43 ++++++++++++++----- js/ws.js | 3 +- 8 files changed, 74 insertions(+), 17 deletions(-) diff --git a/fluidbook/compile/_js/fluidbook.js b/fluidbook/compile/_js/fluidbook.js index ce4bedb54..6926e86cf 100644 --- a/fluidbook/compile/_js/fluidbook.js +++ b/fluidbook/compile/_js/fluidbook.js @@ -10,7 +10,7 @@ function getWmode(){ function getLocation(){ return window.location.toString(); } -function parseGet(){ +function getFlashvars(junk){ var couples=window.location.search.substr(1).split('&'); var res=new Array(); var couple=new Array(); @@ -18,6 +18,7 @@ function parseGet(){ couple=couples[i].split('='); res[couple[0]]=couple[1]; } + res['junk']=junk; return res; } function getLang(){ diff --git a/fluidbook/compile/index.html b/fluidbook/compile/index.html index 6cf5466cb..210f8a3e0 100644 --- a/fluidbook/compile/index.html +++ b/fluidbook/compile/index.html @@ -2,10 +2,16 @@ + + + + + +$robots $facebook $title - - + + $redirectScript @@ -18,7 +24,7 @@ $redirectScript if(isMobile()){ $redirectMobile }else{ - swfobject.embedSWF("$pathToIndex", "fluidbook", "100%", "100%", "10.0.22","", parseGet(), {"allowScriptAccess":"always","quality":"high","scale":"noscale","wmode":getWmode(),"allowFullScreen":"true"},{"bgcolor":"#$bgcolor"}); + swfobject.embedSWF("$pathToIndex?junk=$junk", "fluidbook", "100%", "100%", "10.0.22","", getFlashvars($junk), {"allowScriptAccess":"always","quality":"high","scale":"noscale","wmode":getWmode(),"allowFullScreen":"true"},{"bgcolor":"#$bgcolor"}); } $ga diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index 9858110c4..19d5da350 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -790,6 +790,26 @@ class wsAjax extends cubeAjax { $dao = new wsDAODocument($core->con); $dao->setLinksAndRulers($book_id, json_encode($links), json_encode($rulers), 'Import from excel', $core->user->utilisateur_id); + + $specialLinks=array(); + foreach($links as $l){ + if(is_int($l['page'])){ + continue; + } + $specialLinks[]=$l; + } + $specialRulers=array(); + foreach($rulers as $r){ + if(is_int($r['page'])){ + continue; + } + $specialRulers[]=$r; + } + + + $daoBook = new wsDAOBook($core->con); + $daoBook->setSpecialLinksAndRulers($book_id, json_encode($specialLinks), json_encode($specialRulers)); + } } diff --git a/inc/ws/DAO/class.ws.dao.document.php b/inc/ws/DAO/class.ws.dao.document.php index a033e292e..f894effe9 100644 --- a/inc/ws/DAO/class.ws.dao.document.php +++ b/inc/ws/DAO/class.ws.dao.document.php @@ -139,6 +139,9 @@ class wsDAODocument extends commonDAO { $rulers = array(); foreach ($t as $page => $tt) { + if(!is_int($page)){ + continue; + } $infos = $pages[$page]; $doc_id = $infos['document_id']; $doc_page = $infos['document_page']; diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 88f18ada9..714092c35 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -186,6 +186,11 @@ class wsBookParametres extends wsParametres { $this->forms['secure'] = array('label' => __('Sécurisation'), 'fieldsnames' => array('secureURL', 'secureURLRedirect')); + $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->forms['seo'] = array('label' => __('Optimisation pour les moteurs de recherche'), + 'fieldsnames' => array('seoVersion', 'seoRobots')); $this->fields['widget'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Générer le widget'), 'grade' => 5); $this->fields['widgetCover'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Afficher la couverture') . ')', 'grade' => 5); diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index b53239b29..eed282310 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -1031,7 +1031,7 @@ class wsHTML5Compiler { $origDir = WS_BOOKS . '/working/' . $this->book_id . '/'; $types = array('mp4', 'ogv', 'webm', 'jpg'); if ($video) { - wsTools::encodeWebVideos($origDir . $source, null, false); + wsTools::encodeWebVideos($origDir . $source, null, true); $e = explode('.', $source); array_pop($e); $base = implode('.', $e); diff --git a/inc/ws/Util/packager/class.ws.packager.html.php b/inc/ws/Util/packager/class.ws.packager.html.php index fe2092c09..475cbe134 100644 --- a/inc/ws/Util/packager/class.ws.packager.html.php +++ b/inc/ws/Util/packager/class.ws.packager.html.php @@ -53,13 +53,29 @@ class wsPackagerHTML extends wsPackager { $this->prepareHTML5(); } + $seoVersion = true; + if (isset($this->book->parametres->seoVersion)) { + $seoVersion = $this->book->parametres->seoVersion; + } + + $seoRobot = true; + if (isset($this->book->parametres->seoRobot)) { + $seoRobot = $this->book->parametres->seoRobot; + } + + $robots = ''; + if (!$seoRobot) { + $robots=''; + } // 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); + 'redirectMobile' => $redirectMobile, + 'junk' => TIME, + 'robots' => $robots); $this->origHTML = file_get_contents($this->vdir . '/index.html'); $this->origHTML = $this->replaceHTML($toReplace); @@ -84,16 +100,19 @@ class wsPackagerHTML extends wsPackager { $htmlfile = WS_DOCS . '/' . $infos['document_id'] . '/h' . $infos['document_page'] . '.txt'; - if (file_exists($htmlfile)) { + if ($seoVersion && file_exists($htmlfile)) { $html = file_get_contents($htmlfile); $alt .= "\n" . $html . "\n"; - } - if ($page == 1) { - $alt .= $nav1; - } else { - $alt .= $nav; + + if ($page == 1) { + $alt .= $nav1; + } else { + $alt .= $nav; + } } + + $alt .= $footer; $data = str_replace('$alt', $alt, $this->origHTML); @@ -102,6 +121,10 @@ class wsPackagerHTML extends wsPackager { $data = str_replace('$redirectScript', $redirectScript, $data); file_put_contents($this->vdir . $dest, $data); + + if (!$seoVersion) { + break; + } } } @@ -112,8 +135,8 @@ class wsPackagerHTML extends wsPackager { $cp = new cubeCommandLine('cp'); $cp->setPath(CONVERTER_PATH); $cp->setArg('r'); - $cp->setArg(null,WS_BOOKS . '/html5/' . $this->book_id . '/*'); - $cp->setArg(null,$dest); + $cp->setArg(null, WS_BOOKS . '/html5/' . $this->book_id . '/*'); + $cp->setArg(null, $dest); $cp->execute(); $filesToDelete = array('indext.html', 'indexu.html', 'data/datas.js'); @@ -126,7 +149,7 @@ class wsPackagerHTML extends wsPackager { $rm = new cubeCommandLine('rm'); $rm->setPath(CONVERTER_PATH); foreach ($filesToDelete as $f) { - $rm->setArg(null, $dest.'/'.$f); + $rm->setArg(null, $dest . '/' . $f); } $rm->execute(); } diff --git a/js/ws.js b/js/ws.js index b9b8693d4..431c9727f 100644 --- a/js/ws.js +++ b/js/ws.js @@ -36,7 +36,7 @@ function load_ws(){ url : SITE_PATH+'ajax/'+$(this).attr('action'), success : function(data){ window.opener.document.getElementById("composerSwf").reloadLinks(); - window.close(); + //window.close(); } }); return false; @@ -57,7 +57,6 @@ function restoreLink(){ $.ajax({ url : SITE_PATH+'ajax/restoreLinksVersion/'+$(this).attr('rel'), success : function(data){ - //window.opener.location=window.opener.location; window.opener.document.getElementById("composerSwf").reloadLinks(); window.close(); } -- 2.39.5