Browse Source

Feature #306 - Online editor: Various improvements an corrections about selecting language files and text direction.

Ivan Tcholakov 15 years ago
parent
commit
3cba53ad67

+ 11 - 0
main/inc/lib/fckeditor/editor/plugins/ImageManager/config.inc.php

@@ -263,4 +263,15 @@ $IMConfig['thumbnail_height'] = 96;
   Image Editor temporary filename prefix.
 */
 $IMConfig['tmp_prefix'] = '.editor_';
+
+/*
+ Language and text direction.
+ */
+$IMConfig['language'] = api_get_language_isocode();
+if (empty($IMConfig['language']))
+{
+	$IMConfig['language'] = 'en';
+}
+$IMConfig['text_direction'] = in_array($IMConfig['language'], array('ar', 'prs', 'he', 'ps', 'fa')) ? 'rtl' : 'ltr';
+
 ?>

+ 3 - 2
main/inc/lib/fckeditor/editor/plugins/ImageManager/editor.php

@@ -21,7 +21,7 @@ if (isset($_GET['img'])) {
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
-<html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $IMConfig['language']; ?>" lang="<?php echo $IMConfig['language']; ?>">
 <head>
 <title>Edit image</title>
 <link href="assets/editor.css" rel="stylesheet" type="text/css" />
@@ -125,7 +125,8 @@ body {
 
 </head>
 
-<body onload="javascript: Init();">
+<!-- <body dir="<?php echo $IMConfig['text_direction']; ?>" onload="javascript: Init();"> --><!-- Does not work due to used position:absolute styles. -->
+<body dir="ltr" onload="javascript: Init();">
 <div id="indicator">
 <img src="img/spacer.gif" id="indicator_image" height="20" width="20" alt="" />
 </div>

+ 2 - 2
main/inc/lib/fckeditor/editor/plugins/ImageManager/editorFrame.php

@@ -27,7 +27,7 @@
 <!--[if IE]>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <![endif]-->
-<html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $IMConfig['language']; ?>" lang="<?php echo $IMConfig['language']; ?>">
 <head>
 <title></title>
 <link href="assets/editorFrame.css" rel="stylesheet" type="text/css" />
@@ -244,7 +244,7 @@
 
 </head>
 
-<body>
+<body dir="<?php echo $IMConfig['text_direction']; ?>">
 <div id="status"></div>
 <div id="ant" class="selection" style="visibility:hidden"><img src="img/spacer.gif" width="0" height="0" border="0" alt="" id="cropContent"></div>
 <?php if ($editor->isGDEditable() == -1) { ?>

+ 1 - 1
main/inc/lib/fckeditor/editor/plugins/ImageManager/fckplugin.js

@@ -34,7 +34,7 @@
 
 	// We have to determine which language file to be loaded
 	// using information that is provided by the FCKEditor.
-	var _available_langs = 'en,af,ar,bg,bn,bs,ca,cs,da,de,el,en-au,en-ca,en-uk,eo,es,et,eu,fa,fi,fo,fr-ca,fr,gl,gu,he,hi,hr,hu,is,it,ja,km,ko,lt,lv,mn,ms,nb,nl,no,pl,pt-br,pt,ro,ru,sk,sl,sr-latn,sr,sv,th,tr,uk,vi,zh-cn,zh' ;
+	var _available_langs = 'en,af,ar,ast,bg,bn,bs,ca,cs,da,de,el,en-au,en-ca,en-uk,eo,es,et,eu,fa,fi,fo,fr-ca,fr,fur,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,prs,ps,pt-br,pt,qu,ro,ru,sk,sl,sr-latn,sr,sv,sw,th,tr,uk,vi,yo,zh-cn,zh' ;
 	_available_langs = _available_langs.split( ',' ) ;
 
 	if ( FCKConfig.DefaultLanguage )

File diff suppressed because it is too large
+ 0 - 0
main/inc/lib/fckeditor/editor/plugins/ImageManager/fckplugin_compressed.js


+ 2 - 2
main/inc/lib/fckeditor/editor/plugins/ImageManager/images.php

@@ -122,7 +122,7 @@ function drawErrorBase(&$manager)
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
-<html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $IMConfig['language']; ?>" lang="<?php echo $IMConfig['language']; ?>">
 <head>
 	<title>Image List</title>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@@ -208,7 +208,7 @@ function drawErrorBase(&$manager)
 <script type="text/javascript" src="assets/images.js"></script>
 </head>
 
-<body>
+<body dir="<?php echo $IMConfig['text_direction']; ?>">
 <?php if ($manager->isValidBase() == false) { drawErrorBase($manager); }
 	elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?>
 <table>

+ 3 - 3
main/inc/lib/fckeditor/editor/plugins/ImageManager/manager.php

@@ -25,7 +25,7 @@
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
-<html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $IMConfig['language']; ?>" lang="<?php echo $IMConfig['language']; ?>">
 <head>
 <title>Insert Image</title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@@ -112,7 +112,7 @@ body {
 
 	function Init()
 	{
-		if (window.opener)
+		if ( window.opener )
 		{
 			document.getElementById('dialog_title').style.visibility = '' ;
 		}
@@ -135,7 +135,7 @@ body {
 
 </head>
 
-<body onload="javascript: Init();">
+<body dir="<?php echo $IMConfig['text_direction']; ?>" onload="javascript: Init();">
 <div id="dialog_title" class="PopupTitle" style="visibility: hidden;">Insert Image</div>
 <form action="images.php" id="uploadForm" method="post" enctype="multipart/form-data">
 <fieldset style="margin-left: 15px; margin-right: 15px;"><legend>Image Manager</legend>

+ 2 - 2
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php

@@ -64,7 +64,7 @@
 
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" debug="true">
+<html xmlns="http://www.w3.org/1999/xhtml" debug="true" xml:lang="<?php echo CONFIG_LANG_DEFAULT; ?>" lang="<?php echo CONFIG_LANG_DEFAULT; ?>">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>Ajax File Manager</title>
@@ -209,7 +209,7 @@ $(document).ready(
 <link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ie6.css" type="text/css" rel="Stylesheet" media="screen">
 <![endif]-->
 </head>
-<body style="background-color:#E8E8E8;">
+<body style="background-color:#E8E8E8;" dir="<?php echo CONFIG_LANG_TEXT_DIRECTION_DEFAULT; ?>">
 	<div id="wrapper">
   	<div id="header">
   		<dl id="currentFolderInfo">

+ 8 - 41
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/config.base.php

@@ -200,49 +200,16 @@
 
 
 	//General Option Declarations
-	//LANGAUGAE DECLARATIONNS
-	/*
-	$langdoktoajaxfile= api_get_language_isocode(); //from dokeos. return, en, es...
-	if ($langdoktoajaxfile=='en' || $langdoktoajaxfile=='zh' || $langdoktoajaxfile=='es') // ajaxfilemanager full translations (only with all variables translated).
-	{
-	   $langajaxfilemanager=$langdoktoajaxfile;
-	}
-	else
-	{
-		$langajaxfilemanager='en';//default
-	}
-	*/
-
-	@ $langajaxfilemanager = api_get_language_isocode($language_interface);
-
-	// Some code translations are needed.
-	$langajaxfilemanager = strtolower(str_replace('_', '-', $langajaxfilemanager));
-	if (empty ($langajaxfilemanager))
-	{
-		$langajaxfilemanager = 'en';
-	}
-	switch ($langajaxfilemanager)
-	{
-		case 'uk':
-			$langajaxfilemanager = 'ukr';
-			break;
-		case 'pt':
-			$langajaxfilemanager = 'pt_pt';
-			break;
-		case 'pt-br':
-			$langajaxfilemanager = 'pt_br';
-			break;
-		// Code here other noticed exceptions.
-	}
-
 
-	// Checking for availability of a corresponding language file.
-	if (!file_exists(api_get_path(SYS_PATH).'main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/langs/'.$langajaxfilemanager.'.php'))
-	{
-		// If there was no language file, use the english one.
-		$langajaxfilemanager = 'en';
-	}
+	//LANGAUGAE DECLARATIONNS
+	$ajaxfilemanager_code_translation_table = array('' => 'en', 'pt' => 'pt_pt', 'sr' => 'sr_latn');
+	$langajaxfilemanager  = strtolower(str_replace('-', '_', api_get_language_isocode()));
+	$langajaxfilemanager = isset($ajaxfilemanager_code_translation_table[$langajaxfilemanager]) ? $ajaxfilemanager_code_translation_table[$langajaxfilemanager] : $langajaxfilemanager;
+	$langajaxfilemanager = file_exists(api_get_path(SYS_PATH).'main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/langs/'.$langajaxfilemanager.'.php') ? $langajaxfilemanager : 'en';
 
 	define('CONFIG_LANG_INDEX', 'language'); //the index in the session
 	define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language']) . '.php')?secureFileName($_GET['language']):$langajaxfilemanager)); //change it to be your language file base name, such en
+	// Language text direction.
+	define('CONFIG_LANG_TEXT_DIRECTION_DEFAULT', in_array(CONFIG_LANG_DEFAULT, array('ar', 'prs', 'he', 'ps', 'fa')) ? 'rtl' : 'ltr');
+
 ?>

+ 2 - 2
main/inc/lib/fckeditor/fckeditor.php

@@ -448,9 +448,9 @@ class FCKeditor
 	private function & get_editor_language() {
 		static $config;
 		if (!is_array($config)) {
-			$translation_table = array('' => 'en', 'sr' => 'sr-latn', 'zh' => 'zh-cn', 'zh-tw' => 'zh');
+			$code_translation_table = array('' => 'en', 'sr' => 'sr-latn', 'zh' => 'zh-cn', 'zh-tw' => 'zh');
 			$editor_lang = strtolower(str_replace('_', '-', api_get_language_isocode()));
-			$editor_lang = isset($translation_table[$editor_lang]) ? $translation_table[$editor_lang] : $editor_lang;
+			$editor_lang = isset($code_translation_table[$editor_lang]) ? $code_translation_table[$editor_lang] : $editor_lang;
 			$editor_lang = file_exists(api_get_path(SYS_PATH).'main/inc/lib/fckeditor/editor/lang/'.$editor_lang.'.js') ? $editor_lang : 'en';
 			$config['DefaultLanguage'] = $editor_lang;
 		}

+ 1 - 1
main/inc/lib/fckeditor/myconfig.js

@@ -52,7 +52,7 @@ FCKConfig.SmileyWindowHeight = 250 ;
  */
 
 // This is a list of all supported by the online editor languages.
-FCKConfig.AvailableLanguages = 'en,af,ar,bg,bn,bs,ca,cs,da,de,el,en-au,en-ca,en-uk,eo,es,et,eu,fa,fi,fo,fr-ca,fr,gl,gu,he,hi,hr,hu,is,it,ja,km,ko,lt,lv,mn,ms,nb,nl,no,pl,pt-br,pt,ro,ru,sk,sl,sr-latn,sr,sv,th,tr,uk,vi,zh-cn,zh' ;
+FCKConfig.AvailableLanguages = 'en,af,ar,ast,bg,bn,bs,ca,cs,da,de,el,en-au,en-ca,en-uk,eo,es,et,eu,fa,fi,fo,fr-ca,fr,fur,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,prs,ps,pt-br,pt,qu,ro,ru,sk,sl,sr-latn,sr,sv,sw,th,tr,uk,vi,yo,zh-cn,zh' ;
 // This script selects for loading source/compressed versions of some javascripts and ensures that the English language
 // would be shown for plugins, if they are not provided with the requiested language files.
 LoadScript( ( window.document.location.toString().indexOf('fckeditor.original.html') != -1 ) // Please, do not disable this script.

Some files were not shown because too many files changed in this diff