-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from devgateway/develop
Merge develop into master for 1.0.0
- Loading branch information
Showing
174 changed files
with
3,137 additions
and
644 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditUserDashboardPage.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
81 changes: 81 additions & 0 deletions
81
forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditUserDashboardPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
|
||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditUserDashboardPage.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
8 changes: 8 additions & 0 deletions
8
...g/devgateway/ocds/forms/wicket/page/list/ListAllDashboardsPage$DashboardsActionPanel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
91 changes: 91 additions & 0 deletions
91
forms/src/main/java/org/devgateway/ocds/forms/wicket/page/list/ListAllDashboardsPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...src/main/java/org/devgateway/ocds/forms/wicket/page/list/ListAllDashboardsPage.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
46 changes: 46 additions & 0 deletions
46
forms/src/main/java/org/devgateway/ocds/forms/wicket/page/list/ListMyDashboardsPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
.../src/main/java/org/devgateway/ocds/forms/wicket/page/list/ListMyDashboardsPage.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
58 changes: 58 additions & 0 deletions
58
...vgateway/ocds/forms/wicket/providers/LabelPersistableJpaRepositoryTextChoiceProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
Oops, something went wrong.