]> _ Git - cubeextranet.git/commitdiff
wip #4623 @0.25
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 28 Jul 2021 15:40:56 +0000 (15:40 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 28 Jul 2021 15:40:56 +0000 (15:40 +0000)
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.lang.php
inc/ws/Metier/class.ws.lang.php
inc/ws/Metier/class.ws.theme.parametres.php

index 06f9ae6ccc9f7709c235eb7a6a86fbb805869e13..2699a68b95db815f1d7f0366a222068ee1821f52 100644 (file)
@@ -691,84 +691,7 @@ class wsUrl
         global $core;
 
         commonDroits::min(5);
-
-        if (count($args) < 2) {
-            $args[1] = 'fr';
-        }
-
-        $allLangs = cubeLang::getCodes($core->user->lang);
-        $allLangs['es-pr'] = 'Espagnol, Porto Rico';
-        $allLangs['es-mx'] = 'Espagnol, Mexique';
-        $existingLangs = array();
-
-        $dao = new wsDAOLang($core->con);
-        $langs = $dao->selectAll();
-        foreach ($langs as $lang) {
-            if (!isset($allLangs[$lang->lang_id])) {
-                continue;
-            }
-            $existingLangs[$lang->lang_id] = $allLangs[$lang->lang_id];
-
-            unset($allLangs[$lang->lang_id]);
-        }
-
-        $langs = array(__('Langues configurées') => array_flip($existingLangs), __('Autres langues') => array_flip($allLangs));
-
-        $res = commonPage::barre();
-        $res .= commonPage::tMain(null, false);
-
-        $res .= commonPage::bh();
-        $res .= '<form action="changeLang" method="post" class="submitonchange">';
-        $res .= '<table class="liste">';
-        $res .= '<tr><td class="center">' . __('Sélectionnez la langue à configurer') . ' : ' . form::combo('lang', $langs, $args[1]) . ' </td></tr>';
-        $res .= '</table>';
-        $res .= '</form>';
-        $res .= commonPage::bf();
-
-        $res .= '<div id="formLang">';
-        $res .= self::formLang($args[1]);
-        $res .= '</div>';
-        $res .= commonPage::bMain(true);
-
-        return $res;
-    }
-
-    public static function formLang($lang_id)
-    {
-        commonDroits::min(5);
-        global $core;
-        $dao = new wsDAOLang($core->con);
-        $lang = $dao->selectById($lang_id);
-
-        $res = commonPage::bh();
-        $res .= '<table class="liste">';
-        $res .= '<tr><td><a href="' . SITE_PATH . 'exportLangAsExcel/' . $lang_id . '">' . __('Exporter au format Excel') . '</a>';
-        $res .= ' | <a href="' . SITE_PATH . 'exportAllLangsAsExcel/' . $lang_id . '">' . __('Exporter toutes les langues au format Excel') . '</a>';
-        $res .= '</td></tr>';
-        $res .= '</table>';
-        $res .= commonPage::bf();
-
-        $res .= '<form action="saveLang" method="post">';
-
-        $res .= commonPage::bh();
-        $res .= '<table class="liste">';
-        $res .= '<tr><td>' . __('Police de caractères') . ' : </td><td>' . form::hidden('lang', $lang_id) . form::combo('font', self::getFonts(), $lang->font) . '</td></tr>';
-        $res .= '<tr class="odd"><td>' . __('Jeux de caractères') . ' : </td><td>' . form::combo('charset', self::getCharsets(), $lang->charset) . '</td></tr>';
-        $res .= '<tr><td>' . __("Langue de l'installeur") . ' : </td><td>' . form::combo('nsis', self::getNSISLangs(), $lang->nsis) . '</td></tr>';
-        $res .= '<tr><td colspan="2" class="right odd"><a href="#" class="submit">' . $core->typo->Ajouter('Valider') . '</a></td></tr>';
-        $res .= '</table>';
-        $res .= commonPage::bf();
-
-        $res .= commonPage::bh();
-        $res .= cubeLang::translationForm(self::getTranslationSources(), $lang_id, null, 'liste', array(), '<a href="#" class="submit">' . $core->typo->Ajouter(__('Enregistrer')) . '</a>', $lang->traductions);
-        $res .= commonPage::bf();
-        $res .= '</form>';
-        return $res;
-    }
-
-    public static function getTranslationSources()
-    {
-        return array(__('Version HTML5') => WS_COMPILE_ASSETS . '/player/local', __('Version HTML5 GIT') => WS_COMPILE_ASSETS . '/player/branches', __('Compilateur HTML5') => ROOT . '/inc/ws/Util/html5', __('Application') => WS_COMPILE_ASSETS . '/_html5app');
+        header('Location: https://toolbox.fluidbook.com/fluidbook-translate/1/edit');
     }
 
     public static function exportLangAsExcel($args)
