]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 24 Jan 2013 15:20:48 +0000 (15:20 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 24 Jan 2013 15:20:48 +0000 (15:20 +0000)
fluidbook/compile/_js/fluidbook.js
inc/commons/class.common.core.php
inc/commons/class.common.url.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Metier/class.ws.book.php
inc/ws/Util/class.ws.secure.swf.php

index 9e138de8a8cf5183759eaa781cfa93141ead65d8..85c4d4b529f12dd0b9e4844a3e9ec3267048ed9e 100644 (file)
@@ -69,8 +69,8 @@ function popupFS(page) {
        window.open('index.html#/' + page, 'fbpopupfs_' + date, 'width=' + screen.width + ',height=' + screen.height + ',resizable=yes');\r
 }\r
 \r
-function popupFocus(url,target){\r
-       var opened=window.open(url,target,'width=' + screen.width + ',height=' + screen.height + ',resizable=yes'); \r
+function popupFocus(url, target) {\r
+       var opened = window.open(url, target, 'width=' + screen.width + ',height=' + screen.height + ',resizable=yes');\r
        opened.focus();\r
 }\r
 \r
@@ -123,6 +123,7 @@ function addThis(x) {
 }\r
 function handleWheel(delta) {\r
        try {\r
+               fb(delta);\r
                document.getElementById('fluidbook').mouseWheel(delta);\r
        } catch (e) {\r
 \r
@@ -173,15 +174,23 @@ function redirectMobile() {
                        pageNr = pnr;\r
                }\r
        }\r
-       \r
-       var page='';\r
-       if(pageNr>0){\r
-               page='#/page/'+pageNr;\r
+\r
+       var page = '';\r
+       if (pageNr > 0) {\r
+               page = '#/page/' + pageNr;\r
        }\r
 \r
        window.location = 'm/' + html + page;\r
 }\r
 \r
+function fb(e) {\r
+       try {\r
+               console.log(e);\r
+       } catch (err) {\r
+\r
+       }\r
+}\r
+\r
 \r
 function wheel(event) {\r
        var delta = 0;\r
index 9e66d5408c2a79b4dc8bb8248aa558471239f4e6..cfcc6119d3acf895c141dfd380425ed269dabdf8 100644 (file)
@@ -384,6 +384,7 @@ class commonCore extends cubeCore {
                $db->books->dir_phonegap_android('varchar', 256, false);\r
                $db->books->dir_external('varchar', 256, false);\r
                $db->books->lucene_time('integer', 0, false);\r
+               $db->books->demo_counter('integer', 0, false);\r
                // Clés\r
                $db->books->primary('pk_books', 'book_id');\r
                $db->books->index('index_books_nom', 'BTREE', 'nom');\r
@@ -391,6 +392,7 @@ class commonCore extends cubeCore {
                $db->books->index('index_books_tache', 'BTREE', 'tache');\r
                $db->books->index('index_books_status', 'BTREE', 'status');\r
                $db->books->index('index_books_theme', 'BTREE', 'theme');\r
+               $db->books->index('index_books_demo_counter', 'BTREE', 'demo_counter');\r
                $db->books->index('index_books_lang', 'BTREE', 'lang');\r
                // .\r
                // Table pages des publications\r
index 562cfe9c65f548ed9d5bf7f23ea63f8ef774c020..54be110cdc6cd71bc8b4744681f268f066f85a9b 100644 (file)
@@ -7,10 +7,10 @@ class commonUrl {
                $args = cubePage::getArgs($args);\r
                // Si l'utilisateur n'est pas connecté, on affiche le formulaire\r
                // de login\r
-               \r
-               $bypass=array('stats','telecharger','telechargerr');\r
-               \r
-               if ((!isset($args[0]) || !in_array($args[0],$bypass)) && (is_null($core->user) || !$core->user)) {\r
+\r
+               $bypass = array('stats', 'telecharger', 'telechargerr');\r
+\r
+               if ((!isset($args[0]) || !in_array($args[0], $bypass)) && (is_null($core->user) || !$core->user)) {\r
                        $args = array('login');\r
                } else {\r
                        if (isset($args[0]) && $args[0] == 'login') {\r
@@ -130,8 +130,8 @@ class commonUrl {
                return $res;\r
        }\r
 \r
-       public static function orderby($label, $field, $settings, $function) {\r
-               $res = '<a href="#" class="ajax" rel="' . $function . '/' . $field . '">';\r
+       public static function orderby($label, $field, $settings, $function, $title = '') {\r
+               $res = '<a href="#" class="nowrap ajax" title="' . $title . '" rel="' . $function . '/' . $field . '">';\r
                $res .= $label;\r
                if ($settings['orderby'] == $field) {\r
                        $puce = ($settings['sens'] == 'DESC') ? 'down' : 'up';\r
index fea93b896363f05ab86dd049f1d3f8ddeab11da0..c651a7ef3056783e8304312580196358862deff2 100644 (file)
@@ -69,6 +69,9 @@ class wsUrl {
                $res .= '<th>' . commonUrl::orderby(__('Date'), 'date', $settings, 'sort' . $change) . '</th>';\r
                $res .= '<th>' . commonUrl::orderby(__(''), 'lang', $settings, 'sort' . $change) . '</th>';\r
                $res .= '<th>' . __('Pages') . '</th>';\r
+               if ($droits->admin) {\r
+                       $res .= '<th>' . commonUrl::orderby('C', 'demo_counter', $settings, 'sort' . $change, __('Compteur de démos')) . '</th>';\r
+               }\r
                if ($droits->revendeur) {\r
                        $res .= '<th>' . commonUrl::orderby(__('Proprietaire'), 'proprietaire_nom', $settings, 'sort' . $change) . '</th>';\r
                } else {\r
@@ -101,6 +104,9 @@ class wsUrl {
                        $res .= '<td>' . date('Y-m-d', $book->date) . '</td>';\r
                        $res .= '<td>' . mb_strtoupper($book->lang) . '</td>';\r
                        $res .= '<td>' . $book->parametres->pages . '</td>';\r
+                       if ($droits->revendeur) {\r
+                               $res.='<td>' . $book->demo_counter . '</td>';\r
+                       }\r
 \r
                        if ($droits->revendeur) {\r
                                $p = str_replace(" (", '<br /><em>', html::escapeHTML($book->proprietaire));\r
@@ -127,7 +133,7 @@ class wsUrl {
                        }\r
                        if ($book->version > 1 || $droits->admin) {\r
                                if ($droits->admin) {\r
-                                       $res .= '<td class="bouton"><a href="#" class="openContextMenu" rel="' . $context_view_id . '" rev="' . $book->book_id . '§' . $book->hash . '§' . TIME . '">' . $btVoir . '</a></td>';\r
+                                       $res .= '<td class="bouton"><a href="/viewer/' . $book->book_id . '_' . $book->hash . '/" class="openContextMenu" rel="' . $context_view_id . '" rev="' . $book->book_id . '§' . $book->hash . '§' . TIME . '">' . $btVoir . '</a></td>';\r
                                } else {\r
                                        $viewURL = SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash;\r
                                        if ($book->parametres->version == 1) {\r
@@ -156,7 +162,7 @@ class wsUrl {
 \r
                if (!isset($settings['search']) || is_null($settings['search'])) {\r
                        $odd = cubeMath::isOdd($i) ? ' class="odd"' : '';\r
-                       $res .= '<tr' . $odd . '><td colspan="14">';\r
+                       $res .= '<tr' . $odd . '><td colspan="15">';\r
                        $res .= commonPage::pager($settings['page'], $dao->count($core->user), $settings['par_page'], 'page' . $change . '/%d');\r
                        $res .= commonUrl::formParPage('parPage' . $change, $settings['par_page'], __('publications'), false);\r
                        $res .= '</td></tr>';\r
@@ -900,7 +906,11 @@ html{height:100%}' . "\n";
                        commonDroits::error();\r
                }\r
 \r
-               fb($version);\r
+\r
+               if (is_null($core->user)) {\r
+                       $dao->addDemoCount($book_id);\r
+               }\r
+\r
                $dao->compile($book_id, (string) $version);\r
 \r
                $daoTheme = new wsDAOTheme($core->con);\r
index 485a782ef6bb5bc6c428bb198af6d4edf8f9b9a8..b749040a6da8c23e13a0b10c5b80efeb0c8f28d0 100644 (file)
@@ -47,6 +47,7 @@ class wsDAOBook extends commonDAO {
                $book->dir_macbook_phonegap_ios = $r->dir_macbook_phonegap_ios;\r
                $book->dir_phonegap_android = $r->dir_phonegap_android;\r
                $book->dir_external = $r->dir_external;\r
+               $book->demo_counter = $r->demo_counter;\r
 \r
                return $book;\r
        }\r
@@ -81,6 +82,24 @@ class wsDAOBook extends commonDAO {
                return $r->book_id + 1;\r
        }\r
 \r
+       public function addDemoCount($book_id) {\r
+\r
+               $r = $this->con->select('SELECT demo_counter,nom FROM books WHERE book_id=\'' . $book_id . '\'');\r
+               $m = 20;\r
+               if ($r->demo_counter > 0 && $r->demo_counter % $m == 0) {\r
+                       $mail = new cubeMail();\r
+                       $mail->charset='UTF-8';\r
+                       $mail->from = 'contact@fluidbook.com';\r
+                       $mail->to = 'tech@fluidbook.com';\r
+                       $mail->subject = '[Fluidbook Workshop] Fluidbook consulté via l\'url publique';\r
+                       $mail->body = 'Le fluidbook suivant a été consulté ' . $m . ' fois (et ' . $r->demo_counter . ' au total) via l\'url publique : ' . "\r\n" .\r
+                                       'Fluidbook # ' . $book_id . ' - ' . $r->nom;\r
+                       $mail->send();\r
+               }\r
+\r
+               $this->con->select('UPDATE books SET demo_counter=demo_counter+1 WHERE book_id=\'' . $book_id . '\'');\r
+       }\r
+\r
        public function selectById($book_id = null, $simple = false) {\r
                if (is_null($book_id)) {\r
                        return $this->cree();\r
index 15c0a3e4135f0e89d0aaa9f056da583c181ff7d2..c052162f5d59c8bfe41d2f0c39827862a452d223 100644 (file)
@@ -37,6 +37,7 @@ class wsBook extends cubeMetier {
        protected $dir_macbook_phonegap_ios;\r
        protected $dir_phonegap_android;\r
        protected $dir_external;\r
+       protected $demo_counter;\r
 \r
        public function __get($varname) {\r
                if (!property_exists($this, $varname)) {\r
index 7478902cbb6a5f9b65ca80fef43d6e7a33e99cba..b94227ce755371b3be067f77e5ce0130b70e9cc2 100644 (file)
@@ -81,7 +81,8 @@ class wsSecureSWF {
 \r
        protected static function protectFiles()\r
        {\r
-               $secureSWF = new cubeCommandLine('sudo secureSWF', null, true);\r
+               $secureSWF = new cubeCommandLine('secureSWF', null, true);\r
+               $secureSWF->setSudo();\r
                $secureSWF->setPath(CONVERTER_PATH);\r
                $secureSWF->setManualArg(self::$configLocal);\r
                $secureSWF->setManualArg(self::$protected);\r