$db->books->composition_update('integer', 0, false);\r
$db->books->dir_references('varchar', 256, false);\r
$db->books->dir_hosting('varchar', 256, false);\r
+ $db->books->dir_macbook_phonegap_ios('varchar', 256, false);\r
$db->books->lucene_time('integer', 0, false);\r
// Clés\r
$db->books->primary('pk_books', 'book_id');\r
header('Content-type: application/json');
ob_end_clean();
- $geocoder = new CubeIT_Services_Google_Geocoder();
+ $geocoder = new CubeIT_Services_Google_Geocoder(864000, false);
$r = $geocoder->geocode(urldecode($_GET['address']), $_GET['region'], true);
echo CubeIT_Util_Json::encode($r);
exit;
if ($book->parametres->version == 1) {\r
$version = 'v1';\r
}\r
+ if (stristr($server, 'phonegap')) {\r
+ $version = 'phonegap';\r
+ }\r
+\r
fb(time(), 'start making package');\r
$package = wsPackager::package($book_id, $version, false);\r
\r
} else if ($server == 'hosting') {\r
$root = '/home/fluidbook/hosting';\r
$url = 'http://hosting.fluidbook.com/';\r
+ } else if ($server == 'macbook_phonegap_ios') {\r
+ $root = '/mnt/macbook/Phonegap/Projects/';\r
+ $url = null;\r
}\r
\r
$e = explode('/', $_POST['dir']);\r
mkdir($finalDir, 0777, true);\r
}\r
\r
- $cp = new cubeCommandLine('cp');\r
+ /** --del -r -z -v * */\r
+ $cp = new cubeCommandLine('rsync');\r
$cp->setPath(CONVERTER_PATH);\r
+ $cp->setArg('del');\r
+ $cp->setArg('t');\r
$cp->setArg('r');\r
+ $cp->setArg('z');\r
+ $cp->setArg('v');\r
$cp->setArg(null, $package . '*');\r
$cp->setArg(null, $finalDir);\r
$cp->execute();\r
\r
+ fb($cp->commande);\r
+ fb($cp->output);\r
+\r
fb(time(), 'end transfert');\r
\r
$x->addClosePopup();\r
- $x->addTruePopup($url . $dir . '/');\r
+ if (!is_null($url)) {\r
+ $x->addTruePopup($url . $dir . '/');\r
+ }\r
}\r
\r
public static function statusBook($args, &$x) {\r
$versions = array();\r
$versions['hosting'] = array('title' => __("Le serveur d'hébergement"), 'icon' => cubeMedia::silk('server_go.png'));\r
$versions['references'] = array('title' => __("L'espace références"), 'icon' => cubeMedia::silk('server_add.png'));\r
+ $versions['macbook_phonegap_ios'] = array('title' => __("Projet Phonegap IOS"), 'icon' => cubeMedia::silk('server_add.png'));\r
\r
foreach ($versions as $k => $v) {\r
$res .= '<li><a href="#" rel="instbook/$1/' . $k . '" class="ajax">' . $v['icon'] . $v['title'] . '</a></li>';\r
} elseif ($server == 'hosting') {\r
$s = __("Serveur d'hébergement");\r
$dir = $book->dir_hosting;\r
+ } elseif ($server == 'macbook_phonegap_ios') {\r
+ $s = __("Projet Phonegap iOS");\r
+ $dir = $book->dir_macbook_phonegap_ios;\r
}\r
\r
if ($dir == '') {\r
$book->composition_update = $r->composition_update;\r
$book->dir_references = $r->dir_references;\r
$book->dir_hosting = $r->dir_hosting;\r
+ $book->dir_macbook_phonegap_ios = $r->dir_macbook_phonegap_ios;\r
\r
return $book;\r
}\r
protected $version;\r
protected $dir_references;\r
protected $dir_hosting;\r
+ protected $dir_macbook_phonegap_ios;\r
\r
public function __get($varname) {\r
if (!property_exists($this, $varname)) {\r
$svg = str_replace('$colorize', '#' . $color, $svg);
file_put_contents($svgColorized, $svg);
}
- copy($svgColorized, $dest . '/' . $icon . '.svg');
+ self::copy($svgColorized, $dest . '/' . $icon . '.svg');
// PNG
$png = $dirColorized . '/' . $icon . '.png';
$batik->setManualArg($svgColorized);
$batik->execute();
}
- copy($png, $dest . '/' . $icon . '.png');
+ self::copy($png, $dest . '/' . $icon . '.png');
+ }
+
+ public static function copy($source, $dest) {
+ if(!file_exists($source)){
+ return;
+ }
+ copy($source, $dest);
+ touch($dest, filemtime($source));
}
}
'js/widget.js'
);
public $pluginCSS = array();
+ public $pluginJs = array();
protected $cssX = array();
protected $cssY = array();
protected $cssWidths = array();
protected $pages;
protected $theme;
protected $version;
- protected $book_id;
+ public $book_id;
protected $themeRoot;
/**
// Copy style folder
$from = $this->assets . '/style';
$to = $this->vdir;
- `cp -r $from $to`;
+ `cp -p -r $from $to`;
// Copy images folder
$from = $this->assets . '/images';
- `cp -r $from $to`;
+ `cp -p -r $from $to`;
// Copy swf
if (file_exists($this->vdir . '/swf')) {
- copy($this->assets . '/swf/video.swf', $this->vdir . '/swf/video.swf');
+ $this->copy($this->assets . '/swf/video.swf', $this->vdir . '/swf/video.swf');
}
$this->loadPlugins();
if (file_exists($dir . '/plugin.js')) {
$f = $d . '/plugin.js';
- $this->jsFiles[] = $f;
+ $this->pluginJs[] = $f;
$this->copy($dir . '/plugin.js', $this->vdir . '/' . $f);
}
if (file_exists($dir . '/plugin.css')) {
}
protected function getVideosFormats($poster = true) {
- if ($this->phoenag == 'ios') {
+ if (!$this->phonegap) {
+ $res = array('mp4', 'ogv', 'webm', 'flv');
+ } elseif ($this->phonegap == 'ios') {
$res = array('mp4');
} else if ($this->phonegap == 'android') {
$res = array('ogv', 'webm');
}
- if (!$this->phonegap) {
- $res[] = 'flv';
- }
+
if ($poster) {
$res[] = 'jpg';
}
+ return $res;
}
protected function writeCache() {
}
$script .= '<script type="text/javascript" src="data/fluidbook.js"></script>' . "\n";
$script .= '<script type="text/javascript" src="data/search.js"></script>' . "\n";
+ foreach ($this->pluginJs as $p) {
+ $script .= '<script type="text/javascript" src="' . $p . '"></script>' . "\n";
+ }
$description = '';
if ($this->book->parametres->seoDescription) {
$l = explode(',', $l1);
$flag = $l[1];
- copy(cubeMedia::getFlagFile($flag), $flagsDir . '/' . $flag . '.png');
+ $this->copy(cubeMedia::getFlagFile($flag), $flagsDir . '/' . $flag . '.png');
$l[3] = cubeText::ucfirst($iso[$l[0]]);
$m[] = implode(',', $l);
}
protected function writeExtras() {
if ($this->theme->parametres->afterSearch != '') {
- copy($this->themeRoot . '/' . $this->theme->parametres->afterSearch, $this->vdir . '/data/images/' . $this->theme->parametres->afterSearch);
+ $this->copy($this->themeRoot . '/' . $this->theme->parametres->afterSearch, $this->vdir . '/data/images/' . $this->theme->parametres->afterSearch);
}
}
if (file_exists($t) && filemtime($t) >= filemtime($s) && filesize($s) == filesize($t)) {
return;
}
-
if (!file_exists(dirname($t))) {
mkdir(dirname($t), 0777, true);
}
copy($s, $t);
+ touch($t, filemtime($s));
}
protected function writeCSS($file, $links) {
break;
}
if ($this->theme->parametres->backgroundImage != '') {
- copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, $this->vdir . '/data/images/' . $this->theme->parametres->backgroundImage);
+ $this->copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, $this->vdir . '/data/images/' . $this->theme->parametres->backgroundImage);
$body.='background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');';
$body.='background-position:';
$header.='height:' . $this->theme->parametres->menuHeight . 'px;';
$header.='background-color:' . self::colorToCSS($this->theme->parametres->menuColor) . ';';
if ($this->theme->parametres->menuImage != '') {
- copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, $this->vdir . '/data/images/' . $this->theme->parametres->menuImage);
+ $this->copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, $this->vdir . '/data/images/' . $this->theme->parametres->menuImage);
$header.='background-image:url(../images/' . $this->theme->parametres->menuImage . ');';
$header.='background-repeat:no-repeat;';
$header.='background-size:100% ' . $this->theme->parametres->menuHeight . 'px;';
// Logo
$logo = '#logo{';
if ($this->theme->parametres->logo) {
- copy($this->themeRoot . '/' . $this->theme->parametres->logo, $this->vdir . '/data/images/' . $this->theme->parametres->logo);
+ $this->copy($this->themeRoot . '/' . $this->theme->parametres->logo, $this->vdir . '/data/images/' . $this->theme->parametres->logo);
$dim = getimagesize($this->vdir . '/data/images/' . $this->theme->parametres->logo);
$logo.='background-image:url(../images/' . $this->theme->parametres->logo . ');width:' . $dim[0] . 'px;height:' . $dim[1] . 'px;';
}
if (file_exists($d) && filemtime($d) >= filemtime($s) && filesize($d) == filesize($s)) {
continue;
}
- copy($s, $d);
+ $this->copy($s, $d);
}
}
}
public function getCSSContainer() {
-
+
if (!($this instanceof contentLink) && $this->page % 2 == 1) {
$this->page--;
$this->left+=$this->compiler->width;
$w = round($this->width * $this->compiler->getCssScale());
$h = round($this->height * $this->compiler->getCssScale());
- return self::makeVideoTag($this, $w, $h);
+ return self::makeVideoTag($this, $w, $h, $this->compiler);
}
- public static function makeVideoTag($linkDatas, $w = null, $h = null) {
+ public static function makeVideoTag($linkDatas, $w = null, $h = null, $compiler = null) {
$file = $linkDatas->to;
$e = explode('.', $file);
$ext = array_pop($e);
$res = '<div class="videoContainer" ';
if (!is_null($w) && !is_null($h)) {
$res.='data-width="' . $w . '" data-height="' . $h . '" ';
+ } else if (!is_null($compiler)) {
+
+ $path = WS_BOOKS . '/working/' . $compiler->book_id . '/' . $basename . '.jpg';
+ $dim = getimagesize($path);
+ $res.='data-width="' . $dim[0] . '" data-height="' . $dim[1] . '" ';
}
$res.=' data-autoplay="' . $autoplay . '"';
$res.=' data-controls="' . $controls . '"';
}
public function getAdditionnalContent() {
- return ' data-video="' . rawurlencode(videoLink::makeVideoTag($this)) . '" ';
+ return ' data-video="' . rawurlencode(videoLink::makeVideoTag($this, null, null, $this->compiler)) . '" ';
}
}
$cp = new cubeCommandLine('cp');\r
$cp->setPath(CONVERTER_PATH);\r
$cp->setArg('r');\r
+ $cp->setArg('p');\r
$cp->setArg(null, WS_BOOKS . '/html5/' . $this->book_id . '/*');\r
$cp->setArg(null, $dest);\r
$cp->execute();\r
\r
$filesToAdd = array('.htaccess', 'web.config');\r
foreach ($filesToAdd as $f) {\r
- copy(WS_COMPILE_ASSETS . '/_html5/' . $f, $dest . '/' . $f);\r
+ $this->copy(WS_COMPILE_ASSETS . '/_html5/' . $f, $dest . '/' . $f);\r
}\r
\r
$filesToDelete = array('indext.html', 'indexu.html', 'data/datas.js');\r
unlink($this->vdir . '/indexu.html');
unlink($this->vdir . '/widget.html');
unlink($this->vdir . '/cache.appcache');
- //rmdir($this->vdir . '/data');
$this->resources = $this->vdir . '/Resources';
public function makePackage($zip) {
parent::makePackage($zip);
- $res = $this->zip();
- $this->postPackage();
- return $res;
+ if ($zip) {
+ return $this->zip();
+ }
+ return $this->vdir;
}
}
// Copie du FB vers un répertoire temporaire\r
$cp = new cubeCommandLine('cp');\r
$cp->setArg('R');\r
+ $cp->setArg('p');\r
$cp->setArg(null, WS_BOOKS . '/final/' . $this->book->book_id . '/*');\r
$cp->setArg(null, $this->vdir);\r
$cp->execute();\r
\r
$s = WS_COMPILE_ASSETS . '/' . $source;\r
if (is_file($s) && !file_exists($this->vdir . $dest)) {\r
- copy($s, $this->vdir . $dest);\r
+ $this->copy($s, $this->vdir . $dest);\r
} else if (is_dir($s)) {\r
$cp = new cubeCommandLine('cp');\r
$cp->setArg('R');\r
+ $cp->setArg('p');\r
$cp->setArg(null, $s);\r
$cp->setArg(null, $this->vdir);\r
$cp->execute();\r
$zip->setArg('u');\r
$zip->setArg(null, '.');\r
$zip->execute();\r
- \r
- if(!file_exists(WS_FILES.'/packager/download')){\r
- mkdir(WS_FILES.'/packager/download',0777,true);\r
+\r
+ if (!file_exists(WS_FILES . '/packager/download')) {\r
+ mkdir(WS_FILES . '/packager/download', 0777, true);\r
}\r
- \r
+\r
fb($zip->commande);\r
fb($zip->output);\r
\r
}\r
}\r
\r
+ public function copy($source, $dest) {\r
+ if(!file_exists($source)){\r
+ return;\r
+ }\r
+ copy($source, $dest);\r
+ touch($dest, filemtime($source));\r
+ }\r
+\r
}\r
\r
?>
\ No newline at end of file
protected function copyThumbnails() {
foreach ($this->pages as $book_page => $infos) {
- copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/p' . $book_page . '.jpg');
+ $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/p' . $book_page . '.jpg');
}
}
if (!file_exists($src) || !is_file($src)) {
$src = WS_THEMES . '/spacer.png';
}
- copy($src, $images . '/' . $file);
+ $this->copy($src, $images . '/' . $file);
}
$cp = new cubeCommandLine('cp');
$src = $this->workingDir . '/' . $file;
if (file_exists($src) && is_file($src)) {
- $res= copy($src, $dir . $file);
+ $res= $this->copy($src, $dir . $file);
return $res;
}
return false;
$nsi = str_replace('$output', $this->getPathBase('exe'), $nsi);\r
$favicon = $this->vdir . '/data/fluidbook.ico';\r
if ($this->theme->parametres->favicon == '') {\r
- copy(WS_COMPILE_ASSETS . '/fluidbook.ico',$favicon);\r
+ $this->copy(WS_COMPILE_ASSETS . '/fluidbook.ico',$favicon);\r
}\r
$nsi = str_replace('$favicon', $favicon, $nsi);\r
\r