From: vincent@cubedesigners.com Date: Fri, 6 Jul 2012 17:31:54 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=52a552623d42078a77bee5cec3d9cc66acf44885;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.maintenance.php b/inc/ws/Controlleur/class.ws.maintenance.php index 994c58deb..14e3f5f55 100644 --- a/inc/ws/Controlleur/class.ws.maintenance.php +++ b/inc/ws/Controlleur/class.ws.maintenance.php @@ -735,12 +735,15 @@ class wsMaintenance { return $res; } - public static function updateHTML5Sources() { + public static function updateHTML5Sources($args = array(), $externals = true) { $svn = new cubeCommandLine('svn'); $svn->setPath(CONVERTER_PATH); $svn->setArg(null, 'up'); + if (!$externals) { + $svn->setArg('ignore-externals'); + } $svn->setArg('r', file_get_contents(WS_COMPILE_ASSETS . '/_html5/PROD')); - $svn->setArg(null, WS_COMPILE_ASSETS.'/_html5prod'); + $svn->setArg(null, WS_COMPILE_ASSETS . '/_html5prod'); $svn->execute(); fb($svn->commande); diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index c545ef271..f6a378db5 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -829,7 +829,7 @@ class wsDAOBook extends commonDAO { } if ($html5) { fb(time(), 'Compile HTML5'); - $res.=$this->compileHTML5($book_id); + $res.=$this->compileHTML5($book_id,$book); $this->touchCompile($book_id, 'html5'); } if ($v1 || $v2) { @@ -1263,8 +1263,8 @@ class wsDAOBook extends commonDAO { } } - public function compileHTML5($book_id) { - $htmlCompiler = new wsHTML5Compiler($book_id); + public function compileHTML5($book_id,$book) { + $htmlCompiler = new wsHTML5Compiler($book_id,$book->parametres->mobileLVersion); $htmlCompiler->compile(); } diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index f5ca4f370..34a1c66c1 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -222,6 +222,11 @@ class wsBookParametres extends wsParametres { __('Version HTML5') => 'html5', __("Version HTML5 en images") => 'html5-images') ); + + $this->fields['mobileLVersion']= array('type' => 'combo', 'default' => 'stable', 'editable' => true, 'label' => __('Version logicielle'), 'grade' => 5, + 'datas' => array(__('Stable') => 'stable', + __('En cours de développement') => 'dev') + ); $this->fields['mobileTransitions'] = array('type' => 'combo', 'default' => 'none', 'editable' => true, 'label' => __('Transitions entre les pages'), 'grade' => 5, 'datas' => array(__('Aucune transition') => 'none', @@ -230,7 +235,7 @@ class wsBookParametres extends wsParametres { ); $this->forms['mobile'] = array('label' => __('Version mobile'), - 'fieldsnames' => array('mobileVersion', 'mobileTransitions')); + 'fieldsnames' => array('mobileLVersion','|','mobileVersion', 'mobileTransitions')); $this->fields['secureURL'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('URL de sécurisation'), 'grade' => 5, 'hint' => __('URL intérrogé pour vérifier si le visiteur à les droits pour consulter la publication')); $this->fields['secureURLRedirect'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('Redirection'), 'grade' => 5, 'hint' => __("Si l'authentification échoue, redirection vers cette adresse")); diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index 0bbc6008c..7b4b2cbd4 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -79,10 +79,18 @@ class wsHTML5Compiler { protected $backgroundsPrefix = 'p'; protected $svg = true; protected $config = array(); + protected $assets = ''; - function __construct($book_id) { + function __construct($book_id, $version = 'stable') { global $core; + if ($version == 'stable') { + $this->assets = WS_COMPILE_ASSETS . '/_html5prod'; + wsMaintenance::updateHTML5Sources(array(),false); + } else { + $this->assets = WS_COMPILE_ASSETS . '/_html5'; + } + cubePHP::set_memory('4G'); if (trim($book_id) == '') { @@ -167,16 +175,16 @@ class wsHTML5Compiler { } // Copy style folder - $from = WS_COMPILE_ASSETS . '/_html5/style'; + $from = $this->assets . '/style'; $to = $this->vdir; `cp -r $from $to`; // Copy images folder - $from = WS_COMPILE_ASSETS . '/_html5/images'; + $from = $this->assets . '/images'; `cp -r $from $to`; // Copy swf - copy(WS_COMPILE_ASSETS . '/_html5/swf/video.swf', $this->vdir . '/swf/video.swf'); + copy($this->assets . '/swf/video.swf', $this->vdir . '/swf/video.swf'); $this->writeImages(); $linksCSS = $this->writeLinks(); @@ -271,7 +279,7 @@ class wsHTML5Compiler { } protected function writeIndex($numCSS) { - $html = file_get_contents(WS_COMPILE_ASSETS . '/_html5/_index.html'); + $html = file_get_contents($this->assets . '/_index.html'); $uhtml = $html; $titre = $this->book->parametres->title; @@ -342,7 +350,7 @@ class wsHTML5Compiler { file_put_contents($this->vdir . '/indext.html', $uhtml); // Write widget html - $whtml = file_get_contents(WS_COMPILE_ASSETS . '/_html5/widget.html'); + $whtml = file_get_contents($this->assets . '/widget.html'); $script = ''; $style = ''; @@ -360,12 +368,12 @@ class wsHTML5Compiler { $langs = $daoLang->selectAll(); $traductions = (!count($this->book->traductions)) ? $lang->traductions : $this->book->traductions; - - $this->config->l10n=array(); - $this->config->l10n['default']=$traductions; - + + $this->config->l10n = array(); + $this->config->l10n['default'] = $traductions; + foreach ($langs as $lang) { - $this->config->l10n[$lang->lang_id]=$lang->traductions; + $this->config->l10n[$lang->lang_id] = $lang->traductions; } } @@ -408,13 +416,13 @@ class wsHTML5Compiler { foreach ($finals as $jsfinal => $files) { $mintime = 0; - $minimized = WS_COMPILE_ASSETS . '/_html5/js/' . $jsfinal . '-min.js'; + $minimized = $this->assets . '/js/' . $jsfinal . '-min.js'; if (file_exists($minimized)) { $mintime = filemtime($minimized); } $reminimize = false; foreach ($files as $file) { - if (filemtime(WS_COMPILE_ASSETS . '/_html5/' . $file) > $mintime) { + if (filemtime($this->assets . '/' . $file) > $mintime) { $reminimize = true; break; } @@ -423,7 +431,7 @@ class wsHTML5Compiler { if ($reminimize) { $js = ''; foreach ($files as $file) { - $js.=file_get_contents(WS_COMPILE_ASSETS . '/_html5/' . $file); + $js.=file_get_contents($this->assets . '/' . $file); $js.="\n\n"; } $tmp = cubeFiles::tempnam();