1006079 Ease edit of OnLine Context Help. Make processed, approved and save as tenant customization field readonly. Allow suggestion when context help is not available. / IDEMPIERE-3438 (integrating contribution from hengsin)
This commit is contained in:
parent
bef0a30f90
commit
139de8e0cd
|
@ -0,0 +1,53 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:56:58 PM MYT
|
||||||
|
-- 1006079 Ease edit of OnLine Context Help
|
||||||
|
UPDATE AD_Field SET SeqNo=90, IsDisplayed='Y', XPosition=2,Updated=TO_DATE('2016-08-12 15:56:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204258
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:56:58 PM MYT
|
||||||
|
UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=5,Updated=TO_DATE('2016-08-12 15:56:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204259
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:56:59 PM MYT
|
||||||
|
UPDATE AD_Field SET SeqNo=110,Updated=TO_DATE('2016-08-12 15:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204262
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:56:59 PM MYT
|
||||||
|
UPDATE AD_Field SET SeqNo=120,Updated=TO_DATE('2016-08-12 15:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204261
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:56:59 PM MYT
|
||||||
|
UPDATE AD_Field SET SeqNo=130,Updated=TO_DATE('2016-08-12 15:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204260
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:57:40 PM MYT
|
||||||
|
UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_DATE('2016-08-12 15:57:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204258
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:57:49 PM MYT
|
||||||
|
UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_DATE('2016-08-12 15:57:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204259
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2016-08-12 17:51:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200216
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Field SET SeqNo=110, IsDisplayed='Y', XPosition=2,Updated=TO_DATE('2016-08-15 11:24:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204263
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Field SET SeqNo=120,Updated=TO_DATE('2016-08-15 11:24:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204262
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Field SET SeqNo=130,Updated=TO_DATE('2016-08-15 11:24:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204261
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Field SET SeqNo=140,Updated=TO_DATE('2016-08-15 11:24:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204260
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_DATE('2016-08-15 11:25:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204263
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201608121400_Ticket_1006079.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
-- Aug 12, 2016 3:56:58 PM MYT
|
||||||
|
-- 1006079 Ease edit of OnLine Context Help
|
||||||
|
UPDATE AD_Field SET SeqNo=90, IsDisplayed='Y', XPosition=2,Updated=TO_TIMESTAMP('2016-08-12 15:56:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204258
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:56:58 PM MYT
|
||||||
|
UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=5,Updated=TO_TIMESTAMP('2016-08-12 15:56:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204259
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:56:59 PM MYT
|
||||||
|
UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2016-08-12 15:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204262
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:56:59 PM MYT
|
||||||
|
UPDATE AD_Field SET SeqNo=120,Updated=TO_TIMESTAMP('2016-08-12 15:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204261
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:56:59 PM MYT
|
||||||
|
UPDATE AD_Field SET SeqNo=130,Updated=TO_TIMESTAMP('2016-08-12 15:56:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204260
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:57:40 PM MYT
|
||||||
|
UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2016-08-12 15:57:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204258
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Aug 12, 2016 3:57:49 PM MYT
|
||||||
|
UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2016-08-12 15:57:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204259
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2016-08-12 17:51:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200216
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Field SET SeqNo=110, IsDisplayed='Y', XPosition=2,Updated=TO_TIMESTAMP('2016-08-15 11:24:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204263
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Field SET SeqNo=120,Updated=TO_TIMESTAMP('2016-08-15 11:24:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204262
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Field SET SeqNo=130,Updated=TO_TIMESTAMP('2016-08-15 11:24:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204261
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Field SET SeqNo=140,Updated=TO_TIMESTAMP('2016-08-15 11:24:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204260
|
||||||
|
;
|
||||||
|
|
||||||
|
UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2016-08-15 11:25:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204263
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201608121400_Ticket_1006079.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -59,4 +59,12 @@ public class MCtxHelp extends X_AD_CtxHelp {
|
||||||
super(ctx, rs, trxName);
|
super(ctx, rs, trxName);
|
||||||
} // MCtxHelp
|
} // MCtxHelp
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.compiere.model.PO#setClientOrg(int, int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setClientOrg(int AD_Client_ID, int AD_Org_ID) {
|
||||||
|
super.setClientOrg(AD_Client_ID, AD_Org_ID);
|
||||||
|
}
|
||||||
|
|
||||||
} // MCtxHelp
|
} // MCtxHelp
|
||||||
|
|
|
@ -1882,7 +1882,7 @@ public abstract class PO
|
||||||
|
|
||||||
public String get_Translation (String columnName, String AD_Language)
|
public String get_Translation (String columnName, String AD_Language)
|
||||||
{
|
{
|
||||||
return get_Translation(columnName, AD_Language, false);
|
return get_Translation(columnName, AD_Language, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1891,11 +1891,12 @@ public abstract class PO
|
||||||
* If there is no translation then it fallback to original value.
|
* If there is no translation then it fallback to original value.
|
||||||
* @param columnName
|
* @param columnName
|
||||||
* @param AD_Language
|
* @param AD_Language
|
||||||
* @boolean reload
|
* @param reload don't use cache, reload from DB
|
||||||
|
* @param fallback fallback to base if no translation found
|
||||||
* @return translated string
|
* @return translated string
|
||||||
* @throws IllegalArgumentException if columnName or AD_Language is null or model has multiple PK
|
* @throws IllegalArgumentException if columnName or AD_Language is null or model has multiple PK
|
||||||
*/
|
*/
|
||||||
public String get_Translation (String columnName, String AD_Language, boolean reload)
|
public String get_Translation (String columnName, String AD_Language, boolean reload, boolean fallback)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Check if columnName, AD_Language is valid or table support translation (has 1 PK) => error
|
// Check if columnName, AD_Language is valid or table support translation (has 1 PK) => error
|
||||||
|
@ -1933,7 +1934,7 @@ public abstract class PO
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// If no translation found or not translated, fallback to original:
|
// If no translation found or not translated, fallback to original:
|
||||||
if (retValue == null) {
|
if (retValue == null && fallback) {
|
||||||
Object val = get_Value(columnName);
|
Object val = get_Value(columnName);
|
||||||
retValue = (val != null ? val.toString() : null);
|
retValue = (val != null ? val.toString() : null);
|
||||||
}
|
}
|
||||||
|
@ -1949,13 +1950,33 @@ public abstract class PO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Translation of column
|
* Get Translation of column
|
||||||
* @param ctx context
|
|
||||||
* @param columnName
|
* @param columnName
|
||||||
* @return translation
|
|
||||||
*/
|
*/
|
||||||
public String get_Translation (String columnName)
|
public String get_Translation (String columnName)
|
||||||
{
|
{
|
||||||
return get_Translation(columnName, Env.getAD_Language(getCtx()));
|
return get_Translation(columnName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Translation of column
|
||||||
|
* @param columnName
|
||||||
|
* @param AD_Language
|
||||||
|
* @param reload don't use cache, reload from DB
|
||||||
|
*/
|
||||||
|
public String get_Translation (String columnName, String AD_Language, boolean reload)
|
||||||
|
{
|
||||||
|
return get_Translation(columnName, AD_Language, reload, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Translation of column
|
||||||
|
* @param columnName
|
||||||
|
* @param fallback fallback to base if no translation found
|
||||||
|
* @return translation
|
||||||
|
*/
|
||||||
|
public String get_Translation (String columnName, boolean fallback)
|
||||||
|
{
|
||||||
|
return get_Translation(columnName, Env.getAD_Language(getCtx()), false, fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,15 +23,21 @@ import org.adempiere.webui.window.WCtxHelpSuggestion;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
import org.compiere.model.I_AD_CtxHelpMsg;
|
import org.compiere.model.I_AD_CtxHelpMsg;
|
||||||
|
import org.compiere.model.I_AD_InfoWindow;
|
||||||
|
import org.compiere.model.I_AD_WF_Node;
|
||||||
|
import org.compiere.model.I_AD_Workflow;
|
||||||
import org.compiere.model.MCtxHelpMsg;
|
import org.compiere.model.MCtxHelpMsg;
|
||||||
import org.compiere.model.MForm;
|
import org.compiere.model.MForm;
|
||||||
import org.compiere.model.MInfoWindow;
|
import org.compiere.model.MInfoWindow;
|
||||||
import org.compiere.model.MProcess;
|
import org.compiere.model.MProcess;
|
||||||
import org.compiere.model.MTab;
|
import org.compiere.model.MTab;
|
||||||
import org.compiere.model.MTask;
|
import org.compiere.model.MTask;
|
||||||
|
import org.compiere.model.PO;
|
||||||
import org.compiere.model.X_AD_CtxHelp;
|
import org.compiere.model.X_AD_CtxHelp;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Language;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
import org.compiere.util.Util;
|
||||||
import org.compiere.wf.MWFNode;
|
import org.compiere.wf.MWFNode;
|
||||||
import org.compiere.wf.MWorkflow;
|
import org.compiere.wf.MWorkflow;
|
||||||
import org.zkoss.zk.au.out.AuScript;
|
import org.zkoss.zk.au.out.AuScript;
|
||||||
|
@ -227,11 +233,14 @@ public class HelpController
|
||||||
pnlContextHelp.setTitle(ctxType.equals(X_AD_CtxHelp.CTXTYPE_Home) ? Msg.getMsg(Env.getCtx(), "GettingStarted") : Msg.getMsg(Env.getCtx(), "HowTo"));
|
pnlContextHelp.setTitle(ctxType.equals(X_AD_CtxHelp.CTXTYPE_Home) ? Msg.getMsg(Env.getCtx(), "GettingStarted") : Msg.getMsg(Env.getCtx(), "HowTo"));
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("<html>\n<body>\n<div class=\"help-content\">\n");
|
sb.append("<div class=\"help-content\">\n");
|
||||||
|
|
||||||
MCtxHelpMsg ctxHelpMsg = getCtxHelpMsg(ctxType, recordId);
|
MCtxHelpMsg ctxHelpMsg = getCtxHelpMsg(ctxType, recordId);
|
||||||
String helpMsg, nameMsg, descMsg;
|
String helpMsg, nameMsg, descMsg;
|
||||||
|
Component previousPopup = (Component) pnlContextHelp.removeAttribute("contextMenu");
|
||||||
|
if (previousPopup != null)
|
||||||
|
previousPopup.detach();
|
||||||
|
pnlContextHelp.setContext((Popup)null);
|
||||||
if (ctxHelpMsg != null)
|
if (ctxHelpMsg != null)
|
||||||
{
|
{
|
||||||
sb.append(stripHtml(ctxHelpMsg.get_Translation(I_AD_CtxHelpMsg.COLUMNNAME_MsgText), false) + "<br>\n");
|
sb.append(stripHtml(ctxHelpMsg.get_Translation(I_AD_CtxHelpMsg.COLUMNNAME_MsgText), false) + "<br>\n");
|
||||||
|
@ -242,234 +251,373 @@ public class HelpController
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Component popup = (Component) pnlContextHelp.removeAttribute("contextMenu");
|
StringBuilder baseContent = new StringBuilder();
|
||||||
if (popup != null)
|
StringBuilder translatedContent = new StringBuilder();
|
||||||
popup.detach();
|
ContextHelpMenupopup popup = null;
|
||||||
pnlContextHelp.setContext((Popup)null);
|
|
||||||
sb.append("<i>(" + Msg.getMsg(Env.getCtx(), "NotAvailable") + ")</i>");
|
|
||||||
|
|
||||||
if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Tab))
|
if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Tab))
|
||||||
{
|
{
|
||||||
MTab tab = new MTab(Env.getCtx(), recordId, null);
|
MTab tab = new MTab(Env.getCtx(), recordId, null);
|
||||||
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Tab")) {
|
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Tab")) {
|
||||||
|
|
||||||
nameMsg = tab.get_Translation("Name");
|
nameMsg = tab.get_Translation("Name", false);
|
||||||
if (tab != null && nameMsg != null && nameMsg.length() != 0)
|
if (tab != null && nameMsg != null && nameMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
|
translatedContent.append("<p><strong>" + nameMsg + "</strong></p>\n");
|
||||||
|
|
||||||
descMsg = tab.get_Translation("Description");
|
descMsg = tab.get_Translation("Description", false);
|
||||||
if (descMsg != null && descMsg.length() != 0)
|
if (descMsg != null && descMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + descMsg + "</i>");
|
translatedContent.append("<p><em>" + descMsg + "</em></p>\n");
|
||||||
|
|
||||||
helpMsg = tab.get_Translation("Help");
|
helpMsg = tab.get_Translation("Help", false);
|
||||||
if (helpMsg != null && helpMsg.length() != 0)
|
if (helpMsg != null && helpMsg.length() != 0)
|
||||||
sb.append("<br><br>\n" + helpMsg);
|
translatedContent.append("<p>" + helpMsg + "</p>\n");
|
||||||
|
|
||||||
|
if (translatedContent.length() > 0)
|
||||||
|
{
|
||||||
|
translatedContent.insert(0, "<p>\n");
|
||||||
|
translatedContent.append("</p>");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
|
||||||
if (tab != null && tab.getName() != null
|
if (tab != null && tab.getName() != null
|
||||||
&& tab.getName().length() != 0) {
|
&& tab.getName().length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + tab.getName() + "</b>");
|
baseContent.append("<p><strong>" + tab.getName() + "</strong></p>\n");
|
||||||
|
|
||||||
if (tab.getDescription() != null
|
if (tab.getDescription() != null
|
||||||
&& tab.getDescription().length() != 0)
|
&& tab.getDescription().length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + tab.getDescription()
|
baseContent.append("<p><em>" + tab.getDescription() + "</em></p>\n");
|
||||||
+ "</i>");
|
|
||||||
|
|
||||||
if (tab.getHelp() != null
|
if (tab.getHelp() != null
|
||||||
&& tab.getHelp().length() != 0)
|
&& tab.getHelp().length() != 0)
|
||||||
sb.append("<br><br>\n" + tab.getHelp());
|
baseContent.append("<p>" + tab.getHelp() + "</p>\n");
|
||||||
}
|
|
||||||
|
if (baseContent.length() > 0)
|
||||||
|
{
|
||||||
|
baseContent.insert(0, "<p>\n");
|
||||||
|
baseContent.append("</p>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString());
|
||||||
|
|
||||||
|
popup = new ContextHelpMenupopup(tab, baseContent.toString(), translatedContent.toString());
|
||||||
|
pnlContextHelp.setAttribute("contextMenu", popup);
|
||||||
|
pnlContextHelp.setContext(popup);
|
||||||
|
popup.setPage(pnlContextHelp.getPage());
|
||||||
}
|
}
|
||||||
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Process))
|
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Process))
|
||||||
{
|
{
|
||||||
MProcess process = MProcess.get(Env.getCtx(), recordId);
|
MProcess process = MProcess.get(Env.getCtx(), recordId);
|
||||||
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Process")) {
|
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Process")) {
|
||||||
|
|
||||||
nameMsg = process.get_Translation("Name");
|
nameMsg = process.get_Translation("Name", false);
|
||||||
if (process != null && nameMsg != null
|
if (process != null && nameMsg != null
|
||||||
&& nameMsg.length() != 0)
|
&& nameMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
|
translatedContent.append("<p><strong>" + nameMsg + "</strong></p>\n");
|
||||||
|
|
||||||
descMsg = process.get_Translation("Description");
|
descMsg = process.get_Translation("Description", false);
|
||||||
if (descMsg != null && descMsg.length() != 0)
|
if (descMsg != null && descMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + descMsg + "</i>");
|
translatedContent.append("<p><em>" + descMsg + "</em></p>\n");
|
||||||
|
|
||||||
helpMsg = process.get_Translation("Help");
|
helpMsg = process.get_Translation("Help", false);
|
||||||
if (helpMsg != null && helpMsg.length() != 0)
|
if (helpMsg != null && helpMsg.length() != 0)
|
||||||
sb.append("<br><br>\n" + helpMsg);
|
translatedContent.append("<p>" + helpMsg + "</p>\n");
|
||||||
|
|
||||||
} else {
|
if (translatedContent.length() > 0)
|
||||||
|
{
|
||||||
if (process != null && process.getName() != null
|
translatedContent.insert(0, "<p>\n");
|
||||||
&& process.getName().length() != 0)
|
translatedContent.append("</p>");
|
||||||
sb.append("<br><br>\n<b>" + process.getName() + "</b>");
|
}
|
||||||
|
|
||||||
if (process.getDescription() != null
|
|
||||||
&& process.getDescription().length() != 0)
|
|
||||||
sb.append("<br><br>\n<i>" + process.getDescription()
|
|
||||||
+ "</i>");
|
|
||||||
|
|
||||||
if (process.getHelp() != null
|
|
||||||
&& process.getHelp().length() != 0)
|
|
||||||
sb.append("<br><br>\n" + process.getHelp());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process != null && process.getName() != null
|
||||||
|
&& process.getName().length() != 0)
|
||||||
|
baseContent.append("<p><strong>" + process.getName() + "</strong></p>\n");
|
||||||
|
|
||||||
|
if (process.getDescription() != null
|
||||||
|
&& process.getDescription().length() != 0)
|
||||||
|
baseContent.append("<p><em>" + process.getDescription() + "</em></p>\n");
|
||||||
|
|
||||||
|
if (process.getHelp() != null
|
||||||
|
&& process.getHelp().length() != 0)
|
||||||
|
baseContent.append("<p>" + process.getHelp() + "</p>\n");
|
||||||
|
|
||||||
|
if (baseContent.length() > 0)
|
||||||
|
{
|
||||||
|
baseContent.insert(0, "<p>\n");
|
||||||
|
baseContent.append("</p>");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString());
|
||||||
|
|
||||||
|
popup = new ContextHelpMenupopup(process, baseContent.toString(), translatedContent.toString());
|
||||||
|
pnlContextHelp.setAttribute("contextMenu", popup);
|
||||||
|
pnlContextHelp.setContext(popup);
|
||||||
|
popup.setPage(pnlContextHelp.getPage());
|
||||||
}
|
}
|
||||||
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Form))
|
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Form))
|
||||||
{
|
{
|
||||||
MForm form = new MForm(Env.getCtx(), recordId, null);
|
MForm form = new MForm(Env.getCtx(), recordId, null);
|
||||||
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Form")) {
|
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Form")) {
|
||||||
|
|
||||||
nameMsg = form.get_Translation("Name");
|
nameMsg = form.get_Translation("Name",false);
|
||||||
|
|
||||||
if (form != null && nameMsg != null
|
if (form != null && nameMsg != null
|
||||||
&& nameMsg.length() != 0)
|
&& nameMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
|
translatedContent.append("<p><strong>" + nameMsg + "</strong></p>\n");
|
||||||
|
|
||||||
descMsg = form.get_Translation("Description");
|
descMsg = form.get_Translation("Description",false);
|
||||||
if (descMsg != null && descMsg.length() != 0)
|
if (descMsg != null && descMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + descMsg + "</i>");
|
translatedContent.append("<p><em>" + descMsg + "</em></p>\n");
|
||||||
|
|
||||||
helpMsg = form.get_Translation("Help");
|
helpMsg = form.get_Translation("Help",false);
|
||||||
if (helpMsg != null && helpMsg.length() != 0)
|
if (helpMsg != null && helpMsg.length() != 0)
|
||||||
sb.append("<br><br>\n" + helpMsg);
|
translatedContent.append("<p>" + helpMsg + "</p>\n");
|
||||||
|
|
||||||
} else {
|
if (translatedContent.length() > 0)
|
||||||
|
{
|
||||||
|
translatedContent.insert(0, "<p>\n");
|
||||||
|
translatedContent.append("</p>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (form != null && form.getName() != null
|
if (form != null && form.getName() != null
|
||||||
&& form.getName().length() != 0) {
|
&& form.getName().length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + form.getName() + "</b>");
|
baseContent.append("<p><strong>" + form.getName() + "</strong></p>\n");
|
||||||
|
|
||||||
if (form.getDescription() != null
|
if (form.getDescription() != null
|
||||||
&& form.getDescription().length() != 0)
|
&& form.getDescription().length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + form.getDescription()
|
baseContent.append("<p><em>" + form.getDescription() + "</em></p>\n");
|
||||||
+ "</i>");
|
|
||||||
|
|
||||||
if (form.getHelp() != null
|
if (form.getHelp() != null
|
||||||
&& form.getHelp().length() != 0)
|
&& form.getHelp().length() != 0)
|
||||||
sb.append("<br><br>\n" + form.getHelp());
|
baseContent.append("<p>" + form.getHelp() + "</p>\n");
|
||||||
|
|
||||||
|
if (baseContent.length() > 0)
|
||||||
|
{
|
||||||
|
baseContent.insert(0, "<p>\n");
|
||||||
|
baseContent.append("</p>");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString());
|
||||||
|
|
||||||
|
popup = new ContextHelpMenupopup(form, baseContent.toString(), translatedContent.toString());
|
||||||
|
pnlContextHelp.setAttribute("contextMenu", popup);
|
||||||
|
pnlContextHelp.setContext(popup);
|
||||||
|
popup.setPage(pnlContextHelp.getPage());
|
||||||
}
|
}
|
||||||
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Info))
|
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Info))
|
||||||
{
|
{
|
||||||
MInfoWindow info = new MInfoWindow(Env.getCtx(), recordId, null);
|
MInfoWindow info = new MInfoWindow(Env.getCtx(), recordId, null);
|
||||||
if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) {
|
if (!Env.isBaseLanguage(Env.getCtx(), I_AD_InfoWindow.Table_Name)) {
|
||||||
|
nameMsg = info.get_Translation("Name",false);
|
||||||
nameMsg = info.get_Translation("Name");
|
|
||||||
if (info != null && nameMsg != null
|
if (info != null && nameMsg != null
|
||||||
&& nameMsg.length() != 0) {
|
&& nameMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
|
translatedContent.append("<p><strong>" + nameMsg + "</strong></p>\n");
|
||||||
|
|
||||||
descMsg = info.get_Translation("Description");
|
descMsg = info.get_Translation("Description",false);
|
||||||
if (descMsg != null && descMsg.length() != 0)
|
if (descMsg != null && descMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + descMsg + "</i>");
|
translatedContent.append("<p><em>" + descMsg + "</em></p>\n");
|
||||||
|
|
||||||
helpMsg = info.get_Translation("Help");
|
helpMsg = info.get_Translation("Help",false);
|
||||||
if (helpMsg != null && helpMsg.length() != 0)
|
if (helpMsg != null && helpMsg.length() != 0)
|
||||||
sb.append("<br><br>\n" + helpMsg);
|
translatedContent.append("<p>" + helpMsg + "</p>\n");
|
||||||
|
|
||||||
|
if (translatedContent.length() > 0)
|
||||||
|
{
|
||||||
|
translatedContent.insert(0, "<p>\n");
|
||||||
|
translatedContent.append("</p>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
if (info != null && info.getName() != null
|
if (info != null && info.getName() != null
|
||||||
&& info.getName().length() != 0)
|
&& info.getName().length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + info.getName() + "</b>");
|
baseContent.append("<p><strong>" + info.getName() + "</strong></p>\n");
|
||||||
|
|
||||||
if (info.getDescription() != null
|
if (info.getDescription() != null
|
||||||
&& info.getDescription().length() != 0)
|
&& info.getDescription().length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + info.getDescription()
|
baseContent.append("<p><em>" + info.getDescription() + "</em></p>\n");
|
||||||
+ "</i>");
|
|
||||||
|
|
||||||
if (info.getHelp() != null
|
if (info.getHelp() != null
|
||||||
&& info.getHelp().length() != 0)
|
&& info.getHelp().length() != 0)
|
||||||
sb.append("<br><br>\n" + info.getHelp());
|
baseContent.append("<p>" + info.getHelp() + "</p>\n");
|
||||||
|
|
||||||
|
if (baseContent.length() > 0)
|
||||||
|
{
|
||||||
|
baseContent.insert(0, "<p>\n");
|
||||||
|
baseContent.append("</p>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString());
|
||||||
|
|
||||||
|
popup = new ContextHelpMenupopup(info, baseContent.toString(), translatedContent.toString());
|
||||||
|
pnlContextHelp.setAttribute("contextMenu", popup);
|
||||||
|
pnlContextHelp.setContext(popup);
|
||||||
|
popup.setPage(pnlContextHelp.getPage());
|
||||||
}
|
}
|
||||||
}
|
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Workflow))
|
||||||
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Workflow)) {
|
{
|
||||||
MWorkflow workflow = MWorkflow.get(Env.getCtx(), recordId);
|
MWorkflow workflow = MWorkflow.get(Env.getCtx(), recordId);
|
||||||
|
if (!Env.isBaseLanguage(Env.getCtx(), I_AD_Workflow.Table_Name)) {
|
||||||
boolean trl = !Env.getLoginLanguage(Env.getCtx()).isBaseLanguage();
|
nameMsg = workflow.get_Translation("Name", false);
|
||||||
|
|
||||||
nameMsg = workflow.getName(trl);
|
|
||||||
|
|
||||||
if (workflow != null && nameMsg != null
|
if (workflow != null && nameMsg != null
|
||||||
&& nameMsg.length() != 0) {
|
&& nameMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
|
translatedContent.append("<p><strong>" + nameMsg + "</strong></p>\n");
|
||||||
|
|
||||||
descMsg = workflow.getDescription(trl);
|
descMsg = workflow.get_Translation("Description",false);
|
||||||
if (descMsg != null && descMsg.length() != 0)
|
if (descMsg != null && descMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + descMsg + "</i>");
|
translatedContent.append("<p><em>" + descMsg + "</em></p>\n");
|
||||||
|
|
||||||
helpMsg = workflow.getHelp(trl);
|
helpMsg = workflow.get_Translation("Help", false);
|
||||||
if (helpMsg != null && helpMsg.length() != 0)
|
if (helpMsg != null && helpMsg.length() != 0)
|
||||||
sb.append("<br><br>\n" + helpMsg);
|
translatedContent.append("<p>" + helpMsg + "</p>\n");
|
||||||
|
|
||||||
|
if (translatedContent.length() > 0)
|
||||||
|
{
|
||||||
|
translatedContent.insert(0, "<p>\n");
|
||||||
|
translatedContent.append("</p>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Task)) {
|
if (workflow != null && workflow.getName() != null
|
||||||
|
&& workflow.getName().length() != 0)
|
||||||
|
baseContent.append("<p><strong>" + workflow.getName() + "</strong></p>\n");
|
||||||
|
|
||||||
|
if (workflow.getDescription() != null
|
||||||
|
&& workflow.getDescription().length() != 0)
|
||||||
|
baseContent.append("<p><em>" + workflow.getDescription() + "</em></p>\n");
|
||||||
|
|
||||||
|
if (workflow.getHelp() != null
|
||||||
|
&& workflow.getHelp().length() != 0)
|
||||||
|
baseContent.append("<p>" + workflow.getHelp() + "</p>\n");
|
||||||
|
|
||||||
|
if (baseContent.length() > 0)
|
||||||
|
{
|
||||||
|
baseContent.insert(0, "<p>\n");
|
||||||
|
baseContent.append("</p>");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString());
|
||||||
|
|
||||||
|
popup = new ContextHelpMenupopup(workflow, baseContent.toString(), translatedContent.toString());
|
||||||
|
pnlContextHelp.setAttribute("contextMenu", popup);
|
||||||
|
pnlContextHelp.setContext(popup);
|
||||||
|
popup.setPage(pnlContextHelp.getPage());
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Task))
|
||||||
|
{
|
||||||
MTask task = new MTask(Env.getCtx(), recordId, null);
|
MTask task = new MTask(Env.getCtx(), recordId, null);
|
||||||
|
|
||||||
if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) {
|
if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) {
|
||||||
|
|
||||||
nameMsg = task.get_Translation("Name");
|
nameMsg = task.get_Translation("Name",false);
|
||||||
|
|
||||||
if (task != null && nameMsg != null
|
if (task != null && nameMsg != null
|
||||||
&& nameMsg.length() != 0) {
|
&& nameMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
|
translatedContent.append("<p><strong>" + nameMsg + "</strong></p>\n");
|
||||||
|
|
||||||
descMsg = task.get_Translation("Description");
|
descMsg = task.get_Translation("Description",false);
|
||||||
if (descMsg != null && descMsg.length() != 0)
|
if (descMsg != null && descMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + descMsg + "</i>");
|
translatedContent.append("<p><em>" + descMsg + "</em></p>\n");
|
||||||
|
|
||||||
helpMsg = task.get_Translation("Help");
|
helpMsg = task.get_Translation("Help",false);
|
||||||
if (helpMsg != null && helpMsg.length() != 0)
|
if (helpMsg != null && helpMsg.length() != 0)
|
||||||
sb.append("<br><br>\n" + helpMsg);
|
translatedContent.append("<p>" + helpMsg + "</p>\n");
|
||||||
|
|
||||||
|
if (translatedContent.length() > 0)
|
||||||
|
{
|
||||||
|
translatedContent.insert(0, "<p>\n");
|
||||||
|
translatedContent.append("</p>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
|
||||||
if (task != null && task.getName() != null
|
if (task != null && task.getName() != null
|
||||||
&& task.getName().length() != 0) {
|
&& task.getName().length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + task.getName() + "</b>");
|
baseContent.append("<p><strong>" + task.getName() + "</strong></p>\n");
|
||||||
|
|
||||||
if (task.getDescription() != null
|
if (task.getDescription() != null
|
||||||
&& task.getDescription().length() != 0)
|
&& task.getDescription().length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + task.getDescription()
|
baseContent.append("<p><em>" + task.getDescription() + "</em></p>\n");
|
||||||
+ "</i>");
|
|
||||||
|
|
||||||
if (task.getHelp() != null
|
if (task.getHelp() != null
|
||||||
&& task.getHelp().length() != 0)
|
&& task.getHelp().length() != 0)
|
||||||
sb.append("<br><br>\n" + task.getHelp());
|
baseContent.append("<p>" + task.getHelp() + "</p>\n");
|
||||||
|
|
||||||
|
if (baseContent.length() > 0)
|
||||||
|
{
|
||||||
|
baseContent.insert(0, "<p>\n");
|
||||||
|
baseContent.append("</p>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString());
|
||||||
|
|
||||||
|
popup = new ContextHelpMenupopup(task, baseContent.toString(), translatedContent.toString());
|
||||||
|
pnlContextHelp.setAttribute("contextMenu", popup);
|
||||||
|
pnlContextHelp.setContext(popup);
|
||||||
|
popup.setPage(pnlContextHelp.getPage());
|
||||||
}
|
}
|
||||||
} else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Node)) {
|
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Node))
|
||||||
|
{
|
||||||
MWFNode node = MWFNode.get(Env.getCtx(), recordId);
|
MWFNode node = MWFNode.get(Env.getCtx(), recordId);
|
||||||
|
|
||||||
boolean trl = !Env.getLoginLanguage(Env.getCtx()).isBaseLanguage();
|
if (!Env.isBaseLanguage(Env.getCtx(), I_AD_WF_Node.Table_Name)) {
|
||||||
|
nameMsg = node.get_Translation("Name", false);
|
||||||
nameMsg = node.getName(trl);
|
|
||||||
|
|
||||||
if (node != null && nameMsg != null
|
if (node != null && nameMsg != null
|
||||||
&& nameMsg.length() != 0) {
|
&& nameMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
|
translatedContent.append("<p><strong>" + nameMsg + "</strong></p>\n");
|
||||||
|
|
||||||
descMsg = node.getDescription(trl);
|
descMsg = node.get_Translation("Description",false);
|
||||||
if (descMsg != null && descMsg.length() != 0)
|
if (descMsg != null && descMsg.length() != 0)
|
||||||
sb.append("<br><br>\n<i>" + descMsg + "</i>");
|
translatedContent.append("<p><em>" + descMsg + "</em></p>\n");
|
||||||
|
|
||||||
helpMsg = node.getHelp(trl);
|
helpMsg = node.get_Translation("Help", false);
|
||||||
if (helpMsg != null && helpMsg.length() != 0)
|
if (helpMsg != null && helpMsg.length() != 0)
|
||||||
sb.append("<br><br>\n" + helpMsg);
|
translatedContent.append("<p>" + helpMsg + "</p>\n");
|
||||||
}
|
|
||||||
|
|
||||||
|
if (translatedContent.length() > 0)
|
||||||
|
{
|
||||||
|
translatedContent.insert(0, "<p>\n");
|
||||||
|
translatedContent.append("</p>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("</div>\n</body>\n</html>");
|
if (node != null && node.getName() != null
|
||||||
|
&& node.getName().length() != 0)
|
||||||
|
baseContent.append("<p><strong>" + node.getName() + "</strong></p>\n");
|
||||||
|
|
||||||
|
if (node.getDescription() != null
|
||||||
|
&& node.getDescription().length() != 0)
|
||||||
|
baseContent.append("<p><em>" + node.getDescription() + "</em></p>\n");
|
||||||
|
|
||||||
|
if (node.getHelp() != null
|
||||||
|
&& node.getHelp().length() != 0)
|
||||||
|
baseContent.append("<p>" + node.getHelp() + "</p>\n");
|
||||||
|
|
||||||
|
if (baseContent.length() > 0)
|
||||||
|
{
|
||||||
|
baseContent.insert(0, "<p>\n");
|
||||||
|
baseContent.append("</p>");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString());
|
||||||
|
|
||||||
|
popup = new ContextHelpMenupopup(node, baseContent.toString(), translatedContent.toString());
|
||||||
|
pnlContextHelp.setAttribute("contextMenu", popup);
|
||||||
|
pnlContextHelp.setContext(popup);
|
||||||
|
popup.setPage(pnlContextHelp.getPage());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
translatedContent.append("<p><em>(" + Msg.getMsg(Env.getCtx(), "NotAvailable") + ")</em></p>");
|
||||||
|
baseContent.append("<p><em>(" + Msg.getMsg(Language.getBaseAD_Language(), "NotAvailable") + ")</em></p>");
|
||||||
|
sb.append(translatedContent.toString());
|
||||||
|
popup = new ContextHelpMenupopup(null, baseContent.toString(), translatedContent.toString());
|
||||||
|
pnlContextHelp.setAttribute("contextMenu", popup);
|
||||||
|
pnlContextHelp.setContext(popup);
|
||||||
|
popup.setPage(pnlContextHelp.getPage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append("</div>");
|
||||||
|
|
||||||
htmlContextHelp.setContent(sb.toString());
|
htmlContextHelp.setContent(sb.toString());
|
||||||
}
|
}
|
||||||
|
@ -558,11 +706,25 @@ public class HelpController
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 5957266862632509358L;
|
private static final long serialVersionUID = 5957266862632509358L;
|
||||||
private MCtxHelpMsg ctxHelpMsg;
|
private MCtxHelpMsg ctxHelpMsg;
|
||||||
|
private PO po;
|
||||||
|
private String baseContent, translatedContent;
|
||||||
|
|
||||||
private ContextHelpMenupopup(MCtxHelpMsg ctxHelpMsg) {
|
private ContextHelpMenupopup(MCtxHelpMsg ctxHelpMsg) {
|
||||||
super();
|
super();
|
||||||
this.ctxHelpMsg = ctxHelpMsg;
|
this.ctxHelpMsg = ctxHelpMsg;
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ContextHelpMenupopup(PO po, String baseContent, String translatedContent) {
|
||||||
|
this.po = po;
|
||||||
|
this.baseContent = baseContent;
|
||||||
|
this.translatedContent = translatedContent;
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
Menuitem item = new Menuitem();
|
Menuitem item = new Menuitem();
|
||||||
if (ctxHelpMsg.getAD_Client_ID() == Env.getAD_Client_ID(Env.getCtx())) {
|
if (ctxHelpMsg != null && ctxHelpMsg.getAD_Client_ID() == Env.getAD_Client_ID(Env.getCtx())) {
|
||||||
item.setLabel(Msg.getMsg(Env.getCtx(), "edit"));
|
item.setLabel(Msg.getMsg(Env.getCtx(), "edit"));
|
||||||
} else {
|
} else {
|
||||||
item.setLabel(Msg.getElement(Env.getCtx(), "AD_CtxHelpSuggestion_ID"));
|
item.setLabel(Msg.getElement(Env.getCtx(), "AD_CtxHelpSuggestion_ID"));
|
||||||
|
@ -570,9 +732,14 @@ public class HelpController
|
||||||
appendChild(item);
|
appendChild(item);
|
||||||
item.addEventListener(Events.ON_CLICK, this);
|
item.addEventListener(Events.ON_CLICK, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
WCtxHelpSuggestion suggestion = new WCtxHelpSuggestion(ctxHelpMsg);
|
WCtxHelpSuggestion suggestion = null;
|
||||||
|
if (ctxHelpMsg != null)
|
||||||
|
suggestion = new WCtxHelpSuggestion(ctxHelpMsg);
|
||||||
|
else
|
||||||
|
suggestion = new WCtxHelpSuggestion(po, baseContent, translatedContent);
|
||||||
suggestion.setPage(this.getPage());
|
suggestion.setPage(this.getPage());
|
||||||
suggestion.doHighlighted();
|
suggestion.doHighlighted();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,29 @@
|
||||||
*/
|
*/
|
||||||
package org.adempiere.webui.window;
|
package org.adempiere.webui.window;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.adempiere.webui.component.ConfirmPanel;
|
import org.adempiere.webui.component.ConfirmPanel;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.compiere.model.I_AD_CtxHelpMsg;
|
import org.compiere.model.I_AD_CtxHelpMsg;
|
||||||
|
import org.compiere.model.MCtxHelp;
|
||||||
import org.compiere.model.MCtxHelpMsg;
|
import org.compiere.model.MCtxHelpMsg;
|
||||||
import org.compiere.model.MCtxHelpSuggestion;
|
import org.compiere.model.MCtxHelpSuggestion;
|
||||||
|
import org.compiere.model.MForm;
|
||||||
|
import org.compiere.model.MInfoWindow;
|
||||||
|
import org.compiere.model.MProcess;
|
||||||
|
import org.compiere.model.MTab;
|
||||||
|
import org.compiere.model.MTask;
|
||||||
|
import org.compiere.model.PO;
|
||||||
|
import org.compiere.model.X_AD_CtxHelp;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
import org.compiere.util.Trx;
|
||||||
|
import org.compiere.util.Util;
|
||||||
|
import org.compiere.wf.MWFNode;
|
||||||
|
import org.compiere.wf.MWorkflow;
|
||||||
import org.zkforge.ckez.CKeditor;
|
import org.zkforge.ckez.CKeditor;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
@ -39,6 +54,12 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
||||||
|
|
||||||
private CKeditor helpTextbox;
|
private CKeditor helpTextbox;
|
||||||
|
|
||||||
|
private PO po;
|
||||||
|
|
||||||
|
private String baseContent;
|
||||||
|
|
||||||
|
private String translatedContent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default constructor
|
* default constructor
|
||||||
*/
|
*/
|
||||||
|
@ -47,6 +68,13 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
||||||
layout();
|
layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WCtxHelpSuggestion(PO po, String baseContent, String translatedContent) {
|
||||||
|
this.po = po;
|
||||||
|
this.baseContent = baseContent;
|
||||||
|
this.translatedContent = translatedContent;
|
||||||
|
layout();
|
||||||
|
}
|
||||||
|
|
||||||
private void layout() {
|
private void layout() {
|
||||||
Borderlayout borderlayout = new Borderlayout();
|
Borderlayout borderlayout = new Borderlayout();
|
||||||
appendChild(borderlayout);
|
appendChild(borderlayout);
|
||||||
|
@ -77,7 +105,7 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
||||||
cell = new Cell();
|
cell = new Cell();
|
||||||
cell.setWidth("85%");
|
cell.setWidth("85%");
|
||||||
cell.setAlign("left");
|
cell.setAlign("left");
|
||||||
cell.appendChild(new Label(ctxHelpMsg.getAD_CtxHelp().getName()));
|
cell.appendChild(new Label(ctxHelpMsg != null ? ctxHelpMsg.getAD_CtxHelp().getName() : getContextHelpName(po)));
|
||||||
hlayout.appendChild(cell);
|
hlayout.appendChild(cell);
|
||||||
vlayout.appendChild(hlayout);
|
vlayout.appendChild(hlayout);
|
||||||
|
|
||||||
|
@ -94,7 +122,7 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
||||||
helpTextbox = new CKeditor();
|
helpTextbox = new CKeditor();
|
||||||
helpTextbox.setCustomConfigurationsPath("/js/ckeditor/config-min.js");
|
helpTextbox.setCustomConfigurationsPath("/js/ckeditor/config-min.js");
|
||||||
helpTextbox.setToolbar("MyToolbar");
|
helpTextbox.setToolbar("MyToolbar");
|
||||||
String msgText = ctxHelpMsg.get_Translation("MsgText");
|
String msgText = ctxHelpMsg != null ? ctxHelpMsg.get_Translation("MsgText") : (Util.isEmpty(translatedContent) ? baseContent : translatedContent);
|
||||||
msgText = removeHeaderTag(msgText);
|
msgText = removeHeaderTag(msgText);
|
||||||
helpTextbox.setValue(msgText);
|
helpTextbox.setValue(msgText);
|
||||||
helpTextbox.setWidth("99%");
|
helpTextbox.setWidth("99%");
|
||||||
|
@ -123,7 +151,7 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
||||||
this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||||
this.setSizable(true);
|
this.setSizable(true);
|
||||||
|
|
||||||
if (ctxHelpMsg.getAD_Client_ID() == Env.getAD_Client_ID(Env.getCtx())) {
|
if (ctxHelpMsg != null && ctxHelpMsg.getAD_Client_ID() == Env.getAD_Client_ID(Env.getCtx())) {
|
||||||
setTitle(Msg.getMsg(Env.getCtx(), "edit") + " " + Msg.getElement(Env.getCtx(), "AD_CtxHelpMsg_ID"));
|
setTitle(Msg.getMsg(Env.getCtx(), "edit") + " " + Msg.getElement(Env.getCtx(), "AD_CtxHelpMsg_ID"));
|
||||||
} else {
|
} else {
|
||||||
setTitle(Msg.getElement(Env.getCtx(), "AD_CtxHelpSuggestion_ID"));
|
setTitle(Msg.getElement(Env.getCtx(), "AD_CtxHelpSuggestion_ID"));
|
||||||
|
@ -140,21 +168,90 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSave() {
|
private void onSave() {
|
||||||
if (ctxHelpMsg.getAD_Client_ID() == Env.getAD_Client_ID(Env.getCtx())) {
|
String trxName = Trx.createTrxName();
|
||||||
|
Trx trx = Trx.get(trxName, true);
|
||||||
|
try {
|
||||||
|
trx.start();
|
||||||
|
onSave0(trx);
|
||||||
|
trx.commit(true);
|
||||||
|
if (ctxHelpMsg != null && ctxHelpMsg.getAD_Client_ID() == Env.getAD_Client_ID(Env.getCtx())) {
|
||||||
|
FDialog.info(0, this, "Your changes have been saved.");
|
||||||
|
} else {
|
||||||
|
FDialog.info(0, this, "Your suggestions have been submitted for review");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
trx.rollback();
|
||||||
|
if (e instanceof RuntimeException)
|
||||||
|
throw (RuntimeException)e;
|
||||||
|
else
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
trx.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onSave0(Trx trx) {
|
||||||
|
if (ctxHelpMsg != null && ctxHelpMsg.getAD_Client_ID() == Env.getAD_Client_ID(Env.getCtx())) {
|
||||||
if (Env.isBaseLanguage(Env.getCtx(), I_AD_CtxHelpMsg.Table_Name)) {
|
if (Env.isBaseLanguage(Env.getCtx(), I_AD_CtxHelpMsg.Table_Name)) {
|
||||||
ctxHelpMsg.setMsgText(helpTextbox.getValue());
|
ctxHelpMsg.setMsgText(helpTextbox.getValue());
|
||||||
ctxHelpMsg.saveEx();
|
ctxHelpMsg.saveEx(trx.getTrxName());
|
||||||
}
|
}
|
||||||
StringBuilder update = new StringBuilder("UPDATE AD_CtxHelpMsg_Trl SET MsgText=? ");
|
StringBuilder update = new StringBuilder("UPDATE AD_CtxHelpMsg_Trl SET MsgText=? ");
|
||||||
update.append("WHERE AD_CtxHelpMsg_ID=? AND AD_Client_ID=? AND AD_Language=? AND IsActive='Y' ");
|
update.append("WHERE AD_CtxHelpMsg_ID=? AND AD_Client_ID=? AND AD_Language=? AND IsActive='Y' ");
|
||||||
Object[] params = new Object[]{helpTextbox.getValue(), ctxHelpMsg.get_ID(), ctxHelpMsg.getAD_Client_ID(), Env.getAD_Language(Env.getCtx())};
|
Object[] params = new Object[]{helpTextbox.getValue(), ctxHelpMsg.get_ID(), ctxHelpMsg.getAD_Client_ID(), Env.getAD_Language(Env.getCtx())};
|
||||||
DB.executeUpdateEx(update.toString(), params, null);
|
DB.executeUpdateEx(update.toString(), params, trx.getTrxName());
|
||||||
FDialog.info(0, this, "Your changes have been saved.");
|
|
||||||
} else {
|
} else {
|
||||||
MCtxHelpSuggestion suggestion = new MCtxHelpSuggestion(Env.getCtx(), 0, null);
|
MCtxHelpSuggestion suggestion = new MCtxHelpSuggestion(Env.getCtx(), 0, trx.getTrxName());
|
||||||
suggestion.setClientOrg(0, 0);
|
suggestion.setClientOrg(0, 0);
|
||||||
|
if (ctxHelpMsg != null) {
|
||||||
suggestion.setAD_CtxHelp_ID(ctxHelpMsg.getAD_CtxHelp_ID());
|
suggestion.setAD_CtxHelp_ID(ctxHelpMsg.getAD_CtxHelp_ID());
|
||||||
suggestion.setAD_CtxHelpMsg_ID(ctxHelpMsg.get_ID());
|
suggestion.setAD_CtxHelpMsg_ID(ctxHelpMsg.get_ID());
|
||||||
|
} else {
|
||||||
|
MCtxHelp ctxHelp = new MCtxHelp(Env.getCtx(), 0, trx.getTrxName());
|
||||||
|
setContextHelpInfo(po, ctxHelp);
|
||||||
|
ctxHelp.setClientOrg(0, 0);
|
||||||
|
ctxHelp.saveEx();
|
||||||
|
|
||||||
|
if (po != null) {
|
||||||
|
po.set_ValueOfColumn("AD_CtxHelp_ID", ctxHelp.getAD_CtxHelp_ID());
|
||||||
|
po.saveEx(trx.getTrxName());
|
||||||
|
}
|
||||||
|
|
||||||
|
suggestion.setAD_CtxHelp_ID(ctxHelp.getAD_CtxHelp_ID());
|
||||||
|
MCtxHelpMsg msg = new MCtxHelpMsg(Env.getCtx(), 0, trx.getTrxName());
|
||||||
|
msg.setAD_CtxHelp_ID(ctxHelp.getAD_CtxHelp_ID());
|
||||||
|
msg.setClientOrg(0, 0);
|
||||||
|
msg.setMsgText(baseContent);
|
||||||
|
msg.saveEx();
|
||||||
|
suggestion.setAD_CtxHelpMsg_ID(msg.getAD_CtxHelpMsg_ID());
|
||||||
|
if (!Util.isEmpty(translatedContent) && !Env.isBaseLanguage(Env.getCtx(), I_AD_CtxHelpMsg.Table_Name)) {
|
||||||
|
int id = DB.getSQLValueEx(trx.getTrxName(), "SELECT AD_CtxHelpMsg_ID FROM AD_CtxHelpMsg_Trl WHERE AD_CtxHelpMsg_ID=? AND AD_Client_ID=? " +
|
||||||
|
"AND IsActive='Y' AND AD_Language=?", msg.getAD_CtxHelpMsg_ID(), 0, Env.getAD_Language(Env.getCtx()));
|
||||||
|
if (id == msg.getAD_CtxHelpMsg_ID()) {
|
||||||
|
List<Object> params = new ArrayList<Object>();
|
||||||
|
StringBuilder update = new StringBuilder("UPDATE AD_CtxHelpMsg_Trl SET MsgText=? ");
|
||||||
|
update.append("WHERE AD_CtxHelpMsg_ID=? AND AD_Language=? AND AD_Client_ID=?");
|
||||||
|
params.add(translatedContent);
|
||||||
|
params.add(id);
|
||||||
|
params.add(Env.getAD_Language(Env.getCtx()));
|
||||||
|
params.add(0);
|
||||||
|
DB.executeUpdateEx(update.toString(), params.toArray(), trx.getTrxName());
|
||||||
|
} else {
|
||||||
|
StringBuilder insert = new StringBuilder("Insert Into AD_CtxHelpMsg_Trl (AD_Client_ID, AD_Org_ID, AD_CtxHelpMsg_ID, IsActive, IsTranslated, AD_Language, MsgText,");
|
||||||
|
insert.append("Created, CreatedBy, Updated, UpdatedBy, AD_CtxHelpMsg_Trl_UU)")
|
||||||
|
.append(" Values (?, ?, ?, 'Y', 'N', ?, ?, now(), ?, now(), ?, generate_uuid()) ");
|
||||||
|
List<Object> params = new ArrayList<Object>();
|
||||||
|
params.add(0);
|
||||||
|
params.add(0);
|
||||||
|
params.add(msg.getAD_CtxHelpMsg_ID());
|
||||||
|
params.add(Env.getAD_Language(Env.getCtx()));
|
||||||
|
params.add(translatedContent);
|
||||||
|
params.add(Env.getAD_User_ID(Env.getCtx()));
|
||||||
|
params.add(Env.getAD_User_ID(Env.getCtx()));
|
||||||
|
DB.executeUpdateEx(insert.toString(), params.toArray(), trx.getTrxName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
suggestion.setAD_Language(Env.getAD_Language(Env.getCtx()));
|
suggestion.setAD_Language(Env.getAD_Language(Env.getCtx()));
|
||||||
suggestion.setAD_User_ID(Env.getAD_User_ID(Env.getCtx()));
|
suggestion.setAD_User_ID(Env.getAD_User_ID(Env.getCtx()));
|
||||||
suggestion.setAD_UserClient_ID(Env.getAD_Client_ID(Env.getCtx()));
|
suggestion.setAD_UserClient_ID(Env.getAD_Client_ID(Env.getCtx()));
|
||||||
|
@ -164,7 +261,6 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
||||||
suggestion.setIsSaveAsTenantCustomization(false);
|
suggestion.setIsSaveAsTenantCustomization(false);
|
||||||
|
|
||||||
suggestion.saveEx();
|
suggestion.saveEx();
|
||||||
FDialog.info(0, this, "Your suggestions have been submitted for review");
|
|
||||||
}
|
}
|
||||||
this.detach();
|
this.detach();
|
||||||
}
|
}
|
||||||
|
@ -179,4 +275,127 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
|
||||||
.replace("</head>", "");
|
.replace("</head>", "");
|
||||||
return htmlString;
|
return htmlString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getContextHelpName(PO po) {
|
||||||
|
if (po == null) {
|
||||||
|
return "Home";
|
||||||
|
} else if (po instanceof MTab) {
|
||||||
|
MTab tab = (MTab) po;
|
||||||
|
return tab.getAD_Window().getName() + " / " + tab.getName();
|
||||||
|
} else if (po instanceof MProcess) {
|
||||||
|
MProcess process = (MProcess) po;
|
||||||
|
String name = process.getName();
|
||||||
|
return "Report/Process " + name;
|
||||||
|
} else if (po instanceof MForm) {
|
||||||
|
MForm form = (MForm) po;
|
||||||
|
String name = form.getName();
|
||||||
|
return "Form " + name;
|
||||||
|
} else if (po instanceof MWorkflow) {
|
||||||
|
MWorkflow wf = (MWorkflow) po;
|
||||||
|
String name = wf.getName();
|
||||||
|
return "Workflow " + name;
|
||||||
|
} else if (po instanceof MInfoWindow) {
|
||||||
|
MInfoWindow info = (MInfoWindow) po;
|
||||||
|
String name = info.getName();
|
||||||
|
return "Info " + name;
|
||||||
|
} else if (po instanceof MWFNode) {
|
||||||
|
MWFNode node = (MWFNode) po;
|
||||||
|
String name = "node";
|
||||||
|
return node.getAD_Workflow().getName() + " / " + name;
|
||||||
|
} else if (po instanceof MTask) {
|
||||||
|
MTask task = (MTask) po;
|
||||||
|
String name = task.getName();
|
||||||
|
return "Task " + name;
|
||||||
|
} else {
|
||||||
|
return po.get_ValueAsString("Name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setContextHelpInfo(PO po, MCtxHelp ctxHelp) {
|
||||||
|
if (po == null) {
|
||||||
|
ctxHelp.setName("Home");
|
||||||
|
ctxHelp.setCtxType(X_AD_CtxHelp.CTXTYPE_Home);
|
||||||
|
} else if (po instanceof MTab) {
|
||||||
|
MTab tab = (MTab) po;
|
||||||
|
String name = tab.getName();
|
||||||
|
String fullName = tab.getAD_Window().getName() + " / " + name;
|
||||||
|
if (fullName.length() <= 60) {
|
||||||
|
ctxHelp.setName(fullName);
|
||||||
|
} else {
|
||||||
|
ctxHelp.setDescription(fullName);
|
||||||
|
String lname = "Tab " + name;
|
||||||
|
if (lname.length() <= 60) {
|
||||||
|
ctxHelp.setName(lname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctxHelp.setCtxType(X_AD_CtxHelp.CTXTYPE_Tab);
|
||||||
|
} else if (po instanceof MProcess) {
|
||||||
|
MProcess process = (MProcess) po;
|
||||||
|
String name = process.getName();
|
||||||
|
String fullName = "Report/Process " + name;
|
||||||
|
if (fullName.length() <= 60) {
|
||||||
|
ctxHelp.setName(fullName);
|
||||||
|
} else {
|
||||||
|
ctxHelp.setDescription(fullName);
|
||||||
|
ctxHelp.setName(name);
|
||||||
|
}
|
||||||
|
ctxHelp.setCtxType(X_AD_CtxHelp.CTXTYPE_Process);
|
||||||
|
} else if (po instanceof MForm) {
|
||||||
|
MForm form = (MForm) po;
|
||||||
|
String name = form.getName();
|
||||||
|
String fullName = "Form " + name;
|
||||||
|
if (fullName.length() <= 60) {
|
||||||
|
ctxHelp.setName(fullName);
|
||||||
|
} else {
|
||||||
|
ctxHelp.setDescription(fullName);
|
||||||
|
ctxHelp.setName(name);
|
||||||
|
}
|
||||||
|
ctxHelp.setCtxType(X_AD_CtxHelp.CTXTYPE_Form);
|
||||||
|
} else if (po instanceof MWorkflow) {
|
||||||
|
MWorkflow wf = (MWorkflow) po;
|
||||||
|
String name = wf.getName();
|
||||||
|
String fullName = "Workflow " + name;
|
||||||
|
if (fullName.length() <= 60) {
|
||||||
|
ctxHelp.setName(fullName);
|
||||||
|
} else {
|
||||||
|
ctxHelp.setDescription(fullName);
|
||||||
|
ctxHelp.setName(name);
|
||||||
|
}
|
||||||
|
ctxHelp.setCtxType(X_AD_CtxHelp.CTXTYPE_Workflow);
|
||||||
|
} else if (po instanceof MInfoWindow) {
|
||||||
|
MInfoWindow info = (MInfoWindow) po;
|
||||||
|
String name = info.getName();
|
||||||
|
String fullName = "Info " + name;
|
||||||
|
if (fullName.length() <= 60) {
|
||||||
|
ctxHelp.setName(fullName);
|
||||||
|
} else {
|
||||||
|
ctxHelp.setDescription(fullName);
|
||||||
|
ctxHelp.setName(name);
|
||||||
|
}
|
||||||
|
ctxHelp.setCtxType(X_AD_CtxHelp.CTXTYPE_Info);
|
||||||
|
} else if (po instanceof MWFNode) {
|
||||||
|
MWFNode node = (MWFNode) po;
|
||||||
|
String name = "node";
|
||||||
|
String fullName = node.getAD_Workflow().getName() + " / " + name;
|
||||||
|
if (fullName.length() <= 60) {
|
||||||
|
ctxHelp.setName(fullName);
|
||||||
|
} else {
|
||||||
|
ctxHelp.setDescription(fullName);
|
||||||
|
ctxHelp.setName(name);
|
||||||
|
}
|
||||||
|
ctxHelp.setCtxType(X_AD_CtxHelp.CTXTYPE_Node);
|
||||||
|
} else if (po instanceof MTask) {
|
||||||
|
MTask task = (MTask) po;
|
||||||
|
String name = task.getName();
|
||||||
|
String fullName = "Task " + name;
|
||||||
|
if (fullName.length() <= 60) {
|
||||||
|
ctxHelp.setName(fullName);
|
||||||
|
} else {
|
||||||
|
ctxHelp.setDescription(fullName);
|
||||||
|
ctxHelp.setName(name);
|
||||||
|
}
|
||||||
|
ctxHelp.setCtxType(X_AD_CtxHelp.CTXTYPE_Task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue