self::collectionVersionPublish(array('collectionVersionPublish', $id, $time), new cubeAjax());\r
}\r
\r
+ self::cleanCachesCollection($id);\r
+\r
$x->addReload();\r
}\r
\r
$c->online = 1;\r
$c->update('WHERE collection_id=\'' . $core->con->escape($id) . '\' AND compile_date=\'' . $core->con->escape($date) . '\'');\r
\r
- $caches = array(WS_COLLECTIONS . '/ws/' . $id . '.ios.json', WS_COLLECTIONS . '/ws/' . $id . '.android.json');\r
\r
- foreach ($caches as $cache) {\r
- if (file_exists($cache)) {\r
- unlink($cache);\r
- }\r
- }\r
+ self::cleanCachesCollection($id);\r
\r
$x->addReload();\r
}\r
\r
+ protected static function cleanCachesCollection($id) {\r
+ $os = array('ios', 'android');\r
+ $files = array('json', 'update');\r
+\r
+ foreach ($os as $_os) {\r
+ foreach ($files as $f) {\r
+ $ff = WS_COLLECTIONS . '/ws/' . $id . '.' . $_os . '.' . $f;\r
+ if (file_exists($ff)) {\r
+ unlink($ff);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
public static function collectionVersionDelete($args, &$x) {\r
global $core;\r
\r
exit;\r
}\r
\r
+\r
+\r
$limit = TIME - 72000;\r
if (!file_exists($cache) || !file_exists($update) || filemtime($cache) < $limit) {\r
$r = $core->con->select('SELECT * FROM book_collection_compile WHERE online=1 AND collection_id=\'' . $core->con->escape($id) . '\'');\r
$r->fetch();\r
$version = $r->compile_date;\r
\r
- $composition = json_decode(file_get_contents(WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/composition.json'));\r
+ $vcompo = WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/composition.json';\r
+ $composition = json_decode(file_get_contents($vcompo));\r
\r
$couvertures = array();\r
$vroot = WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/' . $os . '/';\r
\r
$json = json_encode($d);\r
file_put_contents($cache, $json);\r
- echo $json;\r
+\r
file_put_contents($update, $version);\r
} else {\r
- echo file_get_contents($cache);\r
+ $d = json_decode(file_get_contents($cache), true);\r
+ }\r
+\r
+ $force = false;\r
+ if (!is_null($local)) {\r
+ $lcompo = WS_COLLECTIONS . '/versions/' . $id . '/' . $local . '/composition.json';\r
+ if (!file_exists($lcompo)) {\r
+ $force = true;\r
+ }\r
}\r
\r
+ $d['forceUpdate'] = $force;\r
+ echo json_encode($d);\r
exit;\r
}\r
\r
foreach ($images as $i => $label) {\r
$res.='<tr><td class="min nowrap">' . $label . '</td><td><input type="file" name="' . $i . '" />' . form::hidden(array('theme[' . $i . ']', 'theme_' . $i), $collection->theme[$i]) . '</td></tr>';\r
}\r
+ $res.='<tr><td class="min nowrap">' . __('Couleur principale') . '</td><td>#' . form::field(array('settings[couleurA]', 'couleurA'), 6, 6, $collection->settings['couleurA']) . '</td></tr>';\r
+ $res.='<tr><td class="min nowrap">' . __('Couleur secondaire') . '</td><td>#' . form::field(array('settings[couleurB]', 'couleurB'), 6, 6, $collection->settings['couleurB']) . '</td></tr>';\r
+ $res.='<tr><td class="min nowrap">' . __('Couleur des textes') . '</td><td>#' . form::field(array('settings[couleurC]', 'couleurC'), 6, 6, $collection->settings['couleurC']) . '</td></tr>';\r
+\r
$res.='</table>';\r
\r
$res.='<a href="#" class="submit right">' . $core->typo->Ajouter(__('Enregistrer')) . '</a>';\r
}\r
\r
public function makeSVGFile($page) {\r
+ $testFile = $this->out . '/html/s' . $page . '.svg';\r
$svgFile = $this->out . '/html/p' . $page . '.svg';\r
//$svgSimplified = $this->out . '/html/s' . $page . '.svg';\r
$svgOpt = $this->out . '/html/o' . $page . '.svg';\r
$pdftocairo->execute();\r
$this->addToLog($pdftocairo, true, $page);\r
\r
+ /*$pdf2svg = new cubeCommandLine('pdf2svg');\r
+ $pdf2svg->setPath(CONVERTER_PATH);\r
+ $pdf2svg->setArg(null, $this->cropped);\r
+ $pdf2svg->setArg(null, $testFile);\r
+ $pdf2svg->setArg(null, $page);\r
+ $pdf2svg->execute();\r
+ $this->addToLog($pdf2svg, true, $page);\r
+ $this->_cleanSVG($testFile);*/\r
+\r
+ $this->_cleanSVG($svgFile);\r
+ \r
+ }\r
+\r
+ protected function _cleanSVG($svgFile) {\r
$svg = new DOMDocument();\r
$svg->preserveWhiteSpace = false;\r
$svg->load($svgFile);\r
function writeScript() {
$config = array();
$config['id'] = $this->collectionId;
+ $config['couleurA']=$this->collection->settings['couleurA'];
+ $config['couleurB']=$this->collection->settings['couleurB'];
+ $config['couleurC']=$this->collection->settings['couleurC'];
$this->copy(WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap/' . $this->phonegapVersion . '/cordova-' . $this->os . '.js', $this->vdir . '/js/cordova.js');
file_put_contents($this->vdir . '/data/app.js', 'DATAS = ' . CubeIT_Util_Json::encode($config) . ';');