diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index 73d4ec64b..292b5df3e 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -579,8 +579,13 @@ class Bootstrap //trick to generate the translation.language.js file , merging two files if (strtolower($typefile) == 'js' && $typearray[0] == 'translation') { Bootstrap::sendHeaders($filename, 'text/javascript', $download, $downloadFileName); - $output = Bootstrap::streamJSTranslationFile($filename, $typearray[count($typearray)-2]); + + $filename = str_replace(implode(".", $typearray), $typearray[0] . "." . $typearray[1] . "." . $typearray[count($typearray) - 1], $filename); + + $output = Bootstrap::streamJSTranslationFile($filename, $typearray[1]); + echo $output; + return; } @@ -855,11 +860,11 @@ class Bootstrap foreach ($listPluginsActive['_aPluginDetails'] as $key => $value) { $namePlugin = trim($key); $translation = array(); - + if (!file_exists(PATH_LANGUAGECONT . $namePlugin . '.en')) { Translation::generateFileTranslationPlugin($namePlugin, 'en'); } - + if ( ($lang != 'en') && (!file_exists(PATH_LANGUAGECONT . $namePlugin . '.' . $lang)) ) { Translation::generateFileTranslationPlugin($namePlugin, $lang); } @@ -3004,4 +3009,4 @@ class Bootstrap return strtoupper(PHP_OS) == "LINUX"; } } - \ No newline at end of file + diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index c58f36e35..184370e16 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -4899,6 +4899,28 @@ class G { $arrayLibrary = array(); + //Translations /js/ext/translation.en.js + $arrayLibrary["translation"] = ""; //Not use null + + //Translation environment /jscore/labels/en.js + $translationEnvFilePath = PATH_DATA . "META-INF" . PATH_SEP . "translations.env"; + + if (file_exists($translationEnvFilePath)) { + $arrayData = unserialize(file_get_contents($translationEnvFilePath)); + $path = PATH_CORE . "js" . PATH_SEP . "labels" . PATH_SEP; + + foreach ($arrayData as $index1 => $value1) { + foreach ($value1 as $index2 => $value2) { + $record = $value2; + + if (file_exists($path . $record["LOCALE"] . ".js")) { + $arrayLibrary[$record["LOCALE"]] = $path; + } + } + } + } + + //Libraries $library = G::json_decode(file_get_contents(PATH_HOME . "engine" . PATH_SEP . "bin" . PATH_SEP . "tasks" . PATH_SEP . "libraries.json")); foreach ($library as $index => $value) { @@ -4933,13 +4955,17 @@ class G $name = $index; $path = $value; - foreach (glob($path . $name . "*") as $file) { - if (preg_match("/^\.\w{32}\.js$/i", str_replace($path . $name, null, $file))) { - @unlink($file); //Delete old file + if (!empty($path)) { + foreach (glob($path . $name . "*") as $file) { + if (preg_match("/^\.\w{32}\.js$/i", str_replace($path . $name, null, $file))) { + @unlink($file); //Delete old file + } + } + + if (file_exists($path . $name . ".js")) { + @copy($path . $name . ".js", $path . $name . "." . $uid . ".js"); //Create new file } } - - @copy($path . $name . ".js", $path . $name . "." . $uid . ".js"); //Create new file } } @@ -4959,15 +4985,28 @@ class G $n = count($arrayAux); if ($n > 0 && !empty($arrayAux[$n - 1])) { - $name = $arrayAux[$n - 1]; + $arrayAux = explode("?", $arrayAux[$n - 1]); + $name = $arrayAux[0]; if (preg_match("/^(.*)\.js$/i", $name, $arrayMatch)) { + $index = $arrayMatch[1]; + $index = (preg_match("/^translation\..*$/", $index))? "translation" : $index; + $arrayLibrary = G::browserCacheFilesGetLibraryJs(); - if (isset($arrayLibrary[$arrayMatch[1]])) { - $path = $arrayLibrary[$arrayMatch[1]]; + if (isset($arrayLibrary[$index])) { + $path = $arrayLibrary[$index]; + $sw = 0; - if (file_exists($path . $arrayMatch[1] . "." . $browserCacheFilesUid . ".js")) { + if (!empty($path)) { + if (file_exists($path . $arrayMatch[1] . "." . $browserCacheFilesUid . ".js")) { + $sw = 1; + } + } else { + $sw = 1; + } + + if ($sw == 1) { $url = str_replace($name, $arrayMatch[1] . "." . $browserCacheFilesUid . ".js", $url); } } diff --git a/gulliver/system/class.headPublisher.php b/gulliver/system/class.headPublisher.php index a9ed5a214..1588fa254 100644 --- a/gulliver/system/class.headPublisher.php +++ b/gulliver/system/class.headPublisher.php @@ -226,7 +226,7 @@ class headPublisher } if (!in_array($this->translationsFile, $this->scriptFiles)) { - $head .= "\n"; + $head = $head . "\n"; } $head .= "\n"; - // $head .= " \n"; + // $head .= " \n"; if (!isset($this->extJsSkin) || $this->extJsSkin == '') { $this->extJsSkin = 'xtheme-gray'; @@ -341,7 +341,7 @@ class headPublisher public function getExtJsStylesheets($skinName) { $script = " \n"; - //$script .= " \n"; + //$script .= " \n"; /* $script .= " \n"; $script .= " \n"; @@ -413,7 +413,7 @@ class headPublisher } } if (!in_array($this->translationsFile, $this->extJsLibrary)) { - $script .= " \n"; + $script = $script . " \n"; } return $script; } diff --git a/workflow/engine/controllers/installer.php b/workflow/engine/controllers/installer.php index bbaa158b6..03f22fdb4 100644 --- a/workflow/engine/controllers/installer.php +++ b/workflow/engine/controllers/installer.php @@ -367,7 +367,7 @@ class Installer extends Controller { $pathSharedPartner = trim( $_REQUEST['pathShared'] ); if (file_exists($pathSharedPartner.'partner.info')) { - $_REQUEST['PARTNER_FLAG'] = true; + $_REQUEST["PARTNER_FLAG"] = true; } $this->setResponseType( 'json' ); if ($_REQUEST['db_engine'] == 'mysql') { @@ -382,13 +382,13 @@ class Installer extends Controller public function forceTogenerateTranslationsFiles ($url) { $ch = curl_init(); - curl_setopt( $ch, CURLOPT_URL, (isset( $_SERVER['HTTPS'] ) ? ($_SERVER['HTTPS'] != '' ? 'https://' : 'http://') : 'http://') . $_SERVER['HTTP_HOST'] . '/js/ext/translation.en.js?r=' . rand( 1, 10000 ) ); - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); - curl_setopt( $ch, CURLOPT_FRESH_CONNECT, 1 ); - curl_setopt( $ch, CURLOPT_TIMEOUT, 60 ); - curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 20 ); - curl_exec( $ch ); - curl_close( $ch ); + curl_setopt($ch, CURLOPT_URL, G::browserCacheFilesUrl((isset($_SERVER["HTTPS"])? (($_SERVER["HTTPS"] != "")? "https://" : "http://") : "http://") . $_SERVER["HTTP_HOST"] . "/js/ext/translation.en.js?r=" . rand(1, 10000))); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); + curl_setopt($ch, CURLOPT_TIMEOUT, 60); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); + curl_exec($ch); + curl_close($ch); } /** @@ -1374,7 +1374,7 @@ EOL; $output = curl_exec($ch); curl_close($ch); - /** + /** * Upload translation .po file */ @@ -1397,7 +1397,7 @@ EOL; $output = curl_exec($ch); curl_close($ch); - /** + /** * Upload skin file */ diff --git a/workflow/engine/controllers/main.php b/workflow/engine/controllers/main.php index 085c66140..75e804847 100644 --- a/workflow/engine/controllers/main.php +++ b/workflow/engine/controllers/main.php @@ -277,10 +277,11 @@ class Main extends Controller $this->setVar( 'advise_text', $adviseText ); $loginScript = $this->getHeadPublisher()->getExtJsLibraries(); $loginScript .= $this->getHeadPublisher()->getExtJsScripts(); - $this->setVar( 'login_script', $loginScript ); - $this->setVar( 'login_vars', $this->getHeadPublisher()->getExtJsVariablesScript() ); + $this->setVar("login_script", $loginScript); + $this->setVar("login_vars", $this->getHeadPublisher()->getExtJsVariablesScript()); + $this->setVar("URL_TRANSLATION_JS", G::browserCacheFilesUrl("/js/ext/translation.en.js")); - $this->setLayout( 'pm-modern-login' ); + $this->setLayout("pm-modern-login"); $this->render(); } @@ -342,10 +343,11 @@ class Main extends Controller $loginScript = $this->getHeadPublisher()->getExtJsLibraries(); $loginScript .= $this->getHeadPublisher()->getExtJsScripts(); - $this->setVar( 'login_script', $loginScript ); - $this->setVar( 'login_vars', $this->getHeadPublisher()->getExtJsVariablesScript() ); + $this->setVar("login_script", $loginScript); + $this->setVar("login_vars", $this->getHeadPublisher()->getExtJsVariablesScript()); + $this->setVar("URL_TRANSLATION_JS", G::browserCacheFilesUrl("/js/ext/translation.en.js")); - $this->setLayout( 'pm-modern-login' ); + $this->setLayout("pm-modern-login"); $this->render(); } diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index 4904c618e..f038cee67 100755 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -141,6 +141,7 @@ try { $browserCacheFilesUid = G::browserCacheFilesGetUid(); $template->assign("URL_MABORAK_JS", G::browserCacheFilesUrl("/js/maborak/core/maborak.js")); + $template->assign("URL_TRANSLATION_ENV_JS", G::browserCacheFilesUrl("/jscore/labels/" . SYS_LANG . ".js")); $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]); $template->assign("sysSys", SYS_SYS); $template->assign("sysLang", SYS_LANG); diff --git a/workflow/engine/skinEngine/uxmodern/layout-pm-modern-login.html b/workflow/engine/skinEngine/uxmodern/layout-pm-modern-login.html index 84415515d..d038c71e1 100644 --- a/workflow/engine/skinEngine/uxmodern/layout-pm-modern-login.html +++ b/workflow/engine/skinEngine/uxmodern/layout-pm-modern-login.html @@ -5,7 +5,7 @@ - +