parent
8c9bb8bfa9
commit
6246c699f2
|
|
@ -24,6 +24,7 @@ import org.compiere.model.MRole;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
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.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
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,7 +40,7 @@ import org.zkoss.zul.Vbox;
|
||||||
public class DPActivities extends DashboardPanel implements EventListener {
|
public class DPActivities extends DashboardPanel implements EventListener {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final CLogger logger = CLogger.getCLogger(DPActivities.class);
|
private static final CLogger logger = CLogger.getCLogger(DPActivities.class);
|
||||||
|
|
||||||
private Button btnNotice, btnRequest, btnWorkflow;
|
private Button btnNotice, btnRequest, btnWorkflow;
|
||||||
|
|
@ -49,47 +50,47 @@ public class DPActivities extends DashboardPanel implements EventListener {
|
||||||
private int noOfRequest;
|
private int noOfRequest;
|
||||||
|
|
||||||
private int noOfWorkflow;
|
private int noOfWorkflow;
|
||||||
|
|
||||||
public DPActivities()
|
public DPActivities()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
this.appendChild(createActivitiesPanel());
|
this.appendChild(createActivitiesPanel());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Box createActivitiesPanel()
|
private Box createActivitiesPanel()
|
||||||
{
|
{
|
||||||
Vbox vbox = new Vbox();
|
Vbox vbox = new Vbox();
|
||||||
|
|
||||||
btnNotice = new Button();
|
btnNotice = new Button();
|
||||||
vbox.appendChild(btnNotice);
|
vbox.appendChild(btnNotice);
|
||||||
btnNotice.setLabel("Notice : 0");
|
btnNotice.setLabel(Msg.translate(Env.getCtx(), "AD_Note_ID") + " : 0");
|
||||||
btnNotice.setTooltiptext("Notice");
|
btnNotice.setTooltiptext(Msg.translate(Env.getCtx(), "AD_Note_ID"));
|
||||||
btnNotice.setImage("/images/GetMail16.png");
|
btnNotice.setImage("/images/GetMail16.png");
|
||||||
int AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Notice' AND IsSummary = 'N'");
|
int AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Notice' AND IsSummary = 'N'");
|
||||||
btnNotice.setName(String.valueOf(AD_Menu_ID));
|
btnNotice.setName(String.valueOf(AD_Menu_ID));
|
||||||
btnNotice.addEventListener(Events.ON_CLICK, this);
|
btnNotice.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
btnRequest = new Button();
|
btnRequest = new Button();
|
||||||
vbox.appendChild(btnRequest);
|
vbox.appendChild(btnRequest);
|
||||||
btnRequest.setLabel("Request : 0");
|
btnRequest.setLabel(Msg.translate(Env.getCtx(), "R_Request_ID") + " : 0");
|
||||||
btnRequest.setTooltiptext("Request");
|
btnRequest.setTooltiptext(Msg.translate(Env.getCtx(), "R_Request_ID"));
|
||||||
btnRequest.setImage("/images/Request16.png");
|
btnRequest.setImage("/images/Request16.png");
|
||||||
AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Request' AND IsSummary = 'N'");
|
AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Request' AND IsSummary = 'N'");
|
||||||
btnRequest.setName(String.valueOf(AD_Menu_ID));
|
btnRequest.setName(String.valueOf(AD_Menu_ID));
|
||||||
btnRequest.addEventListener(Events.ON_CLICK, this);
|
btnRequest.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
btnWorkflow = new Button();
|
btnWorkflow = new Button();
|
||||||
vbox.appendChild(btnWorkflow);
|
vbox.appendChild(btnWorkflow);
|
||||||
btnWorkflow.setLabel("Workflow Activities : 0");
|
btnWorkflow.setLabel(Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : 0");
|
||||||
btnWorkflow.setTooltiptext("Workflow Activities");
|
btnWorkflow.setTooltiptext(Msg.getMsg (Env.getCtx(), "WorkflowActivities"));
|
||||||
btnWorkflow.setImage("/images/Assignment16.png");
|
btnWorkflow.setImage("/images/Assignment16.png");
|
||||||
AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Workflow Activities' AND IsSummary = 'N'");
|
AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Workflow Activities' AND IsSummary = 'N'");
|
||||||
btnWorkflow.setName(String.valueOf(AD_Menu_ID));
|
btnWorkflow.setName(String.valueOf(AD_Menu_ID));
|
||||||
btnWorkflow.addEventListener(Events.ON_CLICK, this);
|
btnWorkflow.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
return vbox;
|
return vbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get notice count
|
* Get notice count
|
||||||
* @return number of notice
|
* @return number of notice
|
||||||
|
|
@ -99,11 +100,11 @@ public class DPActivities extends DashboardPanel implements EventListener {
|
||||||
String sql = "SELECT COUNT(1) FROM AD_Note "
|
String sql = "SELECT COUNT(1) FROM AD_Note "
|
||||||
+ "WHERE AD_Client_ID=? AND AD_User_ID IN (0,?)"
|
+ "WHERE AD_Client_ID=? AND AD_User_ID IN (0,?)"
|
||||||
+ " AND Processed='N'";
|
+ " AND Processed='N'";
|
||||||
|
|
||||||
int retValue = DB.getSQLValue(null, sql, Env.getAD_Client_ID(Env.getCtx()), Env.getAD_User_ID(Env.getCtx()));
|
int retValue = DB.getSQLValue(null, sql, Env.getAD_Client_ID(Env.getCtx()), Env.getAD_User_ID(Env.getCtx()));
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get request count
|
* Get request count
|
||||||
* @return number of request
|
* @return number of request
|
||||||
|
|
@ -115,18 +116,18 @@ public class DPActivities extends DashboardPanel implements EventListener {
|
||||||
+ " AND (DateNextAction IS NULL OR TRUNC(DateNextAction) <= TRUNC(SysDate))"
|
+ " AND (DateNextAction IS NULL OR TRUNC(DateNextAction) <= TRUNC(SysDate))"
|
||||||
+ " AND (R_Status_ID IS NULL OR R_Status_ID IN (SELECT R_Status_ID FROM R_Status WHERE IsClosed='N'))",
|
+ " AND (R_Status_ID IS NULL OR R_Status_ID IN (SELECT R_Status_ID FROM R_Status WHERE IsClosed='N'))",
|
||||||
"R_Request", false, true); // not qualified - RW
|
"R_Request", false, true); // not qualified - RW
|
||||||
int retValue = DB.getSQLValue(null, sql, Env.getAD_User_ID(Env.getCtx()), Env.getAD_Role_ID(Env.getCtx()));
|
int retValue = DB.getSQLValue(null, sql, Env.getAD_User_ID(Env.getCtx()), Env.getAD_Role_ID(Env.getCtx()));
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get workflow activity count
|
* Get workflow activity count
|
||||||
* @return number of workflow activity
|
* @return number of workflow activity
|
||||||
*/
|
*/
|
||||||
public static int getWorkflowCount()
|
public static int getWorkflowCount()
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
String sql = "SELECT count(*) FROM AD_WF_Activity a "
|
String sql = "SELECT count(*) FROM AD_WF_Activity a "
|
||||||
+ "WHERE a.Processed='N' AND a.WFState='OS' AND ("
|
+ "WHERE a.Processed='N' AND a.WFState='OS' AND ("
|
||||||
// Owner of Activity
|
// Owner of Activity
|
||||||
|
|
@ -166,20 +167,20 @@ public class DPActivities extends DashboardPanel implements EventListener {
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refresh(ServerPushTemplate template)
|
public void refresh(ServerPushTemplate template)
|
||||||
{
|
{
|
||||||
noOfNotice = getNoticeCount();
|
noOfNotice = getNoticeCount();
|
||||||
noOfRequest = getRequestCount();
|
noOfRequest = getRequestCount();
|
||||||
noOfWorkflow = getWorkflowCount();
|
noOfWorkflow = getWorkflowCount();
|
||||||
|
|
||||||
template.execute(this);
|
template.execute(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateUI() {
|
public void updateUI() {
|
||||||
//don't update if not visible
|
//don't update if not visible
|
||||||
|
|
@ -189,31 +190,31 @@ public class DPActivities extends DashboardPanel implements EventListener {
|
||||||
return;
|
return;
|
||||||
c = c.getParent();
|
c = c.getParent();
|
||||||
}
|
}
|
||||||
btnNotice.setLabel("Notice : " + noOfNotice);
|
btnNotice.setLabel(Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice);
|
||||||
btnRequest.setLabel("Request : " + noOfRequest);
|
btnRequest.setLabel(Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest);
|
||||||
btnWorkflow.setLabel("Workflow Activities : " + noOfWorkflow);
|
btnWorkflow.setLabel(Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event)
|
public void onEvent(Event event)
|
||||||
{
|
{
|
||||||
Component comp = event.getTarget();
|
Component comp = event.getTarget();
|
||||||
String eventName = event.getName();
|
String eventName = event.getName();
|
||||||
|
|
||||||
if(eventName.equals(Events.ON_CLICK))
|
if(eventName.equals(Events.ON_CLICK))
|
||||||
{
|
{
|
||||||
if(comp instanceof Button)
|
if(comp instanceof Button)
|
||||||
{
|
{
|
||||||
Button btn = (Button) comp;
|
Button btn = (Button) comp;
|
||||||
|
|
||||||
int menuId = 0;
|
int menuId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
menuId = Integer.valueOf(btn.getName());
|
menuId = Integer.valueOf(btn.getName());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(menuId > 0) SessionManager.getAppDesktop().onMenuSelected(menuId);
|
if(menuId > 0) SessionManager.getAppDesktop().onMenuSelected(menuId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ import org.zkoss.zul.Panel;
|
||||||
import org.zkoss.zul.Panelchildren;
|
import org.zkoss.zul.Panelchildren;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Default desktop implementation.
|
* Default desktop implementation.
|
||||||
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
|
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
|
||||||
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
|
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
|
||||||
|
|
@ -87,19 +87,19 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
private int noOfRequest;
|
private int noOfRequest;
|
||||||
|
|
||||||
private int noOfWorkflow;
|
private int noOfWorkflow;
|
||||||
|
|
||||||
public DefaultDesktop()
|
public DefaultDesktop()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Component doCreatePart(Component parent)
|
protected Component doCreatePart(Component parent)
|
||||||
{
|
{
|
||||||
SidePanel pnlSide = new SidePanel();
|
SidePanel pnlSide = new SidePanel();
|
||||||
HeaderPanel pnlHead = new HeaderPanel();
|
HeaderPanel pnlHead = new HeaderPanel();
|
||||||
|
|
||||||
pnlSide.getMenuPanel().addMenuListener(this);
|
pnlSide.getMenuPanel().addMenuListener(this);
|
||||||
|
|
||||||
layout = new Borderlayout();
|
layout = new Borderlayout();
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
{
|
{
|
||||||
|
|
@ -108,16 +108,16 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
layout.setHeight("100%");
|
layout.setHeight("100%");
|
||||||
layout.setStyle("position: absolute");
|
layout.setStyle("position: absolute");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
layout.setPage(page);
|
layout.setPage(page);
|
||||||
|
|
||||||
dashboardRunnable = new DashboardRunnable(layout.getDesktop(), this);
|
dashboardRunnable = new DashboardRunnable(layout.getDesktop(), this);
|
||||||
|
|
||||||
North n = new North();
|
North n = new North();
|
||||||
layout.appendChild(n);
|
layout.appendChild(n);
|
||||||
n.setCollapsible(false);
|
n.setCollapsible(false);
|
||||||
pnlHead.setParent(n);
|
pnlHead.setParent(n);
|
||||||
|
|
||||||
West w = new West();
|
West w = new West();
|
||||||
layout.appendChild(w);
|
layout.appendChild(w);
|
||||||
w.setWidth("300px");
|
w.setWidth("300px");
|
||||||
|
|
@ -126,45 +126,45 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
w.setTitle("Menu");
|
w.setTitle("Menu");
|
||||||
w.setFlex(true);
|
w.setFlex(true);
|
||||||
pnlSide.setParent(w);
|
pnlSide.setParent(w);
|
||||||
|
|
||||||
windowArea = new Center();
|
windowArea = new Center();
|
||||||
windowArea.setParent(layout);
|
windowArea.setParent(layout);
|
||||||
windowArea.setFlex(true);
|
windowArea.setFlex(true);
|
||||||
|
|
||||||
windowContainer.createPart(windowArea);
|
windowContainer.createPart(windowArea);
|
||||||
|
|
||||||
createHomeTab();
|
createHomeTab();
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createHomeTab()
|
private void createHomeTab()
|
||||||
{
|
{
|
||||||
Tabpanel homeTab = new Tabpanel();
|
Tabpanel homeTab = new Tabpanel();
|
||||||
windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
|
windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
|
||||||
|
|
||||||
Portallayout portalLayout = new Portallayout();
|
Portallayout portalLayout = new Portallayout();
|
||||||
portalLayout.setWidth("100%");
|
portalLayout.setWidth("100%");
|
||||||
portalLayout.setHeight("100%");
|
portalLayout.setHeight("100%");
|
||||||
portalLayout.setStyle("position: absolute; overflow: auto");
|
portalLayout.setStyle("position: absolute; overflow: auto");
|
||||||
homeTab.appendChild(portalLayout);
|
homeTab.appendChild(portalLayout);
|
||||||
|
|
||||||
// Dashboard content
|
// Dashboard content
|
||||||
Portalchildren portalchildren = null;
|
Portalchildren portalchildren = null;
|
||||||
int currentColumnNo = 0;
|
int currentColumnNo = 0;
|
||||||
|
|
||||||
String sql = "SELECT COUNT(DISTINCT COLUMNNO) "
|
String sql = "SELECT COUNT(DISTINCT COLUMNNO) "
|
||||||
+ "FROM PA_DASHBOARDCONTENT "
|
+ "FROM PA_DASHBOARDCONTENT "
|
||||||
+ "WHERE (AD_CLIENT_ID=0 OR AD_CLIENT_ID=?) AND ISACTIVE='Y'";
|
+ "WHERE (AD_CLIENT_ID=0 OR AD_CLIENT_ID=?) AND ISACTIVE='Y'";
|
||||||
|
|
||||||
int noOfCols = DB.getSQLValue(null, sql,
|
int noOfCols = DB.getSQLValue(null, sql,
|
||||||
Env.getAD_Client_ID(Env.getCtx()));
|
Env.getAD_Client_ID(Env.getCtx()));
|
||||||
|
|
||||||
int width = noOfCols <= 0 ? 100 : 100/noOfCols;
|
int width = noOfCols <= 0 ? 100 : 100/noOfCols;
|
||||||
|
|
||||||
sql = "SELECT x.*, m.AD_MENU_ID "
|
sql = "SELECT x.*, m.AD_MENU_ID "
|
||||||
+ "FROM PA_DASHBOARDCONTENT x "
|
+ "FROM PA_DASHBOARDCONTENT x "
|
||||||
+ "LEFT OUTER JOIN AD_MENU m ON x.AD_WINDOW_ID=m.AD_WINDOW_ID "
|
+ "LEFT OUTER JOIN AD_MENU m ON x.AD_WINDOW_ID=m.AD_WINDOW_ID "
|
||||||
+ "WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' "
|
+ "WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' "
|
||||||
+ "ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ";
|
+ "ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
|
@ -174,9 +174,9 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, Env.getAD_Client_ID(Env.getCtx()));
|
pstmt.setInt(1, Env.getAD_Client_ID(Env.getCtx()));
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
|
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo);
|
int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo);
|
||||||
if(portalchildren == null || currentColumnNo != columnNo)
|
if(portalchildren == null || currentColumnNo != columnNo)
|
||||||
{
|
{
|
||||||
|
|
@ -184,26 +184,26 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
portalLayout.appendChild(portalchildren);
|
portalLayout.appendChild(portalchildren);
|
||||||
portalchildren.setWidth(width + "%");
|
portalchildren.setWidth(width + "%");
|
||||||
portalchildren.setStyle("padding: 5px");
|
portalchildren.setStyle("padding: 5px");
|
||||||
|
|
||||||
currentColumnNo = columnNo;
|
currentColumnNo = columnNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
Panel panel = new Panel();
|
Panel panel = new Panel();
|
||||||
panel.setStyle("margin-bottom:10px");
|
panel.setStyle("margin-bottom:10px");
|
||||||
panel.setTitle(rs.getString(X_PA_DashboardContent.COLUMNNAME_Name));
|
panel.setTitle(rs.getString(X_PA_DashboardContent.COLUMNNAME_Name));
|
||||||
|
|
||||||
String description = rs.getString(X_PA_DashboardContent.COLUMNNAME_Description);
|
String description = rs.getString(X_PA_DashboardContent.COLUMNNAME_Description);
|
||||||
if(description != null)
|
if(description != null)
|
||||||
panel.setTooltiptext(description);
|
panel.setTooltiptext(description);
|
||||||
|
|
||||||
String collapsible = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsCollapsible);
|
String collapsible = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsCollapsible);
|
||||||
panel.setCollapsible(collapsible.equals("Y"));
|
panel.setCollapsible(collapsible.equals("Y"));
|
||||||
|
|
||||||
panel.setBorder("normal");
|
panel.setBorder("normal");
|
||||||
portalchildren.appendChild(panel);
|
portalchildren.appendChild(panel);
|
||||||
Panelchildren content = new Panelchildren();
|
Panelchildren content = new Panelchildren();
|
||||||
panel.appendChild(content);
|
panel.appendChild(content);
|
||||||
|
|
||||||
boolean panelEmpty = true;
|
boolean panelEmpty = true;
|
||||||
|
|
||||||
// HTML content
|
// HTML content
|
||||||
|
|
@ -211,7 +211,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
if(htmlContent != null)
|
if(htmlContent != null)
|
||||||
{
|
{
|
||||||
StringBuffer result = new StringBuffer("<html><head>");
|
StringBuffer result = new StringBuffer("<html><head>");
|
||||||
|
|
||||||
URL url = getClass().getClassLoader().
|
URL url = getClass().getClassLoader().
|
||||||
getResource("org/compiere/images/PAPanel.css");
|
getResource("org/compiere/images/PAPanel.css");
|
||||||
InputStreamReader ins;
|
InputStreamReader ins;
|
||||||
|
|
@ -219,25 +219,25 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
ins = new InputStreamReader(url.openStream());
|
ins = new InputStreamReader(url.openStream());
|
||||||
BufferedReader bufferedReader = new BufferedReader( ins );
|
BufferedReader bufferedReader = new BufferedReader( ins );
|
||||||
String cssLine;
|
String cssLine;
|
||||||
while ((cssLine = bufferedReader.readLine()) != null)
|
while ((cssLine = bufferedReader.readLine()) != null)
|
||||||
result.append(cssLine + "\n");
|
result.append(cssLine + "\n");
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.append("</head><body><div class=\"content\">\n");
|
result.append("</head><body><div class=\"content\">\n");
|
||||||
|
|
||||||
// if(description != null)
|
// if(description != null)
|
||||||
// result.append("<h2>" + description + "</h2>\n");
|
// result.append("<h2>" + description + "</h2>\n");
|
||||||
result.append(stripHtml(htmlContent, false) + "<br>\n");
|
result.append(stripHtml(htmlContent, false) + "<br>\n");
|
||||||
result.append("</div>\n</body>\n</html>\n</html>");
|
result.append("</div>\n</body>\n</html>\n</html>");
|
||||||
|
|
||||||
Html html = new Html();
|
Html html = new Html();
|
||||||
html.setContent(result.toString());
|
html.setContent(result.toString());
|
||||||
content.appendChild(html);
|
content.appendChild(html);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
int AD_Window_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Window_ID);
|
int AD_Window_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Window_ID);
|
||||||
if(AD_Window_ID > 0)
|
if(AD_Window_ID > 0)
|
||||||
|
|
@ -250,13 +250,13 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
content.appendChild(btn);
|
content.appendChild(btn);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Goal
|
// Goal
|
||||||
int PA_Goal_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_Goal_ID);
|
int PA_Goal_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_Goal_ID);
|
||||||
if(PA_Goal_ID > 0)
|
if(PA_Goal_ID > 0)
|
||||||
{
|
{
|
||||||
StringBuffer result = new StringBuffer("<html><head>");
|
StringBuffer result = new StringBuffer("<html><head>");
|
||||||
|
|
||||||
URL url = getClass().getClassLoader().
|
URL url = getClass().getClassLoader().
|
||||||
getResource("org/compiere/images/PAPanel.css");
|
getResource("org/compiere/images/PAPanel.css");
|
||||||
InputStreamReader ins;
|
InputStreamReader ins;
|
||||||
|
|
@ -264,12 +264,12 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
ins = new InputStreamReader(url.openStream());
|
ins = new InputStreamReader(url.openStream());
|
||||||
BufferedReader bufferedReader = new BufferedReader( ins );
|
BufferedReader bufferedReader = new BufferedReader( ins );
|
||||||
String cssLine;
|
String cssLine;
|
||||||
while ((cssLine = bufferedReader.readLine()) != null)
|
while ((cssLine = bufferedReader.readLine()) != null)
|
||||||
result.append(cssLine + "\n");
|
result.append(cssLine + "\n");
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.append("</head><body><div class=\"content\">\n");
|
result.append("</head><body><div class=\"content\">\n");
|
||||||
result.append(renderGoals(PA_Goal_ID, content));
|
result.append(renderGoals(PA_Goal_ID, content));
|
||||||
result.append("</div>\n</body>\n</html>\n</html>");
|
result.append("</div>\n</body>\n</html>\n</html>");
|
||||||
|
|
@ -279,14 +279,14 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
content.appendChild(html);
|
content.appendChild(html);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZUL file url
|
// ZUL file url
|
||||||
String url = rs.getString(X_PA_DashboardContent.COLUMNNAME_ZulFilePath);
|
String url = rs.getString(X_PA_DashboardContent.COLUMNNAME_ZulFilePath);
|
||||||
if(url != null)
|
if(url != null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Component component = Executions.createComponents(url, content, null);
|
Component component = Executions.createComponents(url, content, null);
|
||||||
if(component != null)
|
if(component != null)
|
||||||
{
|
{
|
||||||
if (component instanceof DashboardPanel)
|
if (component instanceof DashboardPanel)
|
||||||
{
|
{
|
||||||
|
|
@ -307,7 +307,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
logger.log(Level.WARNING, "Failed to create components. zul="+url, e);
|
logger.log(Level.WARNING, "Failed to create components. zul="+url, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panelEmpty)
|
if (panelEmpty)
|
||||||
panel.detach();
|
panel.detach();
|
||||||
}
|
}
|
||||||
|
|
@ -317,40 +317,40 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
//register as 0
|
//register as 0
|
||||||
registerWindow(homeTab);
|
registerWindow(homeTab);
|
||||||
|
|
||||||
if (!portalLayout.getDesktop().isServerPushEnabled())
|
if (!portalLayout.getDesktop().isServerPushEnabled())
|
||||||
portalLayout.getDesktop().enableServerPush(true);
|
portalLayout.getDesktop().enableServerPush(true);
|
||||||
|
|
||||||
dashboardRunnable.refreshDashboard();
|
dashboardRunnable.refreshDashboard();
|
||||||
|
|
||||||
dashboardThread = new Thread(dashboardRunnable, "UpdateInfo");
|
dashboardThread = new Thread(dashboardRunnable, "UpdateInfo");
|
||||||
dashboardThread.setDaemon(true);
|
dashboardThread.setDaemon(true);
|
||||||
dashboardThread.start();
|
dashboardThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event)
|
public void onEvent(Event event)
|
||||||
{
|
{
|
||||||
Component comp = event.getTarget();
|
Component comp = event.getTarget();
|
||||||
String eventName = event.getName();
|
String eventName = event.getName();
|
||||||
|
|
||||||
if(eventName.equals(Events.ON_CLICK))
|
if(eventName.equals(Events.ON_CLICK))
|
||||||
{
|
{
|
||||||
if(comp instanceof ToolBarButton)
|
if(comp instanceof ToolBarButton)
|
||||||
{
|
{
|
||||||
ToolBarButton btn = (ToolBarButton) comp;
|
ToolBarButton btn = (ToolBarButton) comp;
|
||||||
|
|
||||||
int menuId = 0;
|
int menuId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
menuId = Integer.valueOf(btn.getName());
|
menuId = Integer.valueOf(btn.getName());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(menuId > 0) onMenuSelected(menuId);
|
if(menuId > 0) onMenuSelected(menuId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -361,12 +361,12 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
noOfNotice = DPActivities.getNoticeCount();
|
noOfNotice = DPActivities.getNoticeCount();
|
||||||
noOfRequest = DPActivities.getRequestCount();
|
noOfRequest = DPActivities.getRequestCount();
|
||||||
noOfWorkflow = DPActivities.getWorkflowCount();
|
noOfWorkflow = DPActivities.getWorkflowCount();
|
||||||
|
|
||||||
template.execute(this);
|
template.execute(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param page
|
* @param page
|
||||||
*/
|
*/
|
||||||
public void setPage(Page page) {
|
public void setPage(Page page) {
|
||||||
|
|
@ -375,7 +375,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
this.page = page;
|
this.page = page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the root component
|
* Get the root component
|
||||||
* @return Component
|
* @return Component
|
||||||
|
|
@ -383,7 +383,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
public Component getComponent() {
|
public Component getComponent() {
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logout() {
|
public void logout() {
|
||||||
if (dashboardThread != null && dashboardThread.isAlive()) {
|
if (dashboardThread != null && dashboardThread.isAlive()) {
|
||||||
dashboardRunnable.stop();
|
dashboardRunnable.stop();
|
||||||
|
|
@ -393,7 +393,10 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
|
|
||||||
public void updateUI() {
|
public void updateUI() {
|
||||||
int total = noOfNotice + noOfRequest + noOfWorkflow;
|
int total = noOfNotice + noOfRequest + noOfWorkflow;
|
||||||
windowContainer.setTabTitle(0, "Home (" + total + ")",
|
windowContainer.setTabTitle(0, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", "")
|
||||||
"Notice : " + noOfNotice + ", Request : " + noOfRequest + ", Workflow Activities : " + noOfWorkflow);
|
+ " (" + total + ")",
|
||||||
|
Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice
|
||||||
|
+ ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest
|
||||||
|
+ ", " + Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Copyright (C) 2008 Low Heng Sin *
|
* Copyright (C) 2008 Low Heng Sin *
|
||||||
* Copyright (C) 2008 Idalica Corporation *
|
* Copyright (C) 2008 Idalica Corporation *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
* by the Free Software Foundation. This program is distributed in the hope *
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
|
@ -58,7 +58,7 @@ import org.zkoss.zul.Panel;
|
||||||
import org.zkoss.zul.Panelchildren;
|
import org.zkoss.zul.Panelchildren;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*/
|
*/
|
||||||
public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Serializable, EventListener, IServerPushCallback
|
public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Serializable, EventListener, IServerPushCallback
|
||||||
{
|
{
|
||||||
|
|
@ -88,17 +88,17 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
private int noOfWorkflow;
|
private int noOfWorkflow;
|
||||||
|
|
||||||
public NavBar2Desktop()
|
public NavBar2Desktop()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Component doCreatePart(Component parent)
|
protected Component doCreatePart(Component parent)
|
||||||
{
|
{
|
||||||
SidePanel pnlSide = new SidePanel();
|
SidePanel pnlSide = new SidePanel();
|
||||||
HeaderPanel pnlHead = new HeaderPanel();
|
HeaderPanel pnlHead = new HeaderPanel();
|
||||||
|
|
||||||
pnlSide.getMenuPanel().addMenuListener(this);
|
pnlSide.getMenuPanel().addMenuListener(this);
|
||||||
|
|
||||||
layout = new Borderlayout();
|
layout = new Borderlayout();
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
{
|
{
|
||||||
|
|
@ -107,16 +107,16 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
layout.setHeight("100%");
|
layout.setHeight("100%");
|
||||||
layout.setStyle("position: absolute");
|
layout.setStyle("position: absolute");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
layout.setPage(page);
|
layout.setPage(page);
|
||||||
|
|
||||||
dashboardRunnable = new DashboardRunnable(layout.getDesktop(), this);
|
dashboardRunnable = new DashboardRunnable(layout.getDesktop(), this);
|
||||||
|
|
||||||
North n = new North();
|
North n = new North();
|
||||||
layout.appendChild(n);
|
layout.appendChild(n);
|
||||||
n.setCollapsible(false);
|
n.setCollapsible(false);
|
||||||
pnlHead.setParent(n);
|
pnlHead.setParent(n);
|
||||||
|
|
||||||
West w = new West();
|
West w = new West();
|
||||||
layout.appendChild(w);
|
layout.appendChild(w);
|
||||||
w.setWidth("300px");
|
w.setWidth("300px");
|
||||||
|
|
@ -126,16 +126,16 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
w.setFlex(true);
|
w.setFlex(true);
|
||||||
pnlSide.setParent(w);
|
pnlSide.setParent(w);
|
||||||
w.setOpen(false);
|
w.setOpen(false);
|
||||||
|
|
||||||
Center center = new Center();
|
Center center = new Center();
|
||||||
center.setParent(layout);
|
center.setParent(layout);
|
||||||
center.setFlex(true);
|
center.setFlex(true);
|
||||||
|
|
||||||
Borderlayout innerLayout = new Borderlayout();
|
Borderlayout innerLayout = new Borderlayout();
|
||||||
innerLayout.setHeight("100%");
|
innerLayout.setHeight("100%");
|
||||||
innerLayout.setWidth("100%");
|
innerLayout.setWidth("100%");
|
||||||
innerLayout.setParent(center);
|
innerLayout.setParent(center);
|
||||||
|
|
||||||
West innerW = new West();
|
West innerW = new West();
|
||||||
innerW.setWidth("200px");
|
innerW.setWidth("200px");
|
||||||
innerW.setCollapsible(true);
|
innerW.setCollapsible(true);
|
||||||
|
|
@ -143,16 +143,16 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
innerW.setSplittable(true);
|
innerW.setSplittable(true);
|
||||||
innerW.setCollapsible(true);
|
innerW.setCollapsible(true);
|
||||||
innerW.setParent(innerLayout);
|
innerW.setParent(innerLayout);
|
||||||
|
|
||||||
shortcutPanel = new Accordion();
|
shortcutPanel = new Accordion();
|
||||||
shortcutPanel.setWidth("100%");
|
shortcutPanel.setWidth("100%");
|
||||||
shortcutPanel.setHeight("100%");
|
shortcutPanel.setHeight("100%");
|
||||||
innerW.appendChild(shortcutPanel);
|
innerW.appendChild(shortcutPanel);
|
||||||
|
|
||||||
Div div = new Div();
|
Div div = new Div();
|
||||||
Executions.createComponents(FAVOURITES_PATH, div, null);
|
Executions.createComponents(FAVOURITES_PATH, div, null);
|
||||||
shortcutPanel.add(div, "Favourites");
|
shortcutPanel.add(div, "Favourites");
|
||||||
|
|
||||||
div = new Div();
|
div = new Div();
|
||||||
Component component = Executions.createComponents(ACTIVITIES_PATH, div, null);
|
Component component = Executions.createComponents(ACTIVITIES_PATH, div, null);
|
||||||
if (component instanceof DashboardPanel)
|
if (component instanceof DashboardPanel)
|
||||||
|
|
@ -161,47 +161,47 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
dashboardRunnable.add(dashboardPanel);
|
dashboardRunnable.add(dashboardPanel);
|
||||||
}
|
}
|
||||||
shortcutPanel.add(div, "Activities");
|
shortcutPanel.add(div, "Activities");
|
||||||
|
|
||||||
shortcutPanel.setSelectedIndex(0);
|
shortcutPanel.setSelectedIndex(0);
|
||||||
|
|
||||||
windowArea = new Center();
|
windowArea = new Center();
|
||||||
windowArea.setParent(innerLayout);
|
windowArea.setParent(innerLayout);
|
||||||
windowArea.setFlex(true);
|
windowArea.setFlex(true);
|
||||||
|
|
||||||
windowContainer.createPart(windowArea);
|
windowContainer.createPart(windowArea);
|
||||||
|
|
||||||
createHomeTab();
|
createHomeTab();
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createHomeTab()
|
private void createHomeTab()
|
||||||
{
|
{
|
||||||
Tabpanel homeTab = new Tabpanel();
|
Tabpanel homeTab = new Tabpanel();
|
||||||
windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
|
windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
|
||||||
|
|
||||||
Portallayout portalLayout = new Portallayout();
|
Portallayout portalLayout = new Portallayout();
|
||||||
portalLayout.setWidth("100%");
|
portalLayout.setWidth("100%");
|
||||||
portalLayout.setHeight("100%");
|
portalLayout.setHeight("100%");
|
||||||
portalLayout.setStyle("position: absolute; overflow: auto");
|
portalLayout.setStyle("position: absolute; overflow: auto");
|
||||||
homeTab.appendChild(portalLayout);
|
homeTab.appendChild(portalLayout);
|
||||||
|
|
||||||
// Dashboard content
|
// Dashboard content
|
||||||
Portalchildren portalchildren = null;
|
Portalchildren portalchildren = null;
|
||||||
int currentColumnNo = 0;
|
int currentColumnNo = 0;
|
||||||
|
|
||||||
String sql = "SELECT COUNT(DISTINCT COLUMNNO) "
|
String sql = "SELECT COUNT(DISTINCT COLUMNNO) "
|
||||||
+ "FROM PA_DASHBOARDCONTENT "
|
+ "FROM PA_DASHBOARDCONTENT "
|
||||||
+ "WHERE (AD_CLIENT_ID=0 OR AD_CLIENT_ID=?) AND ISACTIVE='Y'";
|
+ "WHERE (AD_CLIENT_ID=0 OR AD_CLIENT_ID=?) AND ISACTIVE='Y'";
|
||||||
|
|
||||||
int noOfCols = DB.getSQLValue(null, sql,
|
int noOfCols = DB.getSQLValue(null, sql,
|
||||||
Env.getAD_Client_ID(Env.getCtx()));
|
Env.getAD_Client_ID(Env.getCtx()));
|
||||||
|
|
||||||
int width = noOfCols <= 0 ? 100 : 100/noOfCols;
|
int width = noOfCols <= 0 ? 100 : 100/noOfCols;
|
||||||
|
|
||||||
sql = "SELECT x.*, m.AD_MENU_ID "
|
sql = "SELECT x.*, m.AD_MENU_ID "
|
||||||
+ "FROM PA_DASHBOARDCONTENT x "
|
+ "FROM PA_DASHBOARDCONTENT x "
|
||||||
+ "LEFT OUTER JOIN AD_MENU m ON x.AD_WINDOW_ID=m.AD_WINDOW_ID "
|
+ "LEFT OUTER JOIN AD_MENU m ON x.AD_WINDOW_ID=m.AD_WINDOW_ID "
|
||||||
+ "WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' "
|
+ "WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' "
|
||||||
+ "AND x.zulfilepath not in (?, ?) "
|
+ "AND x.zulfilepath not in (?, ?) "
|
||||||
+ "ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ";
|
+ "ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ";
|
||||||
|
|
@ -214,9 +214,9 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
pstmt.setString(2, ACTIVITIES_PATH);
|
pstmt.setString(2, ACTIVITIES_PATH);
|
||||||
pstmt.setString(3, FAVOURITES_PATH);
|
pstmt.setString(3, FAVOURITES_PATH);
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
|
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo);
|
int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo);
|
||||||
if(portalchildren == null || currentColumnNo != columnNo)
|
if(portalchildren == null || currentColumnNo != columnNo)
|
||||||
{
|
{
|
||||||
|
|
@ -224,26 +224,26 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
portalLayout.appendChild(portalchildren);
|
portalLayout.appendChild(portalchildren);
|
||||||
portalchildren.setWidth(width + "%");
|
portalchildren.setWidth(width + "%");
|
||||||
portalchildren.setStyle("padding: 5px");
|
portalchildren.setStyle("padding: 5px");
|
||||||
|
|
||||||
currentColumnNo = columnNo;
|
currentColumnNo = columnNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
Panel panel = new Panel();
|
Panel panel = new Panel();
|
||||||
panel.setStyle("margin-bottom:10px");
|
panel.setStyle("margin-bottom:10px");
|
||||||
panel.setTitle(rs.getString(X_PA_DashboardContent.COLUMNNAME_Name));
|
panel.setTitle(rs.getString(X_PA_DashboardContent.COLUMNNAME_Name));
|
||||||
|
|
||||||
String description = rs.getString(X_PA_DashboardContent.COLUMNNAME_Description);
|
String description = rs.getString(X_PA_DashboardContent.COLUMNNAME_Description);
|
||||||
if(description != null)
|
if(description != null)
|
||||||
panel.setTooltiptext(description);
|
panel.setTooltiptext(description);
|
||||||
|
|
||||||
String collapsible = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsCollapsible);
|
String collapsible = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsCollapsible);
|
||||||
panel.setCollapsible(collapsible.equals("Y"));
|
panel.setCollapsible(collapsible.equals("Y"));
|
||||||
|
|
||||||
panel.setBorder("normal");
|
panel.setBorder("normal");
|
||||||
portalchildren.appendChild(panel);
|
portalchildren.appendChild(panel);
|
||||||
Panelchildren content = new Panelchildren();
|
Panelchildren content = new Panelchildren();
|
||||||
panel.appendChild(content);
|
panel.appendChild(content);
|
||||||
|
|
||||||
boolean panelEmpty = true;
|
boolean panelEmpty = true;
|
||||||
|
|
||||||
// HTML content
|
// HTML content
|
||||||
|
|
@ -251,7 +251,7 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
if(htmlContent != null)
|
if(htmlContent != null)
|
||||||
{
|
{
|
||||||
StringBuffer result = new StringBuffer("<html><head>");
|
StringBuffer result = new StringBuffer("<html><head>");
|
||||||
|
|
||||||
URL url = getClass().getClassLoader().
|
URL url = getClass().getClassLoader().
|
||||||
getResource("org/compiere/images/PAPanel.css");
|
getResource("org/compiere/images/PAPanel.css");
|
||||||
InputStreamReader ins;
|
InputStreamReader ins;
|
||||||
|
|
@ -259,25 +259,25 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
ins = new InputStreamReader(url.openStream());
|
ins = new InputStreamReader(url.openStream());
|
||||||
BufferedReader bufferedReader = new BufferedReader( ins );
|
BufferedReader bufferedReader = new BufferedReader( ins );
|
||||||
String cssLine;
|
String cssLine;
|
||||||
while ((cssLine = bufferedReader.readLine()) != null)
|
while ((cssLine = bufferedReader.readLine()) != null)
|
||||||
result.append(cssLine + "\n");
|
result.append(cssLine + "\n");
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.append("</head><body><div class=\"content\">\n");
|
result.append("</head><body><div class=\"content\">\n");
|
||||||
|
|
||||||
// if(description != null)
|
// if(description != null)
|
||||||
// result.append("<h2>" + description + "</h2>\n");
|
// result.append("<h2>" + description + "</h2>\n");
|
||||||
result.append(stripHtml(htmlContent, false) + "<br>\n");
|
result.append(stripHtml(htmlContent, false) + "<br>\n");
|
||||||
result.append("</div>\n</body>\n</html>\n</html>");
|
result.append("</div>\n</body>\n</html>\n</html>");
|
||||||
|
|
||||||
Html html = new Html();
|
Html html = new Html();
|
||||||
html.setContent(result.toString());
|
html.setContent(result.toString());
|
||||||
content.appendChild(html);
|
content.appendChild(html);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
int AD_Window_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Window_ID);
|
int AD_Window_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Window_ID);
|
||||||
if(AD_Window_ID > 0)
|
if(AD_Window_ID > 0)
|
||||||
|
|
@ -290,13 +290,13 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
content.appendChild(btn);
|
content.appendChild(btn);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Goal
|
// Goal
|
||||||
int PA_Goal_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_Goal_ID);
|
int PA_Goal_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_Goal_ID);
|
||||||
if(PA_Goal_ID > 0)
|
if(PA_Goal_ID > 0)
|
||||||
{
|
{
|
||||||
StringBuffer result = new StringBuffer("<html><head>");
|
StringBuffer result = new StringBuffer("<html><head>");
|
||||||
|
|
||||||
URL url = getClass().getClassLoader().
|
URL url = getClass().getClassLoader().
|
||||||
getResource("org/compiere/images/PAPanel.css");
|
getResource("org/compiere/images/PAPanel.css");
|
||||||
InputStreamReader ins;
|
InputStreamReader ins;
|
||||||
|
|
@ -304,12 +304,12 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
ins = new InputStreamReader(url.openStream());
|
ins = new InputStreamReader(url.openStream());
|
||||||
BufferedReader bufferedReader = new BufferedReader( ins );
|
BufferedReader bufferedReader = new BufferedReader( ins );
|
||||||
String cssLine;
|
String cssLine;
|
||||||
while ((cssLine = bufferedReader.readLine()) != null)
|
while ((cssLine = bufferedReader.readLine()) != null)
|
||||||
result.append(cssLine + "\n");
|
result.append(cssLine + "\n");
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.append("</head><body><div class=\"content\">\n");
|
result.append("</head><body><div class=\"content\">\n");
|
||||||
result.append(renderGoals(PA_Goal_ID, content));
|
result.append(renderGoals(PA_Goal_ID, content));
|
||||||
result.append("</div>\n</body>\n</html>\n</html>");
|
result.append("</div>\n</body>\n</html>\n</html>");
|
||||||
|
|
@ -319,14 +319,14 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
content.appendChild(html);
|
content.appendChild(html);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZUL file url
|
// ZUL file url
|
||||||
String url = rs.getString(X_PA_DashboardContent.COLUMNNAME_ZulFilePath);
|
String url = rs.getString(X_PA_DashboardContent.COLUMNNAME_ZulFilePath);
|
||||||
if(url != null)
|
if(url != null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Component component = Executions.createComponents(url, content, null);
|
Component component = Executions.createComponents(url, content, null);
|
||||||
if(component != null)
|
if(component != null)
|
||||||
{
|
{
|
||||||
if (component instanceof DashboardPanel)
|
if (component instanceof DashboardPanel)
|
||||||
{
|
{
|
||||||
|
|
@ -347,7 +347,7 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
logger.log(Level.WARNING, "Failed to create components. zul="+url, e);
|
logger.log(Level.WARNING, "Failed to create components. zul="+url, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panelEmpty)
|
if (panelEmpty)
|
||||||
panel.detach();
|
panel.detach();
|
||||||
}
|
}
|
||||||
|
|
@ -357,40 +357,40 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
//register as 0
|
//register as 0
|
||||||
registerWindow(homeTab);
|
registerWindow(homeTab);
|
||||||
|
|
||||||
if (!portalLayout.getDesktop().isServerPushEnabled())
|
if (!portalLayout.getDesktop().isServerPushEnabled())
|
||||||
portalLayout.getDesktop().enableServerPush(true);
|
portalLayout.getDesktop().enableServerPush(true);
|
||||||
|
|
||||||
dashboardRunnable.refreshDashboard();
|
dashboardRunnable.refreshDashboard();
|
||||||
|
|
||||||
dashboardThread = new Thread(dashboardRunnable, "UpdateInfo");
|
dashboardThread = new Thread(dashboardRunnable, "UpdateInfo");
|
||||||
dashboardThread.setDaemon(true);
|
dashboardThread.setDaemon(true);
|
||||||
dashboardThread.start();
|
dashboardThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event)
|
public void onEvent(Event event)
|
||||||
{
|
{
|
||||||
Component comp = event.getTarget();
|
Component comp = event.getTarget();
|
||||||
String eventName = event.getName();
|
String eventName = event.getName();
|
||||||
|
|
||||||
if(eventName.equals(Events.ON_CLICK))
|
if(eventName.equals(Events.ON_CLICK))
|
||||||
{
|
{
|
||||||
if(comp instanceof ToolBarButton)
|
if(comp instanceof ToolBarButton)
|
||||||
{
|
{
|
||||||
ToolBarButton btn = (ToolBarButton) comp;
|
ToolBarButton btn = (ToolBarButton) comp;
|
||||||
|
|
||||||
int menuId = 0;
|
int menuId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
menuId = Integer.valueOf(btn.getName());
|
menuId = Integer.valueOf(btn.getName());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(menuId > 0) onMenuSelected(menuId);
|
if(menuId > 0) onMenuSelected(menuId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -401,12 +401,12 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
noOfNotice = DPActivities.getNoticeCount();
|
noOfNotice = DPActivities.getNoticeCount();
|
||||||
noOfRequest = DPActivities.getRequestCount();
|
noOfRequest = DPActivities.getRequestCount();
|
||||||
noOfWorkflow = DPActivities.getWorkflowCount();
|
noOfWorkflow = DPActivities.getWorkflowCount();
|
||||||
|
|
||||||
template.execute(this);
|
template.execute(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param page
|
* @param page
|
||||||
*/
|
*/
|
||||||
public void setPage(Page page) {
|
public void setPage(Page page) {
|
||||||
|
|
@ -415,7 +415,7 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
this.page = page;
|
this.page = page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the root component
|
* Get the root component
|
||||||
* @return Component
|
* @return Component
|
||||||
|
|
@ -423,7 +423,7 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
public Component getComponent() {
|
public Component getComponent() {
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logout() {
|
public void logout() {
|
||||||
if (dashboardThread != null && dashboardThread.isAlive()) {
|
if (dashboardThread != null && dashboardThread.isAlive()) {
|
||||||
dashboardRunnable.stop();
|
dashboardRunnable.stop();
|
||||||
|
|
@ -434,6 +434,8 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
public void updateUI() {
|
public void updateUI() {
|
||||||
int total = noOfNotice + noOfRequest + noOfWorkflow;
|
int total = noOfNotice + noOfRequest + noOfWorkflow;
|
||||||
shortcutPanel.setLabel(1, "Activities (" + total + ")");
|
shortcutPanel.setLabel(1, "Activities (" + total + ")");
|
||||||
shortcutPanel.setTooltiptext(1, "Notice : " + noOfNotice + ", Request : " + noOfRequest + ", Workflow Activities : " + noOfWorkflow);
|
shortcutPanel.setTooltiptext(1, Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice
|
||||||
|
+ ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest
|
||||||
|
+ ", " + Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Copyright (C) 2008 Low Heng Sin *
|
* Copyright (C) 2008 Low Heng Sin *
|
||||||
* Copyright (C) 2008 Idalica Corporation *
|
* Copyright (C) 2008 Idalica Corporation *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
* by the Free Software Foundation. This program is distributed in the hope *
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
|
@ -62,7 +62,7 @@ import org.zkoss.zul.Treeitem;
|
||||||
import org.zkoss.zul.Treerow;
|
import org.zkoss.zul.Treerow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*/
|
*/
|
||||||
public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serializable, EventListener, IServerPushCallback
|
public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serializable, EventListener, IServerPushCallback
|
||||||
{
|
{
|
||||||
|
|
@ -70,7 +70,7 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
private static final String FAVOURITES_PATH = "/zul/favourites.zul";
|
private static final String FAVOURITES_PATH = "/zul/favourites.zul";
|
||||||
|
|
||||||
private static final String ACTIVITIES_PATH = "/zul/activities.zul";
|
private static final String ACTIVITIES_PATH = "/zul/activities.zul";
|
||||||
|
|
||||||
private static final String VIEWS_PATH = "/zul/views.zul";
|
private static final String VIEWS_PATH = "/zul/views.zul";
|
||||||
|
|
||||||
private static final long serialVersionUID = 9056511175189603883L;
|
private static final long serialVersionUID = 9056511175189603883L;
|
||||||
|
|
@ -96,19 +96,19 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
private int noOfRequest;
|
private int noOfRequest;
|
||||||
|
|
||||||
private int noOfWorkflow;
|
private int noOfWorkflow;
|
||||||
|
|
||||||
public NavBarDesktop()
|
public NavBarDesktop()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Component doCreatePart(Component parent)
|
protected Component doCreatePart(Component parent)
|
||||||
{
|
{
|
||||||
SidePanel pnlSide = new SidePanel();
|
SidePanel pnlSide = new SidePanel();
|
||||||
HeaderPanel pnlHead = new HeaderPanel();
|
HeaderPanel pnlHead = new HeaderPanel();
|
||||||
|
|
||||||
pnlSide.getMenuPanel().addMenuListener(this);
|
pnlSide.getMenuPanel().addMenuListener(this);
|
||||||
|
|
||||||
layout = new Borderlayout();
|
layout = new Borderlayout();
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
{
|
{
|
||||||
|
|
@ -117,16 +117,16 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
layout.setHeight("100%");
|
layout.setHeight("100%");
|
||||||
layout.setStyle("position: absolute");
|
layout.setStyle("position: absolute");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
layout.setPage(page);
|
layout.setPage(page);
|
||||||
|
|
||||||
dashboardRunnable = new DashboardRunnable(layout.getDesktop(), this);
|
dashboardRunnable = new DashboardRunnable(layout.getDesktop(), this);
|
||||||
|
|
||||||
North n = new North();
|
North n = new North();
|
||||||
layout.appendChild(n);
|
layout.appendChild(n);
|
||||||
n.setCollapsible(false);
|
n.setCollapsible(false);
|
||||||
pnlHead.setParent(n);
|
pnlHead.setParent(n);
|
||||||
|
|
||||||
leftRegion = new West();
|
leftRegion = new West();
|
||||||
layout.appendChild(leftRegion);
|
layout.appendChild(leftRegion);
|
||||||
leftRegion.setWidth("300px");
|
leftRegion.setWidth("300px");
|
||||||
|
|
@ -137,20 +137,20 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
navigationPanel = new Accordion();
|
navigationPanel = new Accordion();
|
||||||
navigationPanel.setParent(leftRegion);
|
navigationPanel.setParent(leftRegion);
|
||||||
leftRegion.setOpen(true);
|
leftRegion.setOpen(true);
|
||||||
|
|
||||||
navigationPanel.setWidth("100%");
|
navigationPanel.setWidth("100%");
|
||||||
navigationPanel.setHeight("100%");
|
navigationPanel.setHeight("100%");
|
||||||
navigationPanel.add(pnlSide, "Application Menu");
|
navigationPanel.add(pnlSide, "Application Menu");
|
||||||
|
|
||||||
Div div = new Div();
|
Div div = new Div();
|
||||||
favPanel = (DPFavourites) Executions.createComponents(FAVOURITES_PATH, div, null);
|
favPanel = (DPFavourites) Executions.createComponents(FAVOURITES_PATH, div, null);
|
||||||
navigationPanel.add(div, "Favourites");
|
navigationPanel.add(div, "Favourites");
|
||||||
|
|
||||||
//setup drag and drop for favourites
|
//setup drag and drop for favourites
|
||||||
div = navigationPanel.getHeader(1);
|
div = navigationPanel.getHeader(1);
|
||||||
div.setDroppable(DPFavourites.FAVOURITE_DROPPABLE);
|
div.setDroppable(DPFavourites.FAVOURITE_DROPPABLE);
|
||||||
div.addEventListener(Events.ON_DROP, this);
|
div.addEventListener(Events.ON_DROP, this);
|
||||||
|
|
||||||
div = new Div();
|
div = new Div();
|
||||||
Component component = Executions.createComponents(ACTIVITIES_PATH, div, null);
|
Component component = Executions.createComponents(ACTIVITIES_PATH, div, null);
|
||||||
if (component instanceof DashboardPanel)
|
if (component instanceof DashboardPanel)
|
||||||
|
|
@ -159,51 +159,51 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
dashboardRunnable.add(dashboardPanel);
|
dashboardRunnable.add(dashboardPanel);
|
||||||
}
|
}
|
||||||
navigationPanel.add(div, "Activities");
|
navigationPanel.add(div, "Activities");
|
||||||
|
|
||||||
div = new Div();
|
div = new Div();
|
||||||
Executions.createComponents(VIEWS_PATH, div, null);
|
Executions.createComponents(VIEWS_PATH, div, null);
|
||||||
navigationPanel.add(div, "Views");
|
navigationPanel.add(div, Msg.getMsg(Env.getCtx(), "View").replaceAll("&", ""));
|
||||||
|
|
||||||
navigationPanel.setSelectedIndex(0);
|
navigationPanel.setSelectedIndex(0);
|
||||||
|
|
||||||
windowArea = new Center();
|
windowArea = new Center();
|
||||||
windowArea.setParent(layout);
|
windowArea.setParent(layout);
|
||||||
windowArea.setFlex(true);
|
windowArea.setFlex(true);
|
||||||
|
|
||||||
windowContainer.createPart(windowArea);
|
windowContainer.createPart(windowArea);
|
||||||
|
|
||||||
createHomeTab();
|
createHomeTab();
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createHomeTab()
|
private void createHomeTab()
|
||||||
{
|
{
|
||||||
Tabpanel homeTab = new Tabpanel();
|
Tabpanel homeTab = new Tabpanel();
|
||||||
windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
|
windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
|
||||||
|
|
||||||
Portallayout portalLayout = new Portallayout();
|
Portallayout portalLayout = new Portallayout();
|
||||||
portalLayout.setWidth("100%");
|
portalLayout.setWidth("100%");
|
||||||
portalLayout.setHeight("100%");
|
portalLayout.setHeight("100%");
|
||||||
portalLayout.setStyle("position: absolute; overflow: auto");
|
portalLayout.setStyle("position: absolute; overflow: auto");
|
||||||
homeTab.appendChild(portalLayout);
|
homeTab.appendChild(portalLayout);
|
||||||
|
|
||||||
// Dashboard content
|
// Dashboard content
|
||||||
Portalchildren portalchildren = null;
|
Portalchildren portalchildren = null;
|
||||||
int currentColumnNo = 0;
|
int currentColumnNo = 0;
|
||||||
|
|
||||||
String sql = "SELECT COUNT(DISTINCT COLUMNNO) "
|
String sql = "SELECT COUNT(DISTINCT COLUMNNO) "
|
||||||
+ "FROM PA_DASHBOARDCONTENT "
|
+ "FROM PA_DASHBOARDCONTENT "
|
||||||
+ "WHERE (AD_CLIENT_ID=0 OR AD_CLIENT_ID=?) AND ISACTIVE='Y'";
|
+ "WHERE (AD_CLIENT_ID=0 OR AD_CLIENT_ID=?) AND ISACTIVE='Y'";
|
||||||
|
|
||||||
int noOfCols = DB.getSQLValue(null, sql,
|
int noOfCols = DB.getSQLValue(null, sql,
|
||||||
Env.getAD_Client_ID(Env.getCtx()));
|
Env.getAD_Client_ID(Env.getCtx()));
|
||||||
|
|
||||||
int width = noOfCols <= 0 ? 100 : 100/noOfCols;
|
int width = noOfCols <= 0 ? 100 : 100/noOfCols;
|
||||||
|
|
||||||
sql = "SELECT x.*, m.AD_MENU_ID "
|
sql = "SELECT x.*, m.AD_MENU_ID "
|
||||||
+ "FROM PA_DASHBOARDCONTENT x "
|
+ "FROM PA_DASHBOARDCONTENT x "
|
||||||
+ "LEFT OUTER JOIN AD_MENU m ON x.AD_WINDOW_ID=m.AD_WINDOW_ID "
|
+ "LEFT OUTER JOIN AD_MENU m ON x.AD_WINDOW_ID=m.AD_WINDOW_ID "
|
||||||
+ "WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' "
|
+ "WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' "
|
||||||
+ "AND x.zulfilepath not in (?, ?, ?) "
|
+ "AND x.zulfilepath not in (?, ?, ?) "
|
||||||
+ "ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ";
|
+ "ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ";
|
||||||
|
|
@ -217,9 +217,9 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
pstmt.setString(3, FAVOURITES_PATH);
|
pstmt.setString(3, FAVOURITES_PATH);
|
||||||
pstmt.setString(4, VIEWS_PATH);
|
pstmt.setString(4, VIEWS_PATH);
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
|
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo);
|
int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo);
|
||||||
if(portalchildren == null || currentColumnNo != columnNo)
|
if(portalchildren == null || currentColumnNo != columnNo)
|
||||||
{
|
{
|
||||||
|
|
@ -227,26 +227,26 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
portalLayout.appendChild(portalchildren);
|
portalLayout.appendChild(portalchildren);
|
||||||
portalchildren.setWidth(width + "%");
|
portalchildren.setWidth(width + "%");
|
||||||
portalchildren.setStyle("padding: 5px");
|
portalchildren.setStyle("padding: 5px");
|
||||||
|
|
||||||
currentColumnNo = columnNo;
|
currentColumnNo = columnNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
Panel panel = new Panel();
|
Panel panel = new Panel();
|
||||||
panel.setStyle("margin-bottom:10px");
|
panel.setStyle("margin-bottom:10px");
|
||||||
panel.setTitle(rs.getString(X_PA_DashboardContent.COLUMNNAME_Name));
|
panel.setTitle(rs.getString(X_PA_DashboardContent.COLUMNNAME_Name));
|
||||||
|
|
||||||
String description = rs.getString(X_PA_DashboardContent.COLUMNNAME_Description);
|
String description = rs.getString(X_PA_DashboardContent.COLUMNNAME_Description);
|
||||||
if(description != null)
|
if(description != null)
|
||||||
panel.setTooltiptext(description);
|
panel.setTooltiptext(description);
|
||||||
|
|
||||||
String collapsible = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsCollapsible);
|
String collapsible = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsCollapsible);
|
||||||
panel.setCollapsible(collapsible.equals("Y"));
|
panel.setCollapsible(collapsible.equals("Y"));
|
||||||
|
|
||||||
panel.setBorder("normal");
|
panel.setBorder("normal");
|
||||||
portalchildren.appendChild(panel);
|
portalchildren.appendChild(panel);
|
||||||
Panelchildren content = new Panelchildren();
|
Panelchildren content = new Panelchildren();
|
||||||
panel.appendChild(content);
|
panel.appendChild(content);
|
||||||
|
|
||||||
boolean panelEmpty = true;
|
boolean panelEmpty = true;
|
||||||
|
|
||||||
// HTML content
|
// HTML content
|
||||||
|
|
@ -254,7 +254,7 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
if(htmlContent != null)
|
if(htmlContent != null)
|
||||||
{
|
{
|
||||||
StringBuffer result = new StringBuffer("<html><head>");
|
StringBuffer result = new StringBuffer("<html><head>");
|
||||||
|
|
||||||
URL url = getClass().getClassLoader().
|
URL url = getClass().getClassLoader().
|
||||||
getResource("org/compiere/images/PAPanel.css");
|
getResource("org/compiere/images/PAPanel.css");
|
||||||
InputStreamReader ins;
|
InputStreamReader ins;
|
||||||
|
|
@ -262,25 +262,25 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
ins = new InputStreamReader(url.openStream());
|
ins = new InputStreamReader(url.openStream());
|
||||||
BufferedReader bufferedReader = new BufferedReader( ins );
|
BufferedReader bufferedReader = new BufferedReader( ins );
|
||||||
String cssLine;
|
String cssLine;
|
||||||
while ((cssLine = bufferedReader.readLine()) != null)
|
while ((cssLine = bufferedReader.readLine()) != null)
|
||||||
result.append(cssLine + "\n");
|
result.append(cssLine + "\n");
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.append("</head><body><div class=\"content\">\n");
|
result.append("</head><body><div class=\"content\">\n");
|
||||||
|
|
||||||
// if(description != null)
|
// if(description != null)
|
||||||
// result.append("<h2>" + description + "</h2>\n");
|
// result.append("<h2>" + description + "</h2>\n");
|
||||||
result.append(stripHtml(htmlContent, false) + "<br>\n");
|
result.append(stripHtml(htmlContent, false) + "<br>\n");
|
||||||
result.append("</div>\n</body>\n</html>\n</html>");
|
result.append("</div>\n</body>\n</html>\n</html>");
|
||||||
|
|
||||||
Html html = new Html();
|
Html html = new Html();
|
||||||
html.setContent(result.toString());
|
html.setContent(result.toString());
|
||||||
content.appendChild(html);
|
content.appendChild(html);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
int AD_Window_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Window_ID);
|
int AD_Window_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Window_ID);
|
||||||
if(AD_Window_ID > 0)
|
if(AD_Window_ID > 0)
|
||||||
|
|
@ -293,13 +293,13 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
content.appendChild(btn);
|
content.appendChild(btn);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Goal
|
// Goal
|
||||||
int PA_Goal_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_Goal_ID);
|
int PA_Goal_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_Goal_ID);
|
||||||
if(PA_Goal_ID > 0)
|
if(PA_Goal_ID > 0)
|
||||||
{
|
{
|
||||||
StringBuffer result = new StringBuffer("<html><head>");
|
StringBuffer result = new StringBuffer("<html><head>");
|
||||||
|
|
||||||
URL url = getClass().getClassLoader().
|
URL url = getClass().getClassLoader().
|
||||||
getResource("org/compiere/images/PAPanel.css");
|
getResource("org/compiere/images/PAPanel.css");
|
||||||
InputStreamReader ins;
|
InputStreamReader ins;
|
||||||
|
|
@ -307,12 +307,12 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
ins = new InputStreamReader(url.openStream());
|
ins = new InputStreamReader(url.openStream());
|
||||||
BufferedReader bufferedReader = new BufferedReader( ins );
|
BufferedReader bufferedReader = new BufferedReader( ins );
|
||||||
String cssLine;
|
String cssLine;
|
||||||
while ((cssLine = bufferedReader.readLine()) != null)
|
while ((cssLine = bufferedReader.readLine()) != null)
|
||||||
result.append(cssLine + "\n");
|
result.append(cssLine + "\n");
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.append("</head><body><div class=\"content\">\n");
|
result.append("</head><body><div class=\"content\">\n");
|
||||||
result.append(renderGoals(PA_Goal_ID, content));
|
result.append(renderGoals(PA_Goal_ID, content));
|
||||||
result.append("</div>\n</body>\n</html>\n</html>");
|
result.append("</div>\n</body>\n</html>\n</html>");
|
||||||
|
|
@ -322,14 +322,14 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
content.appendChild(html);
|
content.appendChild(html);
|
||||||
panelEmpty = false;
|
panelEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZUL file url
|
// ZUL file url
|
||||||
String url = rs.getString(X_PA_DashboardContent.COLUMNNAME_ZulFilePath);
|
String url = rs.getString(X_PA_DashboardContent.COLUMNNAME_ZulFilePath);
|
||||||
if(url != null)
|
if(url != null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Component component = Executions.createComponents(url, content, null);
|
Component component = Executions.createComponents(url, content, null);
|
||||||
if(component != null)
|
if(component != null)
|
||||||
{
|
{
|
||||||
if (component instanceof DashboardPanel)
|
if (component instanceof DashboardPanel)
|
||||||
{
|
{
|
||||||
|
|
@ -350,7 +350,7 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
logger.log(Level.WARNING, "Failed to create components. zul="+url, e);
|
logger.log(Level.WARNING, "Failed to create components. zul="+url, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panelEmpty)
|
if (panelEmpty)
|
||||||
panel.detach();
|
panel.detach();
|
||||||
}
|
}
|
||||||
|
|
@ -360,40 +360,40 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
//register as 0
|
//register as 0
|
||||||
registerWindow(homeTab);
|
registerWindow(homeTab);
|
||||||
|
|
||||||
if (!portalLayout.getDesktop().isServerPushEnabled())
|
if (!portalLayout.getDesktop().isServerPushEnabled())
|
||||||
portalLayout.getDesktop().enableServerPush(true);
|
portalLayout.getDesktop().enableServerPush(true);
|
||||||
|
|
||||||
dashboardRunnable.refreshDashboard();
|
dashboardRunnable.refreshDashboard();
|
||||||
|
|
||||||
dashboardThread = new Thread(dashboardRunnable, "UpdateInfo");
|
dashboardThread = new Thread(dashboardRunnable, "UpdateInfo");
|
||||||
dashboardThread.setDaemon(true);
|
dashboardThread.setDaemon(true);
|
||||||
dashboardThread.start();
|
dashboardThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event)
|
public void onEvent(Event event)
|
||||||
{
|
{
|
||||||
Component comp = event.getTarget();
|
Component comp = event.getTarget();
|
||||||
String eventName = event.getName();
|
String eventName = event.getName();
|
||||||
|
|
||||||
if(eventName.equals(Events.ON_CLICK))
|
if(eventName.equals(Events.ON_CLICK))
|
||||||
{
|
{
|
||||||
if(comp instanceof ToolBarButton)
|
if(comp instanceof ToolBarButton)
|
||||||
{
|
{
|
||||||
ToolBarButton btn = (ToolBarButton) comp;
|
ToolBarButton btn = (ToolBarButton) comp;
|
||||||
|
|
||||||
int menuId = 0;
|
int menuId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
menuId = Integer.valueOf(btn.getName());
|
menuId = Integer.valueOf(btn.getName());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(menuId > 0) onMenuSelected(menuId);
|
if(menuId > 0) onMenuSelected(menuId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -401,12 +401,12 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
{
|
{
|
||||||
DropEvent de = (DropEvent) event;
|
DropEvent de = (DropEvent) event;
|
||||||
Component dragged = de.getDragged();
|
Component dragged = de.getDragged();
|
||||||
|
|
||||||
if(dragged instanceof Treerow)
|
if(dragged instanceof Treerow)
|
||||||
{
|
{
|
||||||
Treerow treerow = (Treerow) dragged;
|
Treerow treerow = (Treerow) dragged;
|
||||||
Treeitem treeitem = (Treeitem) treerow.getParent();
|
Treeitem treeitem = (Treeitem) treerow.getParent();
|
||||||
|
|
||||||
favPanel.addItem(treeitem);
|
favPanel.addItem(treeitem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -417,12 +417,12 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
noOfNotice = DPActivities.getNoticeCount();
|
noOfNotice = DPActivities.getNoticeCount();
|
||||||
noOfRequest = DPActivities.getRequestCount();
|
noOfRequest = DPActivities.getRequestCount();
|
||||||
noOfWorkflow = DPActivities.getWorkflowCount();
|
noOfWorkflow = DPActivities.getWorkflowCount();
|
||||||
|
|
||||||
template.execute(this);
|
template.execute(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param page
|
* @param page
|
||||||
*/
|
*/
|
||||||
public void setPage(Page page) {
|
public void setPage(Page page) {
|
||||||
|
|
@ -431,7 +431,7 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
this.page = page;
|
this.page = page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the root component
|
* Get the root component
|
||||||
* @return Component
|
* @return Component
|
||||||
|
|
@ -439,7 +439,7 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
public Component getComponent() {
|
public Component getComponent() {
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logout() {
|
public void logout() {
|
||||||
if (dashboardThread != null && dashboardThread.isAlive()) {
|
if (dashboardThread != null && dashboardThread.isAlive()) {
|
||||||
dashboardRunnable.stop();
|
dashboardRunnable.stop();
|
||||||
|
|
@ -450,6 +450,8 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
||||||
public void updateUI() {
|
public void updateUI() {
|
||||||
int total = noOfNotice + noOfRequest + noOfWorkflow;
|
int total = noOfNotice + noOfRequest + noOfWorkflow;
|
||||||
navigationPanel.setLabel(2, "Activities (" + total + ")");
|
navigationPanel.setLabel(2, "Activities (" + total + ")");
|
||||||
navigationPanel.setTooltiptext(2, "Notice : " + noOfNotice + ", Request : " + noOfRequest + ", Workflow Activities : " + noOfWorkflow);
|
navigationPanel.setTooltiptext(2, Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice
|
||||||
|
+ ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest
|
||||||
|
+ ", " + Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue