]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 17 Oct 2014 13:27:10 +0000 (13:27 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 17 Oct 2014 13:27:10 +0000 (13:27 +0000)
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/Util/html5/app/class.ws.html5.app.compiler.php
inc/ws/Util/html5/class.ws.html5.links.php

index d24960c16db0e1e006ccf153870f53468e943f83..f0e96506b9f9b3e87f13f014c9e32d759f15f90b 100644 (file)
@@ -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Ã\83© est le max dont le numÃ\83©ro est infÃ\83©rieur Ã\83  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Ã\83©jÃ\83 
                $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Ã\83¨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 Ã\83  savoir si l'on doit importer de nouveaux documents associÃ\83©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Ã\83©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Ã\83´le des entreprises dÃ\83©jÃ\83  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Ã\83©rÃ\83© Ã\83  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)) {
index d113e98917c7698fb2bfdc2faddba4a1e26a1481..2f75d4a754f46fbb57e268d021274eb0ddab8958 100644 (file)
@@ -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 . '/';
index 63167d48624eb606c86e369dc1efe07718363918..a6d952dd1b6ab47b5d36d369e3ac7926f0afa1f5 100644 (file)
@@ -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'];