From: vincent@cubedesigners.com Date: Thu, 24 Jan 2013 15:20:48 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=09252ff2aa609c92bf1d94a5b87448dee5e19c4c;p=cubeextranet.git --- diff --git a/fluidbook/compile/_js/fluidbook.js b/fluidbook/compile/_js/fluidbook.js index 9e138de8a..85c4d4b52 100644 --- a/fluidbook/compile/_js/fluidbook.js +++ b/fluidbook/compile/_js/fluidbook.js @@ -69,8 +69,8 @@ function popupFS(page) { window.open('index.html#/' + page, 'fbpopupfs_' + date, 'width=' + screen.width + ',height=' + screen.height + ',resizable=yes'); } -function popupFocus(url,target){ - var opened=window.open(url,target,'width=' + screen.width + ',height=' + screen.height + ',resizable=yes'); +function popupFocus(url, target) { + var opened = window.open(url, target, 'width=' + screen.width + ',height=' + screen.height + ',resizable=yes'); opened.focus(); } @@ -123,6 +123,7 @@ function addThis(x) { } function handleWheel(delta) { try { + fb(delta); document.getElementById('fluidbook').mouseWheel(delta); } catch (e) { @@ -173,15 +174,23 @@ function redirectMobile() { pageNr = pnr; } } - - var page=''; - if(pageNr>0){ - page='#/page/'+pageNr; + + var page = ''; + if (pageNr > 0) { + page = '#/page/' + pageNr; } window.location = 'm/' + html + page; } +function fb(e) { + try { + console.log(e); + } catch (err) { + + } +} + function wheel(event) { var delta = 0; diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index 9e66d5408..cfcc6119d 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -384,6 +384,7 @@ class commonCore extends cubeCore { $db->books->dir_phonegap_android('varchar', 256, false); $db->books->dir_external('varchar', 256, false); $db->books->lucene_time('integer', 0, false); + $db->books->demo_counter('integer', 0, false); // Clés $db->books->primary('pk_books', 'book_id'); $db->books->index('index_books_nom', 'BTREE', 'nom'); @@ -391,6 +392,7 @@ class commonCore extends cubeCore { $db->books->index('index_books_tache', 'BTREE', 'tache'); $db->books->index('index_books_status', 'BTREE', 'status'); $db->books->index('index_books_theme', 'BTREE', 'theme'); + $db->books->index('index_books_demo_counter', 'BTREE', 'demo_counter'); $db->books->index('index_books_lang', 'BTREE', 'lang'); // . // Table pages des publications diff --git a/inc/commons/class.common.url.php b/inc/commons/class.common.url.php index 562cfe9c6..54be110cd 100644 --- a/inc/commons/class.common.url.php +++ b/inc/commons/class.common.url.php @@ -7,10 +7,10 @@ class commonUrl { $args = cubePage::getArgs($args); // Si l'utilisateur n'est pas connecté, on affiche le formulaire // de login - - $bypass=array('stats','telecharger','telechargerr'); - - if ((!isset($args[0]) || !in_array($args[0],$bypass)) && (is_null($core->user) || !$core->user)) { + + $bypass = array('stats', 'telecharger', 'telechargerr'); + + if ((!isset($args[0]) || !in_array($args[0], $bypass)) && (is_null($core->user) || !$core->user)) { $args = array('login'); } else { if (isset($args[0]) && $args[0] == 'login') { @@ -130,8 +130,8 @@ class commonUrl { return $res; } - public static function orderby($label, $field, $settings, $function) { - $res = ''; + public static function orderby($label, $field, $settings, $function, $title = '') { + $res = ''; $res .= $label; if ($settings['orderby'] == $field) { $puce = ($settings['sens'] == 'DESC') ? 'down' : 'up'; diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index fea93b896..c651a7ef3 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -69,6 +69,9 @@ class wsUrl { $res .= '' . commonUrl::orderby(__('Date'), 'date', $settings, 'sort' . $change) . ''; $res .= '' . commonUrl::orderby(__(''), 'lang', $settings, 'sort' . $change) . ''; $res .= '' . __('Pages') . ''; + if ($droits->admin) { + $res .= '' . commonUrl::orderby('C', 'demo_counter', $settings, 'sort' . $change, __('Compteur de démos')) . ''; + } if ($droits->revendeur) { $res .= '' . commonUrl::orderby(__('Proprietaire'), 'proprietaire_nom', $settings, 'sort' . $change) . ''; } else { @@ -101,6 +104,9 @@ class wsUrl { $res .= '' . date('Y-m-d', $book->date) . ''; $res .= '' . mb_strtoupper($book->lang) . ''; $res .= '' . $book->parametres->pages . ''; + if ($droits->revendeur) { + $res.='' . $book->demo_counter . ''; + } if ($droits->revendeur) { $p = str_replace(" (", '
', html::escapeHTML($book->proprietaire)); @@ -127,7 +133,7 @@ class wsUrl { } if ($book->version > 1 || $droits->admin) { if ($droits->admin) { - $res .= '
' . $btVoir . ''; + $res .= '' . $btVoir . ''; } else { $viewURL = SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash; if ($book->parametres->version == 1) { @@ -156,7 +162,7 @@ class wsUrl { if (!isset($settings['search']) || is_null($settings['search'])) { $odd = cubeMath::isOdd($i) ? ' class="odd"' : ''; - $res .= ''; + $res .= ''; $res .= commonPage::pager($settings['page'], $dao->count($core->user), $settings['par_page'], 'page' . $change . '/%d'); $res .= commonUrl::formParPage('parPage' . $change, $settings['par_page'], __('publications'), false); $res .= ''; @@ -900,7 +906,11 @@ html{height:100%}' . "\n"; commonDroits::error(); } - fb($version); + + if (is_null($core->user)) { + $dao->addDemoCount($book_id); + } + $dao->compile($book_id, (string) $version); $daoTheme = new wsDAOTheme($core->con); diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 485a782ef..b749040a6 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -47,6 +47,7 @@ class wsDAOBook extends commonDAO { $book->dir_macbook_phonegap_ios = $r->dir_macbook_phonegap_ios; $book->dir_phonegap_android = $r->dir_phonegap_android; $book->dir_external = $r->dir_external; + $book->demo_counter = $r->demo_counter; return $book; } @@ -81,6 +82,24 @@ class wsDAOBook extends commonDAO { return $r->book_id + 1; } + public function addDemoCount($book_id) { + + $r = $this->con->select('SELECT demo_counter,nom FROM books WHERE book_id=\'' . $book_id . '\''); + $m = 20; + if ($r->demo_counter > 0 && $r->demo_counter % $m == 0) { + $mail = new cubeMail(); + $mail->charset='UTF-8'; + $mail->from = 'contact@fluidbook.com'; + $mail->to = 'tech@fluidbook.com'; + $mail->subject = '[Fluidbook Workshop] Fluidbook consulté via l\'url publique'; + $mail->body = 'Le fluidbook suivant a été consulté ' . $m . ' fois (et ' . $r->demo_counter . ' au total) via l\'url publique : ' . "\r\n" . + 'Fluidbook # ' . $book_id . ' - ' . $r->nom; + $mail->send(); + } + + $this->con->select('UPDATE books SET demo_counter=demo_counter+1 WHERE book_id=\'' . $book_id . '\''); + } + public function selectById($book_id = null, $simple = false) { if (is_null($book_id)) { return $this->cree(); diff --git a/inc/ws/Metier/class.ws.book.php b/inc/ws/Metier/class.ws.book.php index 15c0a3e41..c052162f5 100644 --- a/inc/ws/Metier/class.ws.book.php +++ b/inc/ws/Metier/class.ws.book.php @@ -37,6 +37,7 @@ class wsBook extends cubeMetier { protected $dir_macbook_phonegap_ios; protected $dir_phonegap_android; protected $dir_external; + protected $demo_counter; public function __get($varname) { if (!property_exists($this, $varname)) { diff --git a/inc/ws/Util/class.ws.secure.swf.php b/inc/ws/Util/class.ws.secure.swf.php index 7478902cb..b94227ce7 100644 --- a/inc/ws/Util/class.ws.secure.swf.php +++ b/inc/ws/Util/class.ws.secure.swf.php @@ -81,7 +81,8 @@ class wsSecureSWF { protected static function protectFiles() { - $secureSWF = new cubeCommandLine('sudo secureSWF', null, true); + $secureSWF = new cubeCommandLine('secureSWF', null, true); + $secureSWF->setSudo(); $secureSWF->setPath(CONVERTER_PATH); $secureSWF->setManualArg(self::$configLocal); $secureSWF->setManualArg(self::$protected);