Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
GTNPORTAL-2491 should use inline localization in script
Browse files Browse the repository at this point in the history
  • Loading branch information
kiennguyen authored and trongtt committed Aug 22, 2012
1 parent b34b4fd commit 6336733
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 55 deletions.
Expand Up @@ -699,13 +699,15 @@ gadgets.IfrGadget.prototype.generateForm = function(gadget) {

parentEl.appendChild(formEl);

var gadgetJS = require("SHARED/gadget");
var saveEl = document.createElement("div");
saveEl.className = this.cssClassGadgetUserPrefsDialogActionBar;
saveEl.innerHTML = '<input type="button" value="'+gadgetJS.UIGadget.SaveTitle+'" onclick="gadgets.container.getGadget(' +
this.id +').handleSaveUserPrefs()"> <input type="button" value="'+gadgetJS.UIGadget.CancelTitle+'" onclick="gadgets.container.getGadget(' +
this.id +').handleCancelUserPrefs()">';
parentEl.appendChild(saveEl);
var gadget = this;
require(['SHARED/base'], function(base) {
var saveEl = document.createElement("div");
saveEl.className = gadget.cssClassGadgetUserPrefsDialogActionBar;
saveEl.innerHTML = '<input type="button" value="'+base.I18NMessage.getMessage("Save")+'" onclick="gadgets.container.getGadget(' +
gadget.id +').handleSaveUserPrefs()"> <input type="button" value="'+base.I18NMessage.getMessage("Cancel")+'" onclick="gadgets.container.getGadget(' +
gadget.id +').handleCancelUserPrefs()">';
parentEl.appendChild(saveEl);
});
};

gadgets.IfrGadget.prototype.buildUserPrefsDialog = function(content) {
Expand Down
@@ -1,4 +1,6 @@
SessionTimeoutDie Benutzer-Sitzung ist abgelaufen! Aktualisieren Sie Ihren Browser.
TargetBlockNotFoundDie zu aktualisierende Ziel-blockId wurde nicht gefunden: {0}
BlockUpdateNotFoundDie zu aktualisierende blockId wurde nicht gefunden: {0}
DefaultThemeStandard-Thema
SessionTimeout=Die Benutzer-Sitzung ist abgelaufen! Aktualisieren Sie Ihren Browser.
TargetBlockNotFound=Die zu aktualisierende Ziel-blockId wurde nicht gefunden: {0}
BlockUpdateNotFound=Die zu aktualisierende blockId wurde nicht gefunden: {0}
DefaultTheme=Standard-Thema
Save=Speichern
Cancel=Abbrechen
Expand Up @@ -13,3 +13,6 @@ weekdays.wed=W
weekdays.thu=T
weekdays.fri=F
weekdays.sat=S
GadgetDeletionConfirmation=Are you sure to delete this gadget?
Save=Save
Cancel=Cancel
Expand Up @@ -13,3 +13,6 @@ weekdays.wed=M
weekdays.thu=J
weekdays.fri=V
weekdays.sat=S
GadgetDeletionConfirmation=Voudriez-vous supprimer ce gadget?
Save=Enregistrer
Cancel=Annuler
Expand Up @@ -2,3 +2,5 @@ SessionTimeout=\u0422\u0430\u0439\u043c-\u0430\u0443\u0442 \u0441\u0435\u0441\u0
TargetBlockNotFound=\u0426\u0435\u043b\u0435\u0432\u043e\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0431\u043b\u043e\u043a\u0430 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d: {0}
BlockUpdateNotFound=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0431\u043b\u043e\u043a\u0430 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d: {0}
DefaultTheme=\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e
Save=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C
Cancel=\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C
Expand Up @@ -12,4 +12,7 @@ weekdays.tue=T3
weekdays.wed=T4
weekdays.thu=T5
weekdays.fri=T6
weekdays.sat=T7
weekdays.sat=T7
GadgetDeletionConfirmation=B\u1EA1n ch\u1EAFc ch\u1EAFn mu\u1ED1n xóa Gadget này?
Save=L\u01B0u
Cancel=H\u1EE7y
6 changes: 6 additions & 0 deletions web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml
Expand Up @@ -213,9 +213,15 @@
<!-- GADGET Javascripts -->
<module>
<name>gadget</name>
<supported-locale>de</supported-locale>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
<supported-locale>ru</supported-locale>
<supported-locale>vi</supported-locale>
<script>
<name>eXo.gadget.UIGadget</name>
<path>/javascript/eXo/gadget/UIGadget.js</path>
<resource-bundle>eXo.portal</resource-bundle>
</script>
<depends>
<module>common</module>
Expand Down
Expand Up @@ -92,10 +92,8 @@ var eXoGadget = {
* @param {boolean} inDesktop use to realize UIDesktopPage or no
* @param {String} metadata metadata of gadget
*/
init : function(uiGadget, confirmDeleteMsg)
init : function(uiGadget)
{
_module.UIGadget.confirmDeleteGadget = confirmDeleteMsg;

if (typeof (uiGadget) == "string") uiGadget = document.getElementById(uiGadget);
var gadget = gj(uiGadget);
var portletFrag = gadget.closest(".PORTLET-FRAGMENT");
Expand Down Expand Up @@ -330,7 +328,8 @@ var eXoGadget = {
{
var portletID = portletFrag.parent().attr("id");
var dashboardID = gadget.closest(".UIDashboard").attr("id");
if (confirm(_module.UIGadget.confirmDeleteGadget))

if (confirm("${GadgetDeletionConfirmation}"))
{
var href = eXo.env.server.portalBaseURL + "?portal:componentId=" + portletID;
href += "&portal:type=action&uicomponent=" + dashboardID;
Expand Down Expand Up @@ -358,7 +357,7 @@ var eXoGadget = {
{
//Code used for desktop page
var blockID = closeIcon.closest(".UIPage").find("div.id").html();
if (confirm(_module.UIGadget.confirmDeleteGadget))
if (confirm("${GadgetDeletionConfirmation}"))
{
var params = [
{name: "objectId", value : gadget.attr("id")}
Expand Down
Expand Up @@ -58,7 +58,9 @@ eXo.i18n.I18NMessage = {
"${weekdays.thu}",
"${weekdays.fri}",
"${weekdays.sat}"
]
],
Save : "${Save}",
Cancel : "${Cancel}"
};

_module.I18NMessage = eXo.i18n.I18NMessage;
_module.I18NMessage = eXo.i18n.I18NMessage;
Expand Up @@ -1181,10 +1181,6 @@ ThemeDropDown.item.RoundConer=Runde-Ecken-Stile
UIAddGadgetPopup.title.UIDashboardSelectContainer=Dashboard Arbeitsbereich
UIDashboardSelectContainer.action.addGadget=Gadget hinzuf\u00fcgen
UIDashboardContainer.label.openWorkspace=Gadgets hinzuf\u00fcgen
UIDashboardContainer.label.SaveTitle=Speichern
UIDashboardContainer.label.CancelTitle=Abbrechen
UIDashboardContainer.label.Debug=Debug
UIDashboardContainer.label.Cache=Kein Cache
UIDashboardEditForm.label.totalColumns=Anzahl der Spalten
UIDashboardEditForm.label.isPrivate=Ist Privat:
UIDashboardEditForm.label.owner=Eigent\u00fcmer:
Expand Down
Expand Up @@ -1230,7 +1230,6 @@ UIDropDownPageTemp.item.tabsPageConfigs=Tabs Page Config
UIGadgetContainerManagement.action.close=Cancel
UIGadgetContainerManagement.action.save=#{word.save}
UIGadgetContainerManagement.confirm.DeleteContainer=Are you sure to delete this container?
UIGadgetContainerManagement.confirm.DeleteGadget=Are you sure to delete this gadget?
UIGadgetContainerManagement.title.manager=Gadget Containers Management
UIGadgetContainerManagement.title.containers=Containers
UIGadgetContainerManagement.title.selectedContainer=Selected Gadget Container Info:
Expand Down Expand Up @@ -1300,10 +1299,6 @@ ThemeDropDown.item.RoundConer=Round Corner Style
UIAddGadgetPopup.title.UIDashboardSelectContainer=Dashboard Workspace
UIDashboardSelectContainer.action.addGadget=Add Gadget
UIDashboardContainer.label.openWorkspace=Add Gadgets
UIDashboardContainer.label.SaveTitle=Save
UIDashboardContainer.label.CancelTitle=Cancel
UIDashboardContainer.label.Debug=Debug
UIDashboardContainer.label.Cache=No Cache
UIDashboardEditForm.label.totalColumns=Number of columns:
UIDashboardEditForm.label.isPrivate=Is Private:
UIDashboardEditForm.label.owner=Owner:
Expand Down
Expand Up @@ -1182,10 +1182,6 @@ ThemeDropDown.item.RoundConer=Style Angle Arrondi
UIAddGadgetPopup.title.UIDashboardSelectContainer=Dashboard
UIDashboardSelectContainer.action.addGadget=Ajouter Gadget
UIDashboardContainer.label.openWorkspace=Ajouter Gadgets
UIDashboardContainer.label.SaveTitle=Enregistrer
UIDashboardContainer.label.CancelTitle=Annuler
UIDashboardContainer.label.Debug=Debug
UIDashboardContainer.label.Cache=No Cache
UIDashboardEditForm.label.totalColumns=Nombre de colonnes:
UIDashboardEditForm.label.isPrivate=Est privé:
UIDashboardEditForm.label.owner=Propriétaire:
Expand Down
Expand Up @@ -1142,10 +1142,6 @@ ThemeDropDown.item.RoundConer=Скругленный стиль
UIAddGadgetPopup.title.UIDashboardSelectContainer=Рабочая область доски
UIDashboardSelectContainer.action.addGadget=Добавить гаджет
UIDashboardContainer.label.openWorkspace=Добавить гаджет
UIDashboardContainer.label.SaveTitle=Сохранить
UIDashboardContainer.label.CancelTitle=Отменить
UIDashboardContainer.label.Debug=Отладка
UIDashboardContainer.label.Cache=Без кэширования
UIDashboardEditForm.label.totalColumns=Число колонок:
UIDashboardEditForm.label.isPrivate=Is Private:
UIDashboardEditForm.label.owner=Owner:
Expand Down
Expand Up @@ -1218,10 +1218,6 @@ ThemeDropDown.item.RoundConer=Phong cách vòng góc
UIAddGadgetPopup.title.UIDashboardSelectContainer=Dashboard Workspace
UIDashboardSelectContainer.action.addGadget=Thêm Gadget
UIDashboardContainer.label.openWorkspace=Thêm Gadgets
UIDashboardContainer.label.SaveTitle=Lưu
UIDashboardContainer.label.CancelTitle=Hủy
UIDashboardContainer.label.Debug=Debug
UIDashboardContainer.label.Cache=Không lưu Cache
UIDashboardEditForm.label.totalColumns=Số cột
UIDashboardEditForm.label.isPrivate=Là trang cá nhân:
UIDashboardEditForm.label.owner=Chủ nhân:
Expand Down
Expand Up @@ -15,18 +15,17 @@
def view = uicomponent.getView();
def userPref = null;

def confirmDelete = _ctx.appRes("UIGadgetContainerManagement.confirm.DeleteGadget");
def reqJS = jsmanager.require("SHARED/gadget", "gadget")
.addScripts("gadget.UIGadget.init('$id', '$confirmDelete');");
.addScripts("gadget.UIGadget.init('$id');");

def isLossData = uicomponent.isLossData();
if(!isLossData) {
url = uicomponent.getUrl();
metadata = uicomponent.getRpcMetadata();
userPref = uicomponent.getUserPref();
def noCache = uicomponent.isNoCache();
def isDebug = uicomponent.isDebug();
reqJS.addScripts("gadget.UIGadget.createGadget('$url','content-$id', $metadata, $userPref, '$view', '$hostName', " + (isDebug ? 1 : 0) + ", " + (noCache ? 1 : 0) + ");");
def isDebug = uicomponent.isDebug();
reqJS.addScripts("gadget.UIGadget.createGadget('$url','content-$id', $metadata, $userPref, '$view', '$hostName', " + (isDebug ? 1 : 0) + ", " + (noCache ? 1 : 0) + ");");
}

boolean isMini = Boolean.parseBoolean(uicomponent.getProperties().get("minimized"));
Expand Down
@@ -1,14 +1,4 @@
<%
import org.exoplatform.web.application.JavascriptManager;

def rcontext = _ctx.getRequestContext() ;
JavascriptManager jsmanager = rcontext.getJavascriptManager();
jsmanager.require("SHARED/gadget", "gadget")
.addScripts("gadget.UIGadget.SaveTitle='" + _ctx.appRes("UIDashboardContainer.label.SaveTitle") + "';")
.addScripts("gadget.UIGadget.CancelTitle='" + _ctx.appRes("UIDashboardContainer.label.CancelTitle") + "';")
.addScripts("gadget.UIGadget.Cache='" + _ctx.appRes("UIDashboardContainer.label.Cache") + "';")
.addScripts("gadget.UIGadget.Debug='" + _ctx.appRes("UIDashboardContainer.label.Debug") + "';");

<%
def maxiGadget = uicomponent.getMaximizedGadget();
%>
<div id="$uicomponent.id" class="UIDashboard">
Expand Down

0 comments on commit 6336733

Please sign in to comment.