aboutsummaryrefslogtreecommitdiff
path: root/mod/translation_editor/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'mod/translation_editor/views/default')
-rw-r--r--mod/translation_editor/views/default/core/settings/account/language.php42
-rw-r--r--mod/translation_editor/views/default/plugins/translation_editor/settings.php20
-rw-r--r--mod/translation_editor/views/default/translation_editor/add_custom_key.php21
-rw-r--r--mod/translation_editor/views/default/translation_editor/add_language.php167
-rw-r--r--mod/translation_editor/views/default/translation_editor/css/site.php99
-rw-r--r--mod/translation_editor/views/default/translation_editor/js/site.php41
-rw-r--r--mod/translation_editor/views/default/translation_editor/language_selector.php88
-rw-r--r--mod/translation_editor/views/default/translation_editor/plugin_edit.php147
-rw-r--r--mod/translation_editor/views/default/translation_editor/plugin_list.php84
-rw-r--r--mod/translation_editor/views/default/translation_editor/search.php43
-rw-r--r--mod/translation_editor/views/default/translation_editor/search_results.php78
11 files changed, 830 insertions, 0 deletions
diff --git a/mod/translation_editor/views/default/core/settings/account/language.php b/mod/translation_editor/views/default/core/settings/account/language.php
new file mode 100644
index 000000000..225bccc97
--- /dev/null
+++ b/mod/translation_editor/views/default/core/settings/account/language.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Provide a way of setting your language prefs
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+if ($user = elgg_get_page_owner_entity()) {
+ translation_editor_unregister_translations();
+
+ $translations = get_installed_translations();
+
+ $value = $CONFIG->language;
+ if (!empty($user->language)) {
+ $value = $user->language;
+ }
+
+ if(count($translations ) > 1){
+ ?>
+ <div class="elgg-module elgg-module-info">
+ <div class="elgg-head">
+ <h3><?php echo elgg_echo('user:set:language'); ?></h3>
+ </div>
+ <div class="elgg-body">
+ <p>
+ <?php echo elgg_echo('user:language:label'); ?>:
+ <?php
+ echo elgg_view("input/dropdown", array(
+ 'name' => 'language',
+ 'value' => $value,
+ 'options_values' => $translations
+ ));
+ ?>
+ </p>
+ </div>
+ </div>
+ <?php
+ } else {
+ echo elgg_view("input/hidden", array("name" => "language", "value" => $value));
+ }
+} \ No newline at end of file
diff --git a/mod/translation_editor/views/default/plugins/translation_editor/settings.php b/mod/translation_editor/views/default/plugins/translation_editor/settings.php
new file mode 100644
index 000000000..4dfe4b7c9
--- /dev/null
+++ b/mod/translation_editor/views/default/plugins/translation_editor/settings.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Translation Editor plugin settings
+ */
+
+$everybody_translate_string = elgg_echo('translation_editor:settings:everybody_translate');
+$everybody_translate_view = elgg_view('input/dropdown', array(
+ 'name' => 'params[everybody_translate]',
+ 'options_values' => array(
+ 'yes' => elgg_echo('option:yes'),
+ 'no' => elgg_echo('option:no'),
+ ),
+ 'value' => $vars['entity']->everybody_translate ? $vars['entity']->everybody_translate : 'no',
+));
+
+$settings = <<<__HTML
+<div>$everybody_translate_string $everybody_translate_view</div>
+__HTML;
+
+echo $settings;
diff --git a/mod/translation_editor/views/default/translation_editor/add_custom_key.php b/mod/translation_editor/views/default/translation_editor/add_custom_key.php
new file mode 100644
index 000000000..4726479cc
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/add_custom_key.php
@@ -0,0 +1,21 @@
+<?php
+
+ $action = $vars["url"] . "action/translation_editor/add_custom_key";
+
+ $form_body .= "<div>";
+ $form_body .= "<label>" . elgg_echo("translation_editor:custom_keys:key") . "</label>";
+ $form_body .= elgg_view("input/text", array("name" => "key"));
+
+ $form_body .= "<label>" . elgg_echo("translation_editor:custom_keys:translation") . "</label>";
+ $form_body .= "<textarea name='translation'></textarea>";
+ $form_body .= "<span id='translation_editor_custom_keys_translation_info'>" . elgg_echo("translation_editor:custom_keys:translation_info") . "</span>";
+ $form_body .= "</div>";
+
+ $form_body .= elgg_view("input/submit", array("value" => elgg_echo("save")));
+
+ $form = elgg_view("input/form", array("body" => $form_body, "action" => $action, "id" => "translation_editor_custom_keys_form"));
+
+?>
+<h3><?php echo elgg_echo("translation_editor:custom_keys:title"); ?></h3>
+<?php
+ echo $form; \ No newline at end of file
diff --git a/mod/translation_editor/views/default/translation_editor/add_language.php b/mod/translation_editor/views/default/translation_editor/add_language.php
new file mode 100644
index 000000000..4d4ba5dbf
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/add_language.php
@@ -0,0 +1,167 @@
+<?php
+
+/**
+ * Languages according to ISO 639-1
+ */
+
+ $options = array(
+
+ "aa" => "Afar",
+ "ab" => "Abkhazian",
+ "af" => "Afrikaans",
+ "am" => "Amharic",
+ "ar" => "Arabic",
+ "as" => "Assamese",
+ "ay" => "Aymara",
+ "az" => "Azerbaijani",
+ "ba" => "Bashkir",
+ "be" => "Byelorussian",
+ "bg" => "Bulgarian",
+ "bh" => "Bihari",
+ "bi" => "Bislama",
+ "bn" => "Bengali; Bangla",
+ "bo" => "Tibetan",
+ "br" => "Breton",
+ "ca" => "Catalan",
+ "co" => "Corsican",
+ "cs" => "Czech",
+ "cy" => "Welsh",
+ "da" => "Danish",
+ "de" => "German",
+ "dz" => "Bhutani",
+ "el" => "Greek",
+ "en" => "English",
+ "eo" => "Esperanto",
+ "es" => "Spanish",
+ "et" => "Estonian",
+ "eu" => "Basque",
+ "fa" => "Persian",
+ "fi" => "Finnish",
+ "fj" => "Fiji",
+ "fo" => "Faeroese",
+ "fr" => "French",
+ "fy" => "Frisian",
+ "ga" => "Irish",
+ "gd" => "Scots / Gaelic",
+ "gl" => "Galician",
+ "gn" => "Guarani",
+ "gu" => "Gujarati",
+ "he" => "Hebrew",
+ "ha" => "Hausa",
+ "hi" => "Hindi",
+ "hr" => "Croatian",
+ "hu" => "Hungarian",
+ "hy" => "Armenian",
+ "ia" => "Interlingua",
+ "id" => "Indonesian",
+ "ie" => "Interlingue",
+ "ik" => "Inupiak",
+ "is" => "Icelandic",
+ "it" => "Italian",
+ "iu" => "Inuktitut",
+ "iw" => "Hebrew (obsolete)",
+ "ja" => "Japanese",
+ "ji" => "Yiddish (obsolete)",
+ "jw" => "Javanese",
+ "ka" => "Georgian",
+ "kk" => "Kazakh",
+ "kl" => "Greenlandic",
+ "km" => "Cambodian",
+ "kn" => "Kannada",
+ "ko" => "Korean",
+ "ks" => "Kashmiri",
+ "ku" => "Kurdish",
+ "ky" => "Kirghiz",
+ "la" => "Latin",
+ "ln" => "Lingala",
+ "lo" => "Laothian",
+ "lt" => "Lithuanian",
+ "lv" => "Latvian/Lettish",
+ "mg" => "Malagasy",
+ "mi" => "Maori",
+ "mk" => "Macedonian",
+ "ml" => "Malayalam",
+ "mn" => "Mongolian",
+ "mo" => "Moldavian",
+ "mr" => "Marathi",
+ "ms" => "Malay",
+ "mt" => "Maltese",
+ "my" => "Burmese",
+ "na" => "Nauru",
+ "ne" => "Nepali",
+ "nl" => "Dutch",
+ "no" => "Norwegian",
+ "oc" => "Occitan",
+ "om" => "(Afan) Oromo",
+ "or" => "Oriya",
+ "pa" => "Punjabi",
+ "pl" => "Polish",
+ "ps" => "Pashto / Pushto",
+ "pt" => "Portuguese",
+ "qu" => "Quechua",
+ "rm" => "Rhaeto-Romance",
+ "rn" => "Kirundi",
+ "ro" => "Romanian",
+ "ru" => "Russian",
+ "rw" => "Kinyarwanda",
+ "sa" => "Sanskrit",
+ "sd" => "Sindhi",
+ "sg" => "Sangro",
+ "sh" => "Serbo-Croatian",
+ "si" => "Singhalese",
+ "sk" => "Slovak",
+ "sl" => "Slovenian",
+ "sm" => "Samoan",
+ "sn" => "Shona",
+ "so" => "Somali",
+ "sq" => "Albanian",
+ "sr" => "Serbian",
+ "ss" => "Siswati",
+ "st" => "Sesotho",
+ "su" => "Sundanese",
+ "sv" => "Swedish",
+ "sw" => "Swahili",
+ "ta" => "Tamil",
+ "te" => "Tegulu",
+ "tg" => "Tajik",
+ "th" => "Thai",
+ "ti" => "Tigrinya",
+ "tk" => "Turkmen",
+ "tl" => "Tagalog",
+ "tn" => "Setswana",
+ "to" => "Tonga",
+ "tr" => "Turkish",
+ "ts" => "Tsonga",
+ "tt" => "Tatar",
+ "tw" => "Twi",
+ "ug" => "Uigur",
+ "uk" => "Ukrainian",
+ "ur" => "Urdu",
+ "uz" => "Uzbek",
+ "vi" => "Vietnamese",
+ "vo" => "Volapuk",
+ "wo" => "Wolof",
+ "xh" => "Xhosa",
+ "yi" => "Yiddish",
+ "yo" => "Yoruba",
+ "za" => "Zuang",
+ "zh" => "Chinese",
+ "zu" => "Zulu"
+ );
+
+ foreach(get_installed_translations() as $index => $lang){
+ unset($options[$index]);
+ }
+
+ asort($options);
+
+ $form_body .= elgg_view("input/dropdown", array("options_values" => $options, "name" => "code"));
+ $form_body .= " ";
+ $form_body .= elgg_view("input/submit", array("value" => elgg_echo("save")));
+
+ $form = elgg_view("input/form", array("body" => $form_body, "action" => $vars["url"] . "action/translation_editor/add_language", "id" => "translation_editor_add_language_form", "class" => "hidden"));
+
+ echo "<div>";
+ echo "<a href='javascript:void(0);' onclick='$(\"#translation_editor_add_language_form\").toggle();'><b>+</b> " . elgg_echo("translation_editor:language_selector:add_language") . "</a>";
+ echo $form;
+ echo "</div>";
diff --git a/mod/translation_editor/views/default/translation_editor/css/site.php b/mod/translation_editor/views/default/translation_editor/css/site.php
new file mode 100644
index 000000000..941ccdb7a
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/css/site.php
@@ -0,0 +1,99 @@
+<?php
+ $graphics_folder = $vars["url"] . "mod/translation_editor/_graphics/";
+?>
+
+#translation_editor_language_table th,
+#translation_editor_plugin_list th {
+ font-weight: bold;
+}
+
+#translation_editor_language_table .translation_editor_flag,
+#translation_editor_language_table .translation_editor_enable {
+ width: 1%;
+ text-align: center;
+}
+
+#translation_editor_plugin_list th,
+#translation_editor_plugin_list td {
+ text-align: center;
+ white-space: nowrap;
+}
+
+#translation_editor_plugin_list .first_col {
+ text-align: left;
+ width: 100%;
+}
+
+#translation_editor_site_language {
+ color: gray;
+ margin-left: 10px;
+}
+
+#translation_editor_custom_keys_translation_info {
+ color: gray;
+}
+
+.translation_editor_translation_complete {
+ color: green;
+}
+
+.translation_editor_translation_needed {
+ color: red;
+}
+
+.translation_editor_translation_table textarea {
+ height: 70px;
+}
+
+.view_mode_active {
+ font-weight: bold;
+}
+
+.translation_editor_translation_table tr{
+ display: none;
+}
+
+.translation_editor_translation_table tr.first_row th{
+ font-weight: bold;
+}
+
+.translation_editor_translation_table tr.first_row th span{
+ font-weight: normal;
+}
+
+.translation_editor_translation_table tr.first_row,
+.translation_editor_translation_table tr[rel='missing']{
+ display: table-row;
+ <!--
+ display: inline-block;
+ -->
+}
+
+.translation_editor_plugin_key {
+ float: right;
+ width: 16px;
+ height: 16px;
+ background: url(<?php echo $graphics_folder;?>key.gif) no-repeat;
+}
+
+.translation_editor_translation_table {
+ margin-bottom: 20px;
+}
+
+.translation_editor_translation_table pre {
+ white-space: normal;
+ margin-bottom: 5px;
+}
+
+.translation_editor_translation_table td{
+ white-space: nowrap;
+}
+
+.translation_editor_translation_table .first_col {
+ width: 33px;
+}
+
+#translation_editor_search_form td {
+ width: 100%;
+ white-space: nowrap;
+}
diff --git a/mod/translation_editor/views/default/translation_editor/js/site.php b/mod/translation_editor/views/default/translation_editor/js/site.php
new file mode 100644
index 000000000..be4dc0266
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/js/site.php
@@ -0,0 +1,41 @@
+<?php
+
+?>
+//<script>
+function translation_editor_disable_language(){
+ var url = elgg.security.addToken("<?php echo $vars["url"]; ?>action/translation_editor/disable_languages?");
+
+ var lan = new Array();
+ $('#translation_editor_language_table input[name="disabled_languages[]"]:checked').each(function(index, elm){
+ lan.push($(this).val());
+ });
+
+ $.post(url, {'disabled_languages[]': lan });
+}
+
+function toggleViewMode(mode){
+ $("#translation_editor_plugin_toggle a").removeClass("view_mode_active");
+ $("#view_mode_" + mode).addClass("view_mode_active");
+
+ if(mode == "all"){
+ $("#translation_editor_plugin_form tr").show();
+ } else {
+ $("#translation_editor_plugin_form tr").hide();
+ $("#translation_editor_plugin_form tr[rel='" + mode + "']").show();
+ $("#translation_editor_plugin_form tr:first").show();
+ }
+}
+
+function translationEditorJQuerySave(){
+ var url = $('#translation_editor_plugin_form').attr("action") + "?jquery=yes";
+ var formData = $('#translation_editor_plugin_form').serialize();
+
+ $.post(url, formData, function(data){}, "json");
+}
+
+function translationEditorJQuerySearchSave(){
+ var url = $('#translation_editor_search_result_form').attr("action") + "?jquery=yes";
+ var formData = $('#translation_editor_search_result_form').serialize();
+
+ $.post(url, formData, function(data){}, "json");
+} \ No newline at end of file
diff --git a/mod/translation_editor/views/default/translation_editor/language_selector.php b/mod/translation_editor/views/default/translation_editor/language_selector.php
new file mode 100644
index 000000000..89ebbf882
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/language_selector.php
@@ -0,0 +1,88 @@
+<?php
+
+ $languages = $vars["languages"];
+ $current_language = $vars["current_language"];
+ $plugin = $vars["plugin"];
+ $disabled_languages = $vars["disabled_languages"];
+ $site_language = $vars["site_language"];
+
+ if(!empty($languages)){
+ $list = "<table id='translation_editor_language_table' class='elgg-table' title='" . elgg_echo("translation_editor:language_selector:title") . "'>";
+ $list .= "<tr>";
+ $list .= "<th class='translation_editor_flag'>&nbsp;</th>";
+ $list .= "<th>" . elgg_echo("translation_editor:language") . "</th>";
+ if(elgg_is_admin_logged_in()){
+ $list .= "<th class='translation_editor_enable'>" . elgg_echo("translation_editor:disabled") . "</th>";
+ }
+ $list .= "</tr>";
+
+ foreach($languages as $language){
+ $list .= "<tr>";
+
+ // flag
+ $lang_flag_file = "mod/translation_editor/_graphics/flags/" . $language . ".png";
+
+ if(file_exists(elgg_get_root_path() . $lang_flag_file)){
+ $list .= "<td class='translation_editor_flag'>";
+ $list .= "<img src='" . $vars['url'] . $lang_flag_file . "' alt='" . elgg_echo($language) . "' title='" . elgg_echo($language) . "'> ";
+ $list .= "</td>";
+ } else {
+ $list .= "<td class='translation_editor_flag'>&nbsp;</td>";
+ }
+
+ // language
+ $list .= "<td>";
+ if($language != $current_language){
+ $url = $vars["url"] . "translation_editor/" . $language . "/" . $plugin;
+
+ if($language != "en"){
+ $completeness = translation_editor_get_language_completeness($language);
+ $list .= "<a href='" . $url . "'>" . elgg_echo($language) . " (" . $completeness . "%)</a>";
+
+ if(elgg_is_admin_logged_in() && $completeness == 0){
+ $list .= elgg_view("output/confirmlink", array("href" => $vars["url"] . "action/translation_editor/delete_language?language=" . $language, "confirm" => elgg_echo("translation_editor:language_selector:remove_language:confirm"), "text" => elgg_view_icon("delete-alt")));
+ }
+ } else {
+ $list .= "<a href='" . $url . "'>" . elgg_echo($language) . "</a>";
+
+ }
+ } else {
+ if($language != "en"){
+ $list .= elgg_echo($language) . " (" . translation_editor_get_language_completeness($language) . "%)";
+ } else {
+ $list .= elgg_echo($language);
+ }
+ }
+
+ if($site_language == $language){
+ $list .= "<span id='translation_editor_site_language'>" . elgg_echo("translation_editor:language_selector:site_language") . "</span>";
+ }
+ $list .= "</td>";
+
+ // checkbox
+ if(elgg_is_admin_logged_in()){
+ $list .= "<td class='translation_editor_enable'>";
+ if($language != "en"){
+ $list .= "<input type='checkbox' name='disabled_languages[]' value='" . $language . "' onchange='translation_editor_disable_language();' ";
+ if(in_array($language, $disabled_languages)){
+ $list .= "checked='checked' ";
+ }
+ $list .= "/>";
+ }
+ $list .= "</td>";
+ }
+
+ $list .= "</tr>";
+ }
+
+ $list .= "</table>";
+
+ echo $list;
+ }
+
+ if(elgg_is_admin_logged_in()){
+ // add a new language
+ echo elgg_view("translation_editor/add_language");
+ }
+
+ echo "<br />";
diff --git a/mod/translation_editor/views/default/translation_editor/plugin_edit.php b/mod/translation_editor/views/default/translation_editor/plugin_edit.php
new file mode 100644
index 000000000..113813a2a
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/plugin_edit.php
@@ -0,0 +1,147 @@
+<?php
+ $current_language = $vars['current_language'];
+ $english = $vars['translation']['en'];
+ $translated_language = $vars['translation']['current_language'];
+ $custom = $vars['translation']['custom'];
+
+ $en_flag_file = "mod/translation_editor/_graphics/flags/en.png";
+
+ if(file_exists(elgg_get_root_path() . $en_flag_file)){
+ $en_flag = "<img src='" . $vars['url'] . $en_flag_file . "' alt='" . elgg_echo("en") . "' title='" . elgg_echo("en") . "'>";
+ } else {
+ $en_flag = "en";
+ }
+
+ $lang_flag_file = "mod/translation_editor/_graphics/flags/" . $current_language . ".png";
+
+ if(file_exists(elgg_get_root_path() . $lang_flag_file)){
+ $lang_flag = "<img src='" . $vars['url'] . $lang_flag_file . "' alt='" . elgg_echo($current_language) . "' title='" . elgg_echo($current_language) . "'>";
+ } else {
+ $lang_flag = $current_language;
+ }
+
+ $missing_count = 0;
+ $equal_count = 0;
+ $params_count = 0;
+ $custom_count = 0;
+
+ foreach($english as $en_key => $en_value){
+ $en_params = translation_editor_get_string_parameters($en_value);
+ $cur_params = translation_editor_get_string_parameters($translated_language[$en_key]);
+
+ if(!array_key_exists($en_key, $translated_language)){
+ $row_rel = "rel='missing'";
+ $missing_count++;
+ } elseif($en_value == $translated_language[$en_key]){
+ $row_rel = "rel='equal'";
+ $equal_count++;
+ } elseif($en_params != $cur_params){
+ $row_rel = "rel='params'";
+ $params_count++;
+ } elseif(array_key_exists($en_key, $custom)){
+ $row_rel = "rel='custom'";
+ $custom_count++;
+ } else {
+ $row_rel = "";
+ }
+
+ // English information
+ $translation .= "<tr " . $row_rel . ">";
+ $translation .= "<td>" . $en_flag . "</td>";
+ $translation .= "<td>";
+ $translation .= "<span class='translation_editor_plugin_key' title='" . $en_key . "'></span>";
+ $translation .= "<pre class='translation_editor_pre'>" . nl2br(htmlspecialchars($en_value)) . "</pre>";
+ $translation .="</td>";
+ $translation .= "</tr>";
+
+ // Custom language information
+ $translation .= "<tr ". $row_rel . ">";
+ $translation .= "<td>" . $lang_flag . "</td>";
+ $translation .= "<td>";
+ $translation .= "<textarea name='translation[" . $en_key . "]' >";
+ $translation .= $translated_language[$en_key];
+ $translation .= "</textarea>";
+ $translation .= "</td>";
+ $translation .= "</tr>";
+ }
+
+ $selected_view_mode = "missing";
+
+ if($missing_count == 0){
+ $selected_view_mode = "all";
+ ?>
+ <style type="text/css">
+ .translation_editor_translation_table tr {
+ display: table-row;
+ <!--
+ display: inline-block;
+ -->
+ }
+ </style>
+ <?php
+ }
+
+ $toggle = "<span id='translation_editor_plugin_toggle' class='float-alt'>";
+
+ $toggle .= elgg_echo("translation_editor:plugin_edit:show") . " ";
+
+ $missing_class = "";
+ $equal_class = "";
+ $params_class = "";
+ $custom_class = "";
+ $all_class = "";
+
+ switch($selected_view_mode){
+ case "missing":
+ $missing_class = "view_mode_active";
+ break;
+ case "all":
+ $all_class = "view_mode_active";
+ break;
+ case "equal":
+ $equal_class = "view_mode_active";
+ break;
+ case "custom":
+ $custom_class = "view_mode_active";
+ break;
+ case "params":
+ $params_class = "view_mode_active";
+ break;
+ }
+
+ $toggle .= "<a class='$missing_class' id='view_mode_missing' href='javascript:toggleViewMode(\"missing\");'>" . elgg_echo("translation_editor:plugin_edit:show:missing") . "</a> (" . $missing_count . "), ";
+ $toggle .= "<a class='$equal_class' id='view_mode_equal' href='javascript:toggleViewMode(\"equal\");'>" . elgg_echo("translation_editor:plugin_edit:show:equal") . "</a> (" . $equal_count . "), ";
+ $toggle .= "<a class='$params_class' id='view_mode_params' href='javascript:toggleViewMode(\"params\");'>" . elgg_echo("translation_editor:plugin_edit:show:params") . "</a> (" . $params_count . "), ";
+ $toggle .= "<a class='$custom_class' id='view_mode_custom' href='javascript:toggleViewMode(\"custom\");'>" . elgg_echo("translation_editor:plugin_edit:show:custom") . "</a> (" . $custom_count . "), ";
+ $toggle .= "<a class='$all_class' id='view_mode_all' href='javascript:toggleViewMode(\"all\");'>" . elgg_echo("translation_editor:plugin_edit:show:all") . "</a> (" . $vars['translation']['total'] . ")";
+ $toggle .= "</span>";
+
+ $list .= "<table class='elgg-table translation_editor_translation_table'>";
+ $list .= "<col class='first_col'/>";
+ $list .= "<tr class='first_row'><th colspan='2'>";
+ $list .= $toggle;
+ $list .= elgg_echo("translation_editor:plugin_edit:title") . " " . $vars['plugin'];
+ $list .= "</th></tr>";
+ $list .= $translation;
+ $list .= "</table>";
+
+?>
+<script type="text/javascript">
+ $(document).ready(function(){
+ $('#translation_editor_plugin_form textarea').live("change", function(){
+ translationEditorJQuerySave();
+ });
+ });
+</script>
+
+<div>
+ <form id="translation_editor_plugin_form" action="<?php echo $vars['url'];?>action/translation_editor/translate" method="post">
+ <?php echo elgg_view("input/securitytoken"); ?>
+ <input type='hidden' name='current_language' value='<?php echo $current_language; ?>' />
+ <input type='hidden' name='plugin' value='<?php echo $vars['plugin']; ?>' />
+ <?php
+ echo $list;
+ echo elgg_view("input/submit", array("value" => elgg_echo("save")));
+ ?>
+ </form>
+</div>
diff --git a/mod/translation_editor/views/default/translation_editor/plugin_list.php b/mod/translation_editor/views/default/translation_editor/plugin_list.php
new file mode 100644
index 000000000..b48b94fbf
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/plugin_list.php
@@ -0,0 +1,84 @@
+<?php
+ $plugins = $vars["plugins"];
+ $current_language = $vars["current_language"];
+
+ if(!empty($plugins)){
+ $total = 0;
+ $exists = 0;
+ $custom = 0;
+
+ $list .= "<table id='translation_editor_plugin_list' class='elgg-table' title=\"" . elgg_echo("translation_editor:plugin_list:title") . "\">";
+ $list .= "<tr>";
+ $list .= "<th class='first_col'>" . elgg_echo("translation_editor:plugin_list:plugin") . "</th>";
+ $list .= "<th>" . elgg_echo("translation_editor:plugin_list:total") . "</th>";
+ $list .= "<th>" . elgg_echo("translation_editor:plugin_list:exists") . "</th>";
+ $list .= "<th>" . elgg_echo("translation_editor:plugin_list:custom") . "</th>";
+ $list .= "<th>" . elgg_echo("translation_editor:plugin_list:percentage") . "</th>";
+ $list .= "<th>&nbsp;</th>";
+ $list .= "</tr>";
+
+ foreach($plugins as $plugin_name => $plugin_stats){
+
+ $url = $vars["url"] . "translation_editor/" . $current_language . "/" . $plugin_name;
+
+ $total += $plugin_stats["total"];
+ $exists += $plugin_stats["exists"];
+ $custom += $plugin_stats["custom"];
+
+ if(!empty($plugin_stats["total"])){
+ $percentage = round(($plugin_stats["exists"] / $plugin_stats["total"]) * 100);
+ } else {
+ $percentage = 100;
+ }
+
+ $complete_class = "";
+
+ if($percentage == 100){
+ $complete_class = " class='translation_editor_translation_complete'";
+ } elseif($percentage == 0){
+ $complete_class = " class='translation_editor_translation_needed'";
+ }
+
+ $list .= "<tr>";
+ $list .= "<td class='first_col'><a href='" . $url . "'>" . $plugin_name . "</a></td>";
+ $list .= "<td>" . $plugin_stats["total"] . "</td>";
+ $list .= "<td>" . $plugin_stats["exists"] . "</td>";
+
+ if($plugin_stats["custom"] > 0){
+ $list .= "<td>" . $plugin_stats["custom"] . "</td>";
+ } else {
+ $list .= "<td>&nbsp;</td>";
+ }
+
+ $list .= "<td" . $complete_class . ">" . $percentage . "%</td>";
+
+ if($plugin_stats["custom"] > 0){
+ $merge_url = $vars["url"] . "action/translation_editor/merge?current_language=" . $current_language . "&plugin=" . $plugin_name;
+
+ $list .= "<td>";
+ $list .= elgg_view("output/url", array("href" => $merge_url, "is_action" => true, "title" => elgg_echo("translation_editor:plugin_list:merge"), "text" => elgg_view_icon("download")));
+ if(elgg_is_admin_logged_in()){
+ $delete_url = $vars["url"] . "action/translation_editor/delete?current_language=" . $current_language . "&plugin=" . $plugin_name;
+
+ $list .= elgg_view("output/confirmlink", array("href" => $delete_url, "title" => elgg_echo("delete"), "text" => elgg_view_icon("delete-alt")));
+ }
+ $list .= "</td>";
+ } else {
+ $list .= "<td>&nbsp;</td>";
+ }
+ $list .= "</tr>";
+ }
+
+ $list .= "<tr class='translation_editor_plugin_list_total_row'>";
+ $list .= "<td>&nbsp;</td>";
+ $list .= "<td>" . $total . "</td>";
+ $list .= "<td>" . $exists . "</td>";
+ $list .= "<td>" . $custom . "</td>";
+ $list .= "<td>" . round(($exists / $total) * 100, 2) . "%</td>";
+ $list .= "<td>&nbsp;</td>";
+ $list .= "</tr>";
+
+ $list .= "</table>";
+
+ echo $list;
+ }
diff --git a/mod/translation_editor/views/default/translation_editor/search.php b/mod/translation_editor/views/default/translation_editor/search.php
new file mode 100644
index 000000000..541b33123
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/search.php
@@ -0,0 +1,43 @@
+<?php
+
+ $current_language = $vars["current_language"];
+ $q = $vars["query"];
+ $in_search = $vars["in_search"];
+
+ if(empty($q)){
+ $q = elgg_echo("translation_editor:forms:search:default");
+ }
+
+ // build form
+ $form_data .= "<table><tr><td>";
+
+ $form_data .= elgg_view("input/text", array("name" => "translation_editor_search", "value" => $q));
+
+ $form_data .= "</td><td>&nbsp;";
+
+ $form_data .= elgg_view("input/hidden", array("name" => "language", "value" => $current_language));
+ $form_data .= elgg_view("input/submit", array("value" => elgg_echo("search")));
+
+ $form_data .= "</td></tr></table>";
+ $form = elgg_view("input/form", array("body" => $form_data,
+ "id" => "translation_editor_search_form",
+ "action" => $vars["url"] . "translation_editor/search",
+ "disable_security" => true));
+
+ echo $form;
+ echo "<br />";
+
+?>
+<script type="text/javascript">
+ $(document).ready(function(){
+ $('#translation_editor_search_form input[name="translation_editor_search"]').focus(function(){
+ if($(this).val() == "<?php echo elgg_echo("translation_editor:forms:search:default"); ?>"){
+ $(this).val("");
+ }
+ }).blur(function(){
+ if($(this).val() == ""){
+ $(this).val("<?php echo elgg_echo("translation_editor:forms:search:default"); ?>");
+ }
+ });
+ });
+</script> \ No newline at end of file
diff --git a/mod/translation_editor/views/default/translation_editor/search_results.php b/mod/translation_editor/views/default/translation_editor/search_results.php
new file mode 100644
index 000000000..bb771bd9f
--- /dev/null
+++ b/mod/translation_editor/views/default/translation_editor/search_results.php
@@ -0,0 +1,78 @@
+<?php
+
+ $search_results = $vars["results"];
+ $current_language = $vars["current_language"];
+
+ if(!empty($search_results)){
+ $en_flag_file = "mod/translation_editor/_graphics/flags/en.png";
+
+ if(file_exists(elgg_get_root_path() . $en_flag_file)){
+ $en_flag = "<img src='" . $vars['url'] . $en_flag_file . "' alt='" . elgg_echo("en") . "' title='" . elgg_echo("en") . "'>";
+ } else {
+ $en_flag = "en";
+ }
+
+ $lang_flag_file = "mod/translation_editor/_graphics/flags/" . $current_language . ".png";
+
+ if(file_exists(elgg_get_root_path() . $lang_flag_file)){
+ $lang_flag = "<img src='" . $vars['url'] . $lang_flag_file . "' alt='" . elgg_echo($current_language) . "' title='" . elgg_echo($current_language) . "'>";
+ } else {
+ $lang_flag = $current_language;
+ }
+
+ foreach($search_results as $plugin => $data){
+ $translated_language = $data["current_language"];
+
+ $list .= "<table class='elgg-table translation_editor_translation_table'>";
+ $list .= "<col class='first_col'/>";
+ $list .= "<tr class='first_row'><th colspan='2'>";
+ $list .= "<a href='" . $vars["url"] . "translation_editor/" . $current_language . "/" . $plugin . "'>" . $plugin . "</a>";
+ $list .= "</th></tr>";
+
+ foreach($data["en"] as $key => $value){
+
+ // English information
+ $list .= "<tr>";
+ $list .= "<td>" . $en_flag . "</td>";
+ $list .= "<td>";
+ $list .= "<span class='translation_editor_plugin_key' title='" . $key . "'></span>";
+ $list .= "<pre class='translation_editor_pre'>" . nl2br(htmlspecialchars($value)) . "</pre>";
+ $list .="</td>";
+ $list .= "</tr>";
+
+ // Custom language information
+ $list .= "<tr>";
+ $list .= "<td>" . $lang_flag . "</td>";
+ $list .= "<td>";
+ $list .= "<textarea name='translation[" . $plugin . "][" . $key . "]' onchange='translationEditorJQuerySearchSave();'>";
+ $list .= $translated_language[$key];
+ $list .= "</textarea>";
+ $list .= "</td>";
+ $list .= "</tr>";
+ }
+
+ $list .= "</table>";
+ }
+
+ $form_data = elgg_view("input/hidden", array("name" => "current_language", "value" => $current_language));
+ $form_data .= $list;
+
+ $form_data .= elgg_view("input/submit", array("value" => elgg_echo("save")));
+
+ $list = elgg_view("input/form", array("body" => $form_data,
+ "action" => $vars["url"] . "action/translation_editor/translate_search",
+ "id" => "translation_editor_search_result_form"));
+ } else {
+ $list .= elgg_echo("translation_editor:search_results:no_results");
+ }
+
+ echo $list;
+?>
+<style type="text/css">
+ .translation_editor_translation_table tr {
+ display: table-row;
+ <!--
+ display: inline-block;
+ -->
+ }
+</style>