<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">\r
\r
<symbol id="nav-home" viewBox="0 0 25 25">\r
- <path class="st0" d="M19.3,23h-4.8c-0.4,0-0.7-0.3-0.7-0.7v-4.9h-2.6v4.9c0,0.4-0.3,0.7-0.7,0.7H5.7c-0.4,0-0.7-0.3-0.7-0.7v-8\r
+ <path d="M19.3,23h-4.8c-0.4,0-0.7-0.3-0.7-0.7v-4.9h-2.6v4.9c0,0.4-0.3,0.7-0.7,0.7H5.7c-0.4,0-0.7-0.3-0.7-0.7v-8\r
c0-0.4,0.3-0.7,0.7-0.7s0.7,0.3,0.7,0.7v7.3h3.4v-4.9c0-0.4,0.3-0.7,0.7-0.7h4c0.4,0,0.7,0.3,0.7,0.7v4.9h3.4v-6.9\r
c0-0.4,0.3-0.7,0.7-0.7s0.7,0.3,0.7,0.7v7.6C20.1,22.7,19.7,23,19.3,23z"/>\r
- <path class="st0" d="M21.8,14.6c-0.2,0-0.4-0.1-0.5-0.2l-8.7-8.7l-8.7,8.7c-0.3,0.3-0.7,0.3-1,0s-0.3-0.7,0-1L12,4.1\r
+ <path d="M21.8,14.6c-0.2,0-0.4-0.1-0.5-0.2l-8.7-8.7l-8.7,8.7c-0.3,0.3-0.7,0.3-1,0s-0.3-0.7,0-1L12,4.1\r
c0.3-0.3,0.7-0.3,1,0l9.3,9.3c0.3,0.3,0.3,0.7,0,1C22.1,14.5,21.9,14.6,21.8,14.6z"/>\r
</symbol>\r
\r
{
global $core;
+
$e = explode('.', $_FILES['file']['name']);
$ext = array_pop($e);
new PHPExcel();
$phpexcel = $reader->load($_FILES['file']['tmp_name']);
$sheet = $phpexcel->getSheet(0);
$maxRow = $sheet->getHighestRow(0);
- for ($i = 0; $i < $maxRow; $i++) {
-
+ for ($i = 1; $i <= $maxRow; $i++) {
$ref = trim($sheet->getCellByColumnAndRow(0, $i));
$url = trim($sheet->getCellByColumnAndRow(1, $i)->getOldCalculatedValue());
+
+ if ($ref == '') {
+ $ref = trim($sheet->getCellByColumnAndRow(0, $i)->getFormattedValue());
+ }
+ if ($url == '') {
+ $url = trim($sheet->getCellByColumnAndRow(1, $i)->getFormattedValue());
+ }
+
if ($url == '' || $ref == '') {
continue;
}
+ $fref = self::_formatWsReferenceRef($ref, $_POST['type']);
+ $furl = self::_formatWsReferenceUrl($url, $_POST['type']);
+
+ $delete = "DELETE FROM wsref WHERE ref='" . $core->con->escape($fref) . "' AND type='" . $core->con->escape($_POST['type']) . "'";
+ $core->con->execute($delete);
+
$c = $core->con->openCursor('wsref');
$c->type = $_POST['type'];
- $c->ref = self::_formatWsReferenceRef($ref, $_POST['type']);
- $c->url = self::_formatWsReferenceUrl($url, $_POST['type']);
- try {
- $c->insert();
- } catch (Exception $e) {
- $c->update("WHERE ref='" . $core->con->escape($ref) . "' AND type='" . $core->con->escape($_POST['type']) . "'");
- }
+ $c->ref = $fref;
+ $c->url = $furl;
+ $c->insert();
}
}
}
}
- $dao->compile($book_id, 'html5');
- $time = self::getHTML5CacheTime($book_id);
-
- if (count($e) == 2 /*|| $e[2] <= $time - 10*/) {
+ $time = TIME;
+ if (count($e) == 2) {
$e[2] = $time;
http::redirect(SITE_PATH . 'viewerh/' . implode('_', $e) . '/');
exit;
}
+ $dao->compile($book_id, 'html5', false, false, false, null, false);
+
$book_id = $e[0];
$hash = $e[1];
self::commonHTML5Viewer($book_id, $hash);
}
$dao->compile($book_id, 'html5');
- $time = self::getHTML5CacheTime($book_id);
+ $time = TIME;
if (count($e) == 2 || $e[2] <= $time - 10) {
$e[2] = $time;
self::commonHTML5Viewer($book_id, $hash, '', ['<head>' => '<head><script type="text/javascript">var FORCE_SCORM=true;</script>']);
}
-
- public static function getHTML5CacheTime($book_id)
- {
- $cacheFile = WS_BOOKS . '/html5/' . $book_id . '/cache.appcache';
- if (file_exists($cacheFile)) {
- return filemtime($cacheFile);
- }
- return TIME;
- }
-
public static function commonHTML5Viewer($book_id, $hash, $version = '', $replace = [])
{
global $core;
}
}
- public function compile($book_id, $version = 'all', $complete = false, $force = false, $dev = false, $book = null)
+ public function compile($book_id, $version = 'all', $complete = false, $force = false, $dev = false, $book = null, $delete = true)
{
if (is_null($book_id) || !$book_id) {
return;
}
if ($html5) {
fb(time(), 'Compile HTML5');
- $res .= $this->compileHTML5($book_id, $book, $dev);
+ $res .= $this->compileHTML5($book_id, $book, $dev, $delete);
$this->touchCompile($book_id, 'html5');
}
if ($v1 || $v2) {
}
}
- public function compileHTML5($book_id, $book, $dev = false)
+ public function compileHTML5($book_id, $book, $dev = false, $delete = true)
{
$version = $book->parametres->mobileLVersion;
if ($dev) {
}
$htmlCompiler = wsHTML5::compilerFactory($book_id, $version, false, 'latest', null, false, false, false, $book);
- $htmlCompiler->compile();
+ $htmlCompiler->compile($delete);
}
/* public function indexPDF($book, $pages) {
$this->fields['inlineSlideshowDuration'] = array('type' => 'float', 'default' => 7, 'editable' => true, 'label' => __('Temps d\'attente des diaporamas intégrés aux pages (s)'));
$this->fields['textPopupStylesheet'] = ['type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Feuille de style des popups de texte'), 'fileFilter' => $cssFilter];
$this->fields['textPopupWidth'] = ['type' => 'integer', 'default' => '600', 'editable' => true, 'label' => __('Largeur optimale des popups')];
+ $this->fields['iframePopupMaxWidth'] = ['type' => 'integer', 'default' => '0', 'editable' => true, 'label' => __('Largeur maximale des popups iframe')];
$this->forms['multimedia'] = array('label' => __('Liens et multimédia'),
- 'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'customLinkClass', 'ignoreLinksTypes', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix', '|', 'linkMultimediaPerformanceMode', 'linkMultimediaQuality', '|', 'inlineSlideshowTransitionDuration', 'inlineSlideshowDuration', '|', 'videoReset', 'videoBigPlay', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'textPopupWidth', 'textPopupStylesheet'));
+ 'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'customLinkClass', 'ignoreLinksTypes', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix', '|', 'linkMultimediaPerformanceMode', 'linkMultimediaQuality', '|', 'inlineSlideshowTransitionDuration', 'inlineSlideshowDuration', '|', 'videoReset', 'videoBigPlay', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'textPopupStylesheet', 'textPopupWidth', '|', 'iframePopupMaxWidth'));
//.
$this->fields['externalArchives'] = array('type' => 'freefile', 'default' => '', 'editable' => true,
'label' => __('Archives'), 'grade' => 3, 'fileFilter' => $imageFilter);
$this->writeExtras();
$this->log('Extras written');
$this->populateConfig();
- $this->writeCSS('data/style/style_%d.css', $linksCSS);
+ $this->writeCSS($linksCSS);
$this->log('CSS written');
$this->writeIndex();
$this->log('Index written');
return $val ? 'true' : 'false';
}
- protected function writeCSS($file, $links)
+ protected function writeCSS($links)
{
$res = array();
# ZoomPopup close button background
$res[] = '.zoomPopupClose {background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurB) . ';}';
+ if ($this->book->parametres->textPopupStylesheet) {
+ $res[] = file_get_contents($this->wdir . '/' . $this->book->parametres->textPopupStylesheet);
+ }
$this->_writeLess($lessVariables, $lessContents);
-
- $res = array_chunk($res, 3500);
- foreach ($res as $k => $css) {
- $this->stylesheets[] = 'data/style/style_' . $k . '.css';
- $this->vdir->file_put_contents(sprintf($file, $k), implode("\n", $css));
- $this->log('Write CSS ' . sprintf($file, $k));
- }
- return count($res);
+ $this->stylesheets[] = 'data/style/style.css';
+ $this->vdir->file_put_contents('data/style/style.css', implode("\n", $res));
+ $this->log('Write CSS');
}
protected function _writeLess($variables, $lessContents = '')
}
$this->writeJs();
$this->log('Js written');
- $this->vdir->sync($delete);
+ $this->vdir->sync($delete, $this);
$this->log('Files Synced');
}
protected function _writeIndex($page)
{
-
if (!isset($this->seo->pages[$page])) {
return;
}
$seo = $this->seo->pages[$page];
$html = $seo->getHTML();
- $iv = $this->getIndexVars();
-
- foreach ($iv as $k => $v) {
- $html = str_replace($k, $v, $html);
- }
-
if ($this->book->parametres->seoVersion) {
$seo->writePage($html, $this->vdir);
}
if ($page == 1) {
$seo->writePage($html, $this->vdir, 'index.html');
}
+
+ if ($page % 10 == 0) {
+ $this->log('Written page ' . $page);
+ }
}
public function getIndexVars()
protected function writeIndex()
{
+ $iv = $this->getIndexVars();
+ foreach ($iv as $k => $v) {
+ $this->seo->html = str_replace($k, $v, $this->seo->html);
+ }
if ($this->book->parametres->seoVersion) {
foreach ($this->pages as $page => $infos) {
$this->_writeIndex($page);
$this->_makeCover($docdir . 'html/t36-' . $infos['document_page'] . '.jpg');
}
- $this->log('Copied image ' . $page);
+ if ($page % 10 == 0) {
+ $this->log('Copied image ' . $page);
+ }
}
case 'AtlanticDownloadLink':
return new atlanticDownloadLink($id, $init, $compiler);
default :
- return new customLink($id, $init, $compiler);
+ return customLink::getCustomInstance($id, $init, $compiler);
}
break;
case 8:
class customLink extends wescoLink
{
- public function getURL()
+ public static function getCustomInstance($id, $init, &$compiler)
+ {
+ $e = explode(':', $init['to']);
+ if ($e[0] == '10doigts') {
+ $init['to'] = self::_getURL($init['to']);
+ return new iframePopupLink($id, $init, $compiler);
+ }
+ return new customLink($id, $init, $compiler);
+ }
+
+ public static function _getURL($to)
{
global $core;
- $e = explode(':', $this->to, 2);
+ $e = explode(':', $to, 2);
if (!count($e) == 1) {
- return 'https://workshop.fluidbook.com/services/wsref?ref=' . urlencode($this->to);
+ return 'https://workshop.fluidbook.com/services/wsref?ref=' . urlencode($to);
}
$type = trim($e[0]);
$ref = trim($e[1]);
return 'https://workshop.fluidbook.com/services/wsref?ref=' . urlencode($type . '|' . $ref);
}
+ public function getURL()
+ {
+ return self::_getURL($this->to);
+ }
+
public function getDefaultTooltip()
{
return 'click to open the link';
public function keep()
{
- return true;
+ return false;
}
}
*/\r
public $compiler;\r
public $pages;\r
+ public $html;\r
protected $_nav = null;\r
\r
\r
}\r
}\r
}\r
+\r
+ $this->html = file_get_contents($this->compiler->assets . '/_index.html');\r
}\r
\r
public function getTextContent($infos)\r
\r
public function getHTML()\r
{\r
- $compiler = $this->_container->compiler;\r
- $html = file_get_contents($this->_container->compiler->assets . '/_index.html');\r
+ $html = $this->_container->html;\r
\r
$vars = ['description' => $this->description ? '<meta name="description" content="' . $this->description . '">' : '',\r
'keywords' => $this->keywords ? '<meta name="keywords" content="' . $this->keywords . '">' : '',\r
}\r
$html = str_replace('<!-- $base -->', $base, $html);\r
\r
- $vdir->file_put_contents($path, $html);\r
+ $dir = WS_BOOKS . '/seo/' . $this->_container->compiler->book_id . '/';\r
+ if (!file_exists($dir)) {\r
+ mkdir($dir, 0777, true);\r
+ }\r
+ $file = $dir . $this->page . '.html';\r
+ $hash = sha1($html);\r
+ $hashfile = $dir . $this->page . '.hash';\r
+ if (!file_exists($hashfile) || file_get_contents($hashfile) != $hash) {\r
+ file_put_contents($file, $html);\r
+ file_put_contents($hashfile, $hash);\r
+ }\r
+ $vdir->copy($file, $path);\r
}\r
}
\ No newline at end of file
echo $core->url->getDocument();
$buffer = ob_get_contents();
-cubePHP::set_memory('4G');
+cubePHP::set_memory('6G');
ob_clean();
echo cubePage::page($buffer, $js, $jsvar, $css, array(), 9, false, $meta, array(), $standard);