Update Spring stack.

Code refactoring (config files, java classes, css file).
Update LibrePlan version in files.
This commit is contained in:
Vova Perebykivskyi 2016-05-12 17:41:35 +03:00 committed by Dgray16
parent c7b428b61b
commit cfc416e4ec
46 changed files with 1708 additions and 1853 deletions

View file

@ -49,6 +49,15 @@ Changes
* Update CXF-frontend-jaxrs * Update CXF-frontend-jaxrs
* Add CXF-rs-client * Add CXF-rs-client
* Update Spring ORM
* Update Spring Context Support
* Update Spring Test
* Update Spring Web
* Update Spring Security LDAP
* Update Spring Security ACL
* Update Spring Security Web
* Update Spring Security Config
* Update MPXJ * Update MPXJ
* Update Bonecp * Update Bonecp
* Update Guava * Update Guava
@ -65,12 +74,14 @@ Changes
* Update AspectJ Weaver * Update AspectJ Weaver
* Update JAX-RS API * Update JAX-RS API
* Update BeanShell * Update BeanShell
* Update Quartz Framework
* Update LibrePlan version to 1.6.0 * Update LibrePlan version to 1.6.0
* Remove Ezmorph * Remove Ezmorph
* Remove Json-lib * Remove Json-lib
* Remove M2E plugin
* Code refactoring * Code refactoring

View file

@ -56,39 +56,6 @@
</profile> </profile>
</profiles> </profiles>
<!-- TODO delete it? -->
<build>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.xnap.commons</groupId>
<artifactId>maven-gettext-plugin</artifactId>
<versionRange>[1.2.4,)</versionRange>
<goals>
<goal>dist</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies> <dependencies>
<!-- Gettext commons --> <!-- Gettext commons -->
<dependency> <dependency>

View file

