From: vincent@cubedesigners.com Date: Wed, 24 Feb 2010 08:35:50 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b8f1a0aacd1feb6ee04cf6a9c9aa7e0daec54722;p=cubeextranet.git --- diff --git a/inc/extranet/Controlleur/class.extranet.core.php b/inc/extranet/Controlleur/class.extranet.core.php index aeaa862da..c0bc72697 100644 --- a/inc/extranet/Controlleur/class.extranet.core.php +++ b/inc/extranet/Controlleur/class.extranet.core.php @@ -50,7 +50,7 @@ class extranetCore extends cubeCore { { // On regarde si user_email et user_password ont été postées // Si c'est le cas, on les copie dans la session - $_SESSION['errorLogin']=false; + $_SESSION['errorLogin'] = false; if (isset($_POST['user_email'])) { $_SESSION['user_email'] = $_POST['user_email']; } @@ -70,10 +70,9 @@ class extranetCore extends cubeCore { // Utilisateur connecté à l'interface $dao = new extranetDAOUtilisateur($this->con); $this->user = $dao->selectByLoginPassword($_SESSION['user_email'], $_SESSION['user_password']); - if($this->user==false){ - $_SESSION['errorLogin']=true; + if ($this->user == false) { + $_SESSION['errorLogin'] = true; return; - } if ($this->user->grade == 0) { $daoClient = new extranetDAOClient($this->con); @@ -303,6 +302,10 @@ class extranetCore extends cubeCore { $db->documents->trim('text', 0, false); $db->documents->date('integer', 0, false); $db->documents->localInfos('text', 0, false); + $db->documents->generalInfos('text', 0, false); + $db->documents->bookmarks('text', 0, false); + $db->documents->numberSections('text', 0, false); + $db->documents->links('text', 0, false); // Clés $db->documents->primary('pk_documents', 'document_id'); $db->documents->index('index_documents_file', 'BTREE', 'file'); @@ -426,11 +429,11 @@ class extranetCore extends cubeCore { $this->createView('order_timereport', 'SELECT utilisateur_id,projet AS projet_id,MAX(date) AS derniere_activite FROM timereport,taches,projets WHERE taches.tache_id=timereport.tache_id AND taches.projet=projets.projet_id AND projets.status=0 GROUP BY utilisateur_id,taches.projet ORDER BY utilisateur_id ASC,MAX(date) DESC'); $this->createView('ca', 'SELECT SUM(total_ht) AS ca, YEAR(FROM_UNIXTIME(date_creation)) annee FROM factures WHERE status IN(1,2) GROUP BY annee'); $this->createView('ftpaccess', 'SELECT email AS userid,password AS passwd,utilisateur_id AS uid,' - . '\'1000\' AS gid,CONCAT(\''.FTPROOT.'\',utilisateur_id) AS homedir, \'/bin/false\' AS shell ' + . '\'1000\' AS gid,CONCAT(\'' . FTPROOT . '\',utilisateur_id) AS homedir, \'/bin/false\' AS shell ' . 'FROM utilisateurs WHERE grade=0 ' . 'UNION ' . 'SELECT email AS userid,ws_password AS passwd,utilisateur_id AS uid,' - . '\'1000\' AS gid,CONCAT(\''.FTPROOT.'\',utilisateur_id) AS homedir, \'/bin/false\' AS shell ' + . '\'1000\' AS gid,CONCAT(\'' . FTPROOT . '\',utilisateur_id) AS homedir, \'/bin/false\' AS shell ' . 'FROM utilisateurs WHERE grade=0 AND ws_password!=\'\''); $this->createView('chiffres_categories', 'SELECT p.annee_fin AS annee, t.categorie, SUM(t.budget) AS ca ' . 'FROM projets_vue p, taches_vue t ' diff --git a/inc/ws/Controlleur/class.ws.conversion.session.php b/inc/ws/Controlleur/class.ws.conversion.session.php index 0a26d0308..61ca77761 100644 --- a/inc/ws/Controlleur/class.ws.conversion.session.php +++ b/inc/ws/Controlleur/class.ws.conversion.session.php @@ -53,7 +53,8 @@ class wsConversionSession { $this->processing = true; $this->initDocuments(); $this->serialize(); - $dao = new wsDAOBook($core->con); + $dao = new wsDAODocument($core->con); + $daobook = new wsDAOBook($core->con); foreach($this->documents as $doc) { $this->currentDoc = $doc; @@ -64,12 +65,8 @@ class wsConversionSession { $doc->processOnePage($i); $this->processedPages++; } - try { - $dao->appendDocument($this->bookId, $doc->document_id); - } - catch(Exception $e) { - file_put_contents(ROOT . '/test.txt', print_r($e->getTrace(),true)); - } + $doc = $dao->updateFromObject($doc); + $daobook->appendDocument($this->bookId, $doc->document_id); $this->processedDoc++; } @@ -111,6 +108,13 @@ class wsConversionSession { file_put_contents(self::getCachePath($this->guid), serialize($this)); } + public function destroy() + { + if (file_exists(self::getCachePath($this->guid))) { + //unlink(self::getCachePath($this->guid)); + } + } + public function __destruct() { } diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index ecebd5093..84cbf4f31 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -87,8 +87,14 @@ class wsFlash extends cubeFlashGateway { public function processConversionSessionAsync() { cubePHP::neverStop(); - $conversion = wsConversionSession::openFromGUID($_POST['sessionConversionGUID']); - $conversion->process(); + try { + $conversion = wsConversionSession::openFromGUID($_POST['sessionConversionGUID']); + $conversion->process(); + } + catch(Exception $e) { + file_put_contents(CACHE . '/conversionExceptions.txt', print_r($e, true), FILE_APPEND); + } + $conversion->destroy(); } public function getConversionSessionProgress() diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 7ca436ae9..4d38a4d21 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -164,7 +164,7 @@ class wsDAOBook extends extranetDAO { // Insère les pages $c = $this->con->openCursor('book_pages'); $c->book_id = $book_id; - $c->document_id = $r->document_id; + $c->document_id = $document_id; for($i = 1;$i <= $r->pages;$i++) { $c->document_page = $i; $c->book_page = $after_page + $i; diff --git a/inc/ws/DAO/class.ws.dao.document.php b/inc/ws/DAO/class.ws.dao.document.php index 918987093..52ef5f355 100644 --- a/inc/ws/DAO/class.ws.dao.document.php +++ b/inc/ws/DAO/class.ws.dao.document.php @@ -1,18 +1,20 @@ document_id = $r->document_id; - $document->init(); - $document->file = $r->file; - $document->proprietaire = $r->proprietaire; - $document->pages = $r->pages; - if ($r->trim) { - $document->trim = unserialize($r->trim); + foreach(self::$normal as $k) { + $document->$k = $r->$k; + } + foreach(self::$complex as $k) { + if ($r->$k != '') { + $document->$k = unserialize($r->$k); + } } - $document->date = $r->date; - $document->localInfos = unserialize($r->localInfos); + $document->init(); return $document; } @@ -53,14 +55,12 @@ class wsDAODocument extends extranetDAO { $data['document_id'] = 'new'; } $c = $this->con->openCursor('documents'); - $c->file = $data['file']; - $c->proprietaire = $data['proprietaire']; - $c->pages = $data['pages']; - if (isset($data['localInfos'])) { - $c->localInfos = serialize($data['localInfos']); + + foreach(self::$normal as $k) { + $c->$k = $data[$k]; } - if (isset($data['trim'])) { - $c->trim = serialize($data['trim']); + foreach(self::$complex as $k) { + $c->$k = serialize($data[$k]); } if ($data['document_id'] == 'new') { @@ -74,6 +74,40 @@ class wsDAODocument extends extranetDAO { $doc = $this->selectById($document_id); return $doc; } + + public function updateField($document_id, $fieldName, $value) + { + $c = $this->con->openCursor('documents'); + $c->$fieldName = $value; + $c->update('WHERE document_id=\'' . $this->con->escape($document_id) . '\''); + } + + public function updateFromObject($document) + { + /* protected $document_id; + protected $file; + protected $proprietaire; + protected $pages; + protected $trim; + protected $date; + protected $localInfos; + protected $generalInfos; + protected $bookmarks; + protected $numberSections; + protected $links; + + +*/ + + $data = array(); + foreach(self::$normal as $k) { + $data[$k] = $document->$k; + } + foreach(self::$complex as $k) { + $data[$k] = $document->$k; + } + return $this->sauve($data); + } } ?> \ No newline at end of file diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index e68a1315d..9256aee51 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -53,8 +53,8 @@ class wsDocument extends cubeMetier { mkdir($this->out, 0755, true); } $this->log_pointer = fopen($this->log, 'a'); - //$this->_memoErrorLog = ini_get('error_log'); - //ini_set('error_log', $this->phperrors); + // $this->_memoErrorLog = ini_get('error_log'); + // ini_set('error_log', $this->phperrors); } public function copyOriginal($tmp_file) @@ -124,7 +124,7 @@ class wsDocument extends cubeMetier { $k = trim($e[0]); $v = trim($e[1]); if ($k == 'Pages' || $k == 'NumberOfPages') { - $this->generalInfos['pages'] = $v; + $this->pages = $this->generalInfos['pages'] = $v; } elseif (preg_match('|Page ([0-9]+) (.*)Box: ([0-9.]*) ([0-9.]*) ([0-9.]*) ([0-9.]*)|iu', $line, $m)) { $this->generalInfos['page'][$m[1]][strtolower($m[2])] = array($m[3], $m[4], $m[5], $m[6]); } elseif (preg_match('|Page ([0-9]+) size: ([0-9.]*)([\sx]+)([0-9.]*)(.*)|iu', $line, $m)) { @@ -619,7 +619,7 @@ TRACE drawlink s=http://www.ladocumentationfrancaise.fr/ if (isset($this->log_pointer) && is_resource($this->log_pointer)) { fclose($this->log_pointer); } - //ini_set('error_log', $this->_memoErrorLog); + // ini_set('error_log', $this->_memoErrorLog); } } diff --git a/swf/_src/wsComposer.fla b/swf/_src/wsComposer.fla index 217b4a784..96d02f4f7 100644 Binary files a/swf/_src/wsComposer.fla and b/swf/_src/wsComposer.fla differ