http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupUsersPanel.html ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupUsersPanel.html b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupUsersPanel.html index 11bce13..3381830 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupUsersPanel.html +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupUsersPanel.html @@ -1,45 +1,45 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<html xmlns:wicket="http://wicket.apache.org"> - <wicket:panel> - <div class="usergroupspanel"> - <span wicket:id="navigator">[dataview navigator]</span> - <table class="adminListTable" style="min-width: 440px; max-width: 440px" > - <tr> - <th class="ui-widget-header" style="width: 34px; max-width: 34px; overflow: hidden;" wicket:message="title:98"><wicket:message key="98" /></th> - <th class="ui-widget-header" style="width: 360px"><wicket:message key="177" /></th> - <th class="ui-widget-header" style="width: 34px"><wicket:message key="275" /></th> - </tr> - </table> - <div class="tableWrapper" style="width: 460px; height: 250px;"> - <table class="adminListTable" style="min-width: 440px; max-width: 440px"> - <tbody> - <tr wicket:id="userList" class="ui-widget-content"> - <td style="width: 34px"><input type="checkbox" wicket:id="isModerator"/></td> - <td style="width: 360px"><div style="width: 360px"><span wicket:id="label"></span></div></td> - <td style="width: 34px"><div style="width: 34px"><div class="formCancelButton" wicket:id="deleteUserBtn" wicket:message="title:274"></div></div></td> - </tr> - </tbody> - </table> - </div> - </div> - </wicket:panel> -</html> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<html xmlns:wicket="http://wicket.apache.org"> + <wicket:panel> + <div class="usergroupspanel"> + <span wicket:id="navigator">[dataview navigator]</span> + <table class="adminListTable" style="min-width: 440px; max-width: 440px" > + <tr> + <th class="ui-widget-header" style="width: 34px; max-width: 34px; overflow: hidden;" wicket:message="title:98"><wicket:message key="98" /></th> + <th class="ui-widget-header" style="width: 360px"><wicket:message key="177" /></th> + <th class="ui-widget-header" style="width: 34px"><wicket:message key="275" /></th> + </tr> + </table> + <div class="tableWrapper" style="width: 460px; height: 250px;"> + <table class="adminListTable" style="min-width: 440px; max-width: 440px"> + <tbody> + <tr wicket:id="userList" class="ui-widget-content"> + <td style="width: 34px"><input type="checkbox" wicket:id="isModerator"/></td> + <td style="width: 360px"><div style="width: 360px"><span wicket:id="label"></span></div></td> + <td style="width: 34px"><div style="width: 34px"><div class="formCancelButton" wicket:id="deleteUserBtn" wicket:message="title:274"></div></div></td> + </tr> + </tbody> + </table> + </div> + </div> + </wicket:panel> +</html>
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupUsersPanel.java ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupUsersPanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupUsersPanel.java index 4284b86..c9a1d9b 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupUsersPanel.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupUsersPanel.java @@ -1,159 +1,159 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License") + you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.openmeetings.web.admin.groups; - -import static org.apache.openmeetings.web.app.Application.getBean; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.openmeetings.db.dao.user.GroupUserDao; -import org.apache.openmeetings.db.dao.user.UserDao; -import org.apache.openmeetings.db.entity.user.GroupUser; -import org.apache.openmeetings.db.entity.user.User; -import org.apache.openmeetings.web.admin.SearchableDataView; -import org.apache.openmeetings.web.app.WebSession; -import org.apache.openmeetings.web.common.ConfirmableAjaxBorder; -import org.apache.openmeetings.web.common.PagedEntityListPanel; -import org.apache.openmeetings.web.data.SearchableDataProvider; -import org.apache.wicket.AttributeModifier; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.form.OnChangeAjaxBehavior; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.CheckBox; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.markup.repeater.Item; - -public class GroupUsersPanel extends Panel { - private static final long serialVersionUID = 1L; - private long groupId; - private List<GroupUser> users2add = new ArrayList<>(); - - public GroupUsersPanel(String id, long groupId) { - super(id); - this.groupId = groupId; - setOutputMarkupId(true); - - SearchableDataView<GroupUser> dataView = new SearchableDataView<GroupUser>("userList", new GroupUserDataProvider()) { - private static final long serialVersionUID = 1L; - - @Override - protected void populateItem(Item<GroupUser> item) { - final GroupUser grpUser = item.getModelObject(); - item.add(new CheckBox("isModerator").add(new OnChangeAjaxBehavior() { - private static final long serialVersionUID = 1L; - - @Override - protected void onUpdate(AjaxRequestTarget target) { - if (grpUser.getId() != null) { - update(grpUser); - } - } - })); - User u = grpUser.getUser(); - Label label = new Label("label", u == null ? "" : GroupForm.formatUser(u)); - if (grpUser.getId() == null) { - label.add(AttributeModifier.append("class", "newItem")); - } - item.add(label); - item.add(new ConfirmableAjaxBorder("deleteUserBtn", getString("80"), getString("833")) { - private static final long serialVersionUID = 1L; - - @Override - protected void onInitialize() { - super.onInitialize(); - form.setMultiPart(true);//need to be multipart due to parent form is multipart - } - - @Override - protected void onSubmit(AjaxRequestTarget target) { - if (grpUser.getId() == null) { - users2add.remove(grpUser); - } else { - UserDao uDao = getBean(UserDao.class); - User u = uDao.get(grpUser.getUser().getId()); - u.getGroupUsers().remove(grpUser); - uDao.update(u, WebSession.getUserId()); - } - target.add(GroupUsersPanel.this); - } - }); - } - }; - add(dataView).setOutputMarkupId(true); - add(new PagedEntityListPanel("navigator", dataView) { - private static final long serialVersionUID = 1L; - - @Override - protected void onEvent(AjaxRequestTarget target) { - target.add(GroupUsersPanel.this); - } - }); - } - - public static void update(GroupUser grpUser) { - UserDao uDao = getBean(UserDao.class); - User u = uDao.get(grpUser.getUser().getId()); - int idx = u.getGroupUsers().indexOf(grpUser); - if (idx > -1) { - u.getGroupUsers().get(idx).setModerator(grpUser.isModerator()); - } else { - u.getGroupUsers().add(grpUser); - } - uDao.update(u, WebSession.getUserId()); - } - - void update(long groupId) { - this.groupId = groupId; - users2add.clear(); - } - - List<GroupUser> getUsers2add() { - return users2add; - } - - private class GroupUserDataProvider extends SearchableDataProvider<GroupUser> { - private static final long serialVersionUID = 1L; - - GroupUserDataProvider() { - super(GroupUserDao.class); - } - - @Override - protected GroupUserDao getDao() { - return (GroupUserDao)super.getDao(); - } - - @Override - public long size() { - return users2add.size() + (search == null ? getDao().count(groupId) : getDao().count(groupId, search)); - } - - @Override - public java.util.Iterator<? extends GroupUser> iterator(long first, long count) { - List<GroupUser> list = new ArrayList<>(); - list.addAll(users2add); - list.addAll(search == null && getSort() == null - ? getDao().get(groupId, (int)first, (int)count) - : getDao().get(groupId, search, (int)first, (int)count, getSortStr())); - - return list.iterator(); - } - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.openmeetings.web.admin.groups; + +import static org.apache.openmeetings.web.app.Application.getBean; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.openmeetings.db.dao.user.GroupUserDao; +import org.apache.openmeetings.db.dao.user.UserDao; +import org.apache.openmeetings.db.entity.user.GroupUser; +import org.apache.openmeetings.db.entity.user.User; +import org.apache.openmeetings.web.admin.SearchableDataView; +import org.apache.openmeetings.web.app.WebSession; +import org.apache.openmeetings.web.common.ConfirmableAjaxBorder; +import org.apache.openmeetings.web.common.PagedEntityListPanel; +import org.apache.openmeetings.web.data.SearchableDataProvider; +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.form.OnChangeAjaxBehavior; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.CheckBox; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.markup.repeater.Item; + +public class GroupUsersPanel extends Panel { + private static final long serialVersionUID = 1L; + private long groupId; + private List<GroupUser> users2add = new ArrayList<>(); + + public GroupUsersPanel(String id, long groupId) { + super(id); + this.groupId = groupId; + setOutputMarkupId(true); + + SearchableDataView<GroupUser> dataView = new SearchableDataView<GroupUser>("userList", new GroupUserDataProvider()) { + private static final long serialVersionUID = 1L; + + @Override + protected void populateItem(Item<GroupUser> item) { + final GroupUser grpUser = item.getModelObject(); + item.add(new CheckBox("isModerator").add(new OnChangeAjaxBehavior() { + private static final long serialVersionUID = 1L; + + @Override + protected void onUpdate(AjaxRequestTarget target) { + if (grpUser.getId() != null) { + update(grpUser); + } + } + })); + User u = grpUser.getUser(); + Label label = new Label("label", u == null ? "" : GroupForm.formatUser(u)); + if (grpUser.getId() == null) { + label.add(AttributeModifier.append("class", "newItem")); + } + item.add(label); + item.add(new ConfirmableAjaxBorder("deleteUserBtn", getString("80"), getString("833")) { + private static final long serialVersionUID = 1L; + + @Override + protected void onInitialize() { + super.onInitialize(); + form.setMultiPart(true);//need to be multipart due to parent form is multipart + } + + @Override + protected void onSubmit(AjaxRequestTarget target) { + if (grpUser.getId() == null) { + users2add.remove(grpUser); + } else { + UserDao uDao = getBean(UserDao.class); + User u = uDao.get(grpUser.getUser().getId()); + u.getGroupUsers().remove(grpUser); + uDao.update(u, WebSession.getUserId()); + } + target.add(GroupUsersPanel.this); + } + }); + } + }; + add(dataView).setOutputMarkupId(true); + add(new PagedEntityListPanel("navigator", dataView) { + private static final long serialVersionUID = 1L; + + @Override + protected void onEvent(AjaxRequestTarget target) { + target.add(GroupUsersPanel.this); + } + }); + } + + public static void update(GroupUser grpUser) { + UserDao uDao = getBean(UserDao.class); + User u = uDao.get(grpUser.getUser().getId()); + int idx = u.getGroupUsers().indexOf(grpUser); + if (idx > -1) { + u.getGroupUsers().get(idx).setModerator(grpUser.isModerator()); + } else { + u.getGroupUsers().add(grpUser); + } + uDao.update(u, WebSession.getUserId()); + } + + void update(long groupId) { + this.groupId = groupId; + users2add.clear(); + } + + List<GroupUser> getUsers2add() { + return users2add; + } + + private class GroupUserDataProvider extends SearchableDataProvider<GroupUser> { + private static final long serialVersionUID = 1L; + + GroupUserDataProvider() { + super(GroupUserDao.class); + } + + @Override + protected GroupUserDao getDao() { + return (GroupUserDao)super.getDao(); + } + + @Override + public long size() { + return users2add.size() + (search == null ? getDao().count(groupId) : getDao().count(groupId, search)); + } + + @Override + public java.util.Iterator<? extends GroupUser> iterator(long first, long count) { + List<GroupUser> list = new ArrayList<>(); + list.addAll(users2add); + list.addAll(search == null && getSort() == null + ? getDao().get(groupId, (int)first, (int)count) + : getDao().get(groupId, search, (int)first, (int)count, getSortStr())); + + return list.iterator(); + } + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupsPanel.java ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupsPanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupsPanel.java index dcd492c..8fa09a3 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupsPanel.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupsPanel.java @@ -1,99 +1,99 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License") + you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.openmeetings.web.admin.groups; - -import org.apache.openmeetings.db.dao.user.GroupDao; -import org.apache.openmeetings.db.entity.user.Group; -import org.apache.openmeetings.db.entity.user.GroupUser; -import org.apache.openmeetings.web.admin.AdminPanel; -import org.apache.openmeetings.web.admin.SearchableDataView; -import org.apache.openmeetings.web.common.PagedEntityListPanel; -import org.apache.openmeetings.web.data.DataViewContainer; -import org.apache.openmeetings.web.data.OmOrderByBorder; -import org.apache.openmeetings.web.data.SearchableGroupAdminDataProvider; -import org.apache.wicket.AttributeModifier; -import org.apache.wicket.ajax.AjaxEventBehavior; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.repeater.Item; - -/** - * Modify/ CRUD operations for {@link Group} and - * {@link GroupUser} - * - * @author swagner - * - */ -@AuthorizeInstantiation({"Admin", "GroupAdmin"}) -public class GroupsPanel extends AdminPanel { - private static final long serialVersionUID = 1L; - private GroupForm form; - - public GroupsPanel(String id) { - super(id); - final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer"); - - //Adding the Group Form - form = new GroupForm("form", listContainer, new Group()); - add(form); - - //List view - SearchableDataView<Group> dataView = new SearchableDataView<Group>("groupList", new SearchableGroupAdminDataProvider<>(GroupDao.class)) { - private static final long serialVersionUID = 1L; - - @Override - protected void populateItem(Item<Group> item) { - final Group g = item.getModelObject(); - item.add(new Label("id")); - item.add(new Label("name")); - item.add(new AjaxEventBehavior("click") { - private static final long serialVersionUID = 1L; - - @Override - protected void onEvent(AjaxRequestTarget target) { - form.hideNewRecord(); - form.setModelObject(g); - form.updateView(target); - target.add(listContainer); - target.appendJavaScript("adminPanelInit();"); - } - }); - item.add(AttributeModifier.append("class", getRowClass(g.getId(), form.getModelObject().getId()))); - } - }; - - //Paging - add(listContainer.add(dataView).setOutputMarkupId(true)); - PagedEntityListPanel navigator = new PagedEntityListPanel("navigator", dataView) { - private static final long serialVersionUID = 1L; - - @Override - protected void onEvent(AjaxRequestTarget target) { - target.add(listContainer); - } - }; - DataViewContainer<Group> container = new DataViewContainer<>(listContainer, dataView, navigator); - container.addLink(new OmOrderByBorder<>("orderById", "id", container)) - .addLink(new OmOrderByBorder<>("orderByName", "name", container)); - add(container.getLinks()); - add(navigator); - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.openmeetings.web.admin.groups; + +import org.apache.openmeetings.db.dao.user.GroupDao; +import org.apache.openmeetings.db.entity.user.Group; +import org.apache.openmeetings.db.entity.user.GroupUser; +import org.apache.openmeetings.web.admin.AdminPanel; +import org.apache.openmeetings.web.admin.SearchableDataView; +import org.apache.openmeetings.web.common.PagedEntityListPanel; +import org.apache.openmeetings.web.data.DataViewContainer; +import org.apache.openmeetings.web.data.OmOrderByBorder; +import org.apache.openmeetings.web.data.SearchableGroupAdminDataProvider; +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.ajax.AjaxEventBehavior; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.repeater.Item; + +/** + * Modify/ CRUD operations for {@link Group} and + * {@link GroupUser} + * + * @author swagner + * + */ +@AuthorizeInstantiation({"Admin", "GroupAdmin"}) +public class GroupsPanel extends AdminPanel { + private static final long serialVersionUID = 1L; + private GroupForm form; + + public GroupsPanel(String id) { + super(id); + final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer"); + + //Adding the Group Form + form = new GroupForm("form", listContainer, new Group()); + add(form); + + //List view + SearchableDataView<Group> dataView = new SearchableDataView<Group>("groupList", new SearchableGroupAdminDataProvider<>(GroupDao.class)) { + private static final long serialVersionUID = 1L; + + @Override + protected void populateItem(Item<Group> item) { + final Group g = item.getModelObject(); + item.add(new Label("id")); + item.add(new Label("name")); + item.add(new AjaxEventBehavior("click") { + private static final long serialVersionUID = 1L; + + @Override + protected void onEvent(AjaxRequestTarget target) { + form.hideNewRecord(); + form.setModelObject(g); + form.updateView(target); + target.add(listContainer); + target.appendJavaScript("adminPanelInit();"); + } + }); + item.add(AttributeModifier.append("class", getRowClass(g.getId(), form.getModelObject().getId()))); + } + }; + + //Paging + add(listContainer.add(dataView).setOutputMarkupId(true)); + PagedEntityListPanel navigator = new PagedEntityListPanel("navigator", dataView) { + private static final long serialVersionUID = 1L; + + @Override + protected void onEvent(AjaxRequestTarget target) { + target.add(listContainer); + } + }; + DataViewContainer<Group> container = new DataViewContainer<>(listContainer, dataView, navigator); + container.addLink(new OmOrderByBorder<>("orderById", "id", container)) + .addLink(new OmOrderByBorder<>("orderByName", "name", container)); + add(container.getLinks()); + add(navigator); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/AddLanguageDialog.java ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/AddLanguageDialog.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/AddLanguageDialog.java index 3969db9..8fb3d30 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/AddLanguageDialog.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/AddLanguageDialog.java @@ -1,115 +1,115 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License") + you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.openmeetings.web.admin.labels; - -import java.util.Arrays; -import java.util.IllformedLocaleException; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import org.apache.openmeetings.db.dao.label.LabelDao; -import org.apache.openmeetings.web.app.Application; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.core.request.handler.IPartialPageRequestHandler; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.RequiredTextField; -import org.apache.wicket.model.Model; -import org.apache.wicket.validation.IValidatable; -import org.apache.wicket.validation.IValidator; -import org.apache.wicket.validation.ValidationError; - -import com.googlecode.wicket.jquery.core.Options; -import com.googlecode.wicket.jquery.ui.widget.dialog.AbstractFormDialog; -import com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton; -import com.googlecode.wicket.kendo.ui.panel.KendoFeedbackPanel; - -public class AddLanguageDialog extends AbstractFormDialog<String> { - private static final long serialVersionUID = 1L; - private final KendoFeedbackPanel feedback = new KendoFeedbackPanel("feedback", new Options("button", true)); - private final DialogButton add = new DialogButton("add", Application.getString(366L)); - private final Form<Void> form = new Form<>("addLangForm"); - private final RequiredTextField<String> iso = new RequiredTextField<>("iso", Model.of("")); - private final LangPanel langPanel; - - public AddLanguageDialog(String id, final LangPanel langPanel) { - super(id, Application.getString(364)); - this.langPanel = langPanel; - add(form.add(feedback, iso.setOutputMarkupId(true))); - iso.add(new IValidator<String>() { - private static final long serialVersionUID = 1L; - - @Override - public void validate(IValidatable<String> s) { - try { - new Locale.Builder().setLanguageTag(s.getValue()); - } catch (IllformedLocaleException e) { - s.error(new ValidationError("Invalid code, please use ")); //FIXME TODO add proper key - return; - } - Locale l = Locale.forLanguageTag(s.getValue()); - for (Map.Entry<Long, Locale> e : LabelDao.languages.entrySet()) { - if (e.getValue().equals(l)) { - s.error(new ValidationError("This code already added")); //FIXME TODO add proper key - break; - } - } - } - }); - } - - @Override - public Form<?> getForm() { - return form; - } - - @Override - protected List<DialogButton> getButtons() { - return Arrays.asList(add); - } - - @Override - public DialogButton getSubmitButton() { - return add; - } - - @Override - protected void onOpen(IPartialPageRequestHandler handler) { - iso.setModelObject(""); - handler.add(iso); - super.onOpen(handler); - } - - @Override - protected void onError(AjaxRequestTarget target) { - target.add(feedback); - } - - @Override - protected void onSubmit(AjaxRequestTarget target) { - try { - LabelDao.add(Locale.forLanguageTag(iso.getModelObject())); - langPanel.getLangForm().updateLanguages(target); - target.appendJavaScript("$('#addLanguage').dialog('close');"); - } catch (Exception e) { - error("Failed to add, " + e.getMessage()); //FIXME TODO add proper key - target.add(feedback); - } - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.openmeetings.web.admin.labels; + +import java.util.Arrays; +import java.util.IllformedLocaleException; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import org.apache.openmeetings.db.dao.label.LabelDao; +import org.apache.openmeetings.web.app.Application; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.core.request.handler.IPartialPageRequestHandler; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.RequiredTextField; +import org.apache.wicket.model.Model; +import org.apache.wicket.validation.IValidatable; +import org.apache.wicket.validation.IValidator; +import org.apache.wicket.validation.ValidationError; + +import com.googlecode.wicket.jquery.core.Options; +import com.googlecode.wicket.jquery.ui.widget.dialog.AbstractFormDialog; +import com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton; +import com.googlecode.wicket.kendo.ui.panel.KendoFeedbackPanel; + +public class AddLanguageDialog extends AbstractFormDialog<String> { + private static final long serialVersionUID = 1L; + private final KendoFeedbackPanel feedback = new KendoFeedbackPanel("feedback", new Options("button", true)); + private final DialogButton add = new DialogButton("add", Application.getString(366L)); + private final Form<Void> form = new Form<>("addLangForm"); + private final RequiredTextField<String> iso = new RequiredTextField<>("iso", Model.of("")); + private final LangPanel langPanel; + + public AddLanguageDialog(String id, final LangPanel langPanel) { + super(id, Application.getString(364)); + this.langPanel = langPanel; + add(form.add(feedback, iso.setOutputMarkupId(true))); + iso.add(new IValidator<String>() { + private static final long serialVersionUID = 1L; + + @Override + public void validate(IValidatable<String> s) { + try { + new Locale.Builder().setLanguageTag(s.getValue()); + } catch (IllformedLocaleException e) { + s.error(new ValidationError("Invalid code, please use ")); //FIXME TODO add proper key + return; + } + Locale l = Locale.forLanguageTag(s.getValue()); + for (Map.Entry<Long, Locale> e : LabelDao.languages.entrySet()) { + if (e.getValue().equals(l)) { + s.error(new ValidationError("This code already added")); //FIXME TODO add proper key + break; + } + } + } + }); + } + + @Override + public Form<?> getForm() { + return form; + } + + @Override + protected List<DialogButton> getButtons() { + return Arrays.asList(add); + } + + @Override + public DialogButton getSubmitButton() { + return add; + } + + @Override + protected void onOpen(IPartialPageRequestHandler handler) { + iso.setModelObject(""); + handler.add(iso); + super.onOpen(handler); + } + + @Override + protected void onError(AjaxRequestTarget target) { + target.add(feedback); + } + + @Override + protected void onSubmit(AjaxRequestTarget target) { + try { + LabelDao.add(Locale.forLanguageTag(iso.getModelObject())); + langPanel.getLangForm().updateLanguages(target); + target.appendJavaScript("$('#addLanguage').dialog('close');"); + } catch (Exception e) { + error("Failed to add, " + e.getMessage()); //FIXME TODO add proper key + target.add(feedback); + } + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LabelsForm.java ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LabelsForm.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LabelsForm.java index e61f2db..9bd555d 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LabelsForm.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LabelsForm.java @@ -1,112 +1,112 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License") + you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.openmeetings.web.admin.labels; - -import static org.apache.openmeetings.web.app.Application.getBean; - -import org.apache.openmeetings.db.dao.label.LabelDao; -import org.apache.openmeetings.db.entity.label.StringLabel; -import org.apache.openmeetings.web.admin.AdminBaseForm; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.RequiredTextField; -import org.apache.wicket.markup.html.form.TextArea; -import org.apache.wicket.model.CompoundPropertyModel; - - -/** - * Add/edit/delete {@link StringLabel} - * - * @author solomax, swagner - * - */ -public class LabelsForm extends AdminBaseForm<StringLabel> { - private static final long serialVersionUID = 1L; - private LangPanel panel; - private String key, value; - - public LabelsForm(String id, LangPanel panel, StringLabel label) { - super(id, new CompoundPropertyModel<>(label)); - this.panel = panel; - key = label.getKey(); - value = label.getValue(); - - add(new RequiredTextField<String>("key")); - add(new TextArea<String>("value")); - } - - @Override - protected void onNewSubmit(AjaxRequestTarget target, Form<?> f) { - key = null; - value = null; - setModelObject(new StringLabel(key, value)); - target.add(this); - target.appendJavaScript("adminPanelInit();"); - } - - @Override - protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) { - this.setModelObject(new StringLabel(key, value)); - target.add(this); - target.appendJavaScript("adminPanelInit();"); - } - - @Override - protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) { - try { - getBean(LabelDao.class).update(panel.language.getValue(), getModelObject()); - } catch (Exception e) { - error("Unexpected error while saving label:" + e.getMessage()); //TODO localize - } - hideNewRecord(); - target.add(panel.listContainer); - target.appendJavaScript("adminPanelInit();"); - } - - @Override - protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) { - try { - getBean(LabelDao.class).delete(panel.language.getValue(), getModelObject()); - } catch (Exception e) { - error("Unexpected error while deleting label:" + e.getMessage()); //TODO localize - } - target.add(panel.listContainer); - target.appendJavaScript("adminPanelInit();"); - } - - @Override - protected void onSaveError(AjaxRequestTarget target, Form<?> form) { - // TODO Auto-generated method stub - } - - @Override - protected void onNewError(AjaxRequestTarget target, Form<?> form) { - // TODO Auto-generated method stub - } - - @Override - protected void onRefreshError(AjaxRequestTarget target, Form<?> form) { - // TODO Auto-generated method stub - } - - @Override - protected void onDeleteError(AjaxRequestTarget target, Form<?> form) { - // TODO Auto-generated method stub - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.openmeetings.web.admin.labels; + +import static org.apache.openmeetings.web.app.Application.getBean; + +import org.apache.openmeetings.db.dao.label.LabelDao; +import org.apache.openmeetings.db.entity.label.StringLabel; +import org.apache.openmeetings.web.admin.AdminBaseForm; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.RequiredTextField; +import org.apache.wicket.markup.html.form.TextArea; +import org.apache.wicket.model.CompoundPropertyModel; + + +/** + * Add/edit/delete {@link StringLabel} + * + * @author solomax, swagner + * + */ +public class LabelsForm extends AdminBaseForm<StringLabel> { + private static final long serialVersionUID = 1L; + private LangPanel panel; + private String key, value; + + public LabelsForm(String id, LangPanel panel, StringLabel label) { + super(id, new CompoundPropertyModel<>(label)); + this.panel = panel; + key = label.getKey(); + value = label.getValue(); + + add(new RequiredTextField<String>("key")); + add(new TextArea<String>("value")); + } + + @Override + protected void onNewSubmit(AjaxRequestTarget target, Form<?> f) { + key = null; + value = null; + setModelObject(new StringLabel(key, value)); + target.add(this); + target.appendJavaScript("adminPanelInit();"); + } + + @Override + protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) { + this.setModelObject(new StringLabel(key, value)); + target.add(this); + target.appendJavaScript("adminPanelInit();"); + } + + @Override + protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) { + try { + getBean(LabelDao.class).update(panel.language.getValue(), getModelObject()); + } catch (Exception e) { + error("Unexpected error while saving label:" + e.getMessage()); //TODO localize + } + hideNewRecord(); + target.add(panel.listContainer); + target.appendJavaScript("adminPanelInit();"); + } + + @Override + protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) { + try { + getBean(LabelDao.class).delete(panel.language.getValue(), getModelObject()); + } catch (Exception e) { + error("Unexpected error while deleting label:" + e.getMessage()); //TODO localize + } + target.add(panel.listContainer); + target.appendJavaScript("adminPanelInit();"); + } + + @Override + protected void onSaveError(AjaxRequestTarget target, Form<?> form) { + // TODO Auto-generated method stub + } + + @Override + protected void onNewError(AjaxRequestTarget target, Form<?> form) { + // TODO Auto-generated method stub + } + + @Override + protected void onRefreshError(AjaxRequestTarget target, Form<?> form) { + // TODO Auto-generated method stub + } + + @Override + protected void onDeleteError(AjaxRequestTarget target, Form<?> form) { + // TODO Auto-generated method stub + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LangForm.java ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LangForm.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LangForm.java index ca65d72..1bd4d3f 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LangForm.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LangForm.java @@ -1,103 +1,103 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License") + you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.openmeetings.web.admin.labels; - -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import org.apache.openmeetings.db.dao.label.LabelDao; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.form.AjaxFormValidatingBehavior; -import org.apache.wicket.ajax.form.OnChangeAjaxBehavior; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.ChoiceRenderer; -import org.apache.wicket.markup.html.form.DropDownChoice; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.PropertyModel; -import org.apache.wicket.util.time.Duration; - -/** - * Modify the language selection, add/delete language - * - * @author solomax, swagner - * - */ -public class LangForm extends Form<Void> { - private static final long serialVersionUID = 1L; - private DropDownChoice<Map.Entry<Long, Locale>> languages; - - static List<Map.Entry<Long, Locale>> getLanguages() { - List<Map.Entry<Long, Locale>> list = new ArrayList<>(); - for (Map.Entry<Long, Locale> e : LabelDao.languages.entrySet()) { - list.add(new AbstractMap.SimpleEntry<>(e.getKey(), e.getValue())); - } - return list; - } - - public void updateLanguages(AjaxRequestTarget target) { - languages.setChoices(getLanguages()); - target.add(languages); - } - - /** - * Render Main - * - * @param id - * @param listContainer - * @param language - * @param langPanel - */ - public LangForm(String id, final WebMarkupContainer listContainer, final LangPanel langPanel) { - super(id); - setOutputMarkupId(true); - - languages = new DropDownChoice<>("language" - , new PropertyModel<Map.Entry<Long, Locale>>(langPanel, "language") - , getLanguages() - , new ChoiceRenderer<Map.Entry<Long, Locale>>() { - private static final long serialVersionUID = 1L; - - @Override - public Object getDisplayValue(Map.Entry<Long, Locale> object) { - return object.getValue().getDisplayName(); - } - - @Override - public String getIdValue(Map.Entry<Long, Locale> object, int index) { - return "" + object.getKey(); - } - }); - - languages.add(new OnChangeAjaxBehavior() { - private static final long serialVersionUID = 1L; - - @Override - protected void onUpdate(AjaxRequestTarget target) { - target.add(listContainer); - } - }); - add(languages); - // attach an ajax validation behavior to all form component's keydown - // event and throttle it down to once per second - add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND)); - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.openmeetings.web.admin.labels; + +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import org.apache.openmeetings.db.dao.label.LabelDao; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.form.AjaxFormValidatingBehavior; +import org.apache.wicket.ajax.form.OnChangeAjaxBehavior; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.form.ChoiceRenderer; +import org.apache.wicket.markup.html.form.DropDownChoice; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.util.time.Duration; + +/** + * Modify the language selection, add/delete language + * + * @author solomax, swagner + * + */ +public class LangForm extends Form<Void> { + private static final long serialVersionUID = 1L; + private DropDownChoice<Map.Entry<Long, Locale>> languages; + + static List<Map.Entry<Long, Locale>> getLanguages() { + List<Map.Entry<Long, Locale>> list = new ArrayList<>(); + for (Map.Entry<Long, Locale> e : LabelDao.languages.entrySet()) { + list.add(new AbstractMap.SimpleEntry<>(e.getKey(), e.getValue())); + } + return list; + } + + public void updateLanguages(AjaxRequestTarget target) { + languages.setChoices(getLanguages()); + target.add(languages); + } + + /** + * Render Main + * + * @param id + * @param listContainer + * @param language + * @param langPanel + */ + public LangForm(String id, final WebMarkupContainer listContainer, final LangPanel langPanel) { + super(id); + setOutputMarkupId(true); + + languages = new DropDownChoice<>("language" + , new PropertyModel<Map.Entry<Long, Locale>>(langPanel, "language") + , getLanguages() + , new ChoiceRenderer<Map.Entry<Long, Locale>>() { + private static final long serialVersionUID = 1L; + + @Override + public Object getDisplayValue(Map.Entry<Long, Locale> object) { + return object.getValue().getDisplayName(); + } + + @Override + public String getIdValue(Map.Entry<Long, Locale> object, int index) { + return "" + object.getKey(); + } + }); + + languages.add(new OnChangeAjaxBehavior() { + private static final long serialVersionUID = 1L; + + @Override + protected void onUpdate(AjaxRequestTarget target) { + target.add(listContainer); + } + }); + add(languages); + // attach an ajax validation behavior to all form component's keydown + // event and throttle it down to once per second + add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND)); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/ldaps/LdapForm.java ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/ldaps/LdapForm.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/ldaps/LdapForm.java index b4cca0a..c6a189f 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/ldaps/LdapForm.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/ldaps/LdapForm.java @@ -1,130 +1,130 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License") + you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.openmeetings.web.admin.ldaps; - -import static org.apache.openmeetings.util.OpenmeetingsVariables.WEB_DATE_PATTERN; -import static org.apache.openmeetings.web.app.Application.getBean; -import static org.apache.wicket.datetime.markup.html.basic.DateLabel.forDatePattern; - -import org.apache.openmeetings.db.dao.server.LdapConfigDao; -import org.apache.openmeetings.db.entity.server.LdapConfig; -import org.apache.openmeetings.web.admin.AdminBaseForm; -import org.apache.openmeetings.web.app.Application; -import org.apache.openmeetings.web.app.WebSession; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.form.AjaxFormValidatingBehavior; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.CheckBox; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.RequiredTextField; -import org.apache.wicket.markup.html.form.TextArea; -import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.model.CompoundPropertyModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.util.time.Duration; - -/** - * Form components to insert/update/delete {@link LdapConfig} - * - * @author swagner - * - */ -public class LdapForm extends AdminBaseForm<LdapConfig> { - private static final long serialVersionUID = 1L; - private final WebMarkupContainer listContainer; - - public LdapForm(String id, WebMarkupContainer listContainer, final LdapConfig ldapConfig) { - super(id, new CompoundPropertyModel<>(ldapConfig)); - setOutputMarkupId(true); - this.listContainer = listContainer; - - add(new RequiredTextField<String>("name").setLabel(Model.of(Application.getString(1108)))); - add(new CheckBox("active")); - add(forDatePattern("inserted", WEB_DATE_PATTERN)); - add(new Label("insertedby.login")); - add(forDatePattern("updated", WEB_DATE_PATTERN)); - add(new Label("updatedby.login")); - add(new RequiredTextField<String>("configFileName").setLabel(Model.of(Application.getString(1115)))); - add(new CheckBox("addDomainToUserName")); - add(new TextField<String>("domain")); - add(new TextArea<String>("comment")); - - // attach an ajax validation behavior to all form component's keydown - // event and throttle it down to once per second - add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND)); - } - - @Override - protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) { - setModelObject(getBean(LdapConfigDao.class).update(getModelObject(), WebSession.getUserId())); - hideNewRecord(); - target.add(this, listContainer); - target.appendJavaScript("adminPanelInit();"); - } - - @Override - protected void onNewSubmit(AjaxRequestTarget target, Form<?> form) { - this.setModelObject(new LdapConfig()); - target.add(this); - target.appendJavaScript("adminPanelInit();"); - } - - @Override - protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) { - LdapConfig ldapConfig = this.getModelObject(); - if (ldapConfig.getId() != null) { - ldapConfig = getBean(LdapConfigDao.class).get(ldapConfig.getId()); - } else { - ldapConfig = new LdapConfig(); - } - this.setModelObject(ldapConfig); - target.add(this); - target.appendJavaScript("adminPanelInit();"); - } - - @Override - protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) { - getBean(LdapConfigDao.class).delete(getModelObject(), WebSession.getUserId()); - this.setModelObject(new LdapConfig()); - target.add(listContainer); - target.add(this); - target.appendJavaScript("adminPanelInit();"); - } - - @Override - protected void onSaveError(AjaxRequestTarget target, Form<?> form) { - // TODO Auto-generated method stub - } - - @Override - protected void onNewError(AjaxRequestTarget target, Form<?> form) { - // TODO Auto-generated method stub - } - - @Override - protected void onRefreshError(AjaxRequestTarget target, Form<?> form) { - // TODO Auto-generated method stub - } - - @Override - protected void onDeleteError(AjaxRequestTarget target, Form<?> form) { - // TODO Auto-generated method stub - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.openmeetings.web.admin.ldaps; + +import static org.apache.openmeetings.util.OpenmeetingsVariables.WEB_DATE_PATTERN; +import static org.apache.openmeetings.web.app.Application.getBean; +import static org.apache.wicket.datetime.markup.html.basic.DateLabel.forDatePattern; + +import org.apache.openmeetings.db.dao.server.LdapConfigDao; +import org.apache.openmeetings.db.entity.server.LdapConfig; +import org.apache.openmeetings.web.admin.AdminBaseForm; +import org.apache.openmeetings.web.app.Application; +import org.apache.openmeetings.web.app.WebSession; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.form.AjaxFormValidatingBehavior; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.CheckBox; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.RequiredTextField; +import org.apache.wicket.markup.html.form.TextArea; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.model.CompoundPropertyModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.util.time.Duration; + +/** + * Form components to insert/update/delete {@link LdapConfig} + * + * @author swagner + * + */ +public class LdapForm extends AdminBaseForm<LdapConfig> { + private static final long serialVersionUID = 1L; + private final WebMarkupContainer listContainer; + + public LdapForm(String id, WebMarkupContainer listContainer, final LdapConfig ldapConfig) { + super(id, new CompoundPropertyModel<>(ldapConfig)); + setOutputMarkupId(true); + this.listContainer = listContainer; + + add(new RequiredTextField<String>("name").setLabel(Model.of(Application.getString(1108)))); + add(new CheckBox("active")); + add(forDatePattern("inserted", WEB_DATE_PATTERN)); + add(new Label("insertedby.login")); + add(forDatePattern("updated", WEB_DATE_PATTERN)); + add(new Label("updatedby.login")); + add(new RequiredTextField<String>("configFileName").setLabel(Model.of(Application.getString(1115)))); + add(new CheckBox("addDomainToUserName")); + add(new TextField<String>("domain")); + add(new TextArea<String>("comment")); + + // attach an ajax validation behavior to all form component's keydown + // event and throttle it down to once per second + add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND)); + } + + @Override + protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) { + setModelObject(getBean(LdapConfigDao.class).update(getModelObject(), WebSession.getUserId())); + hideNewRecord(); + target.add(this, listContainer); + target.appendJavaScript("adminPanelInit();"); + } + + @Override + protected void onNewSubmit(AjaxRequestTarget target, Form<?> form) { + this.setModelObject(new LdapConfig()); + target.add(this); + target.appendJavaScript("adminPanelInit();"); + } + + @Override + protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) { + LdapConfig ldapConfig = this.getModelObject(); + if (ldapConfig.getId() != null) { + ldapConfig = getBean(LdapConfigDao.class).get(ldapConfig.getId()); + } else { + ldapConfig = new LdapConfig(); + } + this.setModelObject(ldapConfig); + target.add(this); + target.appendJavaScript("adminPanelInit();"); + } + + @Override + protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) { + getBean(LdapConfigDao.class).delete(getModelObject(), WebSession.getUserId()); + this.setModelObject(new LdapConfig()); + target.add(listContainer); + target.add(this); + target.appendJavaScript("adminPanelInit();"); + } + + @Override + protected void onSaveError(AjaxRequestTarget target, Form<?> form) { + // TODO Auto-generated method stub + } + + @Override + protected void onNewError(AjaxRequestTarget target, Form<?> form) { + // TODO Auto-generated method stub + } + + @Override + protected void onRefreshError(AjaxRequestTarget target, Form<?> form) { + // TODO Auto-generated method stub + } + + @Override + protected void onDeleteError(AjaxRequestTarget target, Form<?> form) { + // TODO Auto-generated method stub + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/ldaps/LdapsPanel.java ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/ldaps/LdapsPanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/ldaps/LdapsPanel.java index 4d51408..a6b1c12 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/ldaps/LdapsPanel.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/ldaps/LdapsPanel.java @@ -1,93 +1,93 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License") + you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.openmeetings.web.admin.ldaps; - -import org.apache.openmeetings.db.dao.server.LdapConfigDao; -import org.apache.openmeetings.db.entity.server.LdapConfig; -import org.apache.openmeetings.web.admin.AdminPanel; -import org.apache.openmeetings.web.admin.SearchableDataView; -import org.apache.openmeetings.web.common.PagedEntityListPanel; -import org.apache.openmeetings.web.data.DataViewContainer; -import org.apache.openmeetings.web.data.OmOrderByBorder; -import org.apache.openmeetings.web.data.SearchableDataProvider; -import org.apache.wicket.AttributeModifier; -import org.apache.wicket.ajax.AjaxEventBehavior; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.repeater.Item; - -/** - * {@link AdminPanel} to list and modify {@link LdapConfig} - * - * @author swagner - * - */ -public class LdapsPanel extends AdminPanel { - private static final long serialVersionUID = 1L; - final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer"); - private LdapForm form; - - public LdapsPanel(String id) { - super(id); - SearchableDataView<LdapConfig> dataView = new SearchableDataView<LdapConfig>("ldapList" - , new SearchableDataProvider<>(LdapConfigDao.class)) { - private static final long serialVersionUID = 1L; - - @Override - protected void populateItem(final Item<LdapConfig> item) { - final LdapConfig lc = item.getModelObject(); - item.add(new Label("id")); - item.add(new Label("name")); - item.add(new Label("configFileName")); - item.add(new AjaxEventBehavior("click") { - private static final long serialVersionUID = 1L; - - @Override - protected void onEvent(AjaxRequestTarget target) { - form.setModelObject(lc); - form.hideNewRecord(); - target.add(form, listContainer); - target.appendJavaScript("adminPanelInit();"); - } - }); - item.add(AttributeModifier.replace("class", getRowClass(lc.getId(), form.getModelObject().getId()))); - } - }; - add(listContainer.add(dataView).setOutputMarkupId(true)); - PagedEntityListPanel navigator = new PagedEntityListPanel("navigator", dataView) { - private static final long serialVersionUID = 1L; - - @Override - protected void onEvent(AjaxRequestTarget target) { - target.add(listContainer); - } - }; - DataViewContainer<LdapConfig> container = new DataViewContainer<>(listContainer, dataView, navigator); - container.addLink(new OmOrderByBorder<>("orderById", "id", container)) - .addLink(new OmOrderByBorder<>("orderByName", "name", container)) - .addLink(new OmOrderByBorder<>("orderByFile", "configFileName", container)); - add(container.getLinks()); - add(navigator); - - form = new LdapForm("form", listContainer, new LdapConfig()); - form.showNewRecord(); - add(form); - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.openmeetings.web.admin.ldaps; + +import org.apache.openmeetings.db.dao.server.LdapConfigDao; +import org.apache.openmeetings.db.entity.server.LdapConfig; +import org.apache.openmeetings.web.admin.AdminPanel; +import org.apache.openmeetings.web.admin.SearchableDataView; +import org.apache.openmeetings.web.common.PagedEntityListPanel; +import org.apache.openmeetings.web.data.DataViewContainer; +import org.apache.openmeetings.web.data.OmOrderByBorder; +import org.apache.openmeetings.web.data.SearchableDataProvider; +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.ajax.AjaxEventBehavior; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.repeater.Item; + +/** + * {@link AdminPanel} to list and modify {@link LdapConfig} + * + * @author swagner + * + */ +public class LdapsPanel extends AdminPanel { + private static final long serialVersionUID = 1L; + final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer"); + private LdapForm form; + + public LdapsPanel(String id) { + super(id); + SearchableDataView<LdapConfig> dataView = new SearchableDataView<LdapConfig>("ldapList" + , new SearchableDataProvider<>(LdapConfigDao.class)) { + private static final long serialVersionUID = 1L; + + @Override + protected void populateItem(final Item<LdapConfig> item) { + final LdapConfig lc = item.getModelObject(); + item.add(new Label("id")); + item.add(new Label("name")); + item.add(new Label("configFileName")); + item.add(new AjaxEventBehavior("click") { + private static final long serialVersionUID = 1L; + + @Override + protected void onEvent(AjaxRequestTarget target) { + form.setModelObject(lc); + form.hideNewRecord(); + target.add(form, listContainer); + target.appendJavaScript("adminPanelInit();"); + } + }); + item.add(AttributeModifier.replace("class", getRowClass(lc.getId(), form.getModelObject().getId()))); + } + }; + add(listContainer.add(dataView).setOutputMarkupId(true)); + PagedEntityListPanel navigator = new PagedEntityListPanel("navigator", dataView) { + private static final long serialVersionUID = 1L; + + @Override + protected void onEvent(AjaxRequestTarget target) { + target.add(listContainer); + } + }; + DataViewContainer<LdapConfig> container = new DataViewContainer<>(listContainer, dataView, navigator); + container.addLink(new OmOrderByBorder<>("orderById", "id", container)) + .addLink(new OmOrderByBorder<>("orderByName", "name", container)) + .addLink(new OmOrderByBorder<>("orderByFile", "configFileName", container)); + add(container.getLinks()); + add(navigator); + + form = new LdapForm("form", listContainer, new LdapConfig()); + form.showNewRecord(); + add(form); + } +}