@ -23,15 +23,16 @@ package org.zkoss.ganttz;
import static org.zkoss.ganttz.i18n.I18nHelper._; import static org.zkoss.ganttz.i18n.I18nHelper._;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.List;
import java.util.Collection;
import java.util.Collections;
import java.util.ArrayList;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.zkoss.ganttz.adapters.IDisabilityConfiguration; import org.zkoss.ganttz.adapters.IDisabilityConfiguration;
@ -77,64 +78,51 @@ import org.zkoss.zul.api.Combobox;
public class Planner extends HtmlMacroComponent { public class Planner extends HtmlMacroComponent {
private static final Log PROFILING_LOG = ProfilingLogFactory private static final Log PROFILING_LOG = ProfilingLogFactory.getLog(Planner.class);
.getLog(Planner.class);
public static boolean guessContainersExpandedByDefaultGivenPrintParameters( public static boolean guessContainersExpandedByDefaultGivenPrintParameters(Map<String, String> printParameters) {
Map<String, String> printParameters) {
return guessContainersExpandedByDefault(convertToURLParameters(printParameters)); return guessContainersExpandedByDefault(convertToURLParameters(printParameters));
} }
private static Map<String, String[]> convertToURLParameters( private static Map<String, String[]> convertToURLParameters(Map<String, String> printParameters) {
Map<String, String> printParameters) { Map<String, String[]> result = new HashMap<>();
Map<String, String[]> result = new HashMap<String, String[]>();
for (Entry<String, String> each : printParameters.entrySet()) { for (Entry<String, String> each : printParameters.entrySet()) {
result.put(each.getKey(), new String[] { each.getValue() }); result.put(each.getKey(), new String[] { each.getValue() });
} }
return result; return result;
} }
public static boolean guessContainersExpandedByDefault( public static boolean guessContainersExpandedByDefault(Map<String, String[]> queryURLParameters) {
Map<String, String[]> queryURLParameters) {
String[] values = queryURLParameters.get("expanded"); String[] values = queryURLParameters.get("expanded");
if (values == null) {
return false; return values != null && toLowercaseSet(values).contains("all");
}
return toLowercaseSet(values).contains("all");
} }
public static boolean guessShowAdvancesByDefault( public static boolean guessShowAdvancesByDefault(Map<String, String[]> queryURLParameters) {
Map<String, String[]> queryURLParameters) {
String[] values = queryURLParameters.get("advances"); String[] values = queryURLParameters.get("advances");
if (values == null) {
return false; return values != null && toLowercaseSet(values).contains("all");
}
return toLowercaseSet(values).contains("all");
} }
public static boolean guessShowReportedHoursByDefault( public static boolean guessShowReportedHoursByDefault(Map<String, String[]> queryURLParameters) {
Map<String, String[]> queryURLParameters) {
String[] values = queryURLParameters.get("reportedHours"); String[] values = queryURLParameters.get("reportedHours");
if (values == null) {
return false; return values != null && toLowercaseSet(values).contains("all");
}
return toLowercaseSet(values).contains("all");
} }
public static boolean guessShowMoneyCostBarByDefault( public static boolean guessShowMoneyCostBarByDefault(Map<String, String[]> queryURLParameters) {
Map<String, String[]> queryURLParameters) {
String[] values = queryURLParameters.get("moneyCostBar"); String[] values = queryURLParameters.get("moneyCostBar");
if (values == null) {
return false; return values != null && toLowercaseSet(values).contains("all");
}
return toLowercaseSet(values).contains("all");
} }
private static Set<String> toLowercaseSet(String[] values) { private static Set<String> toLowercaseSet(String[] values) {
Set<String> result = new HashSet<String>(); Set<String> result = new HashSet<>();
for (String each : values) { for (String each : values) {
result.add(each.toLowerCase()); result.add(each.toLowerCase());
} }
return result; return result;
} }
@ -146,8 +134,6 @@ public class Planner extends HtmlMacroComponent {
private List<? extends CommandContextualized<?>> contextualizedGlobalCommands; private List<? extends CommandContextualized<?>> contextualizedGlobalCommands;
private CommandContextualized<?> goingDownInLastArrowCommand;
private List<? extends CommandOnTaskContextualized<?>> commandsOnTasksContextualized; private List<? extends CommandOnTaskContextualized<?>> commandsOnTasksContextualized;
private CommandOnTaskContextualized<?> doubleClickCommand; private CommandOnTaskContextualized<?> doubleClickCommand;
@ -176,17 +162,18 @@ public class Planner extends HtmlMacroComponent {
private Listbox listZoomLevels = null; private Listbox listZoomLevels = null;
private WeakReferencedListeners<IChartVisibilityChangedListener> chartVisibilityListeners = WeakReferencedListeners private WeakReferencedListeners<IChartVisibilityChangedListener> chartVisibilityListeners =
.create(); WeakReferencedListeners.create();
public Planner() { public Planner() {
} }
TaskList getTaskList() { TaskList getTaskList() {
if (ganttPanel == null) { if ( ganttPanel == null ) {
return null; return null;
} }
List<Object> children = ganttPanel.getChildren(); List<Object> children = ganttPanel.getChildren();
return ComponentsFinder.findComponentsOfType(TaskList.class, children).get(0); return ComponentsFinder.findComponentsOfType(TaskList.class, children).get(0);
} }
@ -194,9 +181,6 @@ public class Planner extends HtmlMacroComponent {
return getTaskList().getTasksNumber(); return getTaskList().getTasksNumber();
} }
private static int PIXELS_PER_TASK_LEVEL = 21;
private static int PIXELS_PER_CHARACTER = 5;
public int calculateMinimumWidthForTaskNameColumn(boolean expand) { public int calculateMinimumWidthForTaskNameColumn(boolean expand) {
return calculateMinimumWidthForTaskNameColumn(expand, getTaskList().getAllTasks()); return calculateMinimumWidthForTaskNameColumn(expand, getTaskList().getAllTasks());
} }
@ -204,18 +188,22 @@ public class Planner extends HtmlMacroComponent {
private int calculateMinimumWidthForTaskNameColumn(boolean expand, List<Task> tasks) { private int calculateMinimumWidthForTaskNameColumn(boolean expand, List<Task> tasks) {
IDomainAndBeansMapper<?> mapper = getContext().getMapper(); IDomainAndBeansMapper<?> mapper = getContext().getMapper();
int widest = 0; int widest = 0;
for(Task task : tasks) { for(Task task : tasks) {
int numberOfAncestors = int numberOfAncestors = mapper.findPositionFor(task).getAncestors().size();
mapper.findPositionFor(task).getAncestors().size();
int numberOfCharacters = task.getName().length(); int numberOfCharacters = task.getName().length();
widest = Math.max(widest, int PIXELS_PER_TASK_LEVEL = 21;
numberOfCharacters * PIXELS_PER_CHARACTER + int PIXELS_PER_CHARACTER = 5;
numberOfAncestors * PIXELS_PER_TASK_LEVEL);
if(expand && !task.isLeaf()) { widest = Math.max(
widest = Math.max(widest, widest,
calculateMinimumWidthForTaskNameColumn(expand, task.getTasks())); numberOfCharacters * PIXELS_PER_CHARACTER + numberOfAncestors * PIXELS_PER_TASK_LEVEL);
if( expand && !task.isLeaf() ) {
widest = Math.max(widest, calculateMinimumWidthForTaskNameColumn(expand, task.getTasks()));
} }
} }
return widest; return widest;
} }
@ -228,50 +216,56 @@ public class Planner extends HtmlMacroComponent {
} }
public DependencyList getDependencyList() { public DependencyList getDependencyList() {
if (ganttPanel == null) { if ( ganttPanel == null ) {
return null; return null;
} }
List<Object> children = ganttPanel.getChildren(); List<Object> children = ganttPanel.getChildren();
List<DependencyList> found = ComponentsFinder.findComponentsOfType(DependencyList.class, List<DependencyList> found = ComponentsFinder.findComponentsOfType(DependencyList.class, children);
children);
if (found.isEmpty()) { if ( found.isEmpty() ) {
return null; return null;
} }
return found.get(0); return found.get(0);
} }
public void addTasks(Position position, Collection<? extends Task> newTasks) { public void addTasks(Position position, Collection<? extends Task> newTasks) {
TaskList taskList = getTaskList(); TaskList taskList = getTaskList();
if (taskList != null && leftPane != null) { if ( taskList != null && leftPane != null ) {
taskList.addTasks(position, newTasks); taskList.addTasks(position, newTasks);
leftPane.addTasks(position, newTasks); leftPane.addTasks(position, newTasks);
} }
} }
public void addTask(Position position, Task task) { public void addTask(Position position, Task task) {
addTasks(position, Arrays.asList(task)); addTasks(position, Collections.singletonList(task));
} }
void addDependencies(Collection<? extends Dependency> dependencies) { void addDependencies(Collection<? extends Dependency> dependencies) {
DependencyList dependencyList = getDependencyList(); DependencyList dependencyList = getDependencyList();
if (dependencyList == null) { if ( dependencyList == null ) {
return; return;
} }
for (DependencyComponent d : getTaskList().asDependencyComponents(
dependencies)) { for (DependencyComponent d : getTaskList().asDependencyComponents(dependencies)) {
dependencyList.addDependencyComponent(d); dependencyList.addDependencyComponent(d);
} }
} }
public ListModel getZoomLevels() { public ListModel getZoomLevels() {
ZoomLevel[] selectableZoomlevels = { ZoomLevel.DETAIL_ONE, ZoomLevel[] selectableZoomlevels = {
ZoomLevel.DETAIL_TWO, ZoomLevel.DETAIL_THREE, ZoomLevel.DETAIL_ONE,
ZoomLevel.DETAIL_FOUR, ZoomLevel.DETAIL_FIVE }; ZoomLevel.DETAIL_TWO,
ZoomLevel.DETAIL_THREE,
ZoomLevel.DETAIL_FOUR,
ZoomLevel.DETAIL_FIVE };
return new SimpleListModel(selectableZoomlevels); return new SimpleListModel(selectableZoomlevels);
} }
public void setZoomLevel(final ZoomLevel zoomLevel, int scrollLeft) { public void setZoomLevel(final ZoomLevel zoomLevel, int scrollLeft) {
if (ganttPanel == null) { if ( ganttPanel == null ) {
return; return;
} }
this.zoomLevel = zoomLevel; this.zoomLevel = zoomLevel;
@ -279,7 +273,7 @@ public class Planner extends HtmlMacroComponent {
} }
public void zoomIncrease() { public void zoomIncrease() {
if (ganttPanel == null) { if ( ganttPanel == null ) {
return; return;
} }
LongOperationFeedback.execute(ganttPanel, new ILongOperation() { LongOperationFeedback.execute(ganttPanel, new ILongOperation() {
@ -297,7 +291,7 @@ public class Planner extends HtmlMacroComponent {
} }
public void zoomDecrease() { public void zoomDecrease() {
if (ganttPanel == null) { if ( ganttPanel == null ) {
return; return;
} }
LongOperationFeedback.execute(ganttPanel, new ILongOperation() { LongOperationFeedback.execute(ganttPanel, new ILongOperation() {
@ -314,13 +308,14 @@ public class Planner extends HtmlMacroComponent {
} }
public <T> void setConfiguration(PlannerConfiguration<T> configuration) { public <T> void setConfiguration(PlannerConfiguration<T> configuration) {
if (configuration == null) { if ( configuration == null ) {
return; return;
} }
if (isShowingLabels) if ( isShowingLabels )
Clients.evalJavaScript("ganttz.TaskList.getInstance().showAllTaskLabels()"); Clients.evalJavaScript("ganttz.TaskList.getInstance().showAllTaskLabels()");
if (isShowingResources)
if ( isShowingResources )
Clients.evalJavaScript("ganttz.TaskList.getInstance().showResourceTooltips()"); Clients.evalJavaScript("ganttz.TaskList.getInstance().showResourceTooltips()");
this.diagramGraph = GanttDiagramGraph.create( this.diagramGraph = GanttDiagramGraph.create(
@ -328,24 +323,24 @@ public class Planner extends HtmlMacroComponent {
configuration.getStartConstraints(), configuration.getStartConstraints(),
configuration.getEndConstraints(), configuration.getEndConstraints(),
configuration.isDependenciesConstraintsHavePriority()); configuration.isDependenciesConstraintsHavePriority());
FunctionalityExposedForExtensions<T> newContext = new FunctionalityExposedForExtensions<T>(
this, configuration, diagramGraph); FunctionalityExposedForExtensions<T> newContext =
new FunctionalityExposedForExtensions<>(this, configuration, diagramGraph);
addGraphChangeListenersFromConfiguration(configuration); addGraphChangeListenersFromConfiguration(configuration);
this.contextualizedGlobalCommands = contextualize(newContext, this.contextualizedGlobalCommands = contextualize(newContext, configuration.getGlobalCommands());
configuration.getGlobalCommands()); this.commandsOnTasksContextualized = contextualize(newContext, configuration.getCommandsOnTasks());
this.commandsOnTasksContextualized = contextualize(newContext,
configuration.getCommandsOnTasks()); CommandContextualized<?> goingDownInLastArrowCommand =
goingDownInLastArrowCommand = contextualize(newContext, configuration contextualize(newContext, configuration.getGoingDownInLastArrowCommand());
.getGoingDownInLastArrowCommand());
doubleClickCommand = contextualize(newContext, configuration doubleClickCommand = contextualize(newContext, configuration.getDoubleClickCommand());
.getDoubleClickCommand());
this.context = newContext; this.context = newContext;
this.disabilityConfiguration = configuration; this.disabilityConfiguration = configuration;
resettingPreviousComponentsToNull(); resettingPreviousComponentsToNull();
long timeAddingData = System.currentTimeMillis(); long timeAddingData = System.currentTimeMillis();
newContext.add(configuration.getData()); newContext.add(configuration.getData());
PROFILING_LOG.debug("It took to add data: " PROFILING_LOG.debug("It took to add data: " + (System.currentTimeMillis() - timeAddingData) + " ms");
+ (System.currentTimeMillis() - timeAddingData) + " ms");
long timeSetupingAndAddingComponents = System.currentTimeMillis(); long timeSetupingAndAddingComponents = System.currentTimeMillis();
setupComponents(); setupComponents();
setAt("insertionPointLeftPanel", leftPane); setAt("insertionPointLeftPanel", leftPane);
@ -354,34 +349,38 @@ public class Planner extends HtmlMacroComponent {
ganttPanel.afterCompose(); ganttPanel.afterCompose();
leftPane.setGoingDownInLastArrowCommand(goingDownInLastArrowCommand); leftPane.setGoingDownInLastArrowCommand(goingDownInLastArrowCommand);
TimeTrackerComponent timetrackerheader = new TimeTrackerComponentWithoutColumns( TimeTrackerComponent timetrackerheader =
ganttPanel.getTimeTracker(), "timetrackerheader"); new TimeTrackerComponentWithoutColumns(ganttPanel.getTimeTracker(), "timetrackerheader");
setAt("insertionPointTimetracker", timetrackerheader); setAt("insertionPointTimetracker", timetrackerheader);
timetrackerheader.afterCompose(); timetrackerheader.afterCompose();
Component chartComponent = configuration.getChartComponent(); Component chartComponent = configuration.getChartComponent();
if (chartComponent != null) { if ( chartComponent != null ) {
setAt("insertionPointChart", chartComponent); setAt("insertionPointChart", chartComponent);
} }
if (!configuration.isCriticalPathEnabled()) { if ( !configuration.isCriticalPathEnabled() ) {
Button showCriticalPathButton = (Button) getFellow("showCriticalPath"); Button showCriticalPathButton = (Button) getFellow("showCriticalPath");
showCriticalPathButton.setVisible(false); showCriticalPathButton.setVisible(false);
} }
if (!configuration.isExpandAllEnabled()) {
if ( !configuration.isExpandAllEnabled() ) {
Button expandAllButton = (Button) getFellow("expandAll"); Button expandAllButton = (Button) getFellow("expandAll");
expandAllButton.setVisible(false); expandAllButton.setVisible(false);
} }
if (!configuration.isFlattenTreeEnabled()) {
if ( !configuration.isFlattenTreeEnabled() ) {
Button flattenTree = (Button) getFellow("flattenTree"); Button flattenTree = (Button) getFellow("flattenTree");
flattenTree.setVisible(false); flattenTree.setVisible(false);
} }
if (!configuration.isShowAllResourcesEnabled()) {
if ( !configuration.isShowAllResourcesEnabled() ) {
Button showAllResources = (Button) getFellow("showAllResources"); Button showAllResources = (Button) getFellow("showAllResources");
showAllResources.setVisible(false); showAllResources.setVisible(false);
} }
if (!configuration.isMoneyCostBarEnabled()) {
if ( !configuration.isMoneyCostBarEnabled() ) {
Button showMoneyCostBarButton = (Button) getFellow("showMoneyCostBar"); Button showMoneyCostBarButton = (Button) getFellow("showMoneyCostBar");
showMoneyCostBarButton.setVisible(false); showMoneyCostBarButton.setVisible(false);
} }
@ -391,35 +390,33 @@ public class Planner extends HtmlMacroComponent {
this.visibleChart = configuration.isExpandPlanningViewCharts(); this.visibleChart = configuration.isExpandPlanningViewCharts();
((South) getFellow("graphics")).setOpen(this.visibleChart); ((South) getFellow("graphics")).setOpen(this.visibleChart);
PROFILING_LOG PROFILING_LOG.debug(
.debug("it took doing the setup of components and adding them: " "It took doing the setup of components and adding them: " +
+ (System.currentTimeMillis() - timeSetupingAndAddingComponents) (System.currentTimeMillis() - timeSetupingAndAddingComponents) + " ms");
+ " ms");
setAuService(new AuService(){ setAuService(new AuService(){
public boolean service(AuRequest request, boolean everError){ public boolean service(AuRequest request, boolean everError){
String command = request.getCommand(); String command = request.getCommand();
String[] requestData;
int zoomindex; int zoomindex;
int scrollLeft; int scrollLeft;
if (command.equals("onZoomLevelChange")){ if ( command.equals("onZoomLevelChange") ){
zoomindex= (Integer) retrieveData(request, "zoomindex"); zoomindex= (Integer) retrieveData(request, "zoomindex");
scrollLeft = (Integer) retrieveData(request, "scrollLeft"); scrollLeft = (Integer) retrieveData(request, "scrollLeft");
setZoomLevel((ZoomLevel)((Listbox)getFellow("listZoomLevels")) setZoomLevel((ZoomLevel)((Listbox)getFellow("listZoomLevels"))
.getModel().getElementAt(zoomindex), .getModel().getElementAt(zoomindex), scrollLeft);
scrollLeft);
return true; return true;
} }
return false; return false;
} }
private Object retrieveData(AuRequest request, String key){ private Object retrieveData(AuRequest request, String key){
Object value = request.getData().get(key); Object value = request.getData().get(key);
if ( value == null) if ( value == null )
throw new UiException(MZk.ILLEGAL_REQUEST_WRONG_DATA, throw new UiException(MZk.ILLEGAL_REQUEST_WRONG_DATA, new Object[] { key, this });
new Object[] { key, this });
return value; return value;
} }
@ -438,36 +435,38 @@ public class Planner extends HtmlMacroComponent {
} }
private <T> List<CommandOnTaskContextualized<T>> contextualize( private <T> List<CommandOnTaskContextualized<T>> contextualize(
FunctionalityExposedForExtensions<T> context, FunctionalityExposedForExtensions<T> context, List<ICommandOnTask<T>> commands) {
List<ICommandOnTask<T>> commands) {
List<CommandOnTaskContextualized<T>> result = new ArrayList<CommandOnTaskContextualized<T>>(); List<CommandOnTaskContextualized<T>> result = new ArrayList<>();
for (ICommandOnTask<T> c : commands) { for (ICommandOnTask<T> c : commands) {
result.add(contextualize(context, c)); result.add(contextualize(context, c));
} }
return result; return result;
} }
private <T> CommandOnTaskContextualized<T> contextualize( private <T> CommandOnTaskContextualized<T> contextualize(
FunctionalityExposedForExtensions<T> context, FunctionalityExposedForExtensions<T> context, ICommandOnTask<T> commandOnTask) {
ICommandOnTask<T> commandOnTask) {
return CommandOnTaskContextualized.create(commandOnTask, context return CommandOnTaskContextualized.create(commandOnTask, context.getMapper(), context);
.getMapper(), context);
} }
private <T> CommandContextualized<T> contextualize(IContext<T> context, private <T> CommandContextualized<T> contextualize(IContext<T> context, ICommand<T> command) {
ICommand<T> command) {
if (command == null) { if (command == null) {
return null; return null;
} }
return CommandContextualized.create(command, context); return CommandContextualized.create(command, context);
} }
private <T> List<CommandContextualized<T>> contextualize( private <T> List<CommandContextualized<T>> contextualize(
IContext<T> context, Collection<? extends ICommand<T>> commands) { IContext<T> context, Collection<? extends ICommand<T>> commands) {
ArrayList<CommandContextualized<T>> result = new ArrayList<CommandContextualized<T>>();
ArrayList<CommandContextualized<T>> result = new ArrayList<>();
for (ICommand<T> command : commands) { for (ICommand<T> command : commands) {
result.add(contextualize(context, command)); result.add(contextualize(context, command));
} }
return result; return result;
} }
@ -475,16 +474,16 @@ public class Planner extends HtmlMacroComponent {
insertGlobalCommands(); insertGlobalCommands();
predicate = new FilterAndParentExpandedPredicates(context) { predicate = new FilterAndParentExpandedPredicates(context) {
@Override @Override
public boolean accpetsFilterPredicate(Task task) { public boolean accpetsFilterPredicate(Task task) {
return true; return true;
} }
}; };
this.leftPane = new LeftPane(disabilityConfiguration, this, predicate); this.leftPane = new LeftPane(disabilityConfiguration, this, predicate);
this.ganttPanel = new GanttPanel(this,
commandsOnTasksContextualized, doubleClickCommand, this.ganttPanel = new GanttPanel(
disabilityConfiguration, predicate); this, commandsOnTasksContextualized, doubleClickCommand, disabilityConfiguration, predicate);
Button button = (Button) getFellow("btnPrint"); Button button = (Button) getFellow("btnPrint");
button.setDisabled(!context.isPrintEnabled()); button.setDisabled(!context.isPrintEnabled());
@ -502,16 +501,18 @@ public class Planner extends HtmlMacroComponent {
private void insertGlobalCommands() { private void insertGlobalCommands() {
Component commontoolbar = getCommonCommandsInsertionPoint(); Component commontoolbar = getCommonCommandsInsertionPoint();
Component plannerToolbar = getSpecificCommandsInsertionPoint(); Component plannerToolbar = getSpecificCommandsInsertionPoint();
if (!contextualizedGlobalCommands.isEmpty()) {
if ( !contextualizedGlobalCommands.isEmpty() ) {
commontoolbar.getChildren().removeAll(commontoolbar.getChildren()); commontoolbar.getChildren().removeAll(commontoolbar.getChildren());
} }
for (CommandContextualized<?> c : contextualizedGlobalCommands) { for (CommandContextualized<?> c : contextualizedGlobalCommands) {
// Comparison through icon as name is internationalized // Comparison through icon as name is internationalized
if (c.getCommand().isPlannerCommand()) { if ( c.getCommand().isPlannerCommand() ) {
// FIXME Avoid hard-coding the number of planner commands // FIXME Avoid hard-coding the number of planner commands
// At this moment we have 2 planner commands: reassign and adapt // At this moment we have 2 planner commands: reassign and adapt planning
// planning if ( plannerToolbar.getChildren().size() < 2 ) {
if (plannerToolbar.getChildren().size() < 2) {
plannerToolbar.appendChild(c.toButton()); plannerToolbar.appendChild(c.toButton());
} }
} else { } else {
@ -522,14 +523,11 @@ public class Planner extends HtmlMacroComponent {
} }
private Component getCommonCommandsInsertionPoint() { private Component getCommonCommandsInsertionPoint() {
Component insertionPoint = getPage().getFellow( return getPage().getFellow("perspectiveButtonsInsertionPoint");
"perspectiveButtonsInsertionPoint");
return insertionPoint;
} }
private Component getSpecificCommandsInsertionPoint() { private Component getSpecificCommandsInsertionPoint() {
Component insertionPoint = getFellow("plannerButtonsInsertionPoint"); return getFellow("plannerButtonsInsertionPoint");
return insertionPoint;
} }
void removeTask(Task task) { void removeTask(Task task) {
@ -537,7 +535,10 @@ public class Planner extends HtmlMacroComponent {
taskList.remove(task); taskList.remove(task);
getDependencyList().taskRemoved(task); getDependencyList().taskRemoved(task);
leftPane.taskRemoved(task); leftPane.taskRemoved(task);
setHeight(getHeight());// forcing smart update
// forcing smart update
setHeight(getHeight());
ganttPanel.adjustZoomColumnsHeight(); ganttPanel.adjustZoomColumnsHeight();
getDependencyList().redrawDependencies(); getDependencyList().redrawDependencies();
} }
@ -609,40 +610,47 @@ public class Planner extends HtmlMacroComponent {
public void showCriticalPath() { public void showCriticalPath() {
Button showCriticalPathButton = (Button) getFellow("showCriticalPath"); Button showCriticalPathButton = (Button) getFellow("showCriticalPath");
if (disabilityConfiguration.isCriticalPathEnabled()) {
if (isShowingCriticalPath) { if ( disabilityConfiguration.isCriticalPathEnabled() ) {
if ( isShowingCriticalPath ) {
context.hideCriticalPath(); context.hideCriticalPath();
diagramGraph.removePostGraphChangeListener(showCriticalPathOnChange); diagramGraph.removePostGraphChangeListener(showCriticalPathOnChange);
showCriticalPathButton.setSclass("planner-command"); showCriticalPathButton.setSclass("planner-command");
showCriticalPathButton.setTooltiptext(_("Show critical path")); showCriticalPathButton.setTooltiptext(_("Show critical path"));
} else { } else {
context.showCriticalPath(); context.showCriticalPath();
diagramGraph.addPostGraphChangeListener(showCriticalPathOnChange); diagramGraph.addPostGraphChangeListener(showCriticalPathOnChange);
showCriticalPathButton.setSclass("planner-command clicked"); showCriticalPathButton.setSclass("planner-command clicked");
showCriticalPathButton.setTooltiptext(_("Hide critical path")); showCriticalPathButton.setTooltiptext(_("Hide critical path"));
} }
isShowingCriticalPath = !isShowingCriticalPath; isShowingCriticalPath = !isShowingCriticalPath;
} }
} }
public void forcedShowAdvances() { public void forcedShowAdvances() {
if (!isShowingAdvances) { if ( !isShowingAdvances ) {
showAdvances(); showAdvances();
} }
} }
public void showAdvances() { public void showAdvances() {
Button showAdvancesButton = (Button) getFellow("showAdvances"); Button showAdvancesButton = (Button) getFellow("showAdvances");
if (disabilityConfiguration.isAdvancesEnabled()) { if ( disabilityConfiguration.isAdvancesEnabled() ) {
Combobox progressTypesCombo = (Combobox) getFellow("cbProgressTypes"); Combobox progressTypesCombo = (Combobox) getFellow("cbProgressTypes");
if (isShowingAdvances) { if ( isShowingAdvances ) {
context.hideAdvances(); context.hideAdvances();
diagramGraph.removePostGraphChangeListener(showAdvanceOnChange); diagramGraph.removePostGraphChangeListener(showAdvanceOnChange);
showAdvancesButton.setSclass("planner-command"); showAdvancesButton.setSclass("planner-command");
showAdvancesButton.setTooltiptext(_("Show progress")); showAdvancesButton.setTooltiptext(_("Show progress"));
if (progressTypesCombo.getItemCount() > 0) {
if ( progressTypesCombo.getItemCount() > 0 ) {
progressTypesCombo.setSelectedIndex(0); progressTypesCombo.setSelectedIndex(0);
} }
} else { } else {
context.showAdvances(); context.showAdvances();
diagramGraph.addPostGraphChangeListener(showAdvanceOnChange); diagramGraph.addPostGraphChangeListener(showAdvanceOnChange);
@ -655,21 +663,19 @@ public class Planner extends HtmlMacroComponent {
public void showReportedHours() { public void showReportedHours() {
Button showReportedHoursButton = (Button) getFellow("showReportedHours"); Button showReportedHoursButton = (Button) getFellow("showReportedHours");
if (disabilityConfiguration.isReportedHoursEnabled()) {
if (isShowingReportedHours) { if ( disabilityConfiguration.isReportedHoursEnabled() ) {
if ( isShowingReportedHours ) {
context.hideReportedHours(); context.hideReportedHours();
diagramGraph diagramGraph.removePostGraphChangeListener(showReportedHoursOnChange);
.removePostGraphChangeListener(showReportedHoursOnChange);
showReportedHoursButton.setSclass("planner-command"); showReportedHoursButton.setSclass("planner-command");
showReportedHoursButton showReportedHoursButton.setTooltiptext(_("Show reported hours"));
.setTooltiptext(_("Show reported hours"));
} else { } else {
context.showReportedHours(); context.showReportedHours();
diagramGraph diagramGraph.addPostGraphChangeListener(showReportedHoursOnChange);
.addPostGraphChangeListener(showReportedHoursOnChange);
showReportedHoursButton.setSclass("planner-command clicked"); showReportedHoursButton.setSclass("planner-command clicked");
showReportedHoursButton showReportedHoursButton.setTooltiptext(_("Hide reported hours"));
.setTooltiptext(_("Hide reported hours"));
} }
isShowingReportedHours = !isShowingReportedHours; isShowingReportedHours = !isShowingReportedHours;
} }
@ -677,17 +683,16 @@ public class Planner extends HtmlMacroComponent {
public void showMoneyCostBar() { public void showMoneyCostBar() {
Button showMoneyCostBarButton = (Button) getFellow("showMoneyCostBar"); Button showMoneyCostBarButton = (Button) getFellow("showMoneyCostBar");
if (disabilityConfiguration.isMoneyCostBarEnabled()) {
if (isShowingMoneyCostBar) { if ( disabilityConfiguration.isMoneyCostBarEnabled() ) {
if ( isShowingMoneyCostBar ) {
context.hideMoneyCostBar(); context.hideMoneyCostBar();
diagramGraph diagramGraph.removePostGraphChangeListener(showMoneyCostBarOnChange);
.removePostGraphChangeListener(showMoneyCostBarOnChange);
showMoneyCostBarButton.setSclass("planner-command"); showMoneyCostBarButton.setSclass("planner-command");
showMoneyCostBarButton.setTooltiptext(_("Show money cost bar")); showMoneyCostBarButton.setTooltiptext(_("Show money cost bar"));
} else { } else {
context.showMoneyCostBar(); context.showMoneyCostBar();
diagramGraph diagramGraph.addPostGraphChangeListener(showMoneyCostBarOnChange);
.addPostGraphChangeListener(showMoneyCostBarOnChange);
showMoneyCostBarButton.setSclass("planner-command clicked"); showMoneyCostBarButton.setSclass("planner-command clicked");
showMoneyCostBarButton.setTooltiptext(_("Hide money cost bar")); showMoneyCostBarButton.setTooltiptext(_("Hide money cost bar"));
} }
@ -697,41 +702,39 @@ public class Planner extends HtmlMacroComponent {
public void showAllLabels() { public void showAllLabels() {
Button showAllLabelsButton = (Button) getFellow("showAllLabels"); Button showAllLabelsButton = (Button) getFellow("showAllLabels");
if (isShowingLabels) { if ( isShowingLabels ) {
Clients.evalJavaScript("ganttz.TaskList.getInstance().hideAllTaskLabels()"); Clients.evalJavaScript("ganttz.TaskList.getInstance().hideAllTaskLabels()");
showAllLabelsButton.setSclass("planner-command show-labels"); showAllLabelsButton.setSclass("planner-command show-labels");
} else { } else {
Clients.evalJavaScript("ganttz.TaskList.getInstance().showAllTaskLabels()"); Clients.evalJavaScript("ganttz.TaskList.getInstance().showAllTaskLabels()");
showAllLabelsButton showAllLabelsButton.setSclass("planner-command show-labels clicked");
.setSclass("planner-command show-labels clicked");
} }
isShowingLabels = !isShowingLabels; isShowingLabels = !isShowingLabels;
} }
public void showAllResources() { public void showAllResources() {
Button showAllLabelsButton = (Button) getFellow("showAllResources"); Button showAllLabelsButton = (Button) getFellow("showAllResources");
if (isShowingResources) { if ( isShowingResources ) {
Clients.evalJavaScript("ganttz.TaskList.getInstance().hideResourceTooltips()"); Clients.evalJavaScript("ganttz.TaskList.getInstance().hideResourceTooltips()");
showAllLabelsButton.setSclass("planner-command show-resources"); showAllLabelsButton.setSclass("planner-command show-resources");
} else { } else {
Clients.evalJavaScript("ganttz.TaskList.getInstance().showResourceTooltips()"); Clients.evalJavaScript("ganttz.TaskList.getInstance().showResourceTooltips()");
showAllLabelsButton showAllLabelsButton.setSclass("planner-command show-resources clicked");
.setSclass("planner-command show-resources clicked");
} }
isShowingResources = !isShowingResources; isShowingResources = !isShowingResources;
} }
public void print() { public void print() {
// Pending to raise print configuration popup. Information retrieved // Pending to raise print configuration popup.
// should be passed as parameter to context print method // Information retrieved should be passed as parameter to context print method.
context.print(); context.print();
} }
public ZoomLevel getZoomLevel() { public ZoomLevel getZoomLevel() {
if (ganttPanel == null) { if ( ganttPanel == null ) {
return zoomLevel != null ? zoomLevel return zoomLevel != null ? zoomLevel : ZoomLevel.DETAIL_ONE;
: ZoomLevel.DETAIL_ONE;
} }
return ganttPanel.getTimeTracker().getDetailLevel(); return ganttPanel.getTimeTracker().getDetailLevel();
} }
@ -743,8 +746,7 @@ public class Planner extends HtmlMacroComponent {
return containersExpandedByDefault; return containersExpandedByDefault;
} }
public void setAreContainersExpandedByDefault( public void setAreContainersExpandedByDefault(boolean containersExpandedByDefault) {
boolean containersExpandedByDefault) {
this.containersExpandedByDefault = containersExpandedByDefault; this.containersExpandedByDefault = containersExpandedByDefault;
} }
@ -761,8 +763,7 @@ public class Planner extends HtmlMacroComponent {
this.isShowingAdvances = shownAdvanceByDefault; this.isShowingAdvances = shownAdvanceByDefault;
} }
public void setAreShownReportedHoursByDefault( public void setAreShownReportedHoursByDefault(boolean shownReportedHoursByDefault) {
boolean shownReportedHoursByDefault) {
this.shownReportedHoursByDefault = shownReportedHoursByDefault; this.shownReportedHoursByDefault = shownReportedHoursByDefault;
} }
@ -774,8 +775,7 @@ public class Planner extends HtmlMacroComponent {
return (areShownReportedHoursByDefault() || isShowingReportedHours); return (areShownReportedHoursByDefault() || isShowingReportedHours);
} }
public void setAreShownMoneyCostBarByDefault( public void setAreShownMoneyCostBarByDefault(boolean shownMoneyCostBarByDefault) {
boolean shownMoneyCostBarByDefault) {
this.shownMoneyCostBarByDefault = shownMoneyCostBarByDefault; this.shownMoneyCostBarByDefault = shownMoneyCostBarByDefault;
} }
@ -789,8 +789,9 @@ public class Planner extends HtmlMacroComponent {
public void expandAll() { public void expandAll() {
Button expandAllButton = (Button) getFellow("expandAll"); Button expandAllButton = (Button) getFellow("expandAll");
if (disabilityConfiguration.isExpandAllEnabled()) {
if (isExpandAll) { if ( disabilityConfiguration.isExpandAllEnabled() ) {
if ( isExpandAll ) {
context.collapseAll(); context.collapseAll();
expandAllButton.setSclass("planner-command"); expandAllButton.setSclass("planner-command");
} else { } else {
@ -803,7 +804,7 @@ public class Planner extends HtmlMacroComponent {
public void expandAllAlways() { public void expandAllAlways() {
Button expandAllButton = (Button) getFellow("expandAll"); Button expandAllButton = (Button) getFellow("expandAll");
if (disabilityConfiguration.isExpandAllEnabled()) { if ( disabilityConfiguration.isExpandAllEnabled() ) {
context.expandAll(); context.expandAll();
expandAllButton.setSclass("planner-command clicked"); expandAllButton.setSclass("planner-command clicked");
} }
@ -811,8 +812,7 @@ public class Planner extends HtmlMacroComponent {
public void updateSelectedZoomLevel() { public void updateSelectedZoomLevel() {
ganttPanel.getTimeTracker().setZoomLevel(zoomLevel); ganttPanel.getTimeTracker().setZoomLevel(zoomLevel);
Listitem selectedItem = (Listitem) listZoomLevels.getItems().get( Listitem selectedItem = (Listitem) listZoomLevels.getItems().get(zoomLevel.ordinal());
zoomLevel.ordinal());
listZoomLevels.setSelectedItem(selectedItem); listZoomLevels.setSelectedItem(selectedItem);
listZoomLevels.invalidate(); listZoomLevels.invalidate();
} }
@ -827,19 +827,20 @@ public class Planner extends HtmlMacroComponent {
getTaskList().setPredicate(predicate); getTaskList().setPredicate(predicate);
getDependencyList().redrawDependencies(); getDependencyList().redrawDependencies();
if (isShowingLabels) { if ( isShowingLabels ) {
Clients.evalJavaScript("ganttz.TaskList.getInstance().showAllTaskLabels();"); Clients.evalJavaScript("ganttz.TaskList.getInstance().showAllTaskLabels();");
} }
if (isShowingResources) { if ( isShowingResources ) {
Clients.evalJavaScript("ganttz.TaskList.getInstance().showResourceTooltips();"); Clients.evalJavaScript("ganttz.TaskList.getInstance().showResourceTooltips();");
} }
} }
public void flattenTree() { public void flattenTree() {
Button flattenTreeButton = (Button) getFellow("flattenTree"); Button flattenTreeButton = (Button) getFellow("flattenTree");
if (disabilityConfiguration.isFlattenTreeEnabled()) {
if (isFlattenTree) { if ( disabilityConfiguration.isFlattenTreeEnabled() ) {
if ( isFlattenTree ) {
predicate.setFilterContainers(false); predicate.setFilterContainers(false);
flattenTreeButton.setSclass("planner-command"); flattenTreeButton.setSclass("planner-command");
} else { } else {
@ -858,31 +859,25 @@ public class Planner extends HtmlMacroComponent {
public void changeChartVisibility(boolean visible) { public void changeChartVisibility(boolean visible) {
visibleChart = visible; visibleChart = visible;
chartVisibilityListeners chartVisibilityListeners.fireEvent(new IListenerNotification<IChartVisibilityChangedListener>() {
.fireEvent(new IListenerNotification<IChartVisibilityChangedListener>() { @Override
@Override public void doNotify(IChartVisibilityChangedListener listener) {
public void doNotify( listener.chartVisibilityChanged(visibleChart);
IChartVisibilityChangedListener listener) { }
listener.chartVisibilityChanged(visibleChart); });
}
});
} }
public boolean isVisibleChart() { public boolean isVisibleChart() {
return visibleChart; return visibleChart;
} }
public void addChartVisibilityListener( public void addChartVisibilityListener(IChartVisibilityChangedListener chartVisibilityChangedListener) {
IChartVisibilityChangedListener chartVisibilityChangedListener) {
chartVisibilityListeners.addListener(chartVisibilityChangedListener); chartVisibilityListeners.addListener(chartVisibilityChangedListener);
} }
public void addGraphChangeListenersFromConfiguration( public void addGraphChangeListenersFromConfiguration(PlannerConfiguration<?> configuration) {
PlannerConfiguration<?> configuration) { diagramGraph.addPreChangeListeners(configuration.getPreChangeListeners());
diagramGraph.addPreChangeListeners(configuration diagramGraph.addPostChangeListeners(configuration.getPostChangeListeners());
.getPreChangeListeners());
diagramGraph.addPostChangeListeners(configuration
.getPostChangeListeners());
} }
public boolean isShowingCriticalPath() { public boolean isShowingCriticalPath() {
@ -911,10 +906,11 @@ public class Planner extends HtmlMacroComponent {
public Button findCommandComponent(String name) { public Button findCommandComponent(String name) {
for (CommandContextualized<?> c : contextualizedGlobalCommands) { for (CommandContextualized<?> c : contextualizedGlobalCommands) {
if (c.getCommand().getName().equals(name)) { if ( c.getCommand().getName().equals(name) ) {
return c.toButton(); return c.toButton();
} }
} }
return null; return null;
} }
@ -928,7 +924,7 @@ public class Planner extends HtmlMacroComponent {
public void updateCompletion(String progressType) { public void updateCompletion(String progressType) {
TaskList taskList = getTaskList(); TaskList taskList = getTaskList();
if (taskList != null) { if ( taskList != null ) {
taskList.updateCompletion(progressType); taskList.updateCompletion(progressType);
// FIXME Bug #1270 // FIXME Bug #1270
for (TaskComponent each : taskList.getTaskComponents()) { for (TaskComponent each : taskList.getTaskComponents()) {
@ -937,12 +933,11 @@ public class Planner extends HtmlMacroComponent {
} }
} }
public TaskComponent getTaskComponentRelatedTo( public TaskComponent getTaskComponentRelatedTo(org.zkoss.ganttz.data.Task task) {
org.zkoss.ganttz.data.Task task) {
TaskList taskList = getTaskList(); TaskList taskList = getTaskList();
if (taskList != null) { if ( taskList != null ) {
for (TaskComponent each : taskList.getTaskComponents()) { for (TaskComponent each : taskList.getTaskComponents()) {
if (each.getTask().equals(task)) { if ( each.getTask().equals(task) ) {
return each; return each;
} }
} }

View file

@ -7,7 +7,7 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: libreplan-1.4.0\n" "Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n" "POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"

View file

@ -1,21 +1,27 @@
zk.$package("ganttz"); zk.$package("ganttz");
ganttz.TaskRow = zk.$extends(zk.Widget, { ganttz.TaskRow = zk.$extends(zk.Widget, {
_labelsHidden : true, _labelsHidden : true,
showLabels : function(){
showLabels : function() {
this._labelsHidden = false; this._labelsHidden = false;
this.firstChild.showLabels(); this.firstChild.showLabels();
}, },
hideLabels : function(){
hideLabels : function() {
this._labelsHidden = true; this._labelsHidden = true;
this.firstChild.hideLabels(); this.firstChild.hideLabels();
}, },
_resourcesHidden : true, _resourcesHidden : true,
hideResourceTooltip : function(){
hideResourceTooltip : function() {
this._resourcesHidden = true; this._resourcesHidden = true;
this.firstChild.hideResourceTooltip(); this.firstChild.hideResourceTooltip();
}, },
showResourceTooltip : function(){
showResourceTooltip : function() {
this._resourcesHidden = false; this._resourcesHidden = false;
this.firstChild.showResourceTooltip(); this.firstChild.showResourceTooltip();
} }

View file

@ -207,35 +207,5 @@
</resource> </resource>
</resources> </resources>
<!-- TODO delete it? -->
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<versionRange>[3.5.0,)</versionRange>
<goals>
<goal>update</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build> </build>
</project> </project>

View file

@ -28,7 +28,7 @@ import static org.libreplan.business.i18n.I18nHelper._;
* *
* @author Fernando Bellas Permuy <fbellas@udc.es> * @author Fernando Bellas Permuy <fbellas@udc.es>
* @author Manuel Rego Casasnovas <rego@igalia.com> * @author Manuel Rego Casasnovas <rego@igalia.com>
* @author Vova Perebykivskiy <vova@libreplan-enterprise.com> * @author Vova Perebykivskyi <vova@libreplan-enterprise.com>
*/ */
public enum UserRole { public enum UserRole {
@ -100,7 +100,7 @@ public enum UserRole {
private final String displayName; private final String displayName;
private UserRole(String displayName) { UserRole(String displayName) {
this.displayName = displayName; this.displayName = displayName;
} }

View file

@ -1,7 +1,7 @@
<ehcache> <ehcache>
<!-- Uncomment the next line if you want to enable <!--
overflowToDisk (only recommended when the DB server Uncomment the next line if you want to enable overflowToDisk
is in a different machine) (only recommended when the DB server is in a different machine)
<diskStore path="java.io.tmpdir"/> <diskStore path="java.io.tmpdir"/>
--> -->

View file

@ -10,10 +10,10 @@
<property name="hibernate.use_sql_comments">${hibernate.use_sql_comments}</property> <property name="hibernate.use_sql_comments">${hibernate.use_sql_comments}</property>
<property name="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</property> <property name="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</property>
<!-- We explicitly call validation, otherwise infinite loops can happen. <!--
Sometimes DAOs are queried when validating some constraints. We explicitly call validation, otherwise infinite loops can happen.
When the DAO does a query, the pending changes are flushed, causing Sometimes DAOs are queried when validating some constraints.
the validations to be run again. When the DAO does a query, the pending changes are flushed, causing the validations to be run again.
--> -->
<property name="javax.persistence.validation.mode">none</property> <property name="javax.persistence.validation.mode">none</property>

View file

@ -112,22 +112,17 @@
class="org.springframework.orm.hibernate4.HibernateTransactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"
p:sessionFactory-ref="sessionFactory" /> p:sessionFactory-ref="sessionFactory" />
<!-- <!-- Enable configuration of transactional behavior based on annotations -->
Enable configuration of transactional behavior based on annotations
-->
<tx:annotation-driven transaction-manager="transactionManager" /> <tx:annotation-driven transaction-manager="transactionManager" />
<!-- <!-- For enabling annotation-based configuration (in particular, required for Autowired annotation) -->
For enabling annotation-based configuration (in particular, required
for Autowired annotation)
-->
<context:annotation-config /> <context:annotation-config />
<context:component-scan base-package="org.libreplan.business" /> <context:component-scan base-package="org.libreplan.business" />
<bean id="registry" class="org.libreplan.business.common.Registry" factory-method="getInstance" /> <bean id="registry" class="org.libreplan.business.common.Registry" factory-method="getInstance" />
<bean id="CriterionRequirementOrderElementHandler" <bean id="criterionRequirementOrderElementHandler"
class="org.libreplan.business.orders.entities.CriterionRequirementOrderElementHandler" class="org.libreplan.business.orders.entities.CriterionRequirementOrderElementHandler"
factory-method="getInstance" /> factory-method="getInstance" />
@ -135,26 +130,18 @@
class="org.libreplan.business.common.VersionInformation" class="org.libreplan.business.common.VersionInformation"
factory-method="getInstance" factory-method="getInstance"
lazy-init="false"> lazy-init="false">
<property name="projectVersion"> <property name="projectVersion" value="${project.version}"/>
<value>${project.version}</value>
</property>
</bean> </bean>
<bean id="configuration" <bean id="configuration"
class="org.libreplan.business.common.Configuration" class="org.libreplan.business.common.Configuration"
factory-method="getInstance" factory-method="getInstance"
lazy-init="false"> lazy-init="false">
<property name="defaultPasswordsControl"> <property name="defaultPasswordsControl" value="${default.passwordsControl}"/>
<value>${default.passwordsControl}</value> <property name="exampleUsersDisabled" value="${default.exampleUsersDisabled}"/>
</property> <property name="emailSendingEnabled" value="${default.emailSendingEnabled}"/>
<property name="exampleUsersDisabled">
<value>${default.exampleUsersDisabled}</value>
</property>
<property name="emailSendingEnabled">
<value>${default.emailSendingEnabled}</value>
</property>
</bean> </bean>
<bean id="scenarioManager" class="org.libreplan.business.scenarios.OnlyMainScenarioAwareManager" scope="singleton"/> <bean id="scenarioManager" class="org.libreplan.business.scenarios.OnlyMainScenarioAwareManager"/>
</beans> </beans>

View file

@ -58,9 +58,7 @@ public class EntitySequenceTest {
for (EntitySequence sequence : entitySequenceDAO.getAll()) { for (EntitySequence sequence : entitySequenceDAO.getAll()) {
try { try {
entitySequenceDAO.remove(sequence.getId()); entitySequenceDAO.remove(sequence.getId());
} catch (InstanceNotFoundException e) { } catch (InstanceNotFoundException ignored) {}
}
} }
} }
@ -73,8 +71,8 @@ public class EntitySequenceTest {
} catch (ValidationException e) { } catch (ValidationException e) {
fail("It should not throw an exception"); fail("It should not throw an exception");
} }
assertTrue(entitySequenceDAO.getAll().size() == 1);
assertTrue(entitySequenceDAO.getAll().size() == 1);
} }
@Test @Test
@ -159,8 +157,7 @@ public class EntitySequenceTest {
entitySequenceDAO.save(entitySequenceB); entitySequenceDAO.save(entitySequenceB);
fail("Expected ValidationException"); fail("Expected ValidationException");
} catch (ValidationException e) { } catch (ValidationException ignored) {}
}
} }
@Test @Test

View file

@ -11,8 +11,6 @@
<property name="javax.persistence.validation.mode">none</property> <property name="javax.persistence.validation.mode">none</property>
<property name="javax.persistence.validation.mode">none</property>
<property name="jadira.usertype.autoRegisterUserTypes">true</property> <property name="jadira.usertype.autoRegisterUserTypes">true</property>
<property name="jadira.usertype.databaseZone">jvm</property> <property name="jadira.usertype.databaseZone">jvm</property>
<property name="jadira.usertype.javaZone">jvm</property> <property name="jadira.usertype.javaZone">jvm</property>

View file

@ -236,62 +236,6 @@
<build> <build>
<finalName>libreplan-webapp</finalName> <finalName>libreplan-webapp</finalName>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<versionRange>[1.8,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<versionRange>[1.0-beta-2,)</versionRange>
<goals>
<goal>compile-reports</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.googlecode.gettext-commons</groupId>
<artifactId>gettext-maven-plugin</artifactId>
<versionRange>[1.2.4,)</versionRange>
<goals>
<goal>dist</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build> </build>
<dependencies> <dependencies>
@ -334,8 +278,8 @@
<artifactId>spring-security-config</artifactId> <artifactId>spring-security-config</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.security</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-security-acl</artifactId> <artifactId>spring-context-support</artifactId>
</dependency> </dependency>
<!-- Spring Dependency LDAP --> <!-- Spring Dependency LDAP -->
@ -354,12 +298,6 @@
<artifactId>spring-security-acl</artifactId> <artifactId>spring-security-acl</artifactId>
</dependency> </dependency>
<!-- Spring Dependency LDAP -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
</dependency>
<!-- Spring Test --> <!-- Spring Test -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>

View file

@ -21,8 +21,6 @@ package org.libreplan.importers;
import org.libreplan.business.common.entities.JobSchedulerConfiguration; import org.libreplan.business.common.entities.JobSchedulerConfiguration;
import org.quartz.SchedulerException; import org.quartz.SchedulerException;
import org.springframework.scheduling.quartz.CronTriggerBean;
import org.springframework.scheduling.quartz.JobDetailBean;
/** /**
* A manager(client) that dynamically creates jobs and cron-triggers using * A manager(client) that dynamically creates jobs and cron-triggers using
@ -36,8 +34,8 @@ import org.springframework.scheduling.quartz.JobDetailBean;
* {@link JobSchedulerConfiguration} entity once the scheduler starts. * {@link JobSchedulerConfiguration} entity once the scheduler starts.
* *
* <ul> * <ul>
* <li>Schedule job:create job {@link JobDetailBean} and cron-trigger * <li>Schedule job:create job {@link JobDetailFactoryBean} and cron-trigger
* {@link CronTriggerBean}, associated the trigger with the job and add it to * {@link CronTriggerFactoryBean}, associated the trigger with the job and add it to
* the scheduler. * the scheduler.
* <li> * <li>
* <li>Delete job: search the job in the scheduler and if found * <li>Delete job: search the job in the scheduler and if found

View file

@ -37,12 +37,13 @@ import org.quartz.CronTrigger;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.Scheduler; import org.quartz.Scheduler;
import org.quartz.SchedulerException; import org.quartz.SchedulerException;
import org.quartz.TriggerKey;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.scheduling.quartz.CronTriggerBean; import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.JobDetailBean; import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -71,7 +72,7 @@ public class SchedulerManager implements ISchedulerManager {
/** /**
* suffix for trigger -group and -name * Suffix for trigger -group and -name
*/ */
private static final String TRIGGER_SUFFIX = "-TRIGGER"; private static final String TRIGGER_SUFFIX = "-TRIGGER";
@ -85,8 +86,7 @@ public class SchedulerManager implements ISchedulerManager {
@Override @Override
public void scheduleJobs() { public void scheduleJobs() {
List<JobSchedulerConfiguration> jobSchedulerConfigurations = jobSchedulerConfigurationDAO List<JobSchedulerConfiguration> jobSchedulerConfigurations = jobSchedulerConfigurationDAO.getAll();
.getAll();
for (JobSchedulerConfiguration conf : jobSchedulerConfigurations) { for (JobSchedulerConfiguration conf : jobSchedulerConfigurations) {
try { try {
scheduleOrUnscheduleJob(conf); scheduleOrUnscheduleJob(conf);
@ -98,22 +98,24 @@ public class SchedulerManager implements ISchedulerManager {
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public void scheduleOrUnscheduleJob( public void scheduleOrUnscheduleJob(JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException {
JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException {
if (hasConnector(jobSchedulerConfiguration.getConnectorName())) { if ( hasConnector(jobSchedulerConfiguration.getConnectorName()) ) {
if (isConnectorActivated(jobSchedulerConfiguration if ( isConnectorActivated(jobSchedulerConfiguration.getConnectorName()) ) {
.getConnectorName())) { if ( jobSchedulerConfiguration.isSchedule() ) {
if (jobSchedulerConfiguration.isSchedule()) {
scheduleNewJob(jobSchedulerConfiguration); scheduleNewJob(jobSchedulerConfiguration);
return; return;
} }
} }
deleteJob(jobSchedulerConfiguration); deleteJob(jobSchedulerConfiguration);
return; return;
} }
if (!jobSchedulerConfiguration.isSchedule()) {
if ( !jobSchedulerConfiguration.isSchedule() ) {
deleteJob(jobSchedulerConfiguration); deleteJob(jobSchedulerConfiguration);
return; return;
} }
scheduleNewJob(jobSchedulerConfiguration); scheduleNewJob(jobSchedulerConfiguration);
@ -139,32 +141,30 @@ public class SchedulerManager implements ISchedulerManager {
*/ */
private boolean isConnectorActivated(String connectorName) { private boolean isConnectorActivated(String connectorName) {
Connector connector = connectorDAO.findUniqueByName(connectorName); Connector connector = connectorDAO.findUniqueByName(connectorName);
if (connector == null) {
return false; return connector != null && connector.isActivated();
}
return connector.isActivated();
} }
@Override @Override
public void deleteJob(JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException { public void deleteJob(JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException {
String triggerName = jobSchedulerConfiguration.getJobName() String triggerName = jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX;
+ TRIGGER_SUFFIX; String triggerGroup = jobSchedulerConfiguration.getJobGroup() + TRIGGER_SUFFIX;
String triggerGroup = jobSchedulerConfiguration.getJobGroup()
+ TRIGGER_SUFFIX;
CronTriggerBean trigger = getTriggerBean(triggerName, triggerGroup); CronTriggerFactoryBean trigger = getTriggerBean(triggerName, triggerGroup);
if (trigger == null) { if ( trigger == null ) {
LOG.warn("Trigger not found"); LOG.warn("Trigger not found");
return; return;
} }
if (isJobCurrentlyExecuting(triggerName, triggerGroup)) { if ( isJobCurrentlyExecuting(triggerName, triggerGroup) ) {
LOG.warn("Job is currently executing..."); LOG.warn("Job is currently executing...");
return; return;
} }
// deleteJob doesn't work using unscheduleJob // deleteJob doesn't work using unscheduleJob
this.scheduler.unscheduleJob(trigger.getName(), trigger.getGroup()); this.scheduler.unscheduleJob(trigger.getObject().getKey());
} }
/** /**
@ -178,26 +178,25 @@ public class SchedulerManager implements ISchedulerManager {
* @return true if job is currently running, otherwise false * @return true if job is currently running, otherwise false
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private boolean isJobCurrentlyExecuting(String triggerName, private boolean isJobCurrentlyExecuting(String triggerName, String triggerGroup) {
String triggerGroup) {
try { try {
List<JobExecutionContext> currentExecutingJobs = this.scheduler List<JobExecutionContext> currentExecutingJobs = this.scheduler.getCurrentlyExecutingJobs();
.getCurrentlyExecutingJobs();
for (JobExecutionContext jobExecutionContext : currentExecutingJobs) { for (JobExecutionContext jobExecutionContext : currentExecutingJobs) {
String name = jobExecutionContext.getTrigger().getName(); String name = jobExecutionContext.getTrigger().getKey().getName();
String group = jobExecutionContext.getTrigger().getGroup(); String group = jobExecutionContext.getTrigger().getKey().getGroup();
if (triggerName.equals(name) && triggerGroup.equals(group)) { if ( triggerName.equals(name) && triggerGroup.equals(group) ) {
return true; return true;
} }
} }
} catch (SchedulerException e) { } catch (SchedulerException e) {
LOG.error("Unable to get currently executing jobs", e); LOG.error("Unable to get currently executing jobs", e);
} }
return false; return false;
} }
/** /**
* Creates {@link CronTriggerBean} and {@link JobDetailBean} based on the * Creates {@link CronTriggerFactoryBean} and {@link JobDetailFactoryBean} based on the
* specified <code>{@link JobSchedulerConfiguration}</code>. First delete * specified <code>{@link JobSchedulerConfiguration}</code>. First delete
* job if exist and then schedule it * job if exist and then schedule it
* *
@ -206,65 +205,64 @@ public class SchedulerManager implements ISchedulerManager {
* @throws SchedulerException * @throws SchedulerException
* if unable to delete and/or schedule job * if unable to delete and/or schedule job
*/ */
private void scheduleNewJob( private void scheduleNewJob(JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException {
JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException { CronTriggerFactoryBean cronTriggerBean = createCronTriggerBean(jobSchedulerConfiguration);
CronTriggerBean cronTriggerBean = createCronTriggerBean(jobSchedulerConfiguration); if ( cronTriggerBean == null ) {
if (cronTriggerBean == null) {
return; return;
} }
JobDetailBean jobDetailBean = createJobDetailBean(jobSchedulerConfiguration); JobDetailFactoryBean jobDetailBean = createJobDetailBean(jobSchedulerConfiguration);
if (jobDetailBean == null) { if ( jobDetailBean == null ) {
return; return;
} }
deleteJob(jobSchedulerConfiguration); deleteJob(jobSchedulerConfiguration);
this.scheduler.scheduleJob(jobDetailBean, cronTriggerBean); this.scheduler.scheduleJob(jobDetailBean.getObject(), cronTriggerBean.getObject());
} }
/** /**
* Creates {@link CronTriggerBean} from the specified * Creates {@link CronTriggerFactoryBean} from the specified
* <code>{@link JobSchedulerConfiguration}</code> * <code>{@link JobSchedulerConfiguration}</code>
* *
* @param jobSchedulerConfiguration * @param jobSchedulerConfiguration
* configuration to create <code>CronTriggerBean</> * configuration to create <code>CronTriggerFactoryBean</>
* @return the created <code>CronTriggerBean</code> or null if unable to * @return the created <code>CronTriggerFactoryBean</code> or null if unable to
* create it * create it
*/ */
private CronTriggerBean createCronTriggerBean( private CronTriggerFactoryBean createCronTriggerBean(JobSchedulerConfiguration jobSchedulerConfiguration) {
JobSchedulerConfiguration jobSchedulerConfiguration) { CronTriggerFactoryBean cronTriggerBean = new CronTriggerFactoryBean();
CronTriggerBean cronTriggerBean = new CronTriggerBean();
cronTriggerBean.setName(jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX); cronTriggerBean.setName(jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX);
cronTriggerBean.setGroup(jobSchedulerConfiguration.getJobGroup() cronTriggerBean.setGroup(jobSchedulerConfiguration.getJobGroup() + TRIGGER_SUFFIX);
+ TRIGGER_SUFFIX);
try { try {
cronTriggerBean.setCronExpression(new CronExpression( cronTriggerBean.setCronExpression(
jobSchedulerConfiguration.getCronExpression())); String.valueOf(new CronExpression(jobSchedulerConfiguration.getCronExpression())));
cronTriggerBean.setJobName(jobSchedulerConfiguration.getJobName());
cronTriggerBean cronTriggerBean.setName(jobSchedulerConfiguration.getJobName());
.setJobGroup(jobSchedulerConfiguration.getJobGroup()); cronTriggerBean.setGroup(jobSchedulerConfiguration.getJobGroup());
return cronTriggerBean; return cronTriggerBean;
} catch (ParseException e) { } catch (ParseException e) {
LOG.error("Unable to parse cron expression", e); LOG.error("Unable to parse cron expression", e);
} }
return null; return null;
} }
/** /**
* Creates {@link JobDetailBean} from the specified * Creates {@link JobDetailFactoryBean} from the specified
* <code>{@link JobSchedulerConfiguration}</code> * <code>{@link JobSchedulerConfiguration}</code>
* *
* @param jobSchedulerConfiguration * @param jobSchedulerConfiguration
* configuration to create <code>JobDetailBean</> * configuration to create <code>JobDetailFactoryBean</>
* @return the created <code>JobDetailBean</code> or null if unable to it * @return the created <code>JobDetailFactoryBean</code> or null if unable to it
*/ */
private JobDetailBean createJobDetailBean( private JobDetailFactoryBean createJobDetailBean(JobSchedulerConfiguration jobSchedulerConfiguration) {
JobSchedulerConfiguration jobSchedulerConfiguration) { JobDetailFactoryBean jobDetailBean = new JobDetailFactoryBean();
JobDetailBean jobDetailBean = new JobDetailBean();
Class<?> jobClass = getJobClass(jobSchedulerConfiguration Class<?> jobClass = getJobClass(jobSchedulerConfiguration.getJobClassName());
.getJobClassName()); if ( jobClass == null ) {
if (jobClass == null) {
return null; return null;
} }
@ -272,9 +270,10 @@ public class SchedulerManager implements ISchedulerManager {
jobDetailBean.setGroup(jobSchedulerConfiguration.getJobGroup()); jobDetailBean.setGroup(jobSchedulerConfiguration.getJobGroup());
jobDetailBean.setJobClass(jobClass); jobDetailBean.setJobClass(jobClass);
Map<String, Object> jobDataAsMap = new HashMap<String, Object>(); Map<String, Object> jobDataAsMap = new HashMap<>();
jobDataAsMap.put("applicationContext", applicationContext); jobDataAsMap.put("applicationContext", applicationContext);
jobDetailBean.setJobDataAsMap(jobDataAsMap); jobDetailBean.setJobDataAsMap(jobDataAsMap);
return jobDetailBean; return jobDetailBean;
} }
@ -287,49 +286,48 @@ public class SchedulerManager implements ISchedulerManager {
*/ */
private Class<?> getJobClass(JobClassNameEnum jobClassName) { private Class<?> getJobClass(JobClassNameEnum jobClassName) {
try { try {
return Class.forName(jobClassName.getPackageName() + "." return Class.forName(jobClassName.getPackageName() + "." + jobClassName.getName());
+ jobClassName.getName());
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
LOG.error("Unable to get class object '" + jobClassName + "'", e); LOG.error("Unable to get class object '" + jobClassName + "'", e);
} }
return null; return null;
} }
@Override @Override
public String getNextFireTime( public String getNextFireTime(JobSchedulerConfiguration jobSchedulerConfiguration) {
JobSchedulerConfiguration jobSchedulerConfiguration) {
try { try {
CronTrigger trigger = (CronTrigger) this.scheduler.getTrigger( CronTrigger trigger = (CronTrigger) this.scheduler.getTrigger(TriggerKey.triggerKey(
jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX, jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX,
jobSchedulerConfiguration.getJobGroup() jobSchedulerConfiguration.getJobGroup() + TRIGGER_SUFFIX));
+ TRIGGER_SUFFIX);
if (trigger != null) { if ( trigger != null ) {
return trigger.getNextFireTime().toString(); return trigger.getNextFireTime().toString();
} }
} catch (SchedulerException e) { } catch (SchedulerException e) {
LOG.error("unable to get the trigger", e); LOG.error("unable to get the trigger", e);
} }
return ""; return "";
} }
/** /**
* gets the {@link CronTriggerBean} for the specified * gets the {@link CronTriggerFactoryBean} for the specified
* <code>triggerName</code> and <code>tirggerGroup</code> * <code>triggerName</code> and <code>tirggerGroup</code>
* *
* @param triggerName * @param triggerName
* the trigger name * the trigger name
* @param triggerGroup * @param triggerGroup
* the trigger group * the trigger group
* @return CronTriggerBean if found, otherwise null * @return CronTriggerFactoryBean if found, otherwise null
*/ */
private CronTriggerBean getTriggerBean(String triggerName, private CronTriggerFactoryBean getTriggerBean(String triggerName, String triggerGroup) {
String triggerGroup) {
try { try {
return (CronTriggerBean) this.scheduler.getTrigger(triggerName, return (CronTriggerFactoryBean) this.scheduler.getTrigger(TriggerKey.triggerKey(triggerName, triggerGroup));
triggerGroup);
} catch (SchedulerException e) { } catch (SchedulerException e) {
LOG.error("Unable to get job trigger", e); LOG.error("Unable to get job trigger", e);
} }
return null; return null;
} }

View file

@ -48,15 +48,15 @@ public class IndexController extends GenericForwardComposer {
} }
private String getInitialPageURL() { private String getInitialPageURL() {
if (SecurityUtils.isUserInRole(UserRole.ROLE_SUPERUSER)) { if ( SecurityUtils.isUserInRole(UserRole.ROLE_SUPERUSER) ) {
return PLANNING_URL; return PLANNING_URL;
} }
if (SecurityUtils.isUserInRole(UserRole.ROLE_BOUND_USER)) { if ( SecurityUtils.isUserInRole(UserRole.ROLE_BOUND_USER) ) {
return USER_DASHBOARD_URL; return USER_DASHBOARD_URL;
} }
if (SecurityUtils.isSuperuserOrRolePlanningOrHasAnyAuthorization()) { if ( SecurityUtils.isSuperuserOrRolePlanningOrHasAnyAuthorization() ) {
return PLANNING_URL; return PLANNING_URL;
} }

View file

@ -34,12 +34,11 @@ import org.zkoss.zk.ui.util.GenericForwardComposer;
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com> * @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
*/ */
// TODO resolve deprecated methods
@Component @Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE) @Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class LoginController extends GenericForwardComposer { public class LoginController extends GenericForwardComposer {
private final String autocompletLoginValue = "admin";
@Autowired @Autowired
private IConfigurationDAO configurationDAO; private IConfigurationDAO configurationDAO;
@ -53,11 +52,13 @@ public class LoginController extends GenericForwardComposer {
* It returns the login value in function of the property autocompleteLogin. * It returns the login value in function of the property autocompleteLogin.
*/ */
public String getLoginValue() { public String getLoginValue() {
Configuration configuration = configurationDAO Configuration configuration = configurationDAO.getConfigurationWithReadOnlyTransaction();
.getConfigurationWithReadOnlyTransaction(); String autocompleteLoginValue = "admin";
return ((configuration.isAutocompleteLogin()) && (!configuration
.getChangedDefaultAdminPassword())) ? this.autocompletLoginValue boolean condition =
: null; ((configuration.isAutocompleteLogin()) && (!configuration.getChangedDefaultAdminPassword()));
return condition ? autocompleteLoginValue : null;
} }
} }

View file

@ -48,26 +48,24 @@ public class PageForErrorOnEvent extends GenericForwardComposer {
super.doAfterCompose(comp); super.doAfterCompose(comp);
logError(); logError();
modalWindow = comp; modalWindow = comp;
if (stacktrace != null) { if ( stacktrace != null ) {
stacktrace.setValue(getStacktrace()); stacktrace.setValue(getStacktrace());
} }
} }
private void logError() { private void logError() {
Throwable exception = (Throwable) Executions.getCurrent().getAttribute( Throwable exception = (Throwable) Executions.getCurrent().getAttribute("javax.servlet.error.exception");
"javax.servlet.error.exception"); String errorMessage = (String) Executions.getCurrent().getAttribute("javax.servlet.error.message");
String errorMessage = (String) Executions.getCurrent().getAttribute( Integer code = (Integer) Executions.getCurrent().getAttribute("javax.servlet.error.status_code");
"javax.servlet.error.message");
Integer code = (Integer) Executions.getCurrent().getAttribute( if ( code != null ) {
"javax.servlet.error.status_code");
if (code != null) {
errorMessage += " [Status Code: " + code + "]"; errorMessage += " [Status Code: " + code + "]";
if (code == HttpServletResponse.SC_FORBIDDEN) { if ( code == HttpServletResponse.SC_FORBIDDEN ) {
String uri = (String) Executions.getCurrent().getAttribute( String uri = (String) Executions.getCurrent().getAttribute("javax.servlet.error.request_uri");
"javax.servlet.error.request_uri");
errorMessage += " [Request URI: " + uri + "]"; errorMessage += " [Request URI: " + uri + "]";
} }
} }
LOG.error(errorMessage, exception); LOG.error(errorMessage, exception);
} }
@ -80,20 +78,20 @@ public class PageForErrorOnEvent extends GenericForwardComposer {
} }
public void onClick$quitSession() { public void onClick$quitSession() {
HttpServletRequest nativeRequest = (HttpServletRequest) Executions HttpServletRequest nativeRequest = (HttpServletRequest) Executions.getCurrent().getNativeRequest();
.getCurrent().getNativeRequest();
nativeRequest.getSession().invalidate(); nativeRequest.getSession().invalidate();
Executions.sendRedirect("/"); Executions.sendRedirect("/");
} }
private String getStacktrace() { private String getStacktrace() {
Throwable exception = (Throwable) Executions.getCurrent().getAttribute( Throwable exception = (Throwable) Executions.getCurrent().getAttribute("javax.servlet.error.exception");
"javax.servlet.error.exception");
if (exception != null) { if (exception != null) {
Writer stacktrace = new StringWriter(); Writer stacktrace = new StringWriter();
exception.printStackTrace(new PrintWriter(stacktrace)); exception.printStackTrace(new PrintWriter(stacktrace));
return stacktrace.toString(); return stacktrace.toString();
} }
return ""; return "";
} }

View file

@ -261,37 +261,32 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
@Override @Override
public void typeChanged(ModeType oldType, ModeType newType) { public void typeChanged(ModeType oldType, ModeType newType) {
switch (newType) { switch (newType) {
case GLOBAL:
ConfirmCloseUtil.resetConfirmClose();
break;
case GLOBAL: case ORDER:
ConfirmCloseUtil.resetConfirmClose(); if ( SecurityUtils.loggedUserCanWrite(mode.getOrder()) ) {
break; ConfirmCloseUtil.setConfirmClose(
desktop,
_("You are about to leave the planning editing. Unsaved changes will be lost!"));
}
break;
case ORDER: default:
if ( SecurityUtils.loggedUserCanWrite(mode.getOrder()) ) { break;
ConfirmCloseUtil.setConfirmClose(
desktop,
_("You are about to leave the planning editing. Unsaved changes will be lost!"));
}
break;
default:
break;
} }
} }
}); });
planningTab = doFeedbackOn(PlanningTabCreator.create(mode, planningTab = doFeedbackOn(PlanningTabCreator.create(
companyPlanningController, orderPlanningController, orderDAO, mode, companyPlanningController, orderPlanningController, orderDAO, breadcrumbs, parameters, this));
breadcrumbs, parameters, this));
resourceLoadTab = ResourcesLoadTabCreator.create(mode,
resourceLoadController,
resourceLoadControllerGlobal, new IOrderPlanningGate() {
resourceLoadTab = ResourcesLoadTabCreator.create(
mode, resourceLoadController, resourceLoadControllerGlobal, new IOrderPlanningGate() {
@Override @Override
public void goToScheduleOf(Order order) { public void goToScheduleOf(Order order) {
getTabsRegistry() getTabsRegistry().show(planningTab, changeModeTo(order));
.show(planningTab, changeModeTo(order));
} }
@Override @Override
@ -300,62 +295,28 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
} }
@Override @Override
public void goToTaskResourceAllocation(Order order, public void goToTaskResourceAllocation(Order order, TaskElement task) {
TaskElement task) {
orderPlanningController.setShowedTask(task); orderPlanningController.setShowedTask(task);
orderPlanningController.setCurrentControllerToShow(orderPlanningController.getEditTaskController());
getTabsRegistry() orderPlanningController
.show(planningTab, changeModeTo(order)); .setCurrentControllerToShow(orderPlanningController.getEditTaskController());
getTabsRegistry().show(planningTab, changeModeTo(order));
} }
@Override @Override
public void goToDashboard(Order order) { public void goToDashboard(Order order) {
// do nothing // do nothing
} }
}, breadcrumbs); }, breadcrumbs);
limitingResourcesTab = LimitingResourcesTabCreator.create(mode, limitingResourcesTab = LimitingResourcesTabCreator.create(
limitingResourcesController, limitingResourcesControllerGlobal, mode, limitingResourcesController, limitingResourcesControllerGlobal, breadcrumbs);
breadcrumbs);
ordersTab = OrdersTabCreator.create(mode, orderCRUDController,
breadcrumbs, new IOrderPlanningGate() {
@Override
public void goToScheduleOf(Order order) {
getTabsRegistry()
.show(planningTab, changeModeTo(order));
}
@Override
public void goToOrderDetails(Order order) {
getTabsRegistry().show(ordersTab, changeModeTo(order));
}
@Override
public void goToTaskResourceAllocation(Order order,
TaskElement task) {
// do nothing
}
@Override
public void goToDashboard(Order order) {
// do nothing
}
}, parameters);
dashboardTab = DashboardTabCreator.create(mode, planningStateCreator,
dashboardController, dashboardControllerGlobal, orderPlanningController, breadcrumbs,
resourcesSearcher);
logsTab = LogsTabCreator.create(mode, logsController, logsControllerGlobal, breadcrumbs, new IOrderPlanningGate() {
ordersTab = OrdersTabCreator.create(mode, orderCRUDController, breadcrumbs, new IOrderPlanningGate() {
@Override @Override
public void goToScheduleOf(Order order) { public void goToScheduleOf(Order order) {
getTabsRegistry() getTabsRegistry().show(planningTab, changeModeTo(order));
.show(planningTab, changeModeTo(order));
} }
@Override @Override
@ -364,8 +325,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
} }
@Override @Override
public void goToTaskResourceAllocation(Order order, public void goToTaskResourceAllocation(Order order, TaskElement task) {
TaskElement task) {
// do nothing // do nothing
} }
@ -373,37 +333,72 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
public void goToDashboard(Order order) { public void goToDashboard(Order order) {
// do nothing // do nothing
} }
}, parameters); }, parameters);
dashboardTab = DashboardTabCreator.create(
mode,
planningStateCreator,
dashboardController,
dashboardControllerGlobal,
orderPlanningController,
breadcrumbs,
resourcesSearcher);
logsTab = LogsTabCreator.create(
mode, logsController, logsControllerGlobal, breadcrumbs, new IOrderPlanningGate() {
@Override
public void goToScheduleOf(Order order) {
getTabsRegistry().show(planningTab, changeModeTo(order));
}
@Override
public void goToOrderDetails(Order order) {
getTabsRegistry().show(ordersTab, changeModeTo(order));
}
@Override
public void goToTaskResourceAllocation(Order order, TaskElement task) {
// do nothing
}
@Override
public void goToDashboard(Order order) {
// do nothing
}
}, parameters);
final boolean isMontecarloVisible = isMonteCarloVisible(); final boolean isMontecarloVisible = isMonteCarloVisible();
if (isMontecarloVisible) { if ( isMontecarloVisible ) {
monteCarloTab = MonteCarloTabCreator.create(mode, monteCarloTab = MonteCarloTabCreator.create(
planningStateCreator, monteCarloController, mode,
orderPlanningController, breadcrumbs, planningStateCreator,
monteCarloController,
orderPlanningController,
breadcrumbs,
resourcesSearcher); resourcesSearcher);
} }
final State<Void> typeChanged = typeChangedState(); final State<Void> typeChanged = typeChangedState();
advancedAllocationTab = doFeedbackOn(AdvancedAllocationTabCreator
.create(mode, transactionService, planningStateCreator, advancedAllocationTab = doFeedbackOn(AdvancedAllocationTabCreator.create(
returnToPlanningTab(), breadcrumbs)); mode, transactionService, planningStateCreator, returnToPlanningTab(), breadcrumbs));
TabsConfiguration tabsConfiguration = TabsConfiguration.create() TabsConfiguration tabsConfiguration = TabsConfiguration.create()
.add(tabWithNameReloading(planningTab, typeChanged)) .add(tabWithNameReloading(planningTab, typeChanged))
.add(tabWithNameReloading(ordersTab, typeChanged)); .add(tabWithNameReloading(ordersTab, typeChanged));
if (SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) {
tabsConfiguration.add(
tabWithNameReloading(resourceLoadTab, typeChanged)).add(
tabWithNameReloading(limitingResourcesTab, typeChanged));
} else {
tabsConfiguration.add(visibleOnlyAtOrderModeWithNameReloading(
resourceLoadTab, typeChanged));
}
tabsConfiguration.add(visibleOnlyAtOrderMode(advancedAllocationTab))
.add(tabWithNameReloading(dashboardTab, typeChanged));
if (isMontecarloVisible) { if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING) ) {
tabsConfiguration
.add(tabWithNameReloading(resourceLoadTab, typeChanged))
.add(tabWithNameReloading(limitingResourcesTab, typeChanged));
} else {
tabsConfiguration.add(visibleOnlyAtOrderModeWithNameReloading(resourceLoadTab, typeChanged));
}
tabsConfiguration
.add(visibleOnlyAtOrderMode(advancedAllocationTab))
.add(tabWithNameReloading(dashboardTab, typeChanged));
if ( isMontecarloVisible ) {
tabsConfiguration.add(visibleOnlyAtOrderMode(monteCarloTab)); tabsConfiguration.add(visibleOnlyAtOrderMode(monteCarloTab));
} }
@ -414,7 +409,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
private boolean isMonteCarloVisible() { private boolean isMonteCarloVisible() {
Boolean result = configurationDAO.getConfiguration().isMonteCarloMethodTabVisible(); Boolean result = configurationDAO.getConfiguration().isMonteCarloMethodTabVisible();
return result != null ? result.booleanValue() : false; return result != null ? result : false;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -458,8 +453,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
}; };
} }
private ChangeableTab tabWithNameReloading(ITab tab, private ChangeableTab tabWithNameReloading(ITab tab, final State<Void> typeChanged) {
final State<Void> typeChanged) {
return configure(tab).reloadNameOn(typeChanged); return configure(tab).reloadNameOn(typeChanged);
} }
@ -472,6 +466,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
typeChanged.changeValueTo(null); typeChanged.changeValueTo(null);
} }
}); });
return typeChanged; return typeChanged;
} }
@ -479,11 +474,11 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
return visibleOnlyAtOrderModeWithNameReloading(tab, null); return visibleOnlyAtOrderModeWithNameReloading(tab, null);
} }
private ChangeableTab visibleOnlyAtOrderModeWithNameReloading(ITab tab, private ChangeableTab visibleOnlyAtOrderModeWithNameReloading(ITab tab, final State<Void> typeChanged) {
final State<Void> typeChanged) {
final State<Boolean> state = State.create(mode.isOf(ModeType.ORDER)); final State<Boolean> state = State.create(mode.isOf(ModeType.ORDER));
ChangeableTab result; ChangeableTab result;
if (typeChanged == null) {
if ( typeChanged == null ) {
result = configure(tab).visibleOn(state); result = configure(tab).visibleOn(state);
} else { } else {
result = configure(tab).visibleOn(state).reloadNameOn(typeChanged); result = configure(tab).visibleOn(state).reloadNameOn(typeChanged);
@ -495,6 +490,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
state.changeValueTo(ModeType.ORDER == newType); state.changeValueTo(ModeType.ORDER == newType);
} }
}); });
return result; return result;
} }
@ -503,29 +499,29 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
public void doAfterCompose(org.zkoss.zk.ui.Component comp) { public void doAfterCompose(org.zkoss.zk.ui.Component comp) {
Execution execution = Executions.getCurrent(); Execution execution = Executions.getCurrent();
WELCOME_URL = "http://" + execution.getServerName() + ":" + execution.getServerPort() + Executions.encodeURL("/planner/index.zul"); WELCOME_URL = "http://" + execution.getServerName() + ":" + execution.getServerPort() +
Executions.encodeURL("/planner/index.zul");
tabsSwitcher = (TabSwitcher) comp; tabsSwitcher = (TabSwitcher) comp;
breadcrumbs = comp.getPage().getFellow("breadcrumbs"); breadcrumbs = comp.getPage().getFellow("breadcrumbs");
tabsSwitcher tabsSwitcher.setConfiguration(buildTabsConfiguration(comp.getDesktop()));
.setConfiguration(buildTabsConfiguration(comp.getDesktop()));
final EntryPointsHandler<IGlobalViewEntryPoints> handler = registry final EntryPointsHandler<IGlobalViewEntryPoints> handler =
.getRedirectorFor(IGlobalViewEntryPoints.class); registry.getRedirectorFor(IGlobalViewEntryPoints.class);
if (!handler.applyIfMatches(this)) {
if ( !handler.applyIfMatches(this) ) {
planningTab.toggleToNoFeedback(); planningTab.toggleToNoFeedback();
goToCompanyScheduling(); goToCompanyScheduling();
planningTab.toggleToFeedback(); planningTab.toggleToFeedback();
} }
handler.registerBookmarkListener(this, comp.getPage()); handler.registerBookmarkListener(this, comp.getPage());
if (SecurityUtils if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_CREATE_PROJECTS) ) {
.isSuperuserOrUserInRoles(UserRole.ROLE_CREATE_PROJECTS)) { org.zkoss.zk.ui.Component createOrderButton = comp.getPage().getFellowIfAny("createOrderButton");
org.zkoss.zk.ui.Component createOrderButton = comp.getPage()
.getFellowIfAny( if ( createOrderButton != null ) {
"createOrderButton"); createOrderButton.addEventListener(Events.ON_CLICK, new EventListener() {
if (createOrderButton != null) {
createOrderButton.addEventListener(Events.ON_CLICK,
new EventListener() {
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
goToCreateForm(); goToCreateForm();
@ -544,8 +540,15 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
private void sendDataToServer(){ private void sendDataToServer(){
GatheredUsageStats gatheredUsageStats = new GatheredUsageStats(); GatheredUsageStats gatheredUsageStats = new GatheredUsageStats();
gatheredUsageStats.setupNotAutowiredClasses(userDAO, orderModel, workReportModel, workerModel, machineModel, gatheredUsageStats.setupNotAutowiredClasses(
expenseSheetModel, materialsModel, assignedQualityFormsModel); userDAO,
orderModel,
workReportModel,
workerModel,
machineModel,
expenseSheetModel,
materialsModel,
assignedQualityFormsModel);
gatheredUsageStats.sendGatheredUsageStatsToServer(); gatheredUsageStats.sendGatheredUsageStatsToServer();
SecurityUtils.isGatheredStatsAlreadySent = true; SecurityUtils.isGatheredStatsAlreadySent = true;
@ -578,8 +581,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
public void goToCreateForm() { public void goToCreateForm() {
orderCRUDController.prepareForCreate(tabsSwitcher.getDesktop()); orderCRUDController.prepareForCreate(tabsSwitcher.getDesktop());
orderCRUDController.getCreationPopup().showWindow(orderCRUDController, orderCRUDController.getCreationPopup().showWindow(orderCRUDController, this);
this);
} }
@ -625,14 +627,15 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
@Override @Override
public void goToAdvanceTask(Order order,TaskElement task) { public void goToAdvanceTask(Order order,TaskElement task) {
orderPlanningController.setShowedTask(task); orderPlanningController.setShowedTask(task);
orderPlanningController orderPlanningController
.setCurrentControllerToShow(orderPlanningController .setCurrentControllerToShow(orderPlanningController.getAdvanceAssignmentPlanningController());
.getAdvanceAssignmentPlanningController());
getTabsRegistry().show(planningTab, changeModeTo(order)); getTabsRegistry().show(planningTab, changeModeTo(order));
} }
private IBeforeShowAction changeModeTo(final Order order) { private IBeforeShowAction changeModeTo(final Order order) {
logsController.goToOrderMode(order); LogsController.goToOrderMode(order);
return new IBeforeShowAction() { return new IBeforeShowAction() {
@Override @Override
public void doAction() { public void doAction() {

View file

@ -59,13 +59,10 @@ public class CutyPrint {
private static final Log LOG = LogFactory.getLog(CutyPrint.class); private static final Log LOG = LogFactory.getLog(CutyPrint.class);
private static final String CUTYCAPT_COMMAND = "cutycapt"; private static final String CUTYCAPT_COMMAND = "cutycapt";
// Estimated maximum execution time (ms) // Estimated maximum execution time (ms)
private static final int CAPTURE_DELAY = 10000; private static final int CAPTURE_DELAY = 10000;
// Taskdetails left padding
private static int TASKDETAILS_BASE_WIDTH = 310;
/** /**
* Default width in pixels of the task name text field for depth level 1. * Default width in pixels of the task name text field for depth level 1.
* <p /> * <p />
@ -75,59 +72,49 @@ public class CutyPrint {
private static final int BASE_TASK_NAME_PIXELS = 121; private static final int BASE_TASK_NAME_PIXELS = 121;
private static int TASK_HEIGHT = 25; private static int TASK_HEIGHT = 25;
private static int PRINT_VERTICAL_PADDING = 50;
private static int PRINT_VERTICAL_SPACING = 160;
public static void print(Order order) { public static void print(Order order) {
print("/planner/index.zul", entryPointForShowingOrder(order), print("/planner/index.zul", entryPointForShowingOrder(order), Collections.<String, String> emptyMap());
Collections.<String, String> emptyMap());
} }
public static void print(Order order, Map<String, String> parameters) { public static void print(Order order, Map<String, String> parameters) {
print("/planner/index.zul", entryPointForShowingOrder(order), print("/planner/index.zul", entryPointForShowingOrder(order), parameters);
parameters);
} }
public static void print(Order order, HashMap<String, String> parameters, public static void print(Order order, HashMap<String, String> parameters, Planner planner) {
Planner planner) { print("/planner/index.zul", entryPointForShowingOrder(order), parameters, planner);
print("/planner/index.zul", entryPointForShowingOrder(order),
parameters, planner);
} }
public static void print() { public static void print() {
print("/planner/index.zul", Collections.<String, String> emptyMap(), print("/planner/index.zul", Collections.<String, String> emptyMap(), Collections.<String, String> emptyMap());
Collections.<String, String> emptyMap());
} }
public static void print(Map<String, String> parameters) { public static void print(Map<String, String> parameters) {
print("/planner/index.zul", Collections.<String, String> emptyMap(), print("/planner/index.zul", Collections.<String, String> emptyMap(), parameters);
parameters);
} }
public static void print(HashMap<String, String> parameters, Planner planner) { public static void print(HashMap<String, String> parameters, Planner planner) {
print("/planner/index.zul", Collections.<String, String> emptyMap(), print("/planner/index.zul", Collections.<String, String> emptyMap(), parameters, planner);
parameters, planner);
} }
private static Map<String, String> entryPointForShowingOrder(Order order) { private static Map<String, String> entryPointForShowingOrder(Order order) {
final Map<String, String> result = new HashMap<String, String>(); final Map<String, String> result = new HashMap<>();
result.put("order", order.getCode() + ""); result.put("order", order.getCode() + "");
return result; return result;
} }
public static void print(final String forwardURL, public static void print(
final Map<String, String> entryPointsMap, final String forwardURL, final Map<String, String> entryPointsMap, Map<String, String> parameters) {
Map<String, String> parameters) {
print(forwardURL, entryPointsMap, parameters, null); print(forwardURL, entryPointsMap, parameters, null);
} }
public static void print(final String forwardURL, public static void print(final String forwardURL,
final Map<String, String> entryPointsMap, final Map<String, String> entryPointsMap,
Map<String, String> parameters, Planner planner) { Map<String, String> parameters,
Planner planner) {
CutyCaptParameters params = new CutyCaptParameters(forwardURL, CutyCaptParameters params = new CutyCaptParameters(forwardURL, entryPointsMap, parameters, planner);
entryPointsMap, parameters, planner);
String generatedSnapshotServerPath = takeSnapshot(params); String generatedSnapshotServerPath = takeSnapshot(params);
openInAnotherTab(generatedSnapshotServerPath); openInAnotherTab(generatedSnapshotServerPath);
@ -141,10 +128,8 @@ public class CutyPrint {
private static final AtomicLong counter = new AtomicLong(); private static final AtomicLong counter = new AtomicLong();
private final HttpServletRequest request = (HttpServletRequest) Executions private final HttpServletRequest request = (HttpServletRequest) Executions.getCurrent().getNativeRequest();
.getCurrent().getNativeRequest(); private final ServletContext context = request.getSession().getServletContext();
private final ServletContext context = request.getSession()
.getServletContext();
private final String forwardURL; private final String forwardURL;
private final Map<String, String> entryPointsMap; private final Map<String, String> entryPointsMap;
@ -159,21 +144,21 @@ public class CutyPrint {
private final int recentUniqueToken = (int) (counter.getAndIncrement() % 1000); private final int recentUniqueToken = (int) (counter.getAndIncrement() % 1000);
public CutyCaptParameters(final String forwardURL, public CutyCaptParameters(final String forwardURL,
final Map<String, String> entryPointsMap, final Map<String, String> entryPointsMap,
Map<String, String> printParameters, Planner planner) { Map<String, String> printParameters,
Planner planner) {
this.forwardURL = forwardURL; this.forwardURL = forwardURL;
this.entryPointsMap = entryPointsMap != null ? entryPointsMap this.entryPointsMap = (entryPointsMap != null) ? entryPointsMap : Collections.<String, String> emptyMap();
: Collections.<String, String> emptyMap();
this.printParameters = printParameters != null ? printParameters this.printParameters =
: Collections.<String, String> emptyMap(); (printParameters != null) ? printParameters : Collections.<String, String> emptyMap();
this.planner = planner; this.planner = planner;
containersExpandedByDefault = Planner containersExpandedByDefault = Planner.guessContainersExpandedByDefaultGivenPrintParameters(printParameters);
.guessContainersExpandedByDefaultGivenPrintParameters(printParameters); minWidthForTaskNameColumn = planner.calculateMinimumWidthForTaskNameColumn(containersExpandedByDefault);
minWidthForTaskNameColumn = planner generatedSnapshotServerPath = buildCaptureDestination(printParameters.get("extension"));
.calculateMinimumWidthForTaskNameColumn(containersExpandedByDefault);
generatedSnapshotServerPath = buildCaptureDestination(printParameters
.get("extension"));
} }
String getGeneratedSnapshotServerPath() { String getGeneratedSnapshotServerPath() {
@ -181,36 +166,33 @@ public class CutyPrint {
} }
private String buildCaptureDestination(String extension) { private String buildCaptureDestination(String extension) {
if (StringUtils.isEmpty(extension)) { if ( StringUtils.isEmpty(extension) ) {
extension = ".pdf"; extension = ".pdf";
} }
return String.format("/print/%tY%<tm%<td%<tH%<tM%<tS-%s%s",
new Date(), return String.format("/print/%tY%<tm%<td%<tH%<tM%<tS-%s%s", new Date(), recentUniqueToken, extension);
recentUniqueToken, extension);
} }
/** /**
* An unique recent display number for Xvfb. It's not truly unique * An unique recent display number for Xvfb.
* across all the life of a libreplan application, but it's in the last * It's not truly unique across all the life of a LibrePlan application, but it's in the last period of time.
* period of time.
* *
* @return the display number to use by Xvfb * @return the display number to use by Xvfb
*/ */
public int getXvfbDisplayNumber() { public int getXvfbDisplayNumber() {
return recentUniqueToken + 1; // avoid display 0 // avoid display 0
return recentUniqueToken + 1;
} }
void fillParameters(ProcessBuilder c) { void fillParameters(ProcessBuilder c) {
Map<String, String> parameters = buildParameters(); Map<String, String> parameters = buildParameters();
for (Entry<String, String> each : parameters.entrySet()) { for (Entry<String, String> each : parameters.entrySet()) {
c.command() c.command().add(String.format("--%s=%s", each.getKey(), each.getValue()));
.add(String.format("--%s=%s", each.getKey(),
each.getValue()));
} }
} }
private Map<String, String> buildParameters() { private Map<String, String> buildParameters() {
Map<String, String> result = new HashMap<String, String>(); Map<String, String> result = new HashMap<>();
result.put("url", buildSnapshotURLParam()); result.put("url", buildSnapshotURLParam());
@ -221,8 +203,8 @@ public class CutyPrint {
result.put("delay", CAPTURE_DELAY + ""); result.put("delay", CAPTURE_DELAY + "");
result.put("user-style-path", buildCustomCSSParam(width)); result.put("user-style-path", buildCustomCSSParam(width));
result.put("out", buildPathToOutputFileParam()); result.put("out", buildPathToOutputFileParam());
result.put("header", String.format("Accept-Language:%s", Locales result.put("header", String.format("Accept-Language:%s", Locales.getCurrent().getLanguage()));
.getCurrent().getLanguage()));
return result; return result;
} }
@ -230,39 +212,37 @@ public class CutyPrint {
IServletRequestHandler snapshotRequestHandler = executeOnOriginalContext(new IServletRequestHandler() { IServletRequestHandler snapshotRequestHandler = executeOnOriginalContext(new IServletRequestHandler() {
@Override @Override
public void handle(HttpServletRequest request, public void handle(
HttpServletResponse response) throws ServletException, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
IOException {
EntryPointsHandler.setupEntryPointsForThisRequest(request, EntryPointsHandler.setupEntryPointsForThisRequest(request, entryPointsMap);
entryPointsMap);
// Pending to forward and process additional parameters // Pending to forward and process additional parameters
// as show labels, resources, zoom or expand all // as show labels, resources, zoom or expand all
request.getRequestDispatcher(forwardURL).forward(request, request.getRequestDispatcher(forwardURL).forward(request, response);
response);
} }
}); });
String pageToSnapshot = CallbackServlet.registerAndCreateURLFor(
request, snapshotRequestHandler); String pageToSnapshot = CallbackServlet.registerAndCreateURLFor(request, snapshotRequestHandler);
return createCaptureURL(pageToSnapshot); return createCaptureURL(pageToSnapshot);
} }
private String createCaptureURL(String capturePath) { private String createCaptureURL(String capturePath) {
String hostName = resolveLocalHost(); String hostName = resolveLocalHost();
String uri = String.format("%s://%s:%s", request.getScheme(), String uri = String.format("%s://%s:%s", request.getScheme(), hostName, request.getLocalPort());
hostName, request.getLocalPort());
UriBuilder result = UriBuilder.fromUri(uri).path(capturePath); UriBuilder result = UriBuilder.fromUri(uri).path(capturePath);
for (Entry<String, String> entry : printParameters.entrySet()) { for (Entry<String, String> entry : printParameters.entrySet()) {
result = result.queryParam(entry.getKey(), entry.getValue()); result = result.queryParam(entry.getKey(), entry.getValue());
} }
return result.build().toASCIIString(); return result.build().toASCIIString();
} }
private String resolveLocalHost() { private String resolveLocalHost() {
try { try {
InetAddress host = InetAddress InetAddress host = InetAddress.getByName(request.getLocalName());
.getByName(request.getLocalName());
return host.getHostName(); return host.getHostName();
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -270,46 +250,43 @@ public class CutyPrint {
} }
private int buildMinWidthParam() { private int buildMinWidthParam() {
if (planner != null && planner.getTimeTracker() != null) { if ( planner != null && planner.getTimeTracker() != null ) {
return planner.getTimeTracker().getHorizontalSize() return planner.getTimeTracker().getHorizontalSize() + calculateTaskDetailsWidth();
+ calculateTaskDetailsWidth();
} }
return 0; return 0;
} }
private int calculateTaskDetailsWidth() { private int calculateTaskDetailsWidth() {
return TASKDETAILS_BASE_WIDTH int TASKDETAILS_BASE_WIDTH = 310;
+ Math.max(0, minWidthForTaskNameColumn return TASKDETAILS_BASE_WIDTH + Math.max(0, minWidthForTaskNameColumn - BASE_TASK_NAME_PIXELS);
- BASE_TASK_NAME_PIXELS);
} }
private int buildMinHeightParam() { private int buildMinHeightParam() {
return (containersExpandedByDefault ? planner.getAllTasksNumber() int PRINT_VERTICAL_SPACING = 160;
: planner.getTaskNumber()) return (containersExpandedByDefault ? planner.getAllTasksNumber() :
* TASK_HEIGHT planner.getTaskNumber()) * TASK_HEIGHT + PRINT_VERTICAL_SPACING;
+ PRINT_VERTICAL_SPACING;
} }
private String buildCustomCSSParam(int plannerWidth) { private String buildCustomCSSParam(int plannerWidth) {
// Calculate application path and destination file relative route // Calculate application path and destination file relative route
String absolutePath = context.getRealPath("/"); String absolutePath = context.getRealPath("/");
cssLinesToAppend(plannerWidth); cssLinesToAppend(plannerWidth);
return createCSSFile(absolutePath + "/planner/css/print.css",
cssLinesToAppend(plannerWidth)); return createCSSFile(absolutePath + "/planner/css/print.css", cssLinesToAppend(plannerWidth));
} }
private static String createCSSFile(String sourceFile, private static String createCSSFile(String sourceFile, String cssLinesToAppend) {
String cssLinesToAppend) {
File destination; File destination;
try { try {
destination = File.createTempFile("print", ".css"); destination = File.createTempFile("print", ".css");
FileUtils.copyFile(new File(sourceFile), destination); FileUtils.copyFile(new File(sourceFile), destination);
} catch (IOException e) { } catch (IOException e) {
LOG.error( LOG.error("Can't create a temporal file for storing the CSS files", e);
"Can't create a temporal file for storing the CSS files",
e);
return sourceFile; return sourceFile;
} }
FileWriter appendToFile = null; FileWriter appendToFile = null;
try { try {
appendToFile = new FileWriter(destination, true); appendToFile = new FileWriter(destination, true);
@ -320,54 +297,53 @@ public class CutyPrint {
LOG.error("Can't append to the created file " + destination, e); LOG.error("Can't append to the created file " + destination, e);
} finally { } finally {
try { try {
if (appendToFile != null) { if ( appendToFile != null ) {
appendToFile.close(); appendToFile.close();
} }
} catch (IOException e) { } catch (IOException e) {
LOG.warn("error closing fileWriter", e); LOG.warn("error closing fileWriter", e);
} }
} }
return destination.getAbsolutePath(); return destination.getAbsolutePath();
} }
private String cssLinesToAppend(int width) { private String cssLinesToAppend(int width) {
String includeCSSLines = " body { width: " + width + "px; } \n"; String includeCSSLines = " body { width: " + width + "px; } \n";
if ("all".equals(printParameters.get("labels"))) { if ( "all".equals(printParameters.get("labels")) ) {
includeCSSLines += " .task-labels { display: inline !important;} \n "; includeCSSLines += " .task-labels { display: inline !important;} \n ";
} }
if ("all".equals(printParameters.get("resources"))) {
if ( "all".equals(printParameters.get("resources")) ) {
includeCSSLines += " .task-resources { display: inline !important;} \n"; includeCSSLines += " .task-resources { display: inline !important;} \n";
} }
includeCSSLines += heightCSS(); includeCSSLines += heightCSS();
includeCSSLines += widthForTaskNamesColumnCSS(); includeCSSLines += widthForTaskNamesColumnCSS();
return includeCSSLines; return includeCSSLines;
} }
private String heightCSS() { private String heightCSS() {
int tasksNumber = containersExpandedByDefault ? planner int tasksNumber = containersExpandedByDefault ? planner.getAllTasksNumber() : planner.getTaskNumber();
.getAllTasksNumber() : planner int PRINT_VERTICAL_PADDING = 50;
.getTaskNumber();
int height = (tasksNumber * TASK_HEIGHT) + PRINT_VERTICAL_PADDING; int height = (tasksNumber * TASK_HEIGHT) + PRINT_VERTICAL_PADDING;
String heightCSS = ""; String heightCSS = "";
heightCSS += " body div#scroll_container { height: " + height heightCSS += " body div#scroll_container { height: " + height + "px !important;} \n"; /* 1110 */
+ "px !important;} \n"; /* 1110 */ heightCSS += " body div#timetracker { height: " + (height + 20) + "px !important; } \n";
heightCSS += " body div#timetracker { height: " + (height + 20) heightCSS += " body div.plannerlayout { height: " + (height + 80) + "px !important; } \n";
+ "px !important; } \n"; heightCSS += " body div.main-layout { height: " + (height + 90) + "px !important; } \n";
heightCSS += " body div.plannerlayout { height: " + (height + 80)
+ "px !important; } \n";
heightCSS += " body div.main-layout { height: " + (height + 90)
+ "px !important; } \n";
return heightCSS; return heightCSS;
} }
private String widthForTaskNamesColumnCSS() { private String widthForTaskNamesColumnCSS() {
String css = "/* ------ Make the area for task names wider ------ */\n"; String css = "/* ------ Make the area for task names wider ------ */\n";
css += "th.z-tree-col {width: 76px !important;}\n"; css += "th.z-tree-col {width: 76px !important;}\n";
css += "th.tree-text {width: " + (34 + minWidthForTaskNameColumn) css += "th.tree-text {width: " + (34 + minWidthForTaskNameColumn) + "px !important;}\n";
+ "px !important;}\n";
css += ".taskdetailsContainer, .z-west-body, .z-tree-header, .z-tree-body {"; css += ".taskdetailsContainer, .z-west-body, .z-tree-header, .z-tree-body {";
css += "width: " + (176 + minWidthForTaskNameColumn) + "px !important;}\n"; css += "width: " + (176 + minWidthForTaskNameColumn) + "px !important;}\n";
return css; return css;
} }
@ -378,8 +354,8 @@ public class CutyPrint {
} }
/** /**
* It blocks until the snapshot is ready. It invokes cutycapt program in * It blocks until the snapshot is ready.
* order to take a snapshot from a specified url * It invokes cutycapt program in order to take a snapshot from a specified url.
* *
* @return the path in the web application to access via a HTTP GET to the * @return the path in the web application to access via a HTTP GET to the
* generated snapshot. * generated snapshot.
@ -388,8 +364,7 @@ public class CutyPrint {
ProcessBuilder capture = new ProcessBuilder(CUTYCAPT_COMMAND); ProcessBuilder capture = new ProcessBuilder(CUTYCAPT_COMMAND);
params.fillParameters(capture); params.fillParameters(capture);
String generatedSnapshotServerPath = params String generatedSnapshotServerPath = params.getGeneratedSnapshotServerPath();
.getGeneratedSnapshotServerPath();
Process printProcess = null; Process printProcess = null;
Process serverProcess = null; Process serverProcess = null;
@ -397,15 +372,15 @@ public class CutyPrint {
LOG.info("calling printing: " + capture.command()); LOG.info("calling printing: " + capture.command());
// If there is a not real X server environment then use Xvfb // If there is a not real X server environment then use Xvfb
if (StringUtils.isEmpty(System.getenv("DISPLAY"))) { if ( StringUtils.isEmpty(System.getenv("DISPLAY")) ) {
ProcessBuilder s = new ProcessBuilder("Xvfb", ":" ProcessBuilder s = new ProcessBuilder("Xvfb", ":" + params.getXvfbDisplayNumber());
+ params.getXvfbDisplayNumber());
serverProcess = s.start(); serverProcess = s.start();
capture.environment().put("DISPLAY", capture.environment().put("DISPLAY", ":" + params.getXvfbDisplayNumber() + ".0");
":" + params.getXvfbDisplayNumber() + ".0");
} }
printProcess = capture.start(); printProcess = capture.start();
printProcess.waitFor(); printProcess.waitFor();
// once the printProcess finishes, the print snapshot is available // once the printProcess finishes, the print snapshot is available
return generatedSnapshotServerPath; return generatedSnapshotServerPath;
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -414,10 +389,10 @@ public class CutyPrint {
LOG.error("error invoking command", e); LOG.error("error invoking command", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
if (printProcess != null) { if ( printProcess != null ) {
destroy(printProcess); destroy(printProcess);
} }
if (serverProcess != null) { if ( serverProcess != null ) {
destroy(serverProcess); destroy(serverProcess);
} }
} }
@ -431,16 +406,15 @@ public class CutyPrint {
} }
} }
private static IServletRequestHandler executeOnOriginalContext( private static IServletRequestHandler executeOnOriginalContext(final IServletRequestHandler original) {
final IServletRequestHandler original) { final SecurityContext originalContext = SecurityContextHolder.getContext();
final SecurityContext originalContext = SecurityContextHolder
.getContext();
final Locale current = Locales.getCurrent(); final Locale current = Locales.getCurrent();
return new IServletRequestHandler() { return new IServletRequestHandler() {
@Override @Override
public void handle(HttpServletRequest request, public void handle(
HttpServletResponse response) throws ServletException, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
IOException {
Locales.setThreadLocal(current); Locales.setThreadLocal(current);
SecurityContextHolder.setContext(originalContext); SecurityContextHolder.setContext(originalContext);
original.handle(request, response); original.handle(request, response);

View file

@ -36,7 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* Bootstrapt to create the default {@link User Users}. * Bootstrap to create the default {@link User Users}.
* *
* @author Fernando Bellas Permuy <fbellas@udc.es> * @author Fernando Bellas Permuy <fbellas@udc.es>
* @author Manuel Rego Casasnovas <rego@igalia.com> * @author Manuel Rego Casasnovas <rego@igalia.com>
@ -63,11 +63,15 @@ public class UsersBootstrapInDB implements IUsersBootstrapInDB {
@Override @Override
public void loadRequiredData() { public void loadRequiredData() {
if (userDAO.list(User.class).isEmpty()) { if ( userDAO.list(User.class).isEmpty() ) {
for (PredefinedUsers u : PredefinedUsers.values()) { for (PredefinedUsers u : PredefinedUsers.values()) {
User user = User.create(u.getLoginName(),
getEncodedPassword(u), u.getInitialRoles(), User user = User.create(
u.getLoginName(),
getEncodedPassword(u),
u.getInitialRoles(),
getProfiles(u.getInitialProfiles())); getProfiles(u.getInitialProfiles()));
user.setDisabled(u.isUserDisabled()); user.setDisabled(u.isUserDisabled());
userDAO.save(user); userDAO.save(user);
@ -77,7 +81,7 @@ public class UsersBootstrapInDB implements IUsersBootstrapInDB {
} }
private Set<Profile> getProfiles(Set<PredefinedProfiles> initialProfiles) { private Set<Profile> getProfiles(Set<PredefinedProfiles> initialProfiles) {
Set<Profile> profiles = new HashSet<Profile>(); Set<Profile> profiles = new HashSet<>();
for (PredefinedProfiles each : initialProfiles) { for (PredefinedProfiles each : initialProfiles) {
try { try {
profiles.add(profileDAO.findByProfileName(each.getName())); profiles.add(profileDAO.findByProfileName(each.getName()));
@ -85,13 +89,13 @@ public class UsersBootstrapInDB implements IUsersBootstrapInDB {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
return profiles; return profiles;
} }
private String getEncodedPassword(PredefinedUsers u) { private String getEncodedPassword(PredefinedUsers u) {
return dbPasswordEncoderService.encodePassword(u.getClearPassword(), return dbPasswordEncoderService.encodePassword(u.getClearPassword(), u.getLoginName());
u.getLoginName());
} }

View file

@ -27,8 +27,7 @@ import org.springframework.security.core.AuthenticationException;
public class AuthenticationProviderLoggingDecorator implements AuthenticationProvider { public class AuthenticationProviderLoggingDecorator implements AuthenticationProvider {
private static final Log LOG = LogFactory private static final Log LOG = LogFactory.getLog(AuthenticationProviderLoggingDecorator.class);
.getLog(AuthenticationProviderLoggingDecorator.class);
private AuthenticationProvider decoratedProvider; private AuthenticationProvider decoratedProvider;
@ -41,22 +40,20 @@ public class AuthenticationProviderLoggingDecorator implements AuthenticationPro
} }
@Override @Override
public Authentication authenticate(Authentication authentication) public Authentication authenticate(Authentication authentication) throws AuthenticationException {
throws AuthenticationException { Object principal = authentication != null ? authentication.getPrincipal() : null;
Object principal = authentication != null ? authentication
.getPrincipal() : null;
LOG.info("trying to authenticate " + principal); LOG.info("trying to authenticate " + principal);
try { try {
Authentication result = decoratedProvider Authentication result = decoratedProvider.authenticate(authentication);
.authenticate(authentication); if ( result != null ) {
if (result != null) { LOG.info("successful authentication for: " + principal + " with provider: " + decoratedProvider);
LOG.info("successful authentication for: " + principal
+ " with provider: " + decoratedProvider);
} }
return result; return result;
} catch (AuthenticationException e) { } catch (AuthenticationException e) {
LOG.info("unsuccessful authentication of " + principal LOG.info("unsuccessful authentication of " + principal + " with provider: " + decoratedProvider);
+ " with provider: " + decoratedProvider);
throw e; throw e;
} }
} }

View file

@ -30,15 +30,17 @@ import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
/** /**
* For maximum flexibility, the implementation uses the password encoder and * For maximum flexibility, the implementation uses the password encoder and the salt source
* the salt source configured in the Spring Security configuration file (in * configured in the Spring Security configuration file
* consequence, it is possible to change the configuration to use any password * (in consequence, it is possible to change the configuration to use any password encoder and/or salt source
* encoder and/or salt source without modifying the implementation of this * without modifying the implementation of this service).
* service). The only restriction the implementation imposes is that when using *
* a reflection-based salt source, the "username" property must be specified. * The only restriction the implementation imposes is that
* when using a reflection-based salt source, the "username" property must be specified.
* *
* @author Fernando Bellas Permuy <fbellas@udc.es> * @author Fernando Bellas Permuy <fbellas@udc.es>
*/ */
// TODO resolve deprecated
public class DBPasswordEncoderService implements IDBPasswordEncoderService { public class DBPasswordEncoderService implements IDBPasswordEncoderService {
private SaltSource saltSource; private SaltSource saltSource;
@ -67,12 +69,12 @@ public class DBPasswordEncoderService implements IDBPasswordEncoderService {
* "ReflectionSaltSource". Note that "SystemWideSaltSource" ignores * "ReflectionSaltSource". Note that "SystemWideSaltSource" ignores
* the "user" passed as a parameter to "saltSource.getSalt". * the "user" passed as a parameter to "saltSource.getSalt".
*/ */
UserDetails userDetails = new User(loginName, clearPassword, true, UserDetails userDetails =
true, true, true, Collections.<GrantedAuthority>emptyList()); new User(loginName, clearPassword, true, true, true, true, Collections.<GrantedAuthority>emptyList());
Object salt = null; Object salt = null;
if (saltSource != null) { if ( saltSource != null ) {
salt = saltSource.getSalt(userDetails); salt = saltSource.getSalt(userDetails);
} }

View file

@ -35,7 +35,7 @@ import org.libreplan.business.users.entities.UserRole;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.GrantedAuthorityImpl; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
@ -56,39 +56,36 @@ public class DBUserDetailsService implements UserDetailsService {
@Override @Override
@Transactional(readOnly=true) @Transactional(readOnly=true)
public UserDetails loadUserByUsername(String loginName) public UserDetails loadUserByUsername(String loginName) throws UsernameNotFoundException, DataAccessException {
throws UsernameNotFoundException, DataAccessException {
User user; User user;
try { try {
user = userDAO.findByLoginName(loginName); user = userDAO.findByLoginName(loginName);
} catch (InstanceNotFoundException e) { } catch (InstanceNotFoundException e) {
throw new UsernameNotFoundException(MessageFormat.format( throw new UsernameNotFoundException(MessageFormat.format("User with username {0}: not found", loginName));
"User with username {0}: not found", loginName));
} }
Scenario scenario = user.getLastConnectedScenario(); Scenario scenario = user.getLastConnectedScenario();
if (scenario == null) { if ( scenario == null ) {
scenario = PredefinedScenarios.MASTER.getScenario(); scenario = PredefinedScenarios.MASTER.getScenario();
} }
return new CustomUser( return new CustomUser(
user.getLoginName(), user.getLoginName(), user.getPassword(),
user.getPassword(),
!user.isDisabled(), !user.isDisabled(),
true, // accountNonExpired true, // accountNonExpired
true, // credentialsNonExpired true, // credentialsNonExpired
true, // accountNonLocked true, // accountNonLocked
getGrantedAuthorities(user.getAllRoles()), getGrantedAuthorities(user.getAllRoles()), scenario);
scenario);
} }
private List<GrantedAuthority> getGrantedAuthorities(Set<UserRole> roles) { private List<GrantedAuthority> getGrantedAuthorities(Set<UserRole> roles) {
List<GrantedAuthority> result = new ArrayList<GrantedAuthority>(); List<GrantedAuthority> result = new ArrayList<>();
for (UserRole r : roles) { for (UserRole r : roles) {
result.add(new GrantedAuthorityImpl(r.name())); result.add(new SimpleGrantedAuthority(r.name()));
} }
return result; return result;
} }

View file

@ -58,8 +58,8 @@ import org.springframework.transaction.annotation.Transactional;
* An extending from AbstractUserDetailsAuthenticationProvider class which is * An extending from AbstractUserDetailsAuthenticationProvider class which is
* used to implement the authentication against LDAP. * used to implement the authentication against LDAP.
* *
* This provider implements the process explained in <https * This provider implements the process explained in
* ://wiki.libreplan.org/twiki/bin/view/LibrePlan/AnA04S06LdapAuthentication> * <https://wiki.libreplan.org/twiki/bin/view/LibrePlan/AnA04S06LdapAuthentication>
* *
* At this time it authenticates user against LDAP and then searches it in BD to * At this time it authenticates user against LDAP and then searches it in BD to
* use the BD user in application. * use the BD user in application.
@ -68,9 +68,10 @@ import org.springframework.transaction.annotation.Transactional;
* @author Cristina Alvarino Perez <cristina.alvarino@comtecsf.es> * @author Cristina Alvarino Perez <cristina.alvarino@comtecsf.es>
* *
*/ */
public class LDAPCustomAuthenticationProvider extends
AbstractUserDetailsAuthenticationProvider implements // TODO resolve deprecated methods
AuthenticationProvider { public class LDAPCustomAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider
implements AuthenticationProvider {
@Autowired @Autowired
private IAdHocTransactionService transactionService; private IAdHocTransactionService transactionService;
@ -94,41 +95,36 @@ public class LDAPCustomAuthenticationProvider extends
private static final String USER_ID_SUBSTITUTION = "[USER_ID]"; private static final String USER_ID_SUBSTITUTION = "[USER_ID]";
private static final Log LOG = LogFactory private static final Log LOG = LogFactory.getLog(LDAPCustomAuthenticationProvider.class);
.getLog(LDAPCustomAuthenticationProvider.class);
/** /**
* LDAP role matching could be configured using an asterix (*) to specify * LDAP role matching could be configured using an asterix (*)
* all users or groups * to specify all users or groups
*/ */
private static final String WILDCHAR_ALL = "*"; private static final String WILDCHAR_ALL = "*";
@Override @Override
protected void additionalAuthenticationChecks(UserDetails arg0, protected void additionalAuthenticationChecks(UserDetails arg0, UsernamePasswordAuthenticationToken arg1)
UsernamePasswordAuthenticationToken arg1)
throws AuthenticationException { throws AuthenticationException {
// No needed at this time // No needed at this time
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
@Override @Override
public UserDetails retrieveUser(String username, public UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication)
UsernamePasswordAuthenticationToken authentication)
throws AuthenticationException { throws AuthenticationException {
String clearPassword = authentication.getCredentials().toString(); String clearPassword = authentication.getCredentials().toString();
if (StringUtils.isBlank(username) || StringUtils.isBlank(clearPassword)) { if ( StringUtils.isBlank(username) || StringUtils.isBlank(clearPassword) ) {
throw new BadCredentialsException( throw new BadCredentialsException("Username and password can not be empty");
"Username and password can not be empty");
} }
String encodedPassword = passwordEncoderService.encodePassword( String encodedPassword = passwordEncoderService.encodePassword(clearPassword, username);
clearPassword, username);
User user = getUserFromDB(username); User user = getUserFromDB(username);
// If user != null then exists in LibrePlan // If user != null then exists in LibrePlan
if (null != user && user.isLibrePlanUser()) { if ( null != user && user.isLibrePlanUser() ) {
// is a LibrePlan user, then we must authenticate against DB // is a LibrePlan user, then we must authenticate against DB
return authenticateInDatabase(username, user, encodedPassword); return authenticateInDatabase(username, user, encodedPassword);
} }
@ -137,36 +133,39 @@ public class LDAPCustomAuthenticationProvider extends
// Load LDAPConfiguration properties // Load LDAPConfiguration properties
configuration = loadLDAPConfiguration(); configuration = loadLDAPConfiguration();
if (configuration.getLdapAuthEnabled()) { if ( configuration.getLdapAuthEnabled() ) {
// Sets the new context to ldapTemplate // Sets the new context to ldapTemplate
ldapTemplate.setContextSource(loadLDAPContext()); ldapTemplate.setContextSource(loadLDAPContext());
try { try {
// Test authentication for user against LDAP // Test authentication for user against LDAP
if (authenticateAgainstLDAP(username, clearPassword)) { if ( authenticateAgainstLDAP(username, clearPassword) ) {
// Authentication against LDAP was ok // Authentication against LDAP was ok
if (null == user) { if ( null == user ) {
// User does not exist in LibrePlan must be imported // User does not exist in LibrePlan must be imported
user = createLDAPUserWithRoles(username, encodedPassword); user = createLDAPUserWithRoles(username, encodedPassword);
} else { } else {
// Update password // Update password
if (configuration.isLdapSavePasswordsDB()) { if ( configuration.isLdapSavePasswordsDB() ) {
user.setPassword(encodedPassword); user.setPassword(encodedPassword);
} }
// Update roles from LDAP // Update roles from LDAP
setRoles(user); setRoles(user);
} }
saveUserOnTransaction(user); saveUserOnTransaction(user);
return loadUserDetails(username); return loadUserDetails(username);
} else { } else {
throw new BadCredentialsException("User is not in LDAP."); throw new BadCredentialsException("User is not in LDAP.");
} }
} catch (Exception e) { } catch (Exception e) {
// This exception captures when LDAP authentication is not // This exception captures when LDAP authentication is not possible
// possible LOG.info("LDAP not reachable. Trying to authenticate against database.", e);
LOG.info(
"LDAP not reachable. Trying to authenticate against database.",
e);
} }
} }
@ -179,10 +178,9 @@ public class LDAPCustomAuthenticationProvider extends
} }
private void setRoles(User user) { private void setRoles(User user) {
if (configuration.getLdapSaveRolesDB()) { if ( configuration.getLdapSaveRolesDB() ) {
user.clearRoles(); user.clearRoles();
List<String> roles = getMatchedRoles(configuration, ldapTemplate, List<String> roles = getMatchedRoles(configuration, user.getLoginName());
user.getLoginName());
for (String role : roles) { for (String role : roles) {
user.addRole(UserRole.valueOf(UserRole.class, role)); user.addRole(UserRole.valueOf(UserRole.class, role));
} }
@ -192,58 +190,56 @@ public class LDAPCustomAuthenticationProvider extends
private User createLDAPUserWithRoles(String username, String encodedPassword) { private User createLDAPUserWithRoles(String username, String encodedPassword) {
User user = User.create(); User user = User.create();
user.setLoginName(username); user.setLoginName(username);
// we must check if it is needed to save LDAP
// passwords in DB // we must check if it is needed to save LDAP passwords in DB
if (!configuration.isLdapSavePasswordsDB()) { if ( !configuration.isLdapSavePasswordsDB() ) {
encodedPassword = null; encodedPassword = null;
} }
user.setPassword(encodedPassword); user.setPassword(encodedPassword);
user.setLibrePlanUser(false); user.setLibrePlanUser(false);
user.setDisabled(false); user.setDisabled(false);
setRoles(user); setRoles(user);
return user; return user;
} }
private LDAPConfiguration loadLDAPConfiguration() { private LDAPConfiguration loadLDAPConfiguration() {
return transactionService return transactionService.runOnReadOnlyTransaction(new IOnTransaction<LDAPConfiguration>() {
.runOnReadOnlyTransaction(new IOnTransaction<LDAPConfiguration>() { @Override
public LDAPConfiguration execute() {
@Override return configurationDAO.getConfiguration().getLdapConfiguration();
public LDAPConfiguration execute() { }
return configurationDAO.getConfiguration() });
.getLdapConfiguration();
}
});
} }
private User getUserFromDB(String username) { private User getUserFromDB(String username) {
final String usernameInserted = username; final String usernameInserted = username;
return transactionService
.runOnReadOnlyTransaction(new IOnTransaction<User>() {
@Override return transactionService.runOnReadOnlyTransaction(new IOnTransaction<User>() {
public User execute() { @Override
try { public User execute() {
return userDAO.findByLoginName(usernameInserted); try {
} catch (InstanceNotFoundException e) { return userDAO.findByLoginName(usernameInserted);
LOG.info("User " + usernameInserted } catch (InstanceNotFoundException e) {
+ " not found in database."); LOG.info("User " + usernameInserted + " not found in database.");
return null; return null;
} }
} }
}); });
} }
private LDAPCustomContextSource loadLDAPContext() { private LDAPCustomContextSource loadLDAPContext() {
// Establishes the context for LDAP connection. // Establishes the context for LDAP connection.
LDAPCustomContextSource context = (LDAPCustomContextSource) ldapTemplate LDAPCustomContextSource context = (LDAPCustomContextSource) ldapTemplate.getContextSource();
.getContextSource();
context.setUrl(configuration.getLdapHost() + COLON context.setUrl(configuration.getLdapHost() + COLON + configuration.getLdapPort());
+ configuration.getLdapPort());
context.setBase(configuration.getLdapBase()); context.setBase(configuration.getLdapBase());
context.setUserDn(configuration.getLdapUserDn()); context.setUserDn(configuration.getLdapUserDn());
context.setPassword(configuration.getLdapPassword()); context.setPassword(configuration.getLdapPassword());
try { try {
context.afterPropertiesSet(); context.afterPropertiesSet();
} catch (Exception e) { } catch (Exception e) {
@ -251,83 +247,83 @@ public class LDAPCustomAuthenticationProvider extends
// properties are well-formed. // properties are well-formed.
LOG.error("There is a problem in LDAP connection: ", e); LOG.error("There is a problem in LDAP connection: ", e);
} }
return context; return context;
} }
private boolean authenticateAgainstLDAP(String username, private boolean authenticateAgainstLDAP(String username, String clearPassword) {
String clearPassword) { return ldapTemplate.authenticate(
return ldapTemplate.authenticate(DistinguishedName.EMPTY_PATH, DistinguishedName.EMPTY_PATH,
new EqualsFilter(configuration.getLdapUserId(), username) new EqualsFilter(configuration.getLdapUserId(), username).toString(),
.toString(), clearPassword); clearPassword);
} }
private void saveUserOnTransaction(User user) { private void saveUserOnTransaction(User user) {
final User userLibrePlan = user; final User userLibrePlan = user;
transactionService.runOnTransaction(new IOnTransaction<Void>() { transactionService.runOnTransaction(new IOnTransaction<Void>() {
@Override @Override
public Void execute() { public Void execute() {
userDAO.save(userLibrePlan); userDAO.save(userLibrePlan);
return null; return null;
} }
}); });
} }
private UserDetails authenticateInDatabase(String username, User user, private UserDetails authenticateInDatabase(String username, User user, String encodedPassword) {
String encodedPassword) { if ( null != user && null != user.getPassword() && encodedPassword.equals(user.getPassword()) ) {
if (null != user && null != user.getPassword()
&& encodedPassword.equals(user.getPassword())) {
return loadUserDetails(username); return loadUserDetails(username);
} else { } else {
throw new BadCredentialsException( throw new BadCredentialsException("Credentials are not the same as in database.");
"Credentials are not the same as in database.");
} }
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private List<String> getRolesUsingNodeStrategy( private List<String> getRolesUsingNodeStrategy(
Set<ConfigurationRolesLDAP> rolesLdap, String queryRoles, Set<ConfigurationRolesLDAP> rolesLdap, String queryRoles, final LDAPConfiguration configuration) {
final LDAPConfiguration configuration) {
String roleProperty = configuration.getLdapRoleProperty(); String roleProperty = configuration.getLdapRoleProperty();
List<String> rolesReturn = new ArrayList<String>(); List<String> rolesReturn = new ArrayList<>();
for (ConfigurationRolesLDAP roleLDAP : rolesLdap) { for (ConfigurationRolesLDAP roleLDAP : rolesLdap) {
if (roleLDAP.getRoleLdap().equals(WILDCHAR_ALL)) { if ( roleLDAP.getRoleLdap().equals(WILDCHAR_ALL) ) {
rolesReturn.add(roleLDAP.getRoleLibreplan()); rolesReturn.add(roleLDAP.getRoleLibreplan());
continue; continue;
} }
// We must make a search for each role-matching in nodes // We must make a search for each role-matching in nodes
List<Attribute> resultsSearch = new ArrayList<Attribute>(); List<Attribute> resultsSearch = new ArrayList<>();
resultsSearch.addAll(ldapTemplate.search( resultsSearch.addAll(ldapTemplate.search(
DistinguishedName.EMPTY_PATH, new EqualsFilter( DistinguishedName.EMPTY_PATH,
roleProperty, roleLDAP.getRoleLdap()).toString(), new EqualsFilter(roleProperty, roleLDAP.getRoleLdap()).toString(),
new AttributesMapper() { new AttributesMapper() {
@Override @Override
public Object mapFromAttributes(Attributes attributes) public Object mapFromAttributes(Attributes attributes) throws NamingException {
throws NamingException {
return attributes.get(configuration.getLdapUserId()); return attributes.get(configuration.getLdapUserId());
} }
})); }));
for (Attribute atrib : resultsSearch) { for (Attribute atrib : resultsSearch) {
if (atrib.contains(queryRoles)) { if ( atrib.contains(queryRoles) ) {
rolesReturn.add(roleLDAP.getRoleLibreplan()); rolesReturn.add(roleLDAP.getRoleLibreplan());
} }
} }
} }
return rolesReturn; return rolesReturn;
} }
private List<String> getRolesUsingBranchStrategy( private List<String> getRolesUsingBranchStrategy(
Set<ConfigurationRolesLDAP> rolesLdap, String queryRoles, Set<ConfigurationRolesLDAP> rolesLdap, String queryRoles, LDAPConfiguration configuration) {
LDAPConfiguration configuration) {
String roleProperty = configuration.getLdapRoleProperty(); String roleProperty = configuration.getLdapRoleProperty();
String groupsPath = configuration.getLdapGroupPath(); String groupsPath = configuration.getLdapGroupPath();
List<String> rolesReturn = new ArrayList<String>(); List<String> rolesReturn = new ArrayList<>();
for (ConfigurationRolesLDAP roleLdap : rolesLdap) { for (ConfigurationRolesLDAP roleLdap : rolesLdap) {
if (roleLdap.getRoleLdap().equals(WILDCHAR_ALL)) { if ( roleLdap.getRoleLdap().equals(WILDCHAR_ALL) ) {
rolesReturn.add(roleLdap.getRoleLibreplan()); rolesReturn.add(roleLdap.getRoleLibreplan());
continue; continue;
} }
@ -335,48 +331,41 @@ public class LDAPCustomAuthenticationProvider extends
// We must make a search for each role matching // We must make a search for each role matching
DirContextAdapter adapter = null; DirContextAdapter adapter = null;
try { try {
adapter = (DirContextAdapter) ldapTemplate adapter = (DirContextAdapter) ldapTemplate.lookup(roleLdap.getRoleLdap() + "," + groupsPath);
.lookup(roleLdap.getRoleLdap() + "," + groupsPath);
} catch (org.springframework.ldap.NamingException ne) { } catch (org.springframework.ldap.NamingException ne) {
LOG.error(ne.getMessage()); LOG.error(ne.getMessage());
} }
if (adapter != null && adapter.attributeExists(roleProperty)) { if ( adapter != null && adapter.attributeExists(roleProperty) ) {
Attributes atrs = adapter.getAttributes(); Attributes atrs = adapter.getAttributes();
if (atrs.get(roleProperty).contains(queryRoles)) { if ( atrs.get(roleProperty).contains(queryRoles) ) {
rolesReturn.add(roleLdap.getRoleLibreplan()); rolesReturn.add(roleLdap.getRoleLibreplan());
} }
} }
} }
return rolesReturn; return rolesReturn;
} }
private List<String> getMatchedRoles(LDAPConfiguration configuration, private List<String> getMatchedRoles(LDAPConfiguration configuration, String username) {
LdapTemplate ldapTemplate, String username) {
String queryRoles = configuration.getLdapSearchQuery().replace( String queryRoles = configuration.getLdapSearchQuery().replace(USER_ID_SUBSTITUTION, username);
USER_ID_SUBSTITUTION, username);
Set<ConfigurationRolesLDAP> rolesLdap = configuration Set<ConfigurationRolesLDAP> rolesLdap = configuration.getConfigurationRolesLdap();
.getConfigurationRolesLdap();
try { try {
if ( !configuration.getLdapGroupStrategy() ) {
if (!configuration.getLdapGroupStrategy()) {
// The LDAP has a node strategy for groups, // The LDAP has a node strategy for groups,
// we must check the roleProperty in user node. // we must check the roleProperty in user node.
return getRolesUsingNodeStrategy(rolesLdap, queryRoles, return getRolesUsingNodeStrategy(rolesLdap, queryRoles, configuration);
configuration);
} else { } else {
// The LDAP has a branch strategy for groups // The LDAP has a branch strategy for groups
// we must check if the user is in one of the groups. // we must check if the user is in one of the groups.
return getRolesUsingBranchStrategy(rolesLdap, queryRoles, return getRolesUsingBranchStrategy(rolesLdap, queryRoles, configuration);
configuration);
} }
} catch (Exception e) { } catch (Exception e) {
LOG.error( LOG.error("Configuration of LDAP role-matching is wrong. Please check it.", e);
"Configuration of LDAP role-matching is wrong. Please check it.",
e);
return Collections.emptyList(); return Collections.emptyList();
} }
} }
@ -385,8 +374,7 @@ public class LDAPCustomAuthenticationProvider extends
return passwordEncoderService; return passwordEncoderService;
} }
public void setPasswordEncoderService( public void setPasswordEncoderService(DBPasswordEncoderService passwordEncoderService) {
DBPasswordEncoderService passwordEncoderService) {
this.passwordEncoderService = passwordEncoderService; this.passwordEncoderService = passwordEncoderService;
} }

View file

@ -32,7 +32,7 @@ import org.libreplan.business.users.entities.UserRole;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.GrantedAuthorityImpl; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
@ -55,38 +55,40 @@ public class LDAPUserDetailsService implements UserDetailsService {
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public UserDetails loadUserByUsername(String loginName) public UserDetails loadUserByUsername(String loginName) throws UsernameNotFoundException, DataAccessException {
throws UsernameNotFoundException, DataAccessException {
User user; User user;
try { try {
user = userDAO.findByLoginName(loginName); user = userDAO.findByLoginName(loginName);
} catch (InstanceNotFoundException e) { } catch (InstanceNotFoundException e) {
throw new UsernameNotFoundException(MessageFormat.format( throw new UsernameNotFoundException(MessageFormat.format("User with username {0}: not found", loginName));
"User with username {0}: not found", loginName));
} }
Scenario scenario = user.getLastConnectedScenario(); Scenario scenario = user.getLastConnectedScenario();
if (scenario == null) { if ( scenario == null ) {
scenario = PredefinedScenarios.MASTER.getScenario(); scenario = PredefinedScenarios.MASTER.getScenario();
} }
String password = user.getPassword(); String password = user.getPassword();
if (null == password) if ( null == password )
password = "foo"; password = "foo";
return new CustomUser(user.getLoginName(), password,
!user.isDisabled(), true, // accountNonExpired return new CustomUser(
user.getLoginName(), password,
!user.isDisabled(),
true, // accountNonExpired
true, // credentialsNonExpired true, // credentialsNonExpired
true, // accountNonLocked true, // accountNonLocked
getGrantedAuthorities(user.getAllRoles()), scenario); getGrantedAuthorities(user.getAllRoles()), scenario);
} }
private List<GrantedAuthority> getGrantedAuthorities(Set<UserRole> roles) { private List<GrantedAuthority> getGrantedAuthorities(Set<UserRole> roles) {
List<GrantedAuthority> result = new ArrayList<GrantedAuthority>(); List<GrantedAuthority> result = new ArrayList<>();
for (UserRole r : roles) { for (UserRole r : roles) {
result.add(new GrantedAuthorityImpl(r.name())); result.add(new SimpleGrantedAuthority(r.name()));
} }
return result; return result;
} }
} }

View file

@ -11,7 +11,7 @@
# Lorenzo Tilve Álvaro <ltilve@igalia.com>, 2013. # Lorenzo Tilve Álvaro <ltilve@igalia.com>, 2013.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: libreplan-1.4.0\n" "Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n" "Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n" "POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: 2013-04-22 11:52+0000\n" "PO-Revision-Date: 2013-04-22 11:52+0000\n"

View file

@ -11,7 +11,7 @@
# Philippe Poumaroux <philippe.poumaroux@free.fr>, 2012-2013. # Philippe Poumaroux <philippe.poumaroux@free.fr>, 2012-2013.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: libreplan-1.4.0\n" "Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n" "Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n" "POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: 2013-04-28 16:59+0000\n" "PO-Revision-Date: 2013-04-28 16:59+0000\n"

View file

@ -10,7 +10,7 @@
# Lorenzo Tilve Álvaro <ltilve@igalia.com>, 2013. # Lorenzo Tilve Álvaro <ltilve@igalia.com>, 2013.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: libreplan-1.4.0\n" "Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n" "Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n" "POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: 2013-04-22 17:54+0000\n" "PO-Revision-Date: 2013-04-22 17:54+0000\n"

View file

@ -8,7 +8,7 @@
# Giuseppe Zizza <gzizza@gmail.com>, 2012. # Giuseppe Zizza <gzizza@gmail.com>, 2012.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: libreplan-1.4.0\n" "Project-Id-Version: libreplan-1.4\6.0\n"
"Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n" "Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n" "POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: 2013-04-22 14:14+0000\n" "PO-Revision-Date: 2013-04-22 14:14+0000\n"

View file

@ -7,7 +7,7 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: libreplan-1.4.0\n" "Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n" "POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"

View file

@ -8,7 +8,7 @@
# Jeroen Baten <jeroen@jeroenbaten.nl>, 2012-2013. # Jeroen Baten <jeroen@jeroenbaten.nl>, 2012-2013.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: libreplan-1.4.0\n" "Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n" "Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n" "POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: 2013-04-22 11:54+0000\n" "PO-Revision-Date: 2013-04-22 11:54+0000\n"

View file

@ -1,61 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
<!-- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
For enabling annotation-based configuration (in particular,
required for "@Autowired") http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
-->
<!-- For enabling annotation-based configuration (in particular, required for "@Autowired") -->
<context:annotation-config /> <context:annotation-config />
<bean id="aspect" class="org.libreplan.web.common.concurrentdetection.ConcurrentModificationHandling"> <bean id="aspect" class="org.libreplan.web.common.concurrentdetection.ConcurrentModificationHandling" />
</bean>
<bean class="org.libreplan.web.common.entrypoints.RedirectorSynthetiser"></bean> <bean class="org.libreplan.web.common.entrypoints.RedirectorSynthetiser"/>
<bean id="ordersMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.OrdersMultipleFiltersFinder" scope="singleton" /> <bean id="ordersMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.OrdersMultipleFiltersFinder"/>
<bean id="taskGroupsMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.TaskGroupsMultipleFiltersFinder" scope="singleton" /> <bean id="taskGroupsMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.TaskGroupsMultipleFiltersFinder"/>
<bean id="orderElementsMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.OrderElementsMultipleFiltersFinder" scope="singleton"/> <bean id="orderElementsMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.OrderElementsMultipleFiltersFinder"/>
<bean id="taskElementsMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.TaskElementsMultipleFiltersFinder" scope="singleton" /> <bean id="taskElementsMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.TaskElementsMultipleFiltersFinder"/>
<bean id="resourcesMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.ResourcesMultipleFiltersFinder" scope="singleton" /> <bean id="resourcesMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.ResourcesMultipleFiltersFinder"/>
<bean id="limitingResourceAllocationMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.LimitingResourceAllocationMultipleFiltersFinder" scope="singleton"/> <bean id="limitingResourceAllocationMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.LimitingResourceAllocationMultipleFiltersFinder"/>
<bean id="nonLimitingResourceAllocationMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.NonLimitingResourceAllocationMultipleFiltersFinder" scope="singleton" /> <bean id="nonLimitingResourceAllocationMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.NonLimitingResourceAllocationMultipleFiltersFinder"/>
<bean id="resourceMultipleFiltersFinderByResourceAndCriterion" class="org.libreplan.web.common.components.finders.ResourceMultipleFiltersFinderByResourceAndCriterion" scope="singleton"/> <bean id="resourceMultipleFiltersFinderByResourceAndCriterion"
class="org.libreplan.web.common.components.finders.ResourceMultipleFiltersFinderByResourceAndCriterion"/>
<bean id="criterionMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.CriterionMultipleFiltersFinder" scope="singleton"/> <bean id="criterionMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.CriterionMultipleFiltersFinder"/>
<bean id="scenarioManager" <bean id="scenarioManager" class="org.libreplan.web.scenarios.CurrentUserScenarioAwareManager"/>
class="org.libreplan.web.scenarios.CurrentUserScenarioAwareManager"
scope="singleton"/>
<!-- Scheduler --> <!-- Scheduler -->
<bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false" /> <bean id="schedulerFactoryBean"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false" />
<bean id="schedulerManager" <bean id="schedulerManager" class="org.libreplan.importers.SchedulerManager" init-method="scheduleJobs">
class="org.libreplan.importers.SchedulerManager"
scope="singleton"
init-method="scheduleJobs">
<property name="scheduler" ref="schedulerFactoryBean"/> <property name="scheduler" ref="schedulerFactoryBean"/>
</bean> </bean>

View file

@ -4,150 +4,144 @@
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"> http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.1.xsd">
<!-- NOTE: see http://static.springsource.org/spring-security/site/docs/2.0.x/apidocs/org/springframework/security/vote/AuthenticatedVoter.html <!--
for an explanation of the meaning of IS_AUTHENTICATED_ANONYMOUSLY and IS_AUTHENTICATED_FULLY. --> NOTE: see
<http auto-config="false" realm="LibrePlan Web Application"> http://static.springsource.org/spring-security/site/docs/2.0.x/apidocs/org/springframework/security/vote/AuthenticatedVoter.html
for an explanation of the meaning of IS_AUTHENTICATED_ANONYMOUSLY and IS_AUTHENTICATED_FULLY. -->
<http auto-config="false" realm="LibrePlan Web Application" >
<!-- Web services --> <!-- Web services -->
<intercept-url pattern="/ws/rest/bounduser/**" <intercept-url pattern="/ws/rest/bounduser/**" access="ROLE_BOUND_USER" method="GET" />
access="ROLE_BOUND_USER" <intercept-url pattern="/ws/rest/bounduser/**" access="ROLE_BOUND_USER" method="POST" />
method="GET" /> <intercept-url pattern="/ws/rest/subcontracting/**" access="ROLE_WS_SUBCONTRACTING" method="GET" />
<intercept-url pattern="/ws/rest/bounduser/**" <intercept-url pattern="/ws/rest/subcontracting/**" access="ROLE_WS_SUBCONTRACTING" method="POST" />
access="ROLE_BOUND_USER" <intercept-url pattern="/ws/rest/**" access="ROLE_WS_READER" method="GET" />
method="POST" /> <intercept-url pattern="/ws/rest/**" access="ROLE_WS_WRITER" method="POST" />
<intercept-url pattern="/ws/rest/subcontracting/**" <intercept-url pattern="/ws/rest/**" access="ROLE_WS_WRITER" method="DELETE" />
access="ROLE_WS_SUBCONTRACTING"
method="GET" />
<intercept-url pattern="/ws/rest/subcontracting/**"
access="ROLE_WS_SUBCONTRACTING"
method="POST" />
<intercept-url pattern="/ws/rest/**"
access="ROLE_WS_READER"
method="GET" />
<intercept-url pattern="/ws/rest/**"
access="ROLE_WS_WRITER"
method="POST" />
<intercept-url pattern="/ws/rest/**"
access="ROLE_WS_WRITER"
method="DELETE" />
<!-- Web application --> <!-- Web application -->
<intercept-url pattern="/common/img/**" <intercept-url pattern="/common/img/**" access="permitAll" />
access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/common/css/**" access="permitAll" />
<intercept-url pattern="/common/css/**" <intercept-url pattern="/planner/css/**" access="permitAll" />
access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/callback/**" access="permitAll" />
<intercept-url pattern="/planner/css/**" <intercept-url pattern="/zkau/**" access="permitAll" />
access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/help/**" access="permitAll" />
<intercept-url pattern="/callback/**" <intercept-url pattern="/common/layout/login.zul" access="isAnonymous()" />
access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/common/layout/timeout.zul" access="permitAll" />
<intercept-url pattern="/zkau/**"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/help/**"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/common/layout/login.zul"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/common/layout/timeout.zul"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<!-- Pages --> <!-- Pages -->
<intercept-url pattern="/templates/*" <intercept-url pattern="/templates/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TEMPLATES')" />
access="ROLE_SUPERUSER,ROLE_TEMPLATES" /> <intercept-url pattern="/email/*" access="ROLE_SUPERUSER"/>
<intercept-url pattern="/email/*" <intercept-url pattern="/resources/worker/worker.zul" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_WORKERS')" />
access="ROLE_SUPERUSER"/> <intercept-url pattern="/resources/machine/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_MACHINES')" />
<intercept-url pattern="/resources/worker/worker.zul"
access="ROLE_SUPERUSER,ROLE_WORKERS" />
<intercept-url pattern="/resources/machine/*"
access="ROLE_SUPERUSER,ROLE_MACHINES" />
<intercept-url pattern="/resources/worker/virtualWorkers.zul" <intercept-url pattern="/resources/worker/virtualWorkers.zul"
access="ROLE_SUPERUSER,ROLE_VIRTUAL_WORKERS" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_VIRTUAL_WORKERS')" />
<intercept-url pattern="/calendars/*"
access="ROLE_SUPERUSER,ROLE_CALENDARS" /> <intercept-url pattern="/calendars/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_CALENDARS')" />
<intercept-url pattern="/excetiondays/*" <intercept-url pattern="/excetiondays/*"
access="ROLE_SUPERUSER,ROLE_CALENDAR_EXCEPTION_DAYS" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_CALENDAR_EXCEPTION_DAYS')" />
<intercept-url pattern="/resources/criterions/*"
access="ROLE_SUPERUSER,ROLE_CRITERIA" /> <intercept-url pattern="/resources/criterions/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_CRITERIA')" />
<intercept-url pattern="/advance/*" <intercept-url pattern="/advance/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_PROGRESS_TYPES')" />
access="ROLE_SUPERUSER,ROLE_PROGRESS_TYPES" /> <intercept-url pattern="/labels/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_LABELS')" />
<intercept-url pattern="/labels/*" <intercept-url pattern="/materials/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_MATERIALS')" />
access="ROLE_SUPERUSER,ROLE_LABELS" /> <intercept-url pattern="/unittypes/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_MATERIAL_UNITS')" />
<intercept-url pattern="/materials/*" <intercept-url pattern="/qualityforms/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_QUALITY_FORMS')" />
access="ROLE_SUPERUSER,ROLE_MATERIALS" /> <intercept-url pattern="/workreports/workReport.zul" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TIMESHEETS')" />
<intercept-url pattern="/unittypes/*"
access="ROLE_SUPERUSER,ROLE_MATERIAL_UNITS" />
<intercept-url pattern="/qualityforms/*"
access="ROLE_SUPERUSER,ROLE_QUALITY_FORMS" />
<intercept-url pattern="/workreports/workReport.zul"
access="ROLE_SUPERUSER,ROLE_TIMESHEETS" />
<intercept-url pattern="/workreports/workReportTypes.zul" <intercept-url pattern="/workreports/workReportTypes.zul"
access="ROLE_SUPERUSER,ROLE_TIMESHEETS_TEMPLATES" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TIMESHEETS_TEMPLATES')" />
<intercept-url pattern="/expensesheet/*" <intercept-url pattern="/expensesheet/*"
access="ROLE_SUPERUSER,ROLE_EXPENSES,ROLE_BOUND_USER" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_EXPENSES', 'ROLE_BOUND_USER')" />
<intercept-url pattern="/costcategories/*"
access="ROLE_SUPERUSER,ROLE_COST_CATEGORIES" /> <intercept-url pattern="/costcategories/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_COST_CATEGORIES')" />
<intercept-url pattern="/typeofworkhours/*" <intercept-url pattern="/typeofworkhours/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_HOURS_TYPES')" />
access="ROLE_SUPERUSER,ROLE_HOURS_TYPES" />
<intercept-url pattern="/common/configuration.zul" <intercept-url pattern="/common/configuration.zul"
access="ROLE_SUPERUSER,ROLE_MAIN_SETTINGS" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_MAIN_SETTINGS')" />
<intercept-url pattern="/users/*"
access="ROLE_SUPERUSER,ROLE_USER_ACCOUNTS" /> <intercept-url pattern="/users/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_USER_ACCOUNTS')" />
<intercept-url pattern="/profiles/*" <intercept-url pattern="/profiles/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_PROFILES')" />
access="ROLE_SUPERUSER,ROLE_PROFILES" /> <intercept-url pattern="/externalcompanies/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_COMPANIES')" />
<intercept-url pattern="/externalcompanies/*"
access="ROLE_SUPERUSER,ROLE_COMPANIES" />
<intercept-url pattern="/subcontract/subcontractedTasks.zul" <intercept-url pattern="/subcontract/subcontractedTasks.zul"
access="ROLE_SUPERUSER,ROLE_SEND_TO_SUBCONTRACTORS" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_SEND_TO_SUBCONTRACTORS')" />
<intercept-url pattern="/subcontract/subcontractorCommunications.zul" <intercept-url pattern="/subcontract/subcontractorCommunications.zul"
access="ROLE_SUPERUSER,ROLE_RECEIVED_FROM_SUBCONTRACTORS" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_RECEIVED_FROM_SUBCONTRACTORS')" />
<intercept-url pattern="/subcontract/reportAdvances.zul" <intercept-url pattern="/subcontract/reportAdvances.zul"
access="ROLE_SUPERUSER,ROLE_SEND_TO_CUSTOMERS" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_SEND_TO_CUSTOMERS')" />
<intercept-url pattern="/subcontract/customerCommunications.zul" <intercept-url pattern="/subcontract/customerCommunications.zul"
access="ROLE_SUPERUSER,ROLE_RECEIVED_FROM_CUSTOMERS" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_RECEIVED_FROM_CUSTOMERS')" />
<intercept-url pattern="/workreports/workReportQuery.zul" <intercept-url pattern="/workreports/workReportQuery.zul"
access="ROLE_SUPERUSER,ROLE_TIMESHEET_LINES_LIST" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TIMESHEET_LINES_LIST')" />
<intercept-url pattern="/reports/hoursWorkedPerWorkerReport.zul" <intercept-url pattern="/reports/hoursWorkedPerWorkerReport.zul"
access="ROLE_SUPERUSER,ROLE_HOURS_WORKED_PER_RESOURCE_REPORT" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_HOURS_WORKED_PER_RESOURCE_REPORT')" />
<intercept-url pattern="/reports/hoursWorkedPerWorkerInAMonthReport.zul" <intercept-url pattern="/reports/hoursWorkedPerWorkerInAMonthReport.zul"
access="ROLE_SUPERUSER,ROLE_TOTAL_WORKED_HOURS_BY_RESOURCE_IN_A_MONTH_REPORT" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TOTAL_WORKED_HOURS_BY_RESOURCE_IN_A_MONTH_REPORT')" />
<intercept-url pattern="/reports/schedulingProgressPerOrderReport.zul" <intercept-url pattern="/reports/schedulingProgressPerOrderReport.zul"
access="ROLE_SUPERUSER,ROLE_WORK_AND_PROGRESS_PER_PROJECT_REPORT" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_WORK_AND_PROGRESS_PER_PROJECT_REPORT')" />
<intercept-url pattern="/reports/workingProgressPerTaskReport.zul" <intercept-url pattern="/reports/workingProgressPerTaskReport.zul"
access="ROLE_SUPERUSER,ROLE_WORK_AND_PROGRESS_PER_TASK_REPORT" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_WORK_AND_PROGRESS_PER_TASK_REPORT')" />
<intercept-url pattern="/reports/completedEstimatedHoursPerTask.zul" <intercept-url pattern="/reports/completedEstimatedHoursPerTask.zul"
access="ROLE_SUPERUSER,ROLE_ESTIMATED_PLANNED_HOURS_PER_TASK_REPORT" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_ESTIMATED_PLANNED_HOURS_PER_TASK_REPORT')" />
<intercept-url pattern="/reportsorderCostsPerResource/.zul" <intercept-url pattern="/reportsorderCostsPerResource/.zul"
access="ROLE_SUPERUSER,ROLE_PROJECT_COSTS_REPORT" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_PROJECT_COSTS_REPORT')" />
<intercept-url pattern="/reports/workingArrangementsPerOrderReport.zul" <intercept-url pattern="/reports/workingArrangementsPerOrderReport.zul"
access="ROLE_SUPERUSER,ROLE_TASK_SCHEDULING_STATUS_IN_PROJECT_REPORT" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TASK_SCHEDULING_STATUS_IN_PROJECT_REPORT')" />
<intercept-url pattern="/reports/timeLineMaterialReport.zul" <intercept-url pattern="/reports/timeLineMaterialReport.zul"
access="ROLE_SUPERUSER,ROLE_MATERIALS_NEED_AT_DATE_REPORT" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_MATERIALS_NEED_AT_DATE_REPORT')" />
<intercept-url pattern="/myaccount/userDashboard.zul"
access="ROLE_BOUND_USER" /> <intercept-url pattern="/myaccount/userDashboard.zul" access="ROLE_BOUND_USER" />
<intercept-url pattern="/myaccount/monthlyTimesheet.zul" <intercept-url pattern="/myaccount/monthlyTimesheet.zul"
access="ROLE_SUPERUSER,ROLE_TIMESHEETS,ROLE_BOUND_USER" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TIMESHEETS', 'ROLE_BOUND_USER')" />
<intercept-url pattern="/orders/imports/projectImport.zul" <intercept-url pattern="/orders/imports/projectImport.zul"
access="ROLE_SUPERUSER,ROLE_IMPORT_PROJECTS" /> access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_IMPORT_PROJECTS')" />
<intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" /> <intercept-url pattern="/**" access="isFullyAuthenticated()" />
<!-- These have been added because of auto-config is false now in order <!--
to use a custom authentication filter. These have been added because of auto-config is false now in order to use a custom authentication filter.
See: http://static.springsource.org/spring-security/site/docs/2.0.x/reference/ns-config.html#ns-auto-config --> See: http://static.springsource.org/spring-security/site/docs/2.0.x/reference/ns-config.html#ns-auto-config
-->
<anonymous /> <anonymous />
<form-login login-page="/common/layout/login.zul" <form-login
default-target-url="/common/index.zul" login-page="/common/layout/login.zul"
authentication-failure-url="/common/layout/login.zul?login_error=true" /> default-target-url="/common/index.zul"
authentication-failure-url="/common/layout/login.zul?login_error=true"
login-processing-url="/j_spring_security_check"
username-parameter="j_username"
password-parameter="j_password"/>
<http-basic /> <http-basic />
<logout /> <logout />
<remember-me /> <remember-me />
<csrf disabled="true"/>
</http> </http>
<!-- Beans used by Spring Security (current configuration assumes users <!-- Beans used by Spring Security (current configuration assumes users are registered in the database). -->
are registered in the database). -->
<beans:bean id="passwordEncoder" <beans:bean id="passwordEncoder"
class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"> class="org.springframework.security.authentication.encoding.ShaPasswordEncoder">
<beans:constructor-arg value="512" /> <beans:constructor-arg value="512" />
@ -156,12 +150,11 @@
<beans:bean id="saltSource" <beans:bean id="saltSource"
class="org.springframework.security.authentication.dao.ReflectionSaltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource"
p:userPropertyToUse="username" /> p:userPropertyToUse="username" />
<!-- <beans:bean id="realAuthenticationProvider" class="org.springframework.security.providers.dao.DaoAuthenticationProvider"
p:passwordEncoder-ref="passwordEncoder" p:saltSource-ref="saltSource" p:userDetailsService-ref="dbUserDetailsService"> <!--
<custom-authentication-provider/> </beans:bean> --> Beans used by the LibrePlan Web application when users are registered in the database.
<!-- Beans used by the LibrePlan Web application when users are registered When users are registered externally (e.g. in a LDAP server),these lines may be commented.
in the database. When users are registered externally (e.g. in a LDAP server), -->
these lines may be commented. <beans:bean id="dbUserDetailsService" class="org.libreplan.web.users.services.DBUserDetailsService"/> -->
<beans:bean id="dbPasswordEncoderService" <beans:bean id="dbPasswordEncoderService"
class="org.libreplan.web.users.services.DBPasswordEncoderService" class="org.libreplan.web.users.services.DBPasswordEncoderService"
p:passwordEncoder-ref="passwordEncoder" p:saltSource-ref="saltSource" /> p:passwordEncoder-ref="passwordEncoder" p:saltSource-ref="saltSource" />
@ -169,10 +162,11 @@
<beans:bean id="usersBootstrapInDB" <beans:bean id="usersBootstrapInDB"
class="org.libreplan.web.users.bootstrap.UsersBootstrapInDB" class="org.libreplan.web.users.bootstrap.UsersBootstrapInDB"
p:dbPasswordEncoderService-ref="dbPasswordEncoderService" /> p:dbPasswordEncoderService-ref="dbPasswordEncoderService" />
<!-- Beans used by the LibrePlan Web Application when users are registerd <!--
in LDAP. At this moment users MUST be also in database with same username. Beans used by the LibrePlan Web Application when users are registerd in LDAP.
This will be changed in the near future. the url, base, userDN and password At this moment users MUST be also in database with same username.
properties must be set with the proper values --> This will be changed in the near future.
The url, base, userDN and password properties must be set with the proper values -->
<beans:bean id="contextSource" <beans:bean id="contextSource"
class="org.libreplan.web.users.services.LDAPCustomContextSource"> class="org.libreplan.web.users.services.LDAPCustomContextSource">
</beans:bean> </beans:bean>
@ -182,10 +176,10 @@
p:contextSource-ref="contextSource"> p:contextSource-ref="contextSource">
</beans:bean> </beans:bean>
<!-- This authentication provider will make possible all the login process <!-- This authentication provider will make possible all the login process when an LDAP is used.
when an LDAP is used. Also will allow authenticate users in database. The Also will allow authenticate users in database.
property strUserId must be set with the proper value. It represents the property The property strUserId must be set with the proper value.
of the user in LDAP which will be used to check the username. --> It represents the property of the user in LDAP which will be used to check the username. -->
<beans:bean id="realAuthenticationProvider" <beans:bean id="realAuthenticationProvider"
class="org.libreplan.web.users.services.LDAPCustomAuthenticationProvider" class="org.libreplan.web.users.services.LDAPCustomAuthenticationProvider"
p:userDetailsService-ref="ldapUserDetailsService" p:userDetailsService-ref="ldapUserDetailsService"
@ -195,13 +189,10 @@
<beans:bean id="authenticationProvider" <beans:bean id="authenticationProvider"
class="org.libreplan.web.users.services.AuthenticationProviderLoggingDecorator"> class="org.libreplan.web.users.services.AuthenticationProviderLoggingDecorator">
<beans:property name="decoratedProvider" ref="realAuthenticationProvider"/> <beans:property name="decoratedProvider" ref="realAuthenticationProvider"/>
</beans:bean> </beans:bean>
<!-- This bean is used to implement UserDetailsService with LDAP authentication <!-- This bean is used to implement UserDetailsService with LDAP authentication Provider -->
Provider. -->
<beans:bean id="ldapUserDetailsService" class="org.libreplan.web.users.services.LDAPUserDetailsService" /> <beans:bean id="ldapUserDetailsService" class="org.libreplan.web.users.services.LDAPUserDetailsService" />
<authentication-manager> <authentication-manager>

View file

@ -5,10 +5,9 @@
<addon-name>libreplan-webapp</addon-name> <addon-name>libreplan-webapp</addon-name>
<language-name>xul/html</language-name> <language-name>xul/html</language-name>
<!-- When the version is changed, the browser will reload the <!-- When the version is changed, the browser will reload the JavaScript modules -->
JavaScript modules. --> <javascript-module name="webcommon" version="1.6.0" />
<javascript-module name="webcommon" version="1.4.0" /> <javascript-module name="limitingresources" version="1.6.0" />
<javascript-module name="limitingresources" version="1.4.0" />
<component> <component>
<component-name>twowayselector</component-name> <component-name>twowayselector</component-name>
@ -113,7 +112,6 @@
<mold> <mold>
<mold-name>default</mold-name> <mold-name>default</mold-name>
<mold-uri>mold/queue-list-component.js</mold-uri> <mold-uri>mold/queue-list-component.js</mold-uri>
<!-- <mold-uri>/limitingresources/queuelistcomponent.dsp</mold-uri> -->
</mold> </mold>
</component> </component>
@ -123,14 +121,14 @@
<macro-uri>/limitingresources/leftPane.zul</macro-uri> <macro-uri>/limitingresources/leftPane.zul</macro-uri>
</component> </component>
<!-- Limiting resources queue -->
<component> <component>
<component-name>queuecomponent</component-name><!-- Limiting resources queue --> <component-name>queuecomponent</component-name>
<component-class>org.libreplan.web.limitingresources.QueueComponent</component-class> <component-class>org.libreplan.web.limitingresources.QueueComponent</component-class>
<widget-class>limitingresources.QueueComponent</widget-class> <widget-class>limitingresources.QueueComponent</widget-class>
<mold> <mold>
<mold-name>default</mold-name> <mold-name>default</mold-name>
<mold-uri>mold/queue-component.js</mold-uri> <mold-uri>mold/queue-component.js</mold-uri>
<!-- <mold-uri>/limitingresources/queuecomponent.dsp</mold-uri> -->
</mold> </mold>
</component> </component>
@ -148,7 +146,6 @@
<mold> <mold>
<mold-name>default</mold-name> <mold-name>default</mold-name>
<mold-uri>mold/limiting-dependency-list.js</mold-uri> <mold-uri>mold/limiting-dependency-list.js</mold-uri>
<!-- <mold-uri>/limitingresources/limitingdependencylist.dsp</mold-uri> -->
</mold> </mold>
</component> </component>
@ -159,7 +156,6 @@
<mold> <mold>
<mold-name>default</mold-name> <mold-name>default</mold-name>
<mold-uri>mold/limiting-dependency-component.js</mold-uri> <mold-uri>mold/limiting-dependency-component.js</mold-uri>
<!-- <mold-uri>/limitingresources/limitingdependency.dsp</mold-uri> -->
</mold> </mold>
</component> </component>

View file

@ -5,11 +5,10 @@
<display-name>libreplan-webapp</display-name> <display-name>libreplan-webapp</display-name>
<!-- <!--
It searches all libreplan-business-spring-config.xml files, it can It searches all libreplan-business-spring-config.xml files, it can found several.
found several. There must be at least one. It searches There must be at least one.
libreplan-webapp-spring-config.xml. There must be just one. It It searches libreplan-webapp-spring-config.xml.
searches libreplan-override-spring-config.xml to override some There must be just one.
previous definitions. There could be several or none.
--> -->
<context-param> <context-param>
<param-name>contextConfigLocation</param-name> <param-name>contextConfigLocation</param-name>
@ -21,7 +20,6 @@
</context-param> </context-param>
<!-- /// -->
<!-- DSP --> <!-- DSP -->
<servlet> <servlet>
<description><![CDATA[The servlet loads the DSP pages.]]></description> <description><![CDATA[The servlet loads the DSP pages.]]></description>
@ -42,7 +40,6 @@
<servlet-name>dspLoader</servlet-name> <servlet-name>dspLoader</servlet-name>
<url-pattern>*.dsp</url-pattern> <url-pattern>*.dsp</url-pattern>
</servlet-mapping> </servlet-mapping>
<!-- /// -->
<!-- Spring security --> <!-- Spring security -->
<filter> <filter>
@ -55,7 +52,6 @@
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping> </filter-mapping>
<!-- //// -->
<listener> <listener>
<listener-class>org.libreplan.web.LoggingConfiguration</listener-class> <listener-class>org.libreplan.web.LoggingConfiguration</listener-class>
</listener> </listener>
@ -75,7 +71,6 @@
<listener-class> <listener-class>
org.springframework.web.context.request.RequestContextListener</listener-class> org.springframework.web.context.request.RequestContextListener</listener-class>
</listener> </listener>
<!-- end Spring listeners -->
<!-- Loads all IDataBootstrap and executes them --> <!-- Loads all IDataBootstrap and executes them -->
<listener> <listener>
@ -87,8 +82,8 @@
<servlet-name>zkLoader</servlet-name> <servlet-name>zkLoader</servlet-name>
<servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class> <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>
<!-- <!--
Must. Specifies URI of the update engine (DHtmlUpdateServlet). It Must specify URI of the update engine (DHtmlUpdateServlet).
must be the same as <url-pattern> for the update engine. It must be the same as <url-pattern> for the update engine.
--> -->
<init-param> <init-param>
<param-name>update-uri</param-name> <param-name>update-uri</param-name>
@ -113,7 +108,6 @@
<servlet-name>auEngine</servlet-name> <servlet-name>auEngine</servlet-name>
<url-pattern>/zkau/*</url-pattern> <url-pattern>/zkau/*</url-pattern>
</servlet-mapping> </servlet-mapping>
<!-- //// -->
<!-- CXF --> <!-- CXF -->
<servlet> <servlet>

View file

@ -1,11 +1,11 @@
<zk> <zk>
<log> <log>
<log-base></log-base> <log-base/>
</log> </log>
<desktop-config> <desktop-config>
<!-- seconds it takes between requests for a desktop to be invalidated --> <!-- Seconds it takes between requests for a desktop to be invalidated -->
<!-- a timer is introduced to avoid invalidation of pages still open --> <!-- A timer is introduced to avoid invalidation of pages still open -->
<desktop-timeout>30</desktop-timeout> <desktop-timeout>30</desktop-timeout>
</desktop-config> </desktop-config>

View file

@ -37,7 +37,6 @@ body {
.logo { .logo {
background-image: url("../img/v3/blue_ga.jpg"); background-image: url("../img/v3/blue_ga.jpg");
height: 50px;
width: 300px; width: 300px;
height: 100px; height: 100px;
float: left; float: left;
@ -51,9 +50,9 @@ body {
} }
table { table {
margin: 0px; margin: 0;
padding: 0px; padding: 0;
border: 0px; border: 0;
} }
.errorbox { .errorbox {
@ -75,10 +74,9 @@ body .z-window-embedded .icono .z-button-cm,
body .z-window-modal .icono .z-button-cm, body .z-window-modal .icono .z-button-cm,
body .advancedallocationlayout .icono .z-button-cm { body .advancedallocationlayout .icono .z-button-cm {
color: #007bbe; color: #007bbe;
background-color: transparent; background: transparent none;
background-image: none; border: 0 solid #007bbe;
border: 0px solid #007bbe; padding: 0;
padding: 0px;
} }
@ -132,7 +130,7 @@ body .advancedallocationlayout .icono .z-button-cm {
.sub_menu .z-button-cm { .sub_menu .z-button-cm {
background-color: transparent !important; background-color: transparent !important;
border: 0px; border: 0;
color: #EDF2F7; color: #EDF2F7;
} }
@ -160,15 +158,14 @@ body .advancedallocationlayout .icono .z-button-cm {
.global-action.z-button .z-button-cm { .global-action.z-button .z-button-cm {
padding: 4px 25px !important; padding: 4px 25px !important;
background-position: 5px; background: no-repeat 5px;
background-repeat: no-repeat;
margin-right: 1px; margin-right: 1px;
} }
.global-action.z-button .z-button-cm:active { .global-action.z-button .z-button-cm:active {
margin-right: 0px; margin-right: 0;
border-bottom: 0px; border-bottom: 0;
border-right: 0px; border-right: 0;
} }
.save-button.z-button .z-button-cm { .save-button.z-button .z-button-cm {
@ -217,11 +214,11 @@ body .advancedallocationlayout .icono .z-button-cm {
/* ------------- order element tree ------------- */ /* ------------- order element tree ------------- */
.orderTree input { .orderTree input {
height: 18px; height: 18px;
border-bottom: 0px; border-bottom: 0;
border-top: 0px; border-top: 0;
border-left: 1px dotted #7EAAC6; border-left: 1px dotted #7EAAC6;
padding-left: 2px; padding-left: 2px;
border-right: 0px; border-right: 0;
} }
.orderTree .z-datebox-inp { .orderTree .z-datebox-inp {
@ -234,7 +231,7 @@ body .advancedallocationlayout .icono .z-button-cm {
} }
.orderTree td { .orderTree td {
padding: 0px !important; padding: 0 !important;
} }
/* These constants may be reviewed when testing with 3 digit tasknumbers */ /* These constants may be reviewed when testing with 3 digit tasknumbers */
@ -245,7 +242,7 @@ body .advancedallocationlayout .icono .z-button-cm {
.orderTree .depth_5 input, .orderTree .depth_5 input,
.orderTree .depth_6 input .orderTree .depth_6 input
{ {
border-right: 0px; border-right: 0;
} }
/* Cleaning window borders */ /* Cleaning window borders */
@ -337,8 +334,7 @@ h4.message_WARNING {
.z-window-embedded { .z-window-embedded {
margin: 10px; margin: 5px 10px 10px;
margin-top: 5px;
} }
.main-area .z-center-body > .z-window-embedded { .main-area .z-center-body > .z-window-embedded {
@ -348,10 +344,7 @@ h4.message_WARNING {
} }
/* Hide inner second level embed window titles */ /* Hide inner second level embed window titles */
.z-window-embedded .z-window-embedded .z-window-embedded .z-window-embedded .z-window-embedded-hl {
.z-window-embedded
.z-window-embedded
.z-window-embedded-hl {
display: none; display: none;
} }
@ -436,16 +429,13 @@ div.z-row-cnt {
.z-window-popup-header,.z-window-highlighted-header, .z-window-popup-header,.z-window-highlighted-header,
.z-window-overlapped-header,.z-window-embedded-header { .z-window-overlapped-header,.z-window-embedded-header {
background-color: #FFFFFF;
color: #0081C3; color: #0081C3;
font-family: Georgia, Tahoma, Arial, Helvetica, sans-serif; font-family: Georgia, Tahoma, Arial, Helvetica, sans-serif;
font-size: 18px; font-size: 18px;
padding-bottom: 10px; padding-bottom: 10px;
font-weight: normal; font-weight: normal;
background-image: url(../img/header_bullet.gif);
background-repeat: no-repeat;
padding-left: 22px; padding-left: 22px;
background-position: 0px 3px; background: #FFFFFF url(../img/header_bullet.gif) no-repeat 0 3px;
} }
.caption-title .z-caption-l { .caption-title .z-caption-l {
@ -490,21 +480,21 @@ div.z-footer-cnt,div.z-row-cnt,div.z-group-cnt,div.z-group-foot-cnt,div.z-column
.z-tabs .z-tabs-cnt { .z-tabs .z-tabs-cnt {
background: none; background: none;
border-bottom: 0px; border-bottom: 0;
border-bottom: 1px solid #7EAAC6; border-bottom: 1px solid #7EAAC6;
} }
.z-tabs-scroll { .z-tabs-scroll {
padding-bottom: 0px; padding-bottom: 0;
background: #F2FBFF none repeat scroll 0 0; background: #F2FBFF none repeat scroll 0 0;
border: 0px solid #000000; border: 0 solid #000000;
} }
.z-tab .z-tab-text { .z-tab .z-tab-text {
font-family: Tahoma, Arial, Helvetica, sans-serif; font-family: Tahoma, Arial, Helvetica, sans-serif;
} }
.z-tab-seld .z-tab-text { /* color:#0F3B82; */ .z-tab-seld .z-tab-text { /* color:#0F3B82; */
font-family: Tahoma, Arial, Helvetica, sans-serif; font-family: Tahoma, Arial, Helvetica, sans-serif;
} }
@ -617,7 +607,7 @@ div.z-grid {
} }
.orderTree div.z-tree-cell-cnt { .orderTree div.z-tree-cell-cnt {
padding:0px; padding:0;
} }
.orderTree td { .orderTree td {
@ -633,8 +623,8 @@ div.z-grid {
} }
.orderelements-tab .z-datebox-focus .z-datebox-inp { .orderelements-tab .z-datebox-focus .z-datebox-inp {
border-top: 0px; border-top: 0;
border-bottom: 0px; border-bottom: 0;
} }
.orderelements-tab .z-datebox-focus .z-datebox-inp, .orderelements-tab .z-datebox-focus .z-datebox-inp,
@ -647,8 +637,8 @@ div.z-grid {
} }
.listdetails .z-datebox-focus .z-datebox-inp { .listdetails .z-datebox-focus .z-datebox-inp {
border-top: 0px; border-top: 0;
border-bottom: 0px; border-bottom: 0;
height: 17px; height: 17px;
font-size: 11px !important; font-size: 11px !important;
font-family: Tahoma, Arial, Helvetica, sans-serif; font-family: Tahoma, Arial, Helvetica, sans-serif;
@ -721,21 +711,6 @@ div.z-grid {
.scheduling-graphics .z-tabs-ver-scroll { .scheduling-graphics .z-tabs-ver-scroll {
border: 0; border: 0;
} }
.perspectives-column {
/* border-right: solid 1px; */
}
/* Legend colors:
COLOR_CAPABILITY_LINE = "#000000"; // black
COLOR_OVERLOAD = "#FF5A11"; // Red
COLOR_OVERLOAD_OTHER = "#FFD4C2"; // Soft red
COLOR_ASSIGNED_LOAD = "#98D471"; // Green
COLOR_ASSIGNED_OTHER = "#E0F3D3"; // Soft green
*/
.legend .capability { .legend .capability {
border-top:solid 2px #000000; border-top:solid 2px #000000;
@ -807,14 +782,14 @@ div.z-grid {
.z-panel-header { .z-panel-header {
background:none; background:none;
border: 0px; border: 0;
margin:0px 0px 0 10px margin:0 0 0 10px
} }
.z-panel-body { .z-panel-body {
background:none; background:none;
border: 1px solid #B1CBD5; border: 1px solid #B1CBD5;
margin:0 10px 0px 10px; margin:0 10px 0 10px;
} }
.z-panel-children { .z-panel-children {
@ -931,7 +906,7 @@ span.z-dottree-line {
.z-menubar-hor { .z-menubar-hor {
border-bottom: 3px solid #2a83b4; border-bottom: 3px solid #2a83b4;
padding: 0px; padding: 0;
} }
.user_row .cerrar_sesion { .user_row .cerrar_sesion {
@ -939,7 +914,7 @@ span.z-dottree-line {
} }
.migas_linea { .migas_linea {
border: 0px; border: 0;
cursor: default; cursor: default;
} }
@ -958,8 +933,7 @@ span.z-dottree-line {
.perspective .z-button-cm, .perspective .z-button-cm,
.perspective-active .z-button-cm { .perspective-active .z-button-cm {
padding-top: 60px; padding-top: 60px;
background-position: 18px 10px; background: no-repeat 18px 10px;
background-repeat: no-repeat;
border-radius: 2px; border-radius: 2px;
} }
@ -1182,18 +1156,18 @@ tr.z-treerow-seld {
} }
tr.z-treerow-seld input { tr.z-treerow-seld input {
background-color: #fdf3da; /* Soft orange */ /* Soft orange */
background-image: none; background: #fdf3da none;
} }
tr.z-treerow-over input { tr.z-treerow-over input {
background-color: #eff2f6; /* Soft blue */ /* Soft blue */
background-image: none; background: #eff2f6 none;
} }
tr.z-treerow-over input { tr.z-treerow-over input {
background-color: #eff2f6; /* Soft blue */ /* Soft blue */
background-image: none; background: #eff2f6 none;
} }
.timeplot-canvas { .timeplot-canvas {
@ -1248,7 +1222,6 @@ tr.z-treerow-over input {
.timeplot-grid-label { .timeplot-grid-label {
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
font-size: 10px;
z-index: 2; z-index: 2;
color: transparent; color: transparent;
font-size:9px; font-size:9px;
@ -1318,15 +1291,15 @@ tr.z-treerow-over input {
} }
.allocation-satisfied .resource-allocation tr.z-grid-odd td.z-row-inner, .allocation-satisfied tr.z-grid-odd { .allocation-satisfied .resource-allocation tr.z-grid-odd td.z-row-inner, .allocation-satisfied tr.z-grid-odd {
background-color: none; background-color: transparent;
} }
.allocation-satisfied td.z-row-inner { .allocation-satisfied td.z-row-inner {
background-color: none; background-color: transparent;
} }
.assignedresources .allocation-satisfied td.z-row-inner { .assignedresources .allocation-satisfied td.z-row-inner {
background-color: none; background-color: transparent;
} }
/* Advanced allocation */ /* Advanced allocation */
@ -1457,7 +1430,7 @@ tr.z-tree-row-seld .z-row-cnt {
} }
.filter-more-options .z-groupbox-header { .filter-more-options .z-groupbox-header {
margin-top: 0px; margin-top: 0;
} }
.filter-more-options .z-groupbox-bl { .filter-more-options .z-groupbox-bl {
display: none; display: none;
@ -1537,10 +1510,8 @@ tr.z-tree-row-seld .z-row-cnt {
.progress-types.z-combobox .z-combobox-inp { .progress-types.z-combobox .z-combobox-inp {
margin:0; margin:0;
padding:0; padding:0;
border:0;
color: transparent; color: transparent;
background: transparent; background: transparent;
border: 0;
border-width: 0; border-width: 0;
outline: none; outline: none;
width: 0; width: 0;
@ -1571,7 +1542,7 @@ tr.z-tree-row-seld .z-row-cnt {
} }
.advancedallocationlayout div.z-grid { .advancedallocationlayout div.z-grid {
border-top: 0px; border-top: 0;
} }
.advancedallocationlayout .timeTrackedTableWithLeftPane .z-grid-body .z-row-inner { .advancedallocationlayout .timeTrackedTableWithLeftPane .z-grid-body .z-row-inner {
@ -1596,8 +1567,8 @@ tr.z-tree-row-seld .z-row-cnt {
.advanced-assignment-area td .limiting.z-intbox, .advanced-assignment-area td .limiting.z-intbox,
.advanced-assignment-area td .limiting.z-textbox { .advanced-assignment-area td .limiting.z-textbox {
height: 20px; height: 20px;
background: #61B598; // LIMITING_ASSIGNED background: #61B598; /* LIMITING_ASSIGNED */
color: #555555; color: #555555;
border-right: solid 1px white; border-right: solid 1px white;
opacity: 1; opacity: 1;
-moz-opacity: 1; -moz-opacity: 1;
@ -1606,13 +1577,12 @@ color: #555555;
.advanced-assignment-area td .limiting.z-intbox[value="0"], .advanced-assignment-area td .limiting.z-intbox[value="0"],
.advanced-assignment-area td .limiting.z-textbox[value="0"] { .advanced-assignment-area td .limiting.z-textbox[value="0"] {
background: #C1D9D1; // LIMITING_UNNASSIGNED background: #C1D9D1; /* LIMITING_UNNASSIGNED */
color: #555555; color: #555555;
} }
.advanced-assignment-area > .z-center-body { .advanced-assignment-area > .z-center-body {
overflow: visible !important; overflow: visible !important;
overflow: visible !important;
} }
input.z-spinner-text-disd, input.z-spinner-text-disd,

View file

@ -35,14 +35,13 @@
controller = loginController; controller = loginController;
contextPath = Executions.getCurrent().getContextPath(); contextPath = Executions.getCurrent().getContextPath();
loginError = Executions.getCurrent().getParameter("login_error"); loginError = Executions.getCurrent().getParameter("login_error");
logoLoginLink = contextPath + "/common/img/" + logoLoginLink = contextPath + "/common/img/" + org.libreplan.web.I18nHelper._("en") + "/logo_login.png";
org.libreplan.web.I18nHelper._("en") + "/logo_login.png";
]]> ]]>
</zscript> </zscript>
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<n:tr> <n:tr>
<n:td background="${contextPath}/common/img/flechitas.gif"></n:td> <n:td background="${contextPath}/common/img/flechitas.gif"/>
</n:tr> </n:tr>
</n:table> </n:table>
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
@ -64,12 +63,13 @@
<n:form action="${contextPath}/j_spring_security_check" method="POST"> <n:form action="${contextPath}/j_spring_security_check" method="POST">
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="fondo_identificacion"> <n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"
class="fondo_identificacion">
<n:tr> <n:tr>
<n:td width="20" height="165" valign="top"></n:td> <n:td width="20" height="165" valign="top"/>
<n:td valign="top" class="authentication"><n:table border="0" cellpadding="0" cellspacing="0"> <n:td valign="top" class="authentication"><n:table border="0" cellpadding="0" cellspacing="0">
<n:tr> <n:tr>
<n:td></n:td> <n:td/>
</n:tr> </n:tr>
<n:tr> <n:tr>
<n:td class="usuario_clave">${i18n:_('User')}</n:td> <n:td class="usuario_clave">${i18n:_('User')}</n:td>
@ -77,7 +77,8 @@
<n:tr> <n:tr>
<n:td><label> </label> <n:td><label> </label>
<div align="center"> <div align="center">
<n:input name="j_username" type="text" class="campotexto" id="textfield" size="30" value="${controller.loginValue}" autofocus="autofocus"/> <n:input name="j_username" type="text" class="campotexto" id="textfield" size="30"
value="${controller.loginValue}" autofocus="autofocus"/>
</div></n:td> </div></n:td>
</n:tr> </n:tr>
<n:tr> <n:tr>
@ -85,11 +86,12 @@
</n:tr> </n:tr>
<n:tr> <n:tr>
<n:td><div align="center"> <n:td><div align="center">
<n:input name="j_password" type="password" class="campotexto" id="textfield2" size="30" value="${controller.loginValue}"/> <n:input name="j_password" type="password" class="campotexto" id="textfield2" size="30"
value="${controller.loginValue}"/>
</div></n:td> </div></n:td>
</n:tr> </n:tr>
<n:tr> <n:tr>
<n:td></n:td> <n:td/>
</n:tr> </n:tr>
<n:tr> <n:tr>
<n:td> <n:td>
@ -112,12 +114,13 @@
</n:td> </n:td>
</n:tr> </n:tr>
</n:table> </n:table>
<n:input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</n:form> </n:form>
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="tabla_inferior"> <n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"
class="tabla_inferior">
<n:tr> <n:tr>
<n:td height="10" background="${contextPath}/common/img/linea_pie_login.gif"></n:td> <n:td height="10" background="${contextPath}/common/img/linea_pie_login.gif"/>
</n:tr> </n:tr>
<n:tr> <n:tr>
<n:td><n:span class="supported-browsers" id="supported-browsers-box">${i18n:_('Supported Chrome, Firefox, Safari and Epiphany browsers')}</n:span> <n:td><n:span class="supported-browsers" id="supported-browsers-box">${i18n:_('Supported Chrome, Firefox, Safari and Epiphany browsers')}</n:span>
@ -129,7 +132,7 @@
</n:table> </n:table>
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<n:tr> <n:tr>
<n:td background="${contextPath}/common/img/flechitas.gif"></n:td> <n:td background="${contextPath}/common/img/flechitas.gif"/>
</n:tr> </n:tr>
</n:table> </n:table>

View file

@ -26,7 +26,7 @@
<vbox apply="org.libreplan.web.error.PageForErrorOnEvent" sclass="warningbox"> <vbox apply="org.libreplan.web.error.PageForErrorOnEvent" sclass="warningbox">
<i18n id="message" value="Your session has expired because of inactivity. Please log in again." /> <i18n id="message" value="Your session has expired because of inactivity. Please log in again." />
<hbox style="margin-left:auto; margin-right:auto"> <hbox style="margin-left:auto; margin-right:auto">
<button id="quitSession" label="${i18n:_('Back to log in')}"></button> <button id="quitSession" label="${i18n:_('Back to log in')}"/>
</hbox> </hbox>
</vbox> </vbox>
</window> </window>

View file

@ -37,7 +37,7 @@
]]> ]]>
</zscript> </zscript>
<div id="idContextMenuTaskAssignment"> <div id="idContextMenuTaskAssignment">
<div></div> <div/>
</div> </div>
<tabSwitcher self="@{define(content)}" apply="${multipleTabsPlanner}"> <tabSwitcher self="@{define(content)}" apply="${multipleTabsPlanner}">
</tabSwitcher> </tabSwitcher>

View file

@ -71,15 +71,13 @@ import org.springframework.transaction.annotation.Transactional;
WEBAPP_SPRING_SECURITY_CONFIG_TEST_FILE }) WEBAPP_SPRING_SECURITY_CONFIG_TEST_FILE })
public class ExportTimesheetsToTimTest { public class ExportTimesheetsToTimTest {
private Properties properties = null;
@Autowired @Autowired
IExportTimesheetsToTim exportTimesheetsToTim; IExportTimesheetsToTim exportTimesheetsToTim;
@Before @Before
public void loadProperties() throws IOException { public void loadProperties() throws IOException {
String filename = System.getProperty("user.dir") + "/../scripts/tim-connector/tim-conn.properties"; String filename = System.getProperty("user.dir") + "/../scripts/tim-connector/tim-conn.properties";
properties = new Properties(); Properties properties = new Properties();
properties.load(new FileInputStream(filename)); properties.load(new FileInputStream(filename));
} }
@ -114,6 +112,7 @@ public class ExportTimesheetsToTimTest {
defaultAdvanceTypesBootstrapListener.loadRequiredData(); defaultAdvanceTypesBootstrapListener.loadRequiredData();
configurationBootstrap.loadRequiredData(); configurationBootstrap.loadRequiredData();
scenariosBootstrap.loadRequiredData(); scenariosBootstrap.loadRequiredData();
return null; return null;
} }
}; };
@ -123,11 +122,11 @@ public class ExportTimesheetsToTimTest {
private Order givenOrder() { private Order givenOrder() {
return transactionService.runOnAnotherTransaction(new IOnTransaction<Order>() { return transactionService.runOnAnotherTransaction(new IOnTransaction<Order>() {
@Override @Override
public Order execute() { public Order execute() {
return givenValidOrderAlreadyStored(); return givenValidOrderAlreadyStored();
} }
}); });
} }
private Order givenValidOrderAlreadyStored() { private Order givenValidOrderAlreadyStored() {
@ -152,6 +151,7 @@ public class ExportTimesheetsToTimTest {
Scenario current = scenarioManager.getCurrent(); Scenario current = scenarioManager.getCurrent();
OrderVersion result = OrderVersion.createInitialVersion(current); OrderVersion result = OrderVersion.createInitialVersion(current);
order.setVersionForScenario(current, result); order.setVersionForScenario(current, result);
return result; return result;
} }

View file

@ -1,11 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<bean id="dataSourceReal" <bean id="dataSourceReal"
class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"

View file

@ -12,7 +12,7 @@
<bean id="saltSource" <bean id="saltSource"
class="org.springframework.security.authentication.dao.ReflectionSaltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource"
p:userPropertyToUse="username" /> p:userPropertyToUse="username" />
<!-- <bean id="dbUserDetailsService" class="org.libreplan.web.users.services.DBUserDetailsService"/> -->
<bean id="dbPasswordEncoderService" <bean id="dbPasswordEncoderService"
class="org.libreplan.web.users.services.DBPasswordEncoderService" class="org.libreplan.web.users.services.DBPasswordEncoderService"
p:passwordEncoder-ref="passwordEncoder" p:saltSource-ref="saltSource" /> p:passwordEncoder-ref="passwordEncoder" p:saltSource-ref="saltSource" />
@ -21,31 +21,33 @@
class="org.libreplan.web.users.bootstrap.UsersBootstrapInDB" class="org.libreplan.web.users.bootstrap.UsersBootstrapInDB"
p:dbPasswordEncoderService-ref="dbPasswordEncoderService" /> p:dbPasswordEncoderService-ref="dbPasswordEncoderService" />
<!-- Beans used by the LibrePlan Web Application when users are registerd <!--
in LDAP. At this moment users MUST be also in database with same username. Beans used by the LibrePlan Web Application when users are registerd in LDAP.
This will be changed in the near future. the url, base, userDN and password At this moment users MUST be also in database with same username.
properties must be set with the proper values --> This will be changed in the near future.
The url, base, userDN and password properties must be set with the proper values -->
<bean id="contextSource" <bean id="contextSource"
class="org.springframework.ldap.core.support.LdapContextSource" p:url="ldap://localhost:389" p:base="dc=example,dc=org" class="org.springframework.ldap.core.support.LdapContextSource" p:url="ldap://localhost:389"
p:userDn="cn=admin,dc=example,dc=org" p:password="admin"> p:base="dc=example,dc=org" p:userDn="cn=admin,dc=example,dc=org" p:password="admin">
</bean> </bean>
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate" <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate"
p:contextSource-ref="contextSource"> p:contextSource-ref="contextSource">
</bean> </bean>
<!-- This authentication provider will make possible all the login process <!--
when an LDAP is used. Also will allow authenticate users in database. The This authentication provider will make possible all the login process when an LDAP is used.
property strUserId must be set with the proper value. It represents the property Also will allow authenticate users in database.
of the user in LDAP which will be used to check the username. --> The property strUserId must be set with the proper value.
It represents the property of the user in LDAP which will be used to check the username.
-->
<bean id="authenticationProvider" <bean id="authenticationProvider"
class="org.libreplan.web.users.services.LDAPCustomAuthenticationProvider" class="org.libreplan.web.users.services.LDAPCustomAuthenticationProvider"
p:userDetailsService-ref="ldapUserDetailsService" p:userDetailsService-ref="ldapUserDetailsService"
p:ldapTemplate-ref="ldapTemplate"> p:ldapTemplate-ref="ldapTemplate">
</bean> </bean>
<!-- This bean is used to implement UserDetailsService with LDAP authentication <!-- This bean is used to implement UserDetailsService with LDAP authentication Provider -->
Provider. -->
<bean id="ldapUserDetailsService" <bean id="ldapUserDetailsService"
class="org.libreplan.web.users.services.LDAPUserDetailsService" /> class="org.libreplan.web.users.services.LDAPUserDetailsService" />
</beans> </beans>

96
pom.xml
View file

@ -223,13 +223,6 @@
Define this if you need ORM (org.springframework.orm.*) Define this if you need ORM (org.springframework.orm.*)
--> -->
<!-- Spring ORM -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<!-- Hibernate --> <!-- Hibernate -->
<!-- TODO Hibernate 5.1.0.FINAL for Spring 4.2+ --> <!-- TODO Hibernate 5.1.0.FINAL for Spring 4.2+ -->
<dependency> <dependency>
@ -283,11 +276,57 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!-- Spring ORM -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<!-- Spring Web --> <!-- Spring Web -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
<version>4.0.3.RELEASE</version> <version>4.2.6.RELEASE</version>
</dependency>
<!-- Spring context support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<!-- Spring security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<!-- Spring Dependency LDAP -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<!-- Spring test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.2.6.RELEASE</version>
<scope>test</scope>
</dependency> </dependency>
<!-- <!--
@ -302,45 +341,6 @@
<version>1.8.9</version> <version>1.8.9</version>
</dependency> </dependency>
<!-- Spring context support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<!-- Spring security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<!-- Spring Dependency LDAP -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<!-- Spring test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.0.3.RELEASE</version>
<scope>test</scope>
</dependency>
<!-- JUnit --> <!-- JUnit -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@ -645,7 +645,7 @@
<dependency> <dependency>
<groupId>org.quartz-scheduler</groupId> <groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId> <artifactId>quartz</artifactId>
<version>1.8.6</version> <version>2.2.3</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>