From: vincent@cubedesigners.com Date: Wed, 9 Jun 2010 09:43:27 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=df3e79693b9673c7f566d96585070c98d5f4ed94;p=cubeextranet.git --- diff --git a/inc/config.inc.php b/inc/config.inc.php index 883cca2ca..db77577f1 100644 --- a/inc/config.inc.php +++ b/inc/config.inc.php @@ -48,6 +48,9 @@ if (in_array($_SERVER['HTTP_HOST'], $ws)) { define('GA', 'UA-4339912-4'); define('TITLE', 'Extranet Cubedesigners'); } + +define('WS_STATS','http://stats.fluidbook.com/'); + define('MINIMIZE_JS', false); define('WORKER_PREFIX', 'worker.'); diff --git a/inc/extranet/Controlleur/class.extranet.ajax.php b/inc/extranet/Controlleur/class.extranet.ajax.php index 4f672746d..0d0793942 100644 --- a/inc/extranet/Controlleur/class.extranet.ajax.php +++ b/inc/extranet/Controlleur/class.extranet.ajax.php @@ -922,49 +922,6 @@ class extranetAjax { $dao->supprime($path); $x->addContent('listeFichiers', extranetUrl::listeFichiers()); } - - public static function supprimeBook($args, &$x) - { - global $core; - $dao = new wsDAOBook($core->con); - $dao->supprime($args[1]); - $x->addContent('listeBooks', wsUrl::listeBooks()); - } - - public static function searchBooks($args, &$x) - { - $x->addContent('listeBooks', wsUrl::listeBooks()); - } - - public static function pageBooks($args, &$x) - { - self::page('books', $args[1]); - $x->addContent('listeBooks', wsUrl::listeBooks()); - } - - public static function parPageBooks($args, &$x) - { - self::parPage('books', $_POST['par_page']); - $x->addContent('listeBooks', wsUrl::listeBooks()); - } - - public static function sortBooks($args, &$x) - { - self::sort('books', $args[1]); - $x->addContent('listeBooks', wsUrl::listeBooks()); - } - - public static function filtreBooks($args, &$x) - { - if (isset($args[1]) && $args[1] == 'efface') { - self::filtre('books'); - $x->addReload(); - return; - } else { - self::filtre('books', $_POST); - $x->addContent('listeBooks', wsUrl::listeBooks()); - } - } } ?> \ No newline at end of file diff --git a/inc/extranet/Controlleur/class.extranet.core.php b/inc/extranet/Controlleur/class.extranet.core.php index 6ada40178..d7aac95f9 100644 --- a/inc/extranet/Controlleur/class.extranet.core.php +++ b/inc/extranet/Controlleur/class.extranet.core.php @@ -339,6 +339,7 @@ class extranetCore extends cubeCore { $db->books->status('integer', 0, false); $db->books->date_status('integer', 0, false); $db->books->parametres('text', 0, false); + $db->books->chapters('text',0,false); $db->books->date('integer', 0, false); // Clés $db->books->primary('pk_books', 'book_id'); diff --git a/inc/prepend.php b/inc/prepend.php index 0ae51760e..54d0f7a40 100644 --- a/inc/prepend.php +++ b/inc/prepend.php @@ -12,6 +12,7 @@ require_once(dirname(__FILE__) . '/ws/Metier/_common.php'); require_once(dirname(__FILE__) . '/ws/Controlleur/_common.php'); require_once(dirname(__FILE__) . '/ws/DAO/_common.php'); $GLOBALS['ajaxClasses'][] = 'extranetAjax'; +$GLOBALS['ajaxClasses'][] = 'wsAjax'; // Instantiation de la classe de contrôle $core = new extranetCore(); // Définition des handlers des urls diff --git a/inc/ws/Controlleur/_common.php b/inc/ws/Controlleur/_common.php index 6284ce1d0..69818bdf8 100644 --- a/inc/ws/Controlleur/_common.php +++ b/inc/ws/Controlleur/_common.php @@ -1,8 +1,9 @@ \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index 9fce86717..5b5bb2ed6 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -70,10 +70,14 @@ class wsFlash extends cubeFlashGateway { $p = $this->xml->addChild('pages'); $docs = array(); foreach($pages as $page => $info) { + $file = ROOT . '/docs/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg'; + $dim = getimagesize($file); $pa = $p->addChild('page'); $pa->addAttribute('page', $page); $pa->addAttribute('document_id', $info['document_id']); $pa->addAttribute('document_page', $info['document_page']); + $pa->addAttribute('width', $dim[0]); + $pa->addAttribute('height', $dim[1]); $docs[] = $info['document_id']; } $docs = array_unique($docs); @@ -171,7 +175,7 @@ class wsFlash extends cubeFlashGateway { } else { $right = '-'; } - $t->addAttribute('right', rand(0, 1)?'w':'r'/*$right*/); + $t->addAttribute('right', $right); $t->addAttribute('books', $theme->nbBooks); } } @@ -277,28 +281,73 @@ class wsFlash extends cubeFlashGateway { } } + public function setChapters() + { + global $core; + $dao = new wsDAOBook($core->con); + $dao->setChapters($this->args['book_id'], $this->args['chapters']); + } + + public function getChapters() + { + global $core; + $dao = new wsDAOBook($core->con); + $book = $dao->selectById($this->args['book_id']); + $this->xml->addChild('chapters', json_encode($book->chapters)); + } + + public function formatSize($val) + { + $str = files::size($val); + $str = str_replace('.', __(','), $str); + $str = str_replace('B', __('o'), $str); + return $str; + } + public function getBookInfos() { global $core; $dao = new wsDAOBook($core->con); $book = $dao->selectById($this->args['book_id']); - $res = 'Nombre de pages :' . "\n"; - $res .= '76 pages' . "\n"; + $pages = $dao->getPagesOfBook($this->args['book_id']); + $daoDoc = new wsDAODocument($core->con); + + $nb_pages = count($pages); + $this->xml->addChild('pages', $nb_pages); + + $total_size = 0; + foreach($pages as $page => $info) { + $file = ROOT . '/docs/' . $info['document_id'] . '/p' . $info['document_page'] . '.swf'; + $total_size += filesize($file); + } + $average_size = $total_size / $nb_pages; + + $total = self::formatSize($total_size); + $average = self::formatSize($average_size); + + $firstDoc = $daoDoc->selectById($pages[1]['document_id']); + $size = $firstDoc->generalInfos['size']; + + $this->xml->addChild('width', $size[0]); + $this->xml->addChild('height', $size[1]); + + $res = __('Nombre de pages') . ' : ' . "\n"; + $res .= $nb_pages . ' ' . __('pages') . "\n"; $res .= "\n"; - $res .= 'Dimensions :' . "\n"; - $res .= '651.97 x 822.05 pt' . "\n"; + $res .= __('Dimensions') . ' : ' . "\n"; + $res .= round($size[0], 3) . ' x ' . round($size[1], 3) . ' pts' . "\n"; $res .= "\n"; - $res .= 'Taille totale des pages : ' . "\n"; - $res .= '7898 Ko' . "\n"; + $res .= __('Taille totale des pages') . ' : ' . "\n"; + $res .= $total . "\n"; $res .= "\n"; - $res .= 'Taille moyenne des pages :' . "\n"; - $res .= '198 Ko' . "\n"; + $res .= __('Taille moyenne des pages') . ' : ' . "\n"; + $res .= $average . "\n"; $res .= "\n"; - $res .= 'Taille du PDF:' . "\n"; + /*$res .= __('Taille du PDF') . ' : ' . "\n"; $res .= '7898 Ko' . "\n"; $res .= "\n"; - $res .= 'Qualité de conversion :' . "\n"; - $res .= '150dpi (qualité 85%)' . "\n"; + $res .= __('Qualité de conversion') . ' : ' . "\n"; + $res .= '150dpi (qualité 85%)' . "\n";*/ $this->xml->addChild('infos', $res); } } diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index bcc006334..79fb08d2e 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -7,7 +7,7 @@ class wsUrl { $settings = $core->user->getSettings('books'); $shortcuts = array(); - $shortcuts[] = '' . $core->typo->Ajouter(__('Créer une nouvelle publication')) . ''; + $shortcuts[] = '' . $core->typo->Ajouter(__('Créer une nouvelle publication')) . ''; $filtres = array(); $filtres[] = new extranetFiltre(__('Status'), 'status_book', $settings['filtres']); diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 46a831ba4..2fbd80a42 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -17,6 +17,11 @@ class wsDAOBook extends extranetDAO { $book->date_status = $r->date_status; $book->date = $r->date; $book->pages = array(); + if ($r->chapters == '') { + $book->chapters = array(); + } else { + $book->chapters = json_decode($r->chapters, false); + } $p = unserialize($r->parametres); if (!$p || $p->isEmpty()) { @@ -44,6 +49,7 @@ class wsDAOBook extends extranetDAO { $book->status = 0; $book->date_status = TIME; $book->date = TIME; + $book->chapters = json_encode(array()); $book->parametres = new wsBookParametres(); $book->pages = array(); return $book; @@ -123,6 +129,7 @@ class wsDAOBook extends extranetDAO { public function supprime($book_id) { + $this->con->execute('DELETE FROM book_pages WHERE book_id=\'' . $this->con->escape($book_id) . '\''); return $this->con->execute('DELETE FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } @@ -234,6 +241,13 @@ class wsDAOBook extends extranetDAO { return '1=1'; } } + + public function setChapters($book_id, $json) + { + $c = $this->con->openCursor('books'); + $c->chapters = json_encode(json_decode($json, false)); + $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); + } } ?> \ No newline at end of file diff --git a/inc/ws/DAO/class.ws.dao.document.php b/inc/ws/DAO/class.ws.dao.document.php index 3000a081e..6f84c0693 100644 --- a/inc/ws/DAO/class.ws.dao.document.php +++ b/inc/ws/DAO/class.ws.dao.document.php @@ -30,9 +30,15 @@ class wsDAODocument extends extranetDAO { return $this->singleton($r); } - public function selectInList($documentsId) + public function selectByBookId($book_id) { - $r = $this->con->select('SELECT * FROM documents WHERE document_id IN(' . implode(',', $documentsId) . ')'); + $r = $this->con->select('SELECT * FROM documents WHERE document_id IN(SELECT document_id FROM book_pages WHERE book_id=\'' . $this->con->escape($book_id) . '\')'); + return $this->factory($r); + } + + public function selectInList($documents_id) + { + $r = $this->con->select('SELECT * FROM documents WHERE document_id IN(' . implode(',', $documents_id) . ')'); return $this->factory($r); } diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index e22e1065c..cfb22b9df 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -11,6 +11,9 @@ class wsBookParametres extends wsParametres { if (is_null($this->parent)) { return; } + $this->fields['title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre de la publication"), 'extra' => false, 'grade' => 1); + $this->forms['important'] = array('label' => __('Description de la publication'), + 'fieldsnames' => array('title', 'email_title', 'email_body', 'url_link')); // . $this->fields['pages'] = array('type' => 'integer', 'default' => '', 'editable' => false, 'label' => __('Nombre de pages'), 'extra' => false, 'grade' => 0); $this->fields['width'] = array('type' => 'float', 'default' => '', 'editable' => false, 'label' => __('Largeur'), 'extra' => false, 'grade' => 0); @@ -21,7 +24,7 @@ class wsBookParametres extends wsParametres { $this->fields['bookmark'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Marques-pages'), 'extra' => false, 'grade' => 1); $this->fields['url_link'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __("URL du lien de retour au site"), 'extra' => false, 'grade' => 1); $this->forms['general'] = array('label' => __('Fonctionnalités générales'), - 'fieldsnames' => array('print', 'search', 'bookmark', 'url_link')); + 'fieldsnames' => array('print', 'search', 'bookmark')); // . $this->fields['first_page_nr'] = array('type' => 'integer', 'default' => 1, 'editable' => true, 'label' => __('La numérotation débute à la page'), 'extra' => false, 'grade' => 1); $this->fields['preload'] = array('type' => 'integer', 'default' => 16, 'editable' => true, 'label' => __('Nombre de pages à précharger'), 'extra' => false, 'grade' => 1); @@ -45,18 +48,23 @@ class wsBookParametres extends wsParametres { // . $this->fields['fonctions_friend'] = __('Fonction Envoyer à un ami et partage'); $this->fields['friend'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Envoyer à un ami'), 'extra' => false, 'grade' => 1); - $this->fields['email_title'] = array('type' => 'text', 'default' => __('%name% vous invite à découvrir %title%'), 'editable' => true, 'label' => __("Titre de l'email"), 'extra' => false, 'grade' => 1); - $this->fields['email_body'] = array('type' => 'textarea', 'default' => __('Veuillez cliquer sur le lien suivant : %link%'), 'editable' => true, 'label' => __("Titre de l'email"), 'extra' => false, 'grade' => 1); + $this->fields['email_title'] = array('type' => 'text', 'default' => __('%name% vous invite à découvrir %title%'), 'editable' => true, 'label' => __("Titre de l'email \"Envoyer à un ami\""), 'extra' => false, 'grade' => 1); + $this->fields['email_body'] = array('type' => 'textarea', 'default' => __('Veuillez cliquer sur le lien suivant : %link%'), 'editable' => true, 'label' => __("Corps de l'email \"Envoyer à un ami\""), 'extra' => false, 'grade' => 1); $this->fields['email_editable'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Permettre au lecteur de modifier le corps de l'email"), 'extra' => false, 'grade' => 1); $this->fields['askAcknowledge'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Demander au destinataire un accusé de réception"), 'extra' => true, 'grade' => 4); $this->fields['attachPDFInEmail'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Joindre le fichier PDF de la page en cours à l'email"), 'extra' => true, 'grade' => 4); $this->fields['attachmentName'] = array('type' => 'text', 'default' => '', 'editable' => false, 'label' => __('Nom de la pièce jointe'), 'extra' => true, 'grade' => 4); $this->fields['addThis'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Identifiant addThis"), 'extra' => false, 'grade' => 4); $this->fields['addThisOptions'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Paramètres addThis"), 'extra' => false, 'grade' => 4); + $this->forms['share'] = array('label' => __('Fonctions de partage'), + 'fieldsnames' => array('friend', 'email_editable', 'askAcknowledge', 'attachPDFInEmail', 'attachmentName', 'addThis', 'addThisOptions')); // . $this->fields['fonctions_stats'] = __('Fonction Statistiques'); $this->fields['stats'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer les statistiques'), 'extra' => false, 'grade' => 1); - $this->fields['statsWeborama'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Statistiques Weborama'), 'extra' => true, 'grade' => 4); + $this->fields['statsWeborama'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Statistiques Weborama'), 'size' => 10, 'extra' => true, 'grade' => 1); + $this->fields['googleAnalytics'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Code Google Analytics'), 'size' => 10, 'extra' => true, 'grade' => 1); + $this->forms['stats'] = array('label' => __('Statistiques'), + 'fieldsnames' => array('stats', 'statsWeborama')); // . $this->fields['fonctions_sommaire'] = __('Fonction Sommaire'); $this->fields['displayChaptersAtStart'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Afficher le sommaire au chargement de la publication"), 'extra' => true, 'grade' => 4); @@ -65,11 +73,14 @@ class wsBookParametres extends wsParametres { 'default' => 'center', 'editable' => true, 'label' => __('Positionnement du sommaire'), 'grade' => 4); $this->fields['chaptersCloseOnTop'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Afficher le bouton fermer en haut du sommaire"), 'extra' => true, 'grade' => 4); $this->fields['chaptersMargin'] = array('type' => 'integer', 'default' => 20, 'editable' => false, 'label' => __('Marge latérale du sommaire'), 'extra' => true, 'grade' => 4); + $this->forms['sommaire'] = array('label' => __('Sommaire'), + 'fieldsnames' => array('displayChaptersAtStart', 'chaptersPosition')); // . $this->fields['fonctions_liens'] = __('Liens et multimedia'); $this->fields['playVideoAtStart'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Jouer les vidéos à l'affichage de la page"), 'extra' => true, 'grade' => 4); $this->fields['permanentLinks'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Liens visibles en permanence'), 'extra' => true, 'grade' => 4); - $this->fields['linksColor'] = array('type' => 'color', 'default' => '', 'editable' => true, 'label' => __('Couleurs des liens (si différente de la couleur indiquée dans le thème)'), 'extra' => true, 'grade' => 4); + $this->forms['multimedia'] = array('label' => __('Liens et multimédia'), + 'fieldsnames' => array('playVideoAtStart', 'permanentLinks')); $this->fields['zoomAreas'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Activer le zoom sur les liens ''Plus d'infos''"), 'extra' => true, 'grade' => 4); // . $this->fields['fonctions_sousmenu'] = __('Sous-menu supplémentaire'); diff --git a/inc/ws/Metier/class.ws.book.php b/inc/ws/Metier/class.ws.book.php index 7152a11eb..dd3b20046 100644 --- a/inc/ws/Metier/class.ws.book.php +++ b/inc/ws/Metier/class.ws.book.php @@ -24,6 +24,8 @@ class wsBook extends cubeMetier { protected $parametres; protected $pages; + + protected $chapters; } ?> \ 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 0f7281919..693498984 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -185,10 +185,10 @@ class wsDocument extends cubeMetier { $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])] = new wsBox($m[3], $m[4], $m[5], $m[6]); - } elseif (preg_match('|Page ([0-9]+) size: ([0-9.]*)([\sx]+)([0-9.]*)(.*)|iu', $line, $m)) { - $this->generalInfos['page'][$m[1]]['size'] = array($m[2], $m[4]); + } elseif (preg_match('|Page ([0-9]+) size: ([0-9.]*) pts x ([0-9.]*) pts|iu', $line, $m)) { + $this->generalInfos['page'][$m[1]]['size'] = array($m[2], $m[3]); $this->generalInfos['size'][0] = max($this->generalInfos['size'][0], $m[2]); - $this->generalInfos['size'][1] = max($this->generalInfos['size'][1], $m[4]); + $this->generalInfos['size'][1] = max($this->generalInfos['size'][1], $m[3]); } elseif ($k == 'BookmarkTitle') { $this->bookmarks[$bookmark_id] = array('titre' => str_replace(' ', '', trim($v))); } elseif ($k == 'BookmarkLevel') { diff --git a/swf/_src/wsComposer.fla b/swf/_src/wsComposer.fla index 115d6e659..cf5e05bc5 100644 Binary files a/swf/_src/wsComposer.fla and b/swf/_src/wsComposer.fla differ diff --git a/swf/_src/wsComposerComponents.swc b/swf/_src/wsComposerComponents.swc index aba6b0cb0..2bb7e96e7 100644 Binary files a/swf/_src/wsComposerComponents.swc and b/swf/_src/wsComposerComponents.swc differ