]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 3 Dec 2010 18:35:16 +0000 (18:35 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 3 Dec 2010 18:35:16 +0000 (18:35 +0000)
inc/config.inc.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/DAO/class.ws.dao.theme.php

index 3e2eb4858d10b76ddb8f63d6266466cd536d5607..c541467f7e2d10cd74a5975ede57b49cba10db4d 100644 (file)
@@ -15,7 +15,7 @@ if (in_array($_SERVER['HTTP_HOST'], array_merge($localrel, $localabs))) {
        define('DEV', true);\r
        define('WINDOWS', true);\r
        define('FONT_PATH', 'C:/Windows/Fonts');\r
-       define('AS3_SOURCES', 'C:\Users\Vincent\Documents\Works\as3;C:\Users\Vincent\Documents\Works\cubeExtranet\swf\_src');\r
+       define('AS3_SOURCES', 'C:\Users\Vincent\Documents\Works\as3;C:\Users\Vincent\Documents\Works\cubeExtranet\swf\_src;C:\Users\Vincent\Documents\Works\as3-10');\r
 \r
        if (in_array($_SERVER['HTTP_HOST'], $localrel)) {\r
                define('WEBROOT', '/cubeExtranet');\r
index a49da9bd225966fe85a7d4c085ae33118a1ce3bb..6cd4cf50c30cb8c892ec128c6f0f855c06a4870b 100644 (file)
@@ -165,7 +165,7 @@ html{height:100%}' . "\n";
                $dao = new wsDAOBook($core->con);\r
                header('Content-type: text/plain');\r
                ob_clean();\r
-               echo $dao->compile(2963, 3, false);\r
+               echo $dao->compile(2964, 3, false);\r
                exit;\r
        }\r
 \r
index 6c65facc1f4e5062f46014e5037850dcb9cccfb6..23a4276ea1ddbbf009eff865e85d1fcf88d7d6d7 100644 (file)
@@ -410,33 +410,32 @@ class wsDAOBook extends extranetDAO {
                $index = array();\r
                $textes = array();\r
                foreach($pages as $book_page => $infos) {\r
-                       $file = ROOT . '/docs/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.txt';\r
-                       $text = file_get_contents($file);\r
-                       $text = mb_strtolower($text);\r
-                       $words = cubeSearch::getWords($text, false, true, false);\r
+                       $tfile = ROOT . '/docs/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.txt';\r
+                       $ifile = ROOT . '/docs/' . $infos['document_id'] . '/i' . $infos['document_page'] . '.txt';\r
+                       $text = file_get_contents($tfile);\r
+                       $ipage = file_get_contents($ifile);\r
 \r
-                       $this->fillIndexWithWords($index, $book_page, $words);\r
-                       $textes[$book_page] = cubeText::removeAccents(cubeText::condenseWhite($text));\r
+                       $this->fillIndexWithWords($index, $book_page, $ipage);\r
+                       $textes[$book_page] = $text;\r
                }\r
                ksort($index);\r
        }\r
 \r
-       protected function fillIndexWithWords(&$index, $page, $words)\r
+       protected function fillIndexWithWords(&$index, $page, $ipage)\r
        {\r
-               foreach($words as $word) {\r
-                       $woa = cubeText::removeAccents($word);\r
-                       if (!isset($index[$woa])) {\r
-                               $index[$woa] = array('total' => 0, 'words' => array());\r
-                       }\r
-                       if (!isset($index[$woa]['words'][$word])) {\r
-                               $index[$woa]['words'][$word] = array('total' => 0, 'pages' => array());\r
+               $words = explode('|', $ipage);\r
+\r
+               foreach($words as $worddatas) {\r
+                       list($word, $count) = explode(',', $worddatas);\r
+\r
+                       if (!isset($index[$word])) {\r
+                               $index[$word] = array('total' => 0, 'pages' => array());\r
                        }\r
-                       if (!isset($index[$woa]['words'][$word]['pages'][$page])) {\r
-                               $index[$woa]['words'][$word]['pages'][$page] = 0;\r
+                       if (!isset($index[$word]['pages'][$page])) {\r
+                               $index[$word]['pages'][$page] = 0;\r
                        }\r
-                       $index[$woa]['total']++;\r
-                       $index[$woa]['words'][$word]['total']++;\r
-                       $index[$woa]['words'][$word]['pages'][$page]++;\r
+                       $index[$word]['total'] += $count;\r
+                       $index[$word]['pages'][$page] += $count;\r
                }\r
        }\r
 \r
@@ -470,10 +469,10 @@ class wsDAOBook extends extranetDAO {
                $size = $firstDoc->generalInfos['size'];\r
 \r
                $daoTheme = new wsDAOTheme($this->con);\r
-               $theme = $daoTheme->getThemeOfBook($book_id);\r
+               $theme = $daoTheme->getThemeOfBook($book_id,true);\r
 \r
-               $index='';\r
-               $textes='';\r
+               $index = '';\r
+               $textes = '';\r
 \r
                $this->makeTextsIndexes($book_id, $index, $textes);\r
 \r
@@ -482,6 +481,7 @@ class wsDAOBook extends extranetDAO {
                $flex->addVariable('links', $book->links);\r
                $flexLight->addVariable('datas', $book->parametres->toStandardObject());\r
                $flexLight->addVariable('id', $book_id, false, true, 'uint');\r
+\r
                $flex->addVariable('traductions', wsLang::getTraductionWithId($book->traductions));\r
                $flex->addVariable('chapters', $book->chapters);\r
                $flex->addVariable('extras', '<extras>' . $book->extras . '</extras>', false, true, 'XML');\r
@@ -534,7 +534,7 @@ class wsDAOBook extends extranetDAO {
                // Fonts\r
                $flex->addFont(FONT_PATH . '/FFFATLAN_0.TTF', 'CreditsFont', 'ASCII');\r
                $flex->addFont(FONT_PATH . '/DIN Medium_0.ttf', 'GeneralFont', 'Latin');\r
-               $flexLight->addFont(FONT_PATH . '/DIN Medium_0.ttf', 'GeneralFont', 'Numerals');\r
+               $flexLight->addFont(FONT_PATH . '/DIN Medium_0.ttf', 'GeneralFontLight', 'Numerals');\r
                $res .= $flex->compile() . "\n\n-------------------\n\n";\r
                $flexLight->addVariable('datasSize', filesize(ROOT . '/books/datasCompiler/' . $book_id . '/FluidbookDatas.swf'));\r
                $res .= $flexLight->compile();\r
index 1dc1067e6ed02c71c4a8236a84f43b1dcdb2683d..f45c51b6592dce4f1c79802123d81d6e3ae5dc8d 100644 (file)
@@ -7,8 +7,10 @@ class wsDAOTheme extends extranetDAO {
                $theme->nom = $r->nom;\r
                $theme->date = $r->date;\r
                $theme->proprietaire = $r->proprietaire;\r
-               $theme->books = explode(',', $r->books);\r
-               $theme->nbBooks = $r->nb_books;\r
+               if ($r->exists('books')) {\r
+                       $theme->books = explode(',', $r->books);\r
+                       $theme->nbBooks = $r->nb_books;\r
+               }\r
                $theme->signature = $r->signature;\r
                $theme->icones = $r->icones;\r
                $p = unserialize($r->parametres);\r
@@ -28,9 +30,14 @@ class wsDAOTheme extends extranetDAO {
                return $this->singleton($r);\r
        }\r
 \r
-       public function getThemeOfBook($book_id)\r
+       public function getThemeOfBook($book_id, $basic = false)\r
        {\r
-               $r = $this->con->select('SELECT * FROM themes_vue WHERE theme_id IN (SELECT theme FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\') LIMIT 1');\r
+               if ($basic) {\r
+                       $table = 'themes';\r
+               } else {\r
+                       $table = 'theme_vue';\r
+               }\r
+               $r = $this->con->select('SELECT * FROM '.$table.' WHERE theme_id IN (SELECT theme FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\') LIMIT 1');\r
                return $this->singleton($r);\r
        }\r
 \r
@@ -56,11 +63,11 @@ class wsDAOTheme extends extranetDAO {
                $p = new wsThemeParametres($parent);\r
                foreach($data as $k => $v) {\r
                        try {\r
-                               if(!isset($p->$k)){\r
+                               if (!isset($p->$k)) {\r
                                        continue;\r
                                }\r
                                $p->$k = $v;\r
-                               fb($v,$k);\r
+                               fb($v, $k);\r
                        }\r
                        catch(Exception $e) {\r
                                fb($e);\r