diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/dashboard/DashboardControllerGlobal.java b/libreplan-webapp/src/main/java/org/libreplan/web/dashboard/DashboardControllerGlobal.java new file mode 100644 index 000000000..cdf052a90 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/web/dashboard/DashboardControllerGlobal.java @@ -0,0 +1,21 @@ +package org.libreplan.web.dashboard; + +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.util.GenericForwardComposer; + +/** + * Created + * @author Vova Perebykivskiy + * on 20.11.15. + */ + +@org.springframework.stereotype.Component +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +public class DashboardControllerGlobal extends GenericForwardComposer { + @Override + public void doAfterCompose(Component component) throws Exception { + super.doAfterCompose(component); + } +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/email/EmailTemplateController.java b/libreplan-webapp/src/main/java/org/libreplan/web/email/EmailTemplateController.java index 69e4b82aa..9afde3297 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/email/EmailTemplateController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/email/EmailTemplateController.java @@ -21,12 +21,15 @@ package org.libreplan.web.email; import org.libreplan.business.common.exceptions.InstanceNotFoundException; import org.libreplan.business.common.exceptions.ValidationException; +import org.libreplan.business.orders.entities.Order; import org.libreplan.business.settings.entities.Language; import org.libreplan.business.email.entities.EmailTemplateEnum; import org.libreplan.web.common.IMessagesForUser; import org.libreplan.web.common.Level; import org.libreplan.web.common.MessagesForUser; +import org.libreplan.web.orders.IOrderModel; +import org.springframework.beans.factory.annotation.Autowired; import org.zkoss.zk.ui.Component; @@ -177,4 +180,10 @@ public class EmailTemplateController extends GenericForwardComposer{ private void getContentDataBySelectedTemplate(){ contentsTextbox.setValue( emailTemplateModel.getContentBySelectedTemplate( getSelectedEmailTemplateEnum().ordinal(), getSelectedLanguage().ordinal() ) ); } + + @Autowired + private IOrderModel orderModel; + public List getOrder(){ + return orderModel.getOrders(); + } } diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/DashboardTabCreator.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/DashboardTabCreator.java index 25084ad33..21ecc1c92 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/DashboardTabCreator.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/DashboardTabCreator.java @@ -33,6 +33,7 @@ import org.libreplan.business.orders.entities.Order; import org.libreplan.business.planner.entities.TaskElement; import org.libreplan.business.resources.daos.IResourcesSearcher; import org.libreplan.web.dashboard.DashboardController; +import org.libreplan.web.dashboard.DashboardControllerGlobal; import org.libreplan.web.planner.order.OrderPlanningController; import org.libreplan.web.planner.order.PlanningStateCreator; import org.libreplan.web.planner.order.PlanningStateCreator.PlanningState; @@ -55,17 +56,19 @@ public class DashboardTabCreator { public static ITab create(Mode mode, PlanningStateCreator planningStateCreator, DashboardController dashboardController, + DashboardControllerGlobal dashboardControllerGlobal, OrderPlanningController orderPlanningController, Component breadcrumbs, IResourcesSearcher resourcesSearcher) { return new DashboardTabCreator(mode, planningStateCreator, - dashboardController, orderPlanningController, breadcrumbs, - resourcesSearcher).build(); + dashboardController, dashboardControllerGlobal, orderPlanningController, + breadcrumbs, resourcesSearcher).build(); } private final PlanningStateCreator planningStateCreator; private final Mode mode; private final DashboardController dashboardController; + private final DashboardControllerGlobal dashboardControllerGlobal; private final OrderPlanningController orderPlanningController; private final Component breadcrumbs; private final IResourcesSearcher resourcesSearcher; @@ -73,12 +76,14 @@ public class DashboardTabCreator { private DashboardTabCreator(Mode mode, PlanningStateCreator planningStateCreator, DashboardController dashboardController, + DashboardControllerGlobal dashboardControllerGlobal, OrderPlanningController orderPlanningController, Component breadcrumbs, IResourcesSearcher resourcesSearcher) { this.mode = mode; this.planningStateCreator = planningStateCreator; this.dashboardController = dashboardController; + this.dashboardControllerGlobal = dashboardControllerGlobal; this.orderPlanningController = orderPlanningController; this.breadcrumbs = breadcrumbs; this.resourcesSearcher = resourcesSearcher; @@ -86,7 +91,7 @@ public class DashboardTabCreator { private ITab build() { return TabOnModeType.forMode(mode) - .forType(ModeType.GLOBAL, createDashboardTab()) + .forType(ModeType.GLOBAL, createDashboardGlobalTab()) .forType(ModeType.ORDER, createDashboardTab()) .create(); } @@ -129,6 +134,34 @@ public class DashboardTabCreator { } }; } + private ITab createDashboardGlobalTab(){ + IComponentCreator componentCreator = new IComponentCreator() { + + @Override + public org.zkoss.zk.ui.Component create( + org.zkoss.zk.ui.Component parent) { + Map arguments = new HashMap(); + arguments.put("dashboardControllerGlobal", dashboardControllerGlobal); + return Executions.createComponents( + "/dashboard/_dashboardforglobal.zul", parent, + arguments); + } + + }; + return new CreatedOnDemandTab(_("Dashboard"), "global-dashboard", + componentCreator) { + + @Override + protected void afterShowAction() { + breadcrumbs.getChildren().clear(); + breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR)); + breadcrumbs.appendChild(new Label(getSchedulingLabel())); + breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR)); + breadcrumbs.appendChild(new Label(_("Dashboard"))); + } + }; + + } private List getCriticalPath(final Order order, final Desktop desktop) { CriticalPathBuilder builder = CriticalPathBuilder.create( diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java index ba4ff4365..7b5db901a 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java @@ -40,6 +40,7 @@ import org.libreplan.web.common.ConfirmCloseUtil; import org.libreplan.web.common.entrypoints.EntryPointsHandler; import org.libreplan.web.common.entrypoints.URLHandlerRegistry; import org.libreplan.web.dashboard.DashboardController; +import org.libreplan.web.dashboard.DashboardControllerGlobal; import org.libreplan.web.limitingresources.LimitingResourcesController; import org.libreplan.web.montecarlo.MonteCarloController; import org.libreplan.web.orders.OrderCRUDController; @@ -186,6 +187,9 @@ public class MultipleTabsPlannerController implements Composer, @Autowired private DashboardController dashboardController; + @Autowired + private DashboardControllerGlobal dashboardControllerGlobal; + private org.zkoss.zk.ui.Component breadcrumbs; @Autowired @@ -296,7 +300,7 @@ public class MultipleTabsPlannerController implements Composer, }, parameters); dashboardTab = DashboardTabCreator.create(mode, planningStateCreator, - dashboardController, orderPlanningController, breadcrumbs, + dashboardController, dashboardControllerGlobal, orderPlanningController, breadcrumbs, resourcesSearcher); final boolean isMontecarloVisible = isMonteCarloVisible(); @@ -324,7 +328,7 @@ public class MultipleTabsPlannerController implements Composer, resourceLoadTab, typeChanged)); } tabsConfiguration.add(visibleOnlyAtOrderMode(advancedAllocationTab)) - .add(visibleOnlyAtOrderMode(dashboardTab)); + .add(tabWithNameReloading(dashboardTab, typeChanged)); if (isMontecarloVisible) { tabsConfiguration.add(visibleOnlyAtOrderMode(monteCarloTab)); diff --git a/libreplan-webapp/src/main/webapp/common/css/libreplan_zk.css b/libreplan-webapp/src/main/webapp/common/css/libreplan_zk.css index 8b2ac1658..c8e68b126 100644 --- a/libreplan-webapp/src/main/webapp/common/css/libreplan_zk.css +++ b/libreplan-webapp/src/main/webapp/common/css/libreplan_zk.css @@ -999,7 +999,7 @@ span.z-dottree-line { } span.perspective, span.perspective-active { - margin: 0 2px; + margin: 4px 2px; } .perspectives-label { @@ -1060,10 +1060,19 @@ span.perspective, span.perspective-active { .perspective-active.montecarlo-simulation .z-button-cm { background-image: url(../img/ico_montecarlo-simulation.png); } -.perspective.order-dashboard .z-button-cm, -.perspective-active.order-dashboard .z-button-cm { +.perspective.global-dashboard .z-button-cm{ + background-image: url(../img/ico_global-dashboard.png); +} +.perspective-active.global-dashboard .z-button-cm{ + background-image: url(../img/ico_global-dashboard.png); +} +.perspective.order-dashboard .z-button-cm{ background-image: url(../img/ico_order-dashboard.png); } +.perspective-active.order-dashboard .z-button-cm{ + background-image: url(../img/ico_order-dashboard.png); +} + .perspectives-column { diff --git a/libreplan-webapp/src/main/webapp/common/img/ico_global-dashboard.png b/libreplan-webapp/src/main/webapp/common/img/ico_global-dashboard.png new file mode 100644 index 000000000..da155dc06 Binary files /dev/null and b/libreplan-webapp/src/main/webapp/common/img/ico_global-dashboard.png differ diff --git a/libreplan-webapp/src/main/webapp/dashboard/_dashboardforglobal.zul b/libreplan-webapp/src/main/webapp/dashboard/_dashboardforglobal.zul new file mode 100644 index 000000000..d09dd6edf --- /dev/null +++ b/libreplan-webapp/src/main/webapp/dashboard/_dashboardforglobal.zul @@ -0,0 +1,66 @@ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ \ No newline at end of file diff --git a/libreplan-webapp/src/main/webapp/email/email_templates.zul b/libreplan-webapp/src/main/webapp/email/email_templates.zul index 2c4b8bb2e..22b4018f3 100644 --- a/libreplan-webapp/src/main/webapp/email/email_templates.zul +++ b/libreplan-webapp/src/main/webapp/email/email_templates.zul @@ -130,5 +130,19 @@