Ticket #1002211: Create Help pane for Bizidium - fix sql statement syntax error, show context help of home tab if the window doesn't support context help

This commit is contained in:
Elaine Tan 2013-02-21 13:14:12 +08:00
parent cba45f139b
commit ddae63fbfc
5 changed files with 31 additions and 16 deletions

View File

@ -53,6 +53,7 @@ import org.adempiere.webui.window.FDialog;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MAcctSchemaElement;
import org.compiere.model.MColumn;
import org.compiere.model.X_AD_CtxHelp;
import org.compiere.model.X_C_AcctSchema_Element;
import org.compiere.report.core.RModel;
import org.compiere.report.core.RModelExcelExporter;
@ -64,21 +65,22 @@ import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.compiere.util.ValueNamePair;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.Hlayout;
import org.zkoss.zul.South;
import org.zkoss.zul.Caption;
import org.zkoss.zul.Center;
import org.zkoss.zul.Filedownload;
import org.zkoss.zul.Groupbox;
import org.zkoss.zul.Hlayout;
import org.zkoss.zul.Listhead;
import org.zkoss.zul.Listheader;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Paging;
import org.zkoss.zul.Separator;
import org.zkoss.zul.South;
/**
* Account Viewer : Based on class AcctViewer
@ -1301,4 +1303,11 @@ public class WAcctViewer extends Window implements EventListener<Event>
AEnv.zoom(AD_Table_ID, Record_ID);
}
//
@Override
public void onPageAttached(Page newpage, Page oldpage) {
super.onPageAttached(newpage, oldpage);
if (newpage != null)
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Home, 0);
}
}

View File

@ -140,6 +140,15 @@ public class HelpController
public void renderCtxHelp(String ctxType, int recordId)
{
if (ctxType != X_AD_CtxHelp.CTXTYPE_Home && ctxType != X_AD_CtxHelp.CTXTYPE_Tab &&
ctxType != X_AD_CtxHelp.CTXTYPE_Process && ctxType != X_AD_CtxHelp.CTXTYPE_Form &&
ctxType != X_AD_CtxHelp.CTXTYPE_Info && ctxType != X_AD_CtxHelp.CTXTYPE_Workflow &&
ctxType != X_AD_CtxHelp.CTXTYPE_Task)
ctxType = X_AD_CtxHelp.CTXTYPE_Home;
if (recordId == 0)
ctxType = X_AD_CtxHelp.CTXTYPE_Home;
pnlToolTip.setVisible(ctxType.equals(X_AD_CtxHelp.CTXTYPE_Tab) ||
ctxType.equals(X_AD_CtxHelp.CTXTYPE_Process) ||
ctxType.equals(X_AD_CtxHelp.CTXTYPE_Info));
@ -309,7 +318,9 @@ public class HelpController
if (ctxType == X_AD_CtxHelp.CTXTYPE_Home)
sql.append("AND h." + X_AD_CtxHelp.COLUMNNAME_CtxType);
else
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Tab || ctxType == X_AD_CtxHelp.CTXTYPE_Process ||
ctxType == X_AD_CtxHelp.CTXTYPE_Form || ctxType == X_AD_CtxHelp.CTXTYPE_Info ||
ctxType == X_AD_CtxHelp.CTXTYPE_Workflow || ctxType == X_AD_CtxHelp.CTXTYPE_Task)
{
sql.append("AND t.");
if (ctxType == X_AD_CtxHelp.CTXTYPE_Tab)
@ -324,9 +335,9 @@ public class HelpController
sql.append(X_AD_Workflow.COLUMNNAME_AD_Workflow_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Task)
sql.append(X_AD_Task.COLUMNNAME_AD_Task_ID);
else
sql.append("0");
}
else
sql.append("1");
sql.append(" = ? ");
sql.append("ORDER BY h.AD_Client_ID DESC, h.AD_Org_ID DESC, h.AD_CtxHelp_ID DESC");
return DB.getSQLValue(null, sql.toString(), Env.getAD_Client_ID(ctx), Env.getAD_Org_ID(ctx), ctxType == X_AD_CtxHelp.CTXTYPE_Home ? ctxType : recordId);

View File

@ -1189,7 +1189,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
if (infoWindow != null)
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Info, infoWindow.getAD_InfoWindow_ID());
else
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Info, 0);
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Home, 0);
}
//default
else
@ -1446,7 +1446,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
if (infoWindow != null)
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Info, infoWindow.getAD_InfoWindow_ID());
else
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Info, 0);
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Home, 0);
}
}
} // Info

View File

@ -24,6 +24,7 @@ import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.panel.InfoPanel;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.window.WTask;
import org.compiere.model.X_AD_CtxHelp;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
@ -144,7 +145,7 @@ public class WindowContainer extends AbstractUIPart
|| component instanceof WFPanel || component instanceof WTask)
Events.sendEvent(new Event(ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, component));
else
SessionManager.getAppDesktop().updateHelpContext("", 0);
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Home, 0);
}
});

View File

@ -35,7 +35,6 @@ import org.adempiere.webui.component.Window;
import org.adempiere.webui.component.ZkCssHelper;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.panel.WSchedule;
import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.session.SessionManager;
import org.compiere.model.MAssignmentSlot;
import org.compiere.model.MResourceAssignment;
@ -159,7 +158,6 @@ public class InfoSchedule extends Window implements EventListener<Event>
log.log(Level.SEVERE, "InfoSchedule", ex);
}
displayCalendar();
addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
} // InfoSchedule
/**
@ -478,10 +476,6 @@ public class InfoSchedule extends Window implements EventListener<Event>
else if (event instanceof CalendarsEvent)
doEdit((CalendarsEvent)event);
//
else if (event.getName().equals(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT))
{
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Info, 0);
}
}
private void doEdit(CalendarsEvent event) {
@ -634,7 +628,7 @@ public class InfoSchedule extends Window implements EventListener<Event>
super.onPageAttached(newpage, oldpage);
if (newpage != null) {
displayCalendar();
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Info, 0);
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Home, 0);
}
}