@@ -871,47 +794,6 @@ class wsUrl
         return $lang_name;
     }
 
-    public static function getFonts()
-    {
-        $formats = array('ttf', 'otf', 'TTF', 'OTF');
-
-        $dr = opendir(FONT_PATH);
-        $fonts = array('Arial (police système)' => "system");
-        while ($file = readdir($dr)) {
-            if ($file == '.' || $file == '..' || !in_array(files::getExtension($file), $formats)) {
-                continue;
-            }
-            $fonts[$file] = $file;
-        }
-        return $fonts;
-    }
-
-    protected static function getCharsets()
-    {
-        $sets = cubeFlexFontAsset::getSets();
-        $res = array();
-        foreach ($sets as $k => $v) {
-            $res[$k] = $k;
-        }
-        return $res;
-    }
-
-    protected static function getNSISLangs()
-    {
-        $res = array();
-        $dir = WS_FILES . '/nsislangs';
-        $dr = opendir($dir);
-        while ($file = readdir($dr)) {
-            if ($file == '.' || $file == '..') {
-                continue;
-            }
-            $e = explode('.', $file);
-            $res[$e[0]] = $e[0];
-        }
-
-        ksort($res);
-        return $res;
-    }
 
     public static function editor($args)
     {
index d83c3c2e91d93c695622581cb4f8c4cc7421dd90..e408b045cc2d02ea7a84b6d74c32d6cd1592296e 100644 (file)
@@ -1,61 +1,48 @@
 <?php\r
 \r
-class wsDAOLang extends commonDAO {\r
-\r
-       protected function singleton($r) {\r
-               $lang = new wsLang();\r
-               $lang->lang_id = mb_strtolower($r->lang_id);\r
-               $lang->font = $r->font;\r
-               $lang->charset = $r->charset;\r
-\r
-               if ($r->nsis == '') {\r
-                       $r->nsis = 'English';\r
-               }\r
-               $lang->nsis = $r->nsis;\r
-\r
-               if ($r->traductions == '') {\r
-                       $lang->traductions = array();\r
-               } else {\r
-                       $lang->traductions = json_decode($r->traductions, true);\r
-               }\r
-\r
-               $lang->traductions = wsLang::checkTranslations($lang->traductions);\r
-               return $lang;\r
-       }\r
-\r
-       public function selectById($lang_id) {\r
-               $r = $this->con->select('SELECT * FROM langues WHERE lang_id=\'' . $this->con->escape($lang_id) . '\'');\r
-               return $this->singleton($r);\r
-       }\r
-\r
-       public function selectAll() {\r
-               $r = $this->con->select('SELECT * FROM langues');\r
-               return $this->factory($r);\r
-       }\r
-\r
-       public function sauve($data) {\r
-               $c = $this->con->openCursor('langues');\r
-               $c->lang_id = $data['lang_id'];\r
-               $c->font = $data['font'];\r
-               $c->charset = $data['charset'];\r
-               $c->nsis = $data['nsis'];\r
-               $traductions = array();\r
-               foreach ($data['traductions'] as $msgid => $text) {\r
-                       if (substr($msgid, 0, 4) == 'B64_') {\r
-                               $msgid = base64_decode(substr($msgid, 4));\r
-                       }\r
-                       $traductions[$msgid] = $text;\r
-               }\r
-\r
-               $c->traductions = json_encode($traductions);\r
-               $r = $this->con->select('SELECT * FROM langues WHERE lang_id=\'' . $this->con->escape($c->lang_id) . '\'');\r
-               if (!$r->count()) {\r
-                       $c->insert();\r
-               } else {\r
-                       $c->update('WHERE lang_id=\'' . $this->con->escape($c->lang_id) . '\'');\r
-               }\r
-\r
-               return $this->selectById($c->lang_id);\r
-       }\r
-\r
+class wsDAOLang extends commonDAO\r
+{\r
+\r
+    protected function singleton($r)\r
+    {\r
+        $lang = new wsLang();\r
+        $lang->lang_id = $r['id'];\r
+        $lang->nsis = $r['nsis'] ?? 'English';\r
+        $lang->traductions = $r['translations'];\r
+\r
+        return $lang;\r
+    }\r
+\r
+    public function selectById($lang_id)\r
+    {\r
+\r
+        $res = $this->selectAll();\r
+        return $res[$lang_id];\r
+    }\r
+\r
+    public function selectAll()\r
+    {\r
+        $res = [];\r
+\r
+        $r = $this->con->select('SELECT * FROM fluidbook_toolbox.fluidbook_translate WHERE id=1');\r
+\r
+        $nsis = json_decode($r->nsis, true);\r
+        $contents = json_decode($r->content_translatable, true);\r
+        foreach ($contents as $id => $content) {\r
+            $code = $id;\r
+            if (stristr($code, '_')) {\r
+                $e = explode('_', $code);\r
+                $code = $e[0] . '-' . mb_strtolower($e[1]);\r
+            }\r
+            $translations = [];\r
+            foreach ($contents[$id] as $k => $v) {\r
+                $e = explode('t_', $k);\r
+                if (count($e) > 1) {\r
+                    $translations[base64_decode($e[1])] = $v;\r
+                }\r
+            }\r
+            $res[$code] = $this->singleton(['id' => $code, 'nsis' => $nsis[$id], 'translations' => $translations]);\r
+        }\r
+        return $res;\r
+    }\r
 }
\ No newline at end of file
index cdc427ffbd1b6a00af4c96533b9fb72de08b9435..3e6e0afb30203d8c2e070e561545d4abf1f69324 100644 (file)
@@ -67,8 +67,6 @@ class wsLang extends cubeMetier {
                'functionality dont work when in fullscreen mode' => 63,\r
                "you don't have any bookmark" => 64);\r
        protected $lang_id;\r
-       protected $font;\r
-       protected $charset;\r
        protected $traductions;\r
        protected $nsis;\r
 \r
index 2e865d146ab24dd84b205c13984be079a710401b..996a6a8b21669842be611d1c97d3ad75d5a8a550 100644 (file)
@@ -69,7 +69,7 @@ class wsThemeParametres extends wsParametres
             'label' => __("Couleur des icônes"));\r
 \r
         $this->forms['icones'] = array('label' => __('Personnalisation des icônes'),\r
-            'fieldsnames' => array('iconSet','couleurI'));\r
+            'fieldsnames' => array('iconSet', 'couleurI'));\r
 \r
         /* Book */\r
         $this->fields['interfaceFont'] = ['type' => 'combo', 'default' => 'OpenSans', 'datas' => wsBookParametres::$fonts, 'editable' => true, 'label' => __('Police de l\'interface')];\r
@@ -105,8 +105,8 @@ class wsThemeParametres extends wsParametres
             'label' => __("Couleur de l'étoile activée"));\r
 \r
         $this->forms['book'] = array('label' => __('Personnalisation de la publication'),\r
-            'fieldsnames' => array('interfaceFont', 'interfaceFontUppercase', '|',  'shadeAlpha',\r
-                '|', 'bookShadeColor',\r
+            'fieldsnames' => array('interfaceFont', 'interfaceFontUppercase', '|', 'shadeAlpha',\r
+                '|', 'bookShadeColor', '|', 'usePageEdges',\r
                 '|', 'displayPageNumber', 'colorPageNumber',\r
                 '|', 'linksColor', 'videoBackgroundColor',\r
                 '|', 'tooltipBackColor', 'tooltipTextColor', 'tooltipTextSize',\r
@@ -166,7 +166,7 @@ class wsThemeParametres extends wsParametres
         );\r
 \r
         $this->forms['menubar'] = array('label' => __('Personnalisation de la barre de menu'),\r
-            'fieldsnames' => array('menuHeight', '|', 'menuColor',  'menuImage', '|', 'invertMenuPosition', '|', 'afterSearch'));\r
+            'fieldsnames' => array('menuHeight', '|', 'menuColor', 'menuImage', '|', 'invertMenuPosition', '|', 'afterSearch'));\r
         /* Menu bar logo */\r
 \r
         $imageFilter = new stdClass();\r