Skip to content

Commit

Permalink
Merge pull request #220 from devgateway/develop
Browse files Browse the repository at this point in the history
Merge develop into master for 1.0.0
  • Loading branch information
mpostelnicu authored Dec 9, 2016
2 parents 0241cc9 + d4f6899 commit d3ceab1
Show file tree
Hide file tree
Showing 174 changed files with 3,137 additions and 644 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ npm-debug.log
.idea
rebel.xml
/logs/
/forms/nbactions.xml
/nb-configuration.xml
/forms/nb-configuration.xml
/persistence-mongodb/nb-configuration.xml
/forms/.rebel.xml.bak
/persistence/nb-configuration.xml
/web/nb-configuration.xml
/ui/nb-configuration.xml
8 changes: 4 additions & 4 deletions forms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<wicket.version>7.4.0</wicket.version>
<wicket.bootstrap.version>0.10.8</wicket.bootstrap.version>
<zt.zip.version>1.9</zt.zip.version>
<wicket.version>7.5.0</wicket.version>
<wicket.bootstrap.version>0.10.11</wicket.bootstrap.version>
<zt.zip.version>1.10</zt.zip.version>
<wicket.webjars.version>0.5.5</wicket.webjars.version>
<closure.compiler.version>v20160822</closure.compiler.version>
</properties>
Expand Down Expand Up @@ -231,7 +231,7 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
<version>${pentaho.poi.version}</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<head>
<meta charset="utf-8">
<title>EditUserDashboardPage</title>
</head>
<body>
<wicket:extend>
<div wicket:id="name"></div>
<div wicket:id="formUrlEncodedBody"></div>
<div wicket:id="users"></div>
<div wicket:id="defaultDashboardUsers"></div>
</wicket:extend>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*******************************************************************************
* Copyright (c) 2016 Development Gateway, Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License (MIT)
* which accompanies this distribution, and is available at
* https://opensource.org/licenses/MIT
*
* Contributors:
* Development Gateway - initial API and implementation
*******************************************************************************/
package org.devgateway.ocds.forms.wicket.page.edit;

import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.devgateway.ocds.forms.wicket.page.list.ListAllDashboardsPage;
import org.devgateway.ocds.forms.wicket.providers.LabelPersistableJpaRepositoryTextChoiceProvider;
import org.devgateway.ocds.persistence.dao.UserDashboard;
import org.devgateway.ocds.persistence.repository.UserDashboardRepository;
import org.devgateway.toolkit.forms.security.SecurityConstants;
import org.devgateway.toolkit.forms.wicket.components.form.Select2MultiChoiceBootstrapFormComponent;
import org.devgateway.toolkit.forms.wicket.components.form.TextAreaFieldBootstrapFormComponent;
import org.devgateway.toolkit.forms.wicket.components.form.TextFieldBootstrapFormComponent;
import org.devgateway.toolkit.forms.wicket.page.edit.AbstractEditPage;
import org.devgateway.toolkit.persistence.dao.Person;
import org.devgateway.toolkit.persistence.repository.PersonRepository;
import org.wicketstuff.annotation.mount.MountPath;

