From: vincent@cubedesigners.com Date: Fri, 17 Oct 2014 13:27:10 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6dfc1455e24f14c61cc0e38407d94ecdd4853265;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.maintenance.php b/inc/ws/Controlleur/class.ws.maintenance.php index d24960c16..f0e96506b 100644 --- a/inc/ws/Controlleur/class.ws.maintenance.php +++ b/inc/ws/Controlleur/class.ws.maintenance.php @@ -91,7 +91,7 @@ class wsMaintenance { try { $c->insert(); } catch (Exception $e) { - // fb($e); +// fb($e); } } } @@ -99,11 +99,11 @@ class wsMaintenance { public static function importFromOldWS($args) { global $core; - // Import des fluidbooks - // Donc le dernier importé est le max dont le numéro est inférieur à 10000 +// Import des fluidbooks +// Donc le dernier importé est le max dont le numéro est inférieur à 10000 $r = $core->con->select('SELECT MAX(book_id) AS book_id FROM books WHERE book_id<10000'); $lastImported = $r->book_id; - // On recherche maintenant les fluidbook dans la vieille base +// On recherche maintenant les fluidbook dans la vieille base $r = $core->con->select('SELECT bid FROM ws.book WHERE bid>' . $lastImported); $oldBooks = array(); while ($r->fetch()) { @@ -121,7 +121,7 @@ class wsMaintenance { public static function importLangs($oldBooks) { global $core, $allTrads, $trads; - // On regarde d'abord les langues que nous avons déjà +// On regarde d'abord les langues que nous avons déjà $r = $core->con->select('SELECT lang_id FROM langues'); $already = array(); while ($r->fetch()) { @@ -183,7 +183,7 @@ class wsMaintenance { $r = $core->con->select('SELECT MAX(theme_id) AS theme_id FROM themes WHERE theme_id<1000'); $lastImported = $r->theme_id; - // Import des thèmes +// Import des thèmes $r = $core->con->select('SELECT * FROM ws.theme WHERE tid IN (SELECT tid FROM ws.book WHERE bid ' . self::_sqlIn($oldBooks) . ') AND tid>' . $lastImported); $theme = new wsTheme(); while ($r->fetch()) { @@ -212,7 +212,7 @@ class wsMaintenance { public static function importDocs($oldBooks) { global $core; - // On cherche maintenant à savoir si l'on doit importer de nouveaux documents associés +// On cherche maintenant à savoir si l'on doit importer de nouveaux documents associés $oldDocuments = array(); $r = $core->con->select('SELECT DISTINCT did FROM ws.book_pages WHERE bid ' . self::_sqlIn($oldBooks) . ''); while ($r->fetch()) { @@ -249,17 +249,29 @@ class wsMaintenance { $tolinks = array_merge($tolinks, $fromlinks); $torulers = array_merge($torulers, $fromrulers); + $wt = WS_BOOKS . '/working/' . $to; + $wf = WS_BOOKS . '/working/' . $from; + + if (file_exists($wf)) { + $wf1 = $wf . '/*'; + if (!file_exists($wt)) { + mkdir($wt, 0777, true); + } + + $cmd = "cp -r $wf1 $wt"; + echo `$cmd`; + } $dao->setLinksAndRulers($to, $tolinks, $torulers, 'Copy links from #' . $from . ' to #' . $to, $core->user->utilisateur_id); } public static function importBooks($oldBooks) { global $core, $allTrads, $signatures; - // Importe les fluidbooks +// Importe les fluidbooks $r = $core->con->select('SELECT * FROM ws.book WHERE bid ' . self::_sqlIn($oldBooks) . ' ORDER BY bid'); if (!$r->count()) { return; } - // . +// . while ($r->fetch()) { $c = $core->con->openCursor('books'); $c->book_id = $r->bid; @@ -290,12 +302,12 @@ class wsMaintenance { } $n = array(); - // Pages sans numéro +// Pages sans numéro $offset = $r->first_page_nr - 1; for ($i = 0; $i < $offset; $i++) { $n[] = ''; } - // Pages avec numero +// Pages avec numero for ($j = 1; $j + $offset <= $r->pages; $j++) { $n[] = $j; } @@ -308,7 +320,7 @@ class wsMaintenance { $c->version = 1; $c->insert(); } - // Import des pages +// Import des pages $core->con->execute('INSERT INTO book_pages (book_id,book_page,document_id,document_page) SELECT bid,bpid,did,dpid FROM ws.book_pages WHERE bid ' . self::_sqlIn($oldBooks)); $dao = new wsDAOBook($core->con); @@ -361,7 +373,7 @@ class wsMaintenance { protected static function _getAllUsers() { global $core, $entreprises, $entreprise_id, $utilisateurs_entreprises, $utilisateur_id, $ws2ext, $grades, $utilisateurs; $grades = array(0 => 1, 0.4 => 1, '0.4' => 1, 0.5 => 1, '0.5' => 1, 1 => 1, 2 => 2, 3 => 3, 4 => 5); - // Contrôle des entreprises déjà dans la base extranet +// Contrôle des entreprises déjà dans la base extranet $entreprises = array(); $entreprise_id = 0; $r = $core->con->select('SELECT entreprise_id,nom FROM entreprises'); @@ -379,7 +391,7 @@ class wsMaintenance { } $entreprise_id++; - // Obtient les emails des utilisateurs +// Obtient les emails des utilisateurs $utilisateur_id = 0; $utilisateurs = array(); $r = $core->con->select('SELECT utilisateur_id,email FROM utilisateurs'); @@ -398,13 +410,13 @@ class wsMaintenance { protected static function _importOldUser($oldid) { global $core, $entreprises, $entreprise_id, $utilisateurs_entreprises, $utilisateur_id, $ws2ext, $grades, $utilisateurs; - // Get user from old +// Get user from old $r = $core->con->select('SELECT * FROM ws.user WHERE uid=\'' . $core->con->escape($oldid) . '\''); if ($r->extranet != 0) { $ws2ext[$r->uid] = $r->extranet; return; } - // On s'occupe de l'entreprise +// On s'occupe de l'entreprise $email = trim(mb_strtolower($r->email)); $rs = trim($r->rs); @@ -445,7 +457,7 @@ class wsMaintenance { $c->ws_admin = self::_getWsUser($r->admin); $c->update('WHERE entreprise_id=\'' . $e . '\''); } - // Puis de l'utilisateur +// Puis de l'utilisateur if (isset($utilisateurs[$email])) { $c = $core->con->openCursor('utilisateurs'); $c->ws_password = $r->password; @@ -468,7 +480,7 @@ class wsMaintenance { $c->lang = $r->lang; $c->telephone = $r->telephone; $c->date_creation = $r->date; - $c->notes = 'Inséré à l\'import vers le nouveau Fluidbook Workshop'; + $c->notes = 'Inséré à l\'import vers le nouveau Fluidbook Workshop'; $c->ws_password = $r->password; $c->ws_id = $r->uid; $c->insert(); @@ -496,12 +508,12 @@ class wsMaintenance { public static function cleanPackages() { $limit = TIME - (4 * 3600); // 4 heures avant maintenant* - // +// $dirs = array(ROOT . '/cache/download', WS_FILES . '/packager/download/', WS_FILES . '/packager/', '/home/ws/www/download'); - // Clean downloads +// Clean downloads foreach ($dirs as $dir) { if (!file_exists($dir)) { diff --git a/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php b/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php index d113e9891..2f75d4a75 100644 --- a/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php +++ b/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php @@ -111,11 +111,11 @@ class wsHTML5AppCompiler { } function compile($os, $phonegapVersion = 'latest', $erase = false) { - if ($phonegapVersion == 'collection') { - $phonegapVersion = $this->collection->settings['phonegap']; - } + /* if ($phonegapVersion == 'collection') { + $phonegapVersion = $this->collection->settings['phonegap']; + } - $this->phonegapVersion = wsHTML5Compiler::getPhonegapVersion($phonegapVersion); + $this->phonegapVersion = wsHTML5Compiler::getPhonegapVersion($phonegapVersion); */ $this->os = $os; $this->vdir = $this->dir = WS_COLLECTIONS . '/app/' . $this->collectionId . '/'; diff --git a/inc/ws/Util/html5/class.ws.html5.links.php b/inc/ws/Util/html5/class.ws.html5.links.php index 63167d486..a6d952dd1 100644 --- a/inc/ws/Util/html5/class.ws.html5.links.php +++ b/inc/ws/Util/html5/class.ws.html5.links.php @@ -116,7 +116,7 @@ class wsHTML5Link { $ext = mb_strtolower(files::getExtension($init['alternative'])); - if (in_array($ext, array('oam', 'zip'))) { + if (in_array($ext, array('oam', 'zip', 'html'))) { if ($init['inline']) { return new htmlMultimediaLink($id, $init, $compiler); } else { @@ -577,9 +577,15 @@ class htmlMultimediaLink extends wsHTML5Link { if ($ext == 'oam') { $d = $this->unzipFile($this->alternative, true); $this->_config = $this->getConfigOAM($d['dir']); - } else { + } elseif ($ext == 'zip') { $d = $this->unzipFile($this->alternative, false); $this->_config = $this->getConfigZIP($d['dir']); + } elseif ($ext == 'html') { + $fdir = 'data/links'; + $dir = $this->compiler->vdir . '/' . $fdir; + $d = array('fdir' => $fdir, 'dir' => $dir); + copy($this->compiler->wdir . '/' . $this->alternative, $d['dir'] . '/' . $this->alternative); + $this->_config = $this->getConfigHTML($d['dir'], $this->alternative); } $w = $this->width * $this->getCssScale(); @@ -655,8 +661,6 @@ class htmlMultimediaLink extends wsHTML5Link { } public function getConfigZIP($d) { - - $res = array('width' => $this->video_width, 'height' => $this->video_height); if (file_exists($d . '/index.html')) { $r = array('html' => 'index.html', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array()); @@ -666,6 +670,13 @@ class htmlMultimediaLink extends wsHTML5Link { return array_merge($res, $r); } + public function getConfigHTML($d, $html) { + $res = array('width' => $this->video_width, 'height' => $this->video_height); + $r = array('html' => $html, 'inject' => array(), 'injectcss' => array(), 'injectjs' => array()); + + return array_merge($res, $r); + } + public function getConfigOAM($d) { $x = simplexml_load_file($d . '/config.xml'); $config = (string) $x->oamfile['src'];