From 6ade4c42ca0950d23009b23f261a3fb7e104f411 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 15 Jul 2013 19:57:51 -0500 Subject: [PATCH] IDEMPIERE-842 The How-To help widget is partly language dependent / Thanks to Naim Berisha (nberisha) --- .../adempiere/webui/panel/HelpController.java | 153 +++++++++++++----- 1 file changed, 110 insertions(+), 43 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java index 1de491c144..b66e885b3e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java @@ -322,50 +322,116 @@ public class HelpController } } } - else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Workflow)) - { - MWorkflow workflow = new MWorkflow(Env.getCtx(), recordId, null); - if (workflow != null && workflow.getName() != null && workflow.getName().length() != 0) - { - sb.append("

\n" + workflow.getName() + ""); - - if (workflow.getDescription() != null && workflow.getDescription().length() != 0) - sb.append("

\n" + workflow.getDescription() + ""); - - if (workflow.getHelp() != null && workflow.getHelp().length() != 0) - sb.append("

\n" + workflow.getHelp()); - } - } - else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Task)) - { - MTask task = new MTask(Env.getCtx(), recordId, null); - if (task != null && task.getName() != null && task.getName().length() != 0) - { - sb.append("

\n" + task.getName() + ""); - - if (task.getDescription() != null && task.getDescription().length() != 0) - sb.append("

\n" + task.getDescription() + ""); - - if (task.getHelp() != null && task.getHelp().length() != 0) - sb.append("

\n" + task.getHelp()); - } - } - else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Node)) - { - MWFNode node = new MWFNode(Env.getCtx(), recordId, null); - if (node != null && node.getName() != null && node.getName().length() != 0) - { - sb.append("

\n" + node.getName() + ""); - - if (node.getDescription() != null && node.getDescription().length() != 0) - sb.append("

\n" + node.getDescription() + ""); - - if (node.getHelp() != null && node.getHelp().length() != 0) - sb.append("

\n" + node.getHelp()); - } - } - } + else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Workflow)) { + MWorkflow workflow = new MWorkflow(Env.getCtx(), recordId, null); + if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) { + + nameMsg = workflow.get_Translation("Name"); + + if (workflow != null && nameMsg != null + && nameMsg.length() != 0) { + sb.append("

\n" + nameMsg + ""); + + descMsg = workflow.get_Translation("Description"); + if (descMsg != null && descMsg.length() != 0) + sb.append("

\n" + descMsg + ""); + + helpMsg = workflow.get_Translation("Help"); + if (helpMsg != null && helpMsg.length() != 0) + sb.append("

\n" + helpMsg); + } + } else { + + if (workflow != null && workflow.getName() != null + && workflow.getName().length() != 0) { + sb.append("

\n" + workflow.getName() + ""); + + if (workflow.getDescription() != null + && workflow.getDescription().length() != 0) + sb.append("

\n" + + workflow.getDescription() + ""); + + if (workflow.getHelp() != null + && workflow.getHelp().length() != 0) + sb.append("

\n" + workflow.getHelp()); + } + + } + + } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Task)) { + MTask task = new MTask(Env.getCtx(), recordId, null); + + if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) { + + nameMsg = task.get_Translation("Name"); + + if (task != null && nameMsg != null + && nameMsg.length() != 0) { + sb.append("

\n" + nameMsg + ""); + + descMsg = task.get_Translation("Description"); + if (descMsg != null && descMsg.length() != 0) + sb.append("

\n" + descMsg + ""); + + helpMsg = task.get_Translation("Help"); + if (helpMsg != null && helpMsg.length() != 0) + sb.append("

\n" + helpMsg); + } + } else { + + if (task != null && task.getName() != null + && task.getName().length() != 0) { + sb.append("

\n" + task.getName() + ""); + + if (task.getDescription() != null + && task.getDescription().length() != 0) + sb.append("

\n" + task.getDescription() + + ""); + + if (task.getHelp() != null + && task.getHelp().length() != 0) + sb.append("

\n" + task.getHelp()); + } + } + } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Node)) { + MWFNode node = new MWFNode(Env.getCtx(), recordId, null); + + if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) { + + nameMsg = node.get_Translation("Name"); + + if (node != null && nameMsg != null + && nameMsg.length() != 0) { + sb.append("

\n" + nameMsg + ""); + + descMsg = node.get_Translation("Description"); + if (descMsg != null && descMsg.length() != 0) + sb.append("

\n" + descMsg + ""); + + helpMsg = node.get_Translation("Help"); + if (helpMsg != null && helpMsg.length() != 0) + sb.append("

\n" + helpMsg); + } + + } else { + if (node != null && node.getName() != null + && node.getName().length() != 0) { + sb.append("

\n" + node.getName() + ""); + + if (node.getDescription() != null + && node.getDescription().length() != 0) + sb.append("

\n" + node.getDescription() + + ""); + + if (node.getHelp() != null + && node.getHelp().length() != 0) + sb.append("

\n" + node.getHelp()); + } + } + } + } + sb.append("\n\n"); htmlContextHelp.setContent(sb.toString()); @@ -519,6 +585,7 @@ public class HelpController finally { DB.close(rs, pstmt); + rs=null; pstmt=null; } }