@AuthorizeInstantiation(SecurityConstants.Roles.ROLE_ADMIN)
@MountPath("/editUserDashboard")
public class EditUserDashboardPage extends AbstractEditPage<UserDashboard> {

private static final long serialVersionUID = -6069250112046118104L;

@Override
protected UserDashboard newInstance() {
return new UserDashboard();
}

@SpringBean
private UserDashboardRepository userDashboardRepository;

@SpringBean
private PersonRepository personRepository;

public EditUserDashboardPage(final PageParameters parameters) {
super(parameters);
this.jpaRepository = userDashboardRepository;
this.listPageClass = ListAllDashboardsPage.class;

}

@Override
protected void onInitialize() {
super.onInitialize();

TextFieldBootstrapFormComponent<String> name = new TextFieldBootstrapFormComponent<>("name");
name.required();
editForm.add(name);

TextAreaFieldBootstrapFormComponent<String> formUrlEncodedBody =
new TextAreaFieldBootstrapFormComponent<>("formUrlEncodedBody");
formUrlEncodedBody.required();
formUrlEncodedBody.getField().setEnabled(false);
editForm.add(formUrlEncodedBody);

Select2MultiChoiceBootstrapFormComponent<Person> defaultDashboardUsers =
new Select2MultiChoiceBootstrapFormComponent<>("defaultDashboardUsers",
new LabelPersistableJpaRepositoryTextChoiceProvider<>(personRepository));
defaultDashboardUsers.setEnabled(false);
editForm.add(defaultDashboardUsers);

Select2MultiChoiceBootstrapFormComponent<Person> users =
new Select2MultiChoiceBootstrapFormComponent<>("users",
new LabelPersistableJpaRepositoryTextChoiceProvider<>(personRepository));
editForm.add(users);


}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
###############################################################################
# Copyright (c) 2015 Development Gateway, Inc and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the MIT License (MIT)
# which accompanies this distribution, and is available at
# https://opensource.org/licenses/MIT
#
# Contributors:
# Development Gateway - initial API and implementation
###############################################################################
page.title=Edit User Dashboard
name.label=Name
formUrlEncodedBody.label=Filter body
formUrlEncodedBody.help=This is a list of saved filters from the UI and cannot be edited here.
defaultDashboardUsers.label=Default Dashboard For Users
defaultDashboardUsers.help=This is a user setting and can be changed from the User form
users.label=Assigned Users
delete_error_message=Cannot delete this dashboard. It is assigned as the default dashboard for at least one user.\
Please assign a different default dashboard for the assigned users or select no default dashboard, and then try the delete again.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:extend>
<button wicket:id="view">View</button>
</wicket:extend>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*******************************************************************************
* Copyright (c) 2016 Development Gateway, Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License (MIT)
* which accompanies this distribution, and is available at
* https://opensource.org/licenses/MIT
*
* Contributors:
* Development Gateway - initial API and implementation
*******************************************************************************/
package org.devgateway.ocds.forms.wicket.page.list;

import de.agilecoders.wicket.core.markup.html.bootstrap.button.BootstrapExternalLink;
import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesomeIconType;
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.devgateway.ocds.forms.wicket.page.edit.EditUserDashboardPage;
import org.devgateway.ocds.persistence.dao.UserDashboard;
import org.devgateway.ocds.persistence.repository.UserDashboardRepository;
import org.devgateway.toolkit.forms.security.SecurityConstants;
import org.devgateway.toolkit.forms.wicket.page.lists.AbstractListPage;
import org.wicketstuff.annotation.mount.MountPath;

@AuthorizeInstantiation(SecurityConstants.Roles.ROLE_ADMIN)
@MountPath(value = "/listAllDashboards")
public class ListAllDashboardsPage extends AbstractListPage<UserDashboard> {

/**
*
*/
private static final long serialVersionUID = -324298525712620234L;
@SpringBean
protected UserDashboardRepository userDashboardRepository;

public class DashboardsActionPanel extends ActionPanel {

/**
* @param id
* @param model
*/
public DashboardsActionPanel(String id, IModel<UserDashboard> model) {
super(id, model);

UserDashboard entity = (UserDashboard) this.getDefaultModelObject();

BootstrapExternalLink viewLink = new BootstrapExternalLink("view", Model.of("ui/index.html?dashboardId="
+ entity.getId()), Buttons.Type.Danger) {
};
viewLink.setLabel(new StringResourceModel("view", ListAllDashboardsPage.this, null));
viewLink.setIconType(FontAwesomeIconType.eye).setSize(Buttons.Size.Small);
add(viewLink);

}
}

public ListAllDashboardsPage(final PageParameters pageParameters) {
super(pageParameters);
this.jpaRepository = userDashboardRepository;
this.editPageClass = EditUserDashboardPage.class;
columns.add(new PropertyColumn<UserDashboard, String>(
new Model<String>((new StringResourceModel("name", ListAllDashboardsPage.this, null)).getString()),
"name", "name"));
columns.add(new PropertyColumn<UserDashboard, String>(new Model<String>(
(new StringResourceModel("defaultDashboardUsers", ListAllDashboardsPage.this, null)).getString()),
"defaultDashboardUsers", "defaultDashboardUsers"));

columns.add(new PropertyColumn<UserDashboard, String>(new Model<String>(
(new StringResourceModel("users", ListAllDashboardsPage.this, null)).getString()),
"users", "users"));

}

@Override
protected void onInitialize() {
super.onInitialize();

editPageLink.setVisibilityAllowed(false);
}

@Override
public ActionPanel getActionPanel(String id, IModel<UserDashboard> model) {
return new DashboardsActionPanel(id, model);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
###############################################################################
# Copyright (c) 2015 Development Gateway, Inc and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the MIT License (MIT)
# which accompanies this distribution, and is available at
# https://opensource.org/licenses/MIT
#
# Contributors:
# Development Gateway - initial API and implementation
###############################################################################
page.title=All Dashboards
name=Name
defaultDashboardUsers=Default Dashboard For Users
users=Users
view=View
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (c) 2016 Development Gateway, Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License (MIT)
* which accompanies this distribution, and is available at
* https://opensource.org/licenses/MIT
*
* Contributors:
* Development Gateway - initial API and implementation
*******************************************************************************/
package org.devgateway.ocds.forms.wicket.page.list;

import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.devgateway.ocds.forms.wicket.providers.PersonDashboardJpaRepositoryProvider;
import org.devgateway.ocds.persistence.dao.UserDashboard;
import org.devgateway.toolkit.forms.security.SecurityConstants;
import org.devgateway.toolkit.forms.wicket.providers.SortableJpaRepositoryDataProvider;
import org.devgateway.toolkit.persistence.repository.PersonRepository;
import org.wicketstuff.annotation.mount.MountPath;

@AuthorizeInstantiation(SecurityConstants.Roles.ROLE_PROCURING_ENTITY)
@MountPath(value = "/listMyDashboards")
public class ListMyDashboardsPage extends ListAllDashboardsPage {

/**
*
*/
private static final long serialVersionUID = 8105049572554654046L;

@SpringBean
private PersonRepository personRepository;


@Override
public SortableJpaRepositoryDataProvider<UserDashboard> getProvider() {
return new PersonDashboardJpaRepositoryProvider(userDashboardRepository, personRepository);
}

public ListMyDashboardsPage(final PageParameters pageParameters) {
super(pageParameters);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
###############################################################################
# Copyright (c) 2015 Development Gateway, Inc and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the MIT License (MIT)
# which accompanies this distribution, and is available at
# https://opensource.org/licenses/MIT
#
# Contributors:
# Development Gateway - initial API and implementation
###############################################################################
page.title=My Dashboards
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*******************************************************************************
* Copyright (c) 2015 Development Gateway, Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License (MIT)
* which accompanies this distribution, and is available at
* https://opensource.org/licenses/MIT
*
* Contributors:
* Development Gateway - initial API and implementation
*******************************************************************************/
/**
*
*/
package org.devgateway.ocds.forms.wicket.providers;

import java.util.Collection;

import org.apache.wicket.model.IModel;
import org.devgateway.toolkit.forms.wicket.providers.AbstractJpaRepositoryTextChoiceProvider;
import org.devgateway.toolkit.persistence.dao.GenericPersistable;
import org.devgateway.toolkit.persistence.dao.Labelable;
import org.devgateway.toolkit.persistence.repository.category.TextSearchableRepository;

/**
* @author mpostelnicu
*
*/
public class LabelPersistableJpaRepositoryTextChoiceProvider<T extends GenericPersistable & Labelable>
extends AbstractJpaRepositoryTextChoiceProvider<T> {

/**
*
*/
private static final long serialVersionUID = -9109118476966448737L;

public LabelPersistableJpaRepositoryTextChoiceProvider(
final TextSearchableRepository<T, Long> textSearchableRepository) {
super(textSearchableRepository);
}

public LabelPersistableJpaRepositoryTextChoiceProvider(
final TextSearchableRepository<T, Long> textSearchableRepository,
final IModel<Collection<T>> restrictedToItemsModel) {
super(textSearchableRepository, restrictedToItemsModel);
}

public LabelPersistableJpaRepositoryTextChoiceProvider(
final TextSearchableRepository<T, Long> textSearchableRepository, final Class<T> clazz,
final Boolean addNewElements) {
super(textSearchableRepository, clazz, addNewElements);
}

@Override
public String getDisplayValue(final T choice) {
return choice.getLabel();
}
}
Loading

0 comments on commit d3ceab1

Please sign in to comment.