You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/05/18 05:36:17 UTC
[10/26] openmeetings git commit: Normalize all the line endings
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-util/src/main/java/org/apache/openmeetings/util/process/ProcessHelper.java
----------------------------------------------------------------------
diff --git a/openmeetings-util/src/main/java/org/apache/openmeetings/util/process/ProcessHelper.java b/openmeetings-util/src/main/java/org/apache/openmeetings/util/process/ProcessHelper.java
index 0e467be..ebb0a54 100644
--- a/openmeetings-util/src/main/java/org/apache/openmeetings/util/process/ProcessHelper.java
+++ b/openmeetings-util/src/main/java/org/apache/openmeetings/util/process/ProcessHelper.java
@@ -1,116 +1,116 @@
-/*
- * 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.util.process;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.openmeetings.util.OpenmeetingsVariables;
-import org.red5.logging.Red5LoggerFactory;
-import org.slf4j.Logger;
-
-public class ProcessHelper {
- public static final Logger log = Red5LoggerFactory.getLogger(ProcessHelper.class, OpenmeetingsVariables.webAppRootKey);
-
- public static ConverterProcessResult executeScriptWindows(String process, String[] argv) {
- try {
- String[] cmd = new String[argv.length + 2];
- cmd[0] = "cmd.exe";
- cmd[1] = "/C";
- System.arraycopy(argv, 0, cmd, 2, argv.length);
- Map<String, String> env = new HashMap<>();
- return executeScript(process, cmd, env);
- } catch (Exception t) {
- log.error("executeScriptWindows", t);
- return new ConverterProcessResult(process, t.getMessage(), t);
- }
- }
-
- private static String getCommand(String[] argv) {
- StringBuffer tString = new StringBuffer();
- for (int i = 0; i < argv.length; i++) {
- tString.append(argv[i]).append(" ");
- }
- return tString.toString();
- }
-
- private static void debugCommandStart(String desc, String[] argv) {
- if (log.isDebugEnabled()) {
- log.debug("START " + desc + " ################# ");
- log.debug(getCommand(argv));
- }
- }
-
- private static void debugCommandEnd(String desc) {
- if (log.isDebugEnabled()) {
- log.debug("END " + desc + " ################# ");
- }
- }
-
- public static ConverterProcessResult executeScript(String process, String[] argv) {
- Map<String, String> env = new HashMap<>();
- return executeScript(process, argv, env);
- }
-
- public static ConverterProcessResult executeScript(String process, String[] argv, Map<? extends String, ? extends String> env) {
- ConverterProcessResult res = new ConverterProcessResult();
- res.setProcess(process);
- debugCommandStart(process, argv);
-
- Process proc = null;
- try {
- res.setCommand(getCommand(argv));
- res.setOut("");
-
- // By using the process Builder we have access to modify the
- // environment variables
- // that is handy to set variables to run it inside eclipse
- ProcessBuilder pb = new ProcessBuilder(argv);
- pb.environment().putAll(env);
-
- proc = pb.start();
-
- // 20-minute timeout for command execution
- // FFMPEG conversion of Recordings may take a real long time until
- // its finished
- proc.waitFor(20, TimeUnit.MINUTES);
-
- res.setExitCode(proc.exitValue());
- res.setOut(IOUtils.toString(proc.getInputStream(), UTF_8));
- res.setError(IOUtils.toString(proc.getErrorStream(), UTF_8));
- } catch (Throwable t) {
- log.error("executeScript", t);
- res.setError(t.getMessage());
- res.setException(t.toString());
- res.setExitCode(-1);
- } finally {
- if (proc != null) {
- proc.destroy();
- }
- }
-
- debugCommandEnd(process);
- return res;
- }
-}
-
+/*
+ * 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.util.process;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.openmeetings.util.OpenmeetingsVariables;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+
+public class ProcessHelper {
+ public static final Logger log = Red5LoggerFactory.getLogger(ProcessHelper.class, OpenmeetingsVariables.webAppRootKey);
+
+ public static ConverterProcessResult executeScriptWindows(String process, String[] argv) {
+ try {
+ String[] cmd = new String[argv.length + 2];
+ cmd[0] = "cmd.exe";
+ cmd[1] = "/C";
+ System.arraycopy(argv, 0, cmd, 2, argv.length);
+ Map<String, String> env = new HashMap<>();
+ return executeScript(process, cmd, env);
+ } catch (Exception t) {
+ log.error("executeScriptWindows", t);
+ return new ConverterProcessResult(process, t.getMessage(), t);
+ }
+ }
+
+ private static String getCommand(String[] argv) {
+ StringBuffer tString = new StringBuffer();
+ for (int i = 0; i < argv.length; i++) {
+ tString.append(argv[i]).append(" ");
+ }
+ return tString.toString();
+ }
+
+ private static void debugCommandStart(String desc, String[] argv) {
+ if (log.isDebugEnabled()) {
+ log.debug("START " + desc + " ################# ");
+ log.debug(getCommand(argv));
+ }
+ }
+
+ private static void debugCommandEnd(String desc) {
+ if (log.isDebugEnabled()) {
+ log.debug("END " + desc + " ################# ");
+ }
+ }
+
+ public static ConverterProcessResult executeScript(String process, String[] argv) {
+ Map<String, String> env = new HashMap<>();
+ return executeScript(process, argv, env);
+ }
+
+ public static ConverterProcessResult executeScript(String process, String[] argv, Map<? extends String, ? extends String> env) {
+ ConverterProcessResult res = new ConverterProcessResult();
+ res.setProcess(process);
+ debugCommandStart(process, argv);
+
+ Process proc = null;
+ try {
+ res.setCommand(getCommand(argv));
+ res.setOut("");
+
+ // By using the process Builder we have access to modify the
+ // environment variables
+ // that is handy to set variables to run it inside eclipse
+ ProcessBuilder pb = new ProcessBuilder(argv);
+ pb.environment().putAll(env);
+
+ proc = pb.start();
+
+ // 20-minute timeout for command execution
+ // FFMPEG conversion of Recordings may take a real long time until
+ // its finished
+ proc.waitFor(20, TimeUnit.MINUTES);
+
+ res.setExitCode(proc.exitValue());
+ res.setOut(IOUtils.toString(proc.getInputStream(), UTF_8));
+ res.setError(IOUtils.toString(proc.getErrorStream(), UTF_8));
+ } catch (Throwable t) {
+ log.error("executeScript", t);
+ res.setError(t.getMessage());
+ res.setException(t.toString());
+ res.setExitCode(-1);
+ } finally {
+ if (proc != null) {
+ proc.destroy();
+ }
+ }
+
+ debugCommandEnd(process);
+ return res;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-util/src/site/site.xml
----------------------------------------------------------------------
diff --git a/openmeetings-util/src/site/site.xml b/openmeetings-util/src/site/site.xml
index c26954e..0d9f35c 100644
--- a/openmeetings-util/src/site/site.xml
+++ b/openmeetings-util/src/site/site.xml
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
- -->
-<project xmlns="http://maven.apache.org/DECORATION/1.7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.7.0 http://maven.apache.org/xsd/decoration-1.7.0.xsd"
- name="Apache OpenMeetings Project">
-
- <body>
- <menu ref="parent"/>
- <menu name="Project">
- <item name="About" href="/index.html" />
- <item name="Info" href="/project-info.html" />
- <item name="Summary" href="/project-summary.html" />
- <item name="License" href="/license.html" />
- <item name="Dependencies" href="/dependencies.html" />
- <item name="Dependency Convergence" href="/dependency-convergence.html" />
- <item name="RAT Report" href="/rat-report.html" />
- <item name="JavaDoc" href="/apidocs/index.html" target="_blank" />
- </menu>
- </body>
- <custom>
- <reflowSkin>
- <bottomNav maxSpan="12">
- <column>Parent Project</column>
- <column>Project</column>
- </bottomNav>
- </reflowSkin>
- </custom>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed 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.
+ -->
+<project xmlns="http://maven.apache.org/DECORATION/1.7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.7.0 http://maven.apache.org/xsd/decoration-1.7.0.xsd"
+ name="Apache OpenMeetings Project">
+
+ <body>
+ <menu ref="parent"/>
+ <menu name="Project">
+ <item name="About" href="/index.html" />
+ <item name="Info" href="/project-info.html" />
+ <item name="Summary" href="/project-summary.html" />
+ <item name="License" href="/license.html" />
+ <item name="Dependencies" href="/dependencies.html" />
+ <item name="Dependency Convergence" href="/dependency-convergence.html" />
+ <item name="RAT Report" href="/rat-report.html" />
+ <item name="JavaDoc" href="/apidocs/index.html" target="_blank" />
+ </menu>
+ </body>
+ <custom>
+ <reflowSkin>
+ <bottomNav maxSpan="12">
+ <column>Parent Project</column>
+ <column>Project</column>
+ </bottomNav>
+ </reflowSkin>
+ </custom>
+</project>
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/AdminBaseForm.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/AdminBaseForm.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/AdminBaseForm.java
index 7405178..2f100ed 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/AdminBaseForm.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/AdminBaseForm.java
@@ -1,181 +1,181 @@
-/*
- * 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;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.IModel;
-
-/**
- * provides basic functionality to insert, update, remove, refresh record in
- * admin section
- *
- * @author swagner
- *
- * @param <T>
- */
-public abstract class AdminBaseForm<T> extends Form<T> {
- private static final long serialVersionUID = 1L;
- private AdminSavePanel<T> savePanel;
-
- public AdminBaseForm(String id, IModel<T> object) {
- super(id, object);
-
- savePanel = new AdminSavePanel<T>("buttons", this) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
- AdminBaseForm.this.onSaveSubmit(target, form);
- }
-
- @Override
- protected void onSaveError(AjaxRequestTarget target, Form<?> form) {
- AdminBaseForm.this.onSaveError(target, form);
- }
-
- @Override
- protected void onNewSubmit(AjaxRequestTarget target, Form<?> form) {
- AdminBaseForm.this.onNewSubmit(target, form);
- }
-
- @Override
- protected void onNewError(AjaxRequestTarget target, Form<?> form) {
- AdminBaseForm.this.onNewError(target, form);
- }
-
- @Override
- protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
- AdminBaseForm.this.onRefreshSubmit(target, form);
- }
-
- @Override
- protected void onRefreshError(AjaxRequestTarget target, Form<?> form) {
- AdminBaseForm.this.onRefreshError(target, form);
- }
-
- @Override
- protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) {
- AdminBaseForm.this.onDeleteSubmit(target, form);
- }
-
- @Override
- protected void onDeleteError(AjaxRequestTarget target, Form<?> form) {
- AdminBaseForm.this.onDeleteError(target, form);
- }
-
- @Override
- protected boolean isNewBtnVisible() {
- return AdminBaseForm.this.isNewBtnVisible();
- }
-
- @Override
- protected boolean isDelBtnVisible() {
- return AdminBaseForm.this.isDelBtnVisible();
- }
- };
- add(savePanel);
- }
-
- /**
- * @see AdminBaseForm#hideNewRecord()
- */
- public void hideNewRecord() {
- savePanel.hideNewRecord();
- }
-
- /**
- * @see AdminBaseForm#showNewRecord()
- */
- public void showNewRecord() {
- savePanel.showNewRecord();
- }
-
- protected boolean isNewBtnVisible() {
- return true;
- }
-
- protected boolean isDelBtnVisible() {
- return true;
- }
- /**
- * invoked when user press save button
- *
- * @param target
- * @param form
- */
- protected abstract void onSaveSubmit(AjaxRequestTarget target, Form<?> form);
-
- /**
- * invoked when save has error
- *
- * @param target
- * @param form
- */
- protected abstract void onSaveError(AjaxRequestTarget target, Form<?> form);
-
- /**
- * invoked when new button is pressed
- *
- * @param target
- * @param form
- */
- protected abstract void onNewSubmit(AjaxRequestTarget target, Form<?> form);
-
- /**
- * invoked if new has error
- *
- * @param target
- * @param form
- */
- protected abstract void onNewError(AjaxRequestTarget target, Form<?> form);
-
- /**
- * invoked when refresh button is pressed
- *
- * @param target
- * @param form
- */
- protected abstract void onRefreshSubmit(AjaxRequestTarget target, Form<?> form);
-
- /**
- * invoked when refresh has error
- *
- * @param target
- * @param form
- */
- protected abstract void onRefreshError(AjaxRequestTarget target, Form<?> form);
-
- /**
- * invoked when delete button is pressed
- *
- * @param target
- * @param form
- */
- protected abstract void onDeleteSubmit(AjaxRequestTarget target, Form<?> form);
-
- /**
- * invoked when delete has error
- *
- * @param target
- * @param form
- */
- protected abstract void onDeleteError(AjaxRequestTarget target, Form<?> 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;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.model.IModel;
+
+/**
+ * provides basic functionality to insert, update, remove, refresh record in
+ * admin section
+ *
+ * @author swagner
+ *
+ * @param <T>
+ */
+public abstract class AdminBaseForm<T> extends Form<T> {
+ private static final long serialVersionUID = 1L;
+ private AdminSavePanel<T> savePanel;
+
+ public AdminBaseForm(String id, IModel<T> object) {
+ super(id, object);
+
+ savePanel = new AdminSavePanel<T>("buttons", this) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
+ AdminBaseForm.this.onSaveSubmit(target, form);
+ }
+
+ @Override
+ protected void onSaveError(AjaxRequestTarget target, Form<?> form) {
+ AdminBaseForm.this.onSaveError(target, form);
+ }
+
+ @Override
+ protected void onNewSubmit(AjaxRequestTarget target, Form<?> form) {
+ AdminBaseForm.this.onNewSubmit(target, form);
+ }
+
+ @Override
+ protected void onNewError(AjaxRequestTarget target, Form<?> form) {
+ AdminBaseForm.this.onNewError(target, form);
+ }
+
+ @Override
+ protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
+ AdminBaseForm.this.onRefreshSubmit(target, form);
+ }
+
+ @Override
+ protected void onRefreshError(AjaxRequestTarget target, Form<?> form) {
+ AdminBaseForm.this.onRefreshError(target, form);
+ }
+
+ @Override
+ protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) {
+ AdminBaseForm.this.onDeleteSubmit(target, form);
+ }
+
+ @Override
+ protected void onDeleteError(AjaxRequestTarget target, Form<?> form) {
+ AdminBaseForm.this.onDeleteError(target, form);
+ }
+
+ @Override
+ protected boolean isNewBtnVisible() {
+ return AdminBaseForm.this.isNewBtnVisible();
+ }
+
+ @Override
+ protected boolean isDelBtnVisible() {
+ return AdminBaseForm.this.isDelBtnVisible();
+ }
+ };
+ add(savePanel);
+ }
+
+ /**
+ * @see AdminBaseForm#hideNewRecord()
+ */
+ public void hideNewRecord() {
+ savePanel.hideNewRecord();
+ }
+
+ /**
+ * @see AdminBaseForm#showNewRecord()
+ */
+ public void showNewRecord() {
+ savePanel.showNewRecord();
+ }
+
+ protected boolean isNewBtnVisible() {
+ return true;
+ }
+
+ protected boolean isDelBtnVisible() {
+ return true;
+ }
+ /**
+ * invoked when user press save button
+ *
+ * @param target
+ * @param form
+ */
+ protected abstract void onSaveSubmit(AjaxRequestTarget target, Form<?> form);
+
+ /**
+ * invoked when save has error
+ *
+ * @param target
+ * @param form
+ */
+ protected abstract void onSaveError(AjaxRequestTarget target, Form<?> form);
+
+ /**
+ * invoked when new button is pressed
+ *
+ * @param target
+ * @param form
+ */
+ protected abstract void onNewSubmit(AjaxRequestTarget target, Form<?> form);
+
+ /**
+ * invoked if new has error
+ *
+ * @param target
+ * @param form
+ */
+ protected abstract void onNewError(AjaxRequestTarget target, Form<?> form);
+
+ /**
+ * invoked when refresh button is pressed
+ *
+ * @param target
+ * @param form
+ */
+ protected abstract void onRefreshSubmit(AjaxRequestTarget target, Form<?> form);
+
+ /**
+ * invoked when refresh has error
+ *
+ * @param target
+ * @param form
+ */
+ protected abstract void onRefreshError(AjaxRequestTarget target, Form<?> form);
+
+ /**
+ * invoked when delete button is pressed
+ *
+ * @param target
+ * @param form
+ */
+ protected abstract void onDeleteSubmit(AjaxRequestTarget target, Form<?> form);
+
+ /**
+ * invoked when delete has error
+ *
+ * @param target
+ * @param form
+ */
+ protected abstract void onDeleteError(AjaxRequestTarget target, Form<?> form);
+
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/SearchableDataView.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/SearchableDataView.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/SearchableDataView.java
index 8bc5450..ee12b8a 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/SearchableDataView.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/SearchableDataView.java
@@ -1,45 +1,45 @@
-/*
- * 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;
-
-import org.apache.openmeetings.db.entity.IDataProviderEntity;
-import org.apache.openmeetings.web.data.SearchableDataProvider;
-import org.apache.wicket.markup.repeater.data.DataView;
-
-/**
- * Provides {@link SearchableDataProvider}
- *
- * @author swagner
- *
- * @param <T>
- */
-public abstract class SearchableDataView<T extends IDataProviderEntity> extends DataView<T> {
- private static final long serialVersionUID = 1L;
- private SearchableDataProvider<T> dp;
-
- public SearchableDataView(String id, SearchableDataProvider<T> dp) {
- super(id, dp);
- this.dp = dp;
- }
-
- @Override
- public SearchableDataProvider<T> getDataProvider() {
- return dp;
- }
-}
+/*
+ * 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;
+
+import org.apache.openmeetings.db.entity.IDataProviderEntity;
+import org.apache.openmeetings.web.data.SearchableDataProvider;
+import org.apache.wicket.markup.repeater.data.DataView;
+
+/**
+ * Provides {@link SearchableDataProvider}
+ *
+ * @author swagner
+ *
+ * @param <T>
+ */
+public abstract class SearchableDataView<T extends IDataProviderEntity> extends DataView<T> {
+ private static final long serialVersionUID = 1L;
+ private SearchableDataProvider<T> dp;
+
+ public SearchableDataView(String id, SearchableDataProvider<T> dp) {
+ super(id, dp);
+ this.dp = dp;
+ }
+
+ @Override
+ public SearchableDataProvider<T> getDataProvider() {
+ return dp;
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/backup/BackupPanel.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/backup/BackupPanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/backup/BackupPanel.java
index f804ba6..758890f 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/backup/BackupPanel.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/backup/BackupPanel.java
@@ -1,242 +1,242 @@
-/*
- * 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.backup;
-
-import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
-import static org.apache.openmeetings.web.app.Application.getBean;
-
-import java.io.File;
-import java.text.DecimalFormat;
-import java.util.Date;
-
-import org.apache.openmeetings.backup.BackupExport;
-import org.apache.openmeetings.backup.BackupImport;
-import org.apache.openmeetings.backup.ProgressHolder;
-import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
-import org.apache.openmeetings.util.CalendarPatterns;
-import org.apache.openmeetings.util.OmFileHelper;
-import org.apache.openmeetings.web.admin.AdminPanel;
-import org.apache.openmeetings.web.app.Application;
-import org.apache.openmeetings.web.util.AjaxDownload;
-import org.apache.openmeetings.web.util.upload.BootstrapFileUploadBehavior;
-import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
-import org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar;
-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.upload.FileUpload;
-import org.apache.wicket.markup.html.form.upload.FileUploadField;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.util.lang.Bytes;
-import org.apache.wicket.util.resource.FileResourceStream;
-import org.apache.wicket.util.time.Duration;
-import org.red5.logging.Red5LoggerFactory;
-import org.slf4j.Logger;
-
-import com.googlecode.wicket.jquery.core.Options;
-import com.googlecode.wicket.jquery.ui.form.button.AjaxButton;
-import com.googlecode.wicket.jquery.ui.widget.progressbar.ProgressBar;
-import com.googlecode.wicket.kendo.ui.panel.KendoFeedbackPanel;
-/**
- * Panel component to manage Backup Import/Export
- *
- * @author swagner
- *
- */
-public class BackupPanel extends AdminPanel {
- private static final Logger log = Red5LoggerFactory.getLogger(BackupPanel.class, webAppRootKey);
-
- private static final long serialVersionUID = -1L;
-
- private final KendoFeedbackPanel feedback = new KendoFeedbackPanel("feedback", new Options("button", true));
-
- /**
- * Form to handle upload files
- *
- * @author swagner
- *
- */
- private class BackupForm extends Form<Void> {
- private static final long serialVersionUID = 1L;
- private final FileUploadField fileUploadField;
- private final Model<Boolean> includeFilesInBackup = Model.of(true);
- private final AbstractAjaxTimerBehavior timer;
- private final ProgressBar progressBar;
- private File backupFile;
- private Throwable th = null;
- private boolean started = false;
- private ProgressHolder progressHolder;
-
- public BackupForm(String id) {
- super(id);
-
- // set this form to multipart mode (allways needed for uploads!)
- setMultiPart(true);
-
- // set max upload size in form as info text
- Long maxBytes = getBean(ConfigurationDao.class).getMaxUploadSize();
- double megaBytes = maxBytes.doubleValue() / 1024 / 1024;
- DecimalFormat formatter = new DecimalFormat("#,###.00");
- add(new Label("MaxUploadSize", formatter.format(megaBytes)));
-
- // Add one file input field
- fileUploadField = new FileUploadField("fileInput");
-
- add(new CheckBox("includeFilesInBackup", includeFilesInBackup));
-
- // Set maximum size controlled by configuration
- setMaxSize(Bytes.bytes(maxBytes));
-
- // Add a component to download a file without page refresh
- final AjaxDownload download = new AjaxDownload();
- add(download);
- // add an download button
- add(new AjaxButton("download", this) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onSubmit(AjaxRequestTarget target) {
- String dateString = "backup_" + CalendarPatterns.getTimeForStreamId(new Date());
- backupFile = new File(OmFileHelper.getUploadBackupDir(), dateString + ".zip");
- th = null;
- started = true;
- progressHolder = new ProgressHolder();
-
- timer.restart(target);
- new Thread(new BackupProcess(getBean(BackupExport.class), includeFilesInBackup.getObject())
- , "Openmeetings - " + dateString).start();
-
- // repaint the feedback panel so that it is hidden
- target.add(feedback, progressBar.setVisible(true));
- }
-
- @Override
- protected void onError(AjaxRequestTarget target) {
- // repaint the feedback panel so errors are shown
- target.add(feedback);
- }
- });
- add(timer = new AbstractAjaxTimerBehavior(Duration.ONE_SECOND) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onTimer(AjaxRequestTarget target) {
- if (!started) {
- timer.stop(target);
- return;
- }
- if (th != null) {
- timer.stop(target);
- //TODO change text, localize
- progressBar.setVisible(false);
- feedback.error(th.getMessage());
- target.add(feedback);
- } else {
- progressBar.setModelObject(progressHolder.getProgress());
- progressBar.refresh(target);
- //TODO add current step result as info
- }
- }
- });
- add((progressBar = new ProgressBar("dprogress", new Model<>(0)) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onComplete(AjaxRequestTarget target) {
- timer.stop(target);
- target.add(progressBar.setVisible(false));
-
- download.setFileName(backupFile.getName());
- download.setResourceStream(new FileResourceStream(backupFile));
- download.initiate(target);
- }
- }).setVisible(false).setOutputMarkupPlaceholderTag(true));
- add(fileUploadField.add(new AjaxFormSubmitBehavior(this, "change") {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onSubmit(AjaxRequestTarget target) {
- FileUpload upload = fileUploadField.getFileUpload();
- try {
- if (upload == null || upload.getInputStream() == null) {
- feedback.error("File is empty");
- target.add(feedback);
- return;
- }
- getBean(BackupImport.class).performImport(upload.getInputStream());
- } catch (Exception e) {
- log.error("Exception on panel backup upload ", e);
- feedback.error(e);
- }
- // repaint the feedback panel so that it is hidden
- target.add(feedback);
- }
-
- @Override
- protected void onError(AjaxRequestTarget target) {
- // repaint the feedback panel so errors are shown
- target.add(feedback);
- }
- }));
- add(new Label("cmdLineDesc", Application.getString(1505)).setEscapeModelStrings(false));
- }
-
- @Override
- protected void onDetach() {
- includeFilesInBackup.detach();
- super.onDetach();
- }
-
- private class BackupProcess implements Runnable {
- private BackupExport backup;
- private boolean includeFiles;
-
- public BackupProcess(BackupExport backup, boolean includeFiles) {
- this.backup = backup;
- this.includeFiles = includeFiles;
- th = null;
- }
-
- @Override
- public void run() {
- try {
- backup.performExport(backupFile, includeFiles, progressHolder);
- } catch (Exception e) {
- log.error("Exception on panel backup download ", e);
- th = e;
- }
- }
- }
- }
-
- public BackupPanel(String id) {
- super(id);
-
- add(feedback);
-
- BackupForm backupForm = new BackupForm("backupUpload");
-
- backupForm.add(new UploadProgressBar("progress", backupForm, backupForm.fileUploadField));
-
- add(backupForm);
- add(BootstrapFileUploadBehavior.INSTANCE);
- }
-}
+/*
+ * 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.backup;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.web.app.Application.getBean;
+
+import java.io.File;
+import java.text.DecimalFormat;
+import java.util.Date;
+
+import org.apache.openmeetings.backup.BackupExport;
+import org.apache.openmeetings.backup.BackupImport;
+import org.apache.openmeetings.backup.ProgressHolder;
+import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
+import org.apache.openmeetings.util.CalendarPatterns;
+import org.apache.openmeetings.util.OmFileHelper;
+import org.apache.openmeetings.web.admin.AdminPanel;
+import org.apache.openmeetings.web.app.Application;
+import org.apache.openmeetings.web.util.AjaxDownload;
+import org.apache.openmeetings.web.util.upload.BootstrapFileUploadBehavior;
+import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
+import org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar;
+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.upload.FileUpload;
+import org.apache.wicket.markup.html.form.upload.FileUploadField;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.util.lang.Bytes;
+import org.apache.wicket.util.resource.FileResourceStream;
+import org.apache.wicket.util.time.Duration;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+
+import com.googlecode.wicket.jquery.core.Options;
+import com.googlecode.wicket.jquery.ui.form.button.AjaxButton;
+import com.googlecode.wicket.jquery.ui.widget.progressbar.ProgressBar;
+import com.googlecode.wicket.kendo.ui.panel.KendoFeedbackPanel;
+/**
+ * Panel component to manage Backup Import/Export
+ *
+ * @author swagner
+ *
+ */
+public class BackupPanel extends AdminPanel {
+ private static final Logger log = Red5LoggerFactory.getLogger(BackupPanel.class, webAppRootKey);
+
+ private static final long serialVersionUID = -1L;
+
+ private final KendoFeedbackPanel feedback = new KendoFeedbackPanel("feedback", new Options("button", true));
+
+ /**
+ * Form to handle upload files
+ *
+ * @author swagner
+ *
+ */
+ private class BackupForm extends Form<Void> {
+ private static final long serialVersionUID = 1L;
+ private final FileUploadField fileUploadField;
+ private final Model<Boolean> includeFilesInBackup = Model.of(true);
+ private final AbstractAjaxTimerBehavior timer;
+ private final ProgressBar progressBar;
+ private File backupFile;
+ private Throwable th = null;
+ private boolean started = false;
+ private ProgressHolder progressHolder;
+
+ public BackupForm(String id) {
+ super(id);
+
+ // set this form to multipart mode (allways needed for uploads!)
+ setMultiPart(true);
+
+ // set max upload size in form as info text
+ Long maxBytes = getBean(ConfigurationDao.class).getMaxUploadSize();
+ double megaBytes = maxBytes.doubleValue() / 1024 / 1024;
+ DecimalFormat formatter = new DecimalFormat("#,###.00");
+ add(new Label("MaxUploadSize", formatter.format(megaBytes)));
+
+ // Add one file input field
+ fileUploadField = new FileUploadField("fileInput");
+
+ add(new CheckBox("includeFilesInBackup", includeFilesInBackup));
+
+ // Set maximum size controlled by configuration
+ setMaxSize(Bytes.bytes(maxBytes));
+
+ // Add a component to download a file without page refresh
+ final AjaxDownload download = new AjaxDownload();
+ add(download);
+ // add an download button
+ add(new AjaxButton("download", this) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onSubmit(AjaxRequestTarget target) {
+ String dateString = "backup_" + CalendarPatterns.getTimeForStreamId(new Date());
+ backupFile = new File(OmFileHelper.getUploadBackupDir(), dateString + ".zip");
+ th = null;
+ started = true;
+ progressHolder = new ProgressHolder();
+
+ timer.restart(target);
+ new Thread(new BackupProcess(getBean(BackupExport.class), includeFilesInBackup.getObject())
+ , "Openmeetings - " + dateString).start();
+
+ // repaint the feedback panel so that it is hidden
+ target.add(feedback, progressBar.setVisible(true));
+ }
+
+ @Override
+ protected void onError(AjaxRequestTarget target) {
+ // repaint the feedback panel so errors are shown
+ target.add(feedback);
+ }
+ });
+ add(timer = new AbstractAjaxTimerBehavior(Duration.ONE_SECOND) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onTimer(AjaxRequestTarget target) {
+ if (!started) {
+ timer.stop(target);
+ return;
+ }
+ if (th != null) {
+ timer.stop(target);
+ //TODO change text, localize
+ progressBar.setVisible(false);
+ feedback.error(th.getMessage());
+ target.add(feedback);
+ } else {
+ progressBar.setModelObject(progressHolder.getProgress());
+ progressBar.refresh(target);
+ //TODO add current step result as info
+ }
+ }
+ });
+ add((progressBar = new ProgressBar("dprogress", new Model<>(0)) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onComplete(AjaxRequestTarget target) {
+ timer.stop(target);
+ target.add(progressBar.setVisible(false));
+
+ download.setFileName(backupFile.getName());
+ download.setResourceStream(new FileResourceStream(backupFile));
+ download.initiate(target);
+ }
+ }).setVisible(false).setOutputMarkupPlaceholderTag(true));
+ add(fileUploadField.add(new AjaxFormSubmitBehavior(this, "change") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onSubmit(AjaxRequestTarget target) {
+ FileUpload upload = fileUploadField.getFileUpload();
+ try {
+ if (upload == null || upload.getInputStream() == null) {
+ feedback.error("File is empty");
+ target.add(feedback);
+ return;
+ }
+ getBean(BackupImport.class).performImport(upload.getInputStream());
+ } catch (Exception e) {
+ log.error("Exception on panel backup upload ", e);
+ feedback.error(e);
+ }
+ // repaint the feedback panel so that it is hidden
+ target.add(feedback);
+ }
+
+ @Override
+ protected void onError(AjaxRequestTarget target) {
+ // repaint the feedback panel so errors are shown
+ target.add(feedback);
+ }
+ }));
+ add(new Label("cmdLineDesc", Application.getString(1505)).setEscapeModelStrings(false));
+ }
+
+ @Override
+ protected void onDetach() {
+ includeFilesInBackup.detach();
+ super.onDetach();
+ }
+
+ private class BackupProcess implements Runnable {
+ private BackupExport backup;
+ private boolean includeFiles;
+
+ public BackupProcess(BackupExport backup, boolean includeFiles) {
+ this.backup = backup;
+ this.includeFiles = includeFiles;
+ th = null;
+ }
+
+ @Override
+ public void run() {
+ try {
+ backup.performExport(backupFile, includeFiles, progressHolder);
+ } catch (Exception e) {
+ log.error("Exception on panel backup download ", e);
+ th = e;
+ }
+ }
+ }
+ }
+
+ public BackupPanel(String id) {
+ super(id);
+
+ add(feedback);
+
+ BackupForm backupForm = new BackupForm("backupUpload");
+
+ backupForm.add(new UploadProgressBar("progress", backupForm, backupForm.fileUploadField));
+
+ add(backupForm);
+ add(BootstrapFileUploadBehavior.INSTANCE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigForm.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigForm.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigForm.java
index 5a8393e..6f11e2b 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigForm.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigForm.java
@@ -1,143 +1,143 @@
-/*
- * 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.configurations;
-
-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.basic.ConfigurationDao;
-import org.apache.openmeetings.db.entity.basic.Configuration;
-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.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;
-import org.apache.wicket.validation.IValidatable;
-import org.apache.wicket.validation.IValidator;
-import org.apache.wicket.validation.ValidationError;
-
-/**
- * Handle {@link Configuration} items as list and form
- *
- * @author swagner
- *
- */
-public class ConfigForm extends AdminBaseForm<Configuration> {
- private static final long serialVersionUID = 1L;
- private final WebMarkupContainer listContainer;
-
- private void refresh(AjaxRequestTarget target) {
- target.add(this);
- target.appendJavaScript("adminPanelInit();");
- }
-
- public ConfigForm(String id, WebMarkupContainer listContainer, Configuration configuration) {
- super(id, new CompoundPropertyModel<>(configuration));
- setOutputMarkupId(true);
- this.listContainer = listContainer;
- add(new RequiredTextField<String>("key").setLabel(Model.of(Application.getString(267))).add(new IValidator<String>(){
- private static final long serialVersionUID = 1L;
-
- @Override
- public void validate(IValidatable<String> validatable) {
- Configuration c = getBean(ConfigurationDao.class).forceGet(validatable.getValue());
- if (c != null && !c.isDeleted() && !c.getId().equals(ConfigForm.this.getModelObject().getId())) {
- validatable.error(new ValidationError(Application.getString(1544L)));
- }
- }
- }));
- add(new TextField<String>("value").setLabel(Model.of(Application.getString(271))));
- add(forDatePattern("updated", WEB_DATE_PATTERN));
- add(new Label("user.login"));
- 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) {
- ConfigurationDao cfgDao = getBean(ConfigurationDao.class);
- Configuration c = cfgDao.forceGet(getModelObject().getKey());
- if (c != null && c.isDeleted() && !c.getId().equals(getModelObject().getId())) {
- getModelObject().setId(c.getId());
- }
- setModelObject(getBean(ConfigurationDao.class).update(getModelObject(), WebSession.getUserId()));
- hideNewRecord();
- target.add(listContainer);
- refresh(target);
- }
-
- @Override
- protected void onNewSubmit(AjaxRequestTarget target, Form<?> form) {
- this.setModelObject(new Configuration());
- refresh(target);
- }
-
- @Override
- protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
- Configuration conf = getModelObject();
- if (conf.getId() != null) {
- conf = getBean(ConfigurationDao.class).get(conf.getId());
- } else {
- conf = new Configuration();
- }
- setModelObject(conf);
- refresh(target);
- }
-
- @Override
- protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) {
- getBean(ConfigurationDao.class).delete(getModelObject(), WebSession.getUserId());
- setModelObject(new Configuration());
- target.add(listContainer);
- refresh(target);
- }
-
- @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.configurations;
+
+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.basic.ConfigurationDao;
+import org.apache.openmeetings.db.entity.basic.Configuration;
+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.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;
+import org.apache.wicket.validation.IValidatable;
+import org.apache.wicket.validation.IValidator;
+import org.apache.wicket.validation.ValidationError;
+
+/**
+ * Handle {@link Configuration} items as list and form
+ *
+ * @author swagner
+ *
+ */
+public class ConfigForm extends AdminBaseForm<Configuration> {
+ private static final long serialVersionUID = 1L;
+ private final WebMarkupContainer listContainer;
+
+ private void refresh(AjaxRequestTarget target) {
+ target.add(this);
+ target.appendJavaScript("adminPanelInit();");
+ }
+
+ public ConfigForm(String id, WebMarkupContainer listContainer, Configuration configuration) {
+ super(id, new CompoundPropertyModel<>(configuration));
+ setOutputMarkupId(true);
+ this.listContainer = listContainer;
+ add(new RequiredTextField<String>("key").setLabel(Model.of(Application.getString(267))).add(new IValidator<String>(){
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void validate(IValidatable<String> validatable) {
+ Configuration c = getBean(ConfigurationDao.class).forceGet(validatable.getValue());
+ if (c != null && !c.isDeleted() && !c.getId().equals(ConfigForm.this.getModelObject().getId())) {
+ validatable.error(new ValidationError(Application.getString(1544L)));
+ }
+ }
+ }));
+ add(new TextField<String>("value").setLabel(Model.of(Application.getString(271))));
+ add(forDatePattern("updated", WEB_DATE_PATTERN));
+ add(new Label("user.login"));
+ 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) {
+ ConfigurationDao cfgDao = getBean(ConfigurationDao.class);
+ Configuration c = cfgDao.forceGet(getModelObject().getKey());
+ if (c != null && c.isDeleted() && !c.getId().equals(getModelObject().getId())) {
+ getModelObject().setId(c.getId());
+ }
+ setModelObject(getBean(ConfigurationDao.class).update(getModelObject(), WebSession.getUserId()));
+ hideNewRecord();
+ target.add(listContainer);
+ refresh(target);
+ }
+
+ @Override
+ protected void onNewSubmit(AjaxRequestTarget target, Form<?> form) {
+ this.setModelObject(new Configuration());
+ refresh(target);
+ }
+
+ @Override
+ protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
+ Configuration conf = getModelObject();
+ if (conf.getId() != null) {
+ conf = getBean(ConfigurationDao.class).get(conf.getId());
+ } else {
+ conf = new Configuration();
+ }
+ setModelObject(conf);
+ refresh(target);
+ }
+
+ @Override
+ protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) {
+ getBean(ConfigurationDao.class).delete(getModelObject(), WebSession.getUserId());
+ setModelObject(new Configuration());
+ target.add(listContainer);
+ refresh(target);
+ }
+
+ @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/1cb3518f/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigsPanel.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigsPanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigsPanel.java
index c0c91d0..99de0e2 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigsPanel.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigsPanel.java
@@ -1,94 +1,94 @@
-/*
- * 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.configurations;
-
-import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
-import org.apache.openmeetings.db.entity.basic.Configuration;
-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;
-
-/**
- * add/update/delete {@link Configuration}
- *
- * @author swagner
- *
- */
-public class ConfigsPanel extends AdminPanel {
- private static final long serialVersionUID = 1L;
- private ConfigForm form;
- private final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer");
-
- public ConfigsPanel(String id) {
- super(id);
-
- SearchableDataView<Configuration> dataView = new SearchableDataView<Configuration>("configList"
- , new SearchableDataProvider<>(ConfigurationDao.class)) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void populateItem(final Item<Configuration> item) {
- final Configuration c = item.getModelObject();
- item.add(new Label("id"));
- item.add(new Label("key"));
- item.add(new Label("value"));
- item.add(new AjaxEventBehavior("click") {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onEvent(AjaxRequestTarget target) {
- form.hideNewRecord();
- form.setModelObject(c);
- target.add(form, listContainer);
- target.appendJavaScript("adminPanelInit();");
- }
- });
- item.add(AttributeModifier.replace("class", getRowClass(c.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<Configuration> container = new DataViewContainer<>(listContainer, dataView, navigator);
- container.addLink(new OmOrderByBorder<>("orderById", "id", container))
- .addLink(new OmOrderByBorder<>("orderByKey", "key", container))
- .addLink(new OmOrderByBorder<>("orderByValue", "value", container));
- add(container.getLinks());
- add(navigator);
-
- form = new ConfigForm("form", listContainer, new Configuration());
- 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.configurations;
+
+import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
+import org.apache.openmeetings.db.entity.basic.Configuration;
+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;
+
+/**
+ * add/update/delete {@link Configuration}
+ *
+ * @author swagner
+ *
+ */
+public class ConfigsPanel extends AdminPanel {
+ private static final long serialVersionUID = 1L;
+ private ConfigForm form;
+ private final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer");
+
+ public ConfigsPanel(String id) {
+ super(id);
+
+ SearchableDataView<Configuration> dataView = new SearchableDataView<Configuration>("configList"
+ , new SearchableDataProvider<>(ConfigurationDao.class)) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void populateItem(final Item<Configuration> item) {
+ final Configuration c = item.getModelObject();
+ item.add(new Label("id"));
+ item.add(new Label("key"));
+ item.add(new Label("value"));
+ item.add(new AjaxEventBehavior("click") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onEvent(AjaxRequestTarget target) {
+ form.hideNewRecord();
+ form.setModelObject(c);
+ target.add(form, listContainer);
+ target.appendJavaScript("adminPanelInit();");
+ }
+ });
+ item.add(AttributeModifier.replace("class", getRowClass(c.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<Configuration> container = new DataViewContainer<>(listContainer, dataView, navigator);
+ container.addLink(new OmOrderByBorder<>("orderById", "id", container))
+ .addLink(new OmOrderByBorder<>("orderByKey", "key", container))
+ .addLink(new OmOrderByBorder<>("orderByValue", "value", container));
+ add(container.getLinks());
+ add(navigator);
+
+ form = new ConfigForm("form", listContainer, new Configuration());
+ form.showNewRecord();
+ add(form);
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupForm.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupForm.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupForm.java
index cddb3da..e07780d 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupForm.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/groups/GroupForm.java
@@ -1,250 +1,250 @@
-/*
- * 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.db.util.AuthLevelUtil.hasGroupAdminLevel;
-import static org.apache.openmeetings.util.OmFileHelper.getGroupLogo;
-import static org.apache.openmeetings.web.app.Application.getBean;
-import static org.apache.openmeetings.web.app.WebSession.getRights;
-import static org.apache.openmeetings.web.app.WebSession.getUserId;
-import static org.apache.openmeetings.web.util.GroupLogoResourceReference.getUrl;
-
-import java.io.File;
-
-import org.apache.openmeetings.core.converter.ImageConverter;
-import org.apache.openmeetings.db.dao.user.GroupDao;
-import org.apache.openmeetings.db.dao.user.GroupUserDao;
-import org.apache.openmeetings.db.entity.user.Group;
-import org.apache.openmeetings.db.entity.user.GroupUser;
-import org.apache.openmeetings.db.entity.user.User;
-import org.apache.openmeetings.util.StoredFile;
-import org.apache.openmeetings.web.admin.AdminBaseForm;
-import org.apache.openmeetings.web.admin.AdminUserChoiceProvider;
-import org.apache.openmeetings.web.common.UploadableImagePanel;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.ajax.form.AjaxFormValidatingBehavior;
-import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.CheckBox;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.NumberTextField;
-import org.apache.wicket.markup.html.form.RequiredTextField;
-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;
-import org.wicketstuff.select2.Select2Choice;
-
-public class GroupForm extends AdminBaseForm<Group> {
- private static final long serialVersionUID = 1L;
- private GroupUsersPanel usersPanel;
- private final WebMarkupContainer groupList;
- private final Select2Choice<User> userToadd;
- private final NumberTextField<Integer> maxFilesSize = new NumberTextField<>("maxFilesSize");
- private final NumberTextField<Integer> maxRecordingsSize = new NumberTextField<>("maxRecordingsSize");
- private final NumberTextField<Integer> maxRooms = new NumberTextField<>("maxRooms");
- private final NumberTextField<Integer> recordingTtl = new NumberTextField<>("recordingTtl");
- private final NumberTextField<Integer> reminderDays = new NumberTextField<>("reminderDays");
- private final UploadableImagePanel logo = new UploadableImagePanel("logo") {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected String getImageUrl() {
- return getUrl(getRequestCycle(), GroupForm.this.getModelObject().getId());
- }
-
- @Override
- protected void processImage(StoredFile sf, File f) throws Exception {
- getBean(ImageConverter.class).resize(f, getGroupLogo(GroupForm.this.getModelObject().getId(), false), null, 28);
- }
-
- @Override
- protected String getTitle() {
- return getString("admin.group.form.logo");
- }
- };
-
- static String formatUser(User choice) {
- return String.format("%s [%s %s]", choice.getLogin(), choice.getFirstname(), choice.getLastname());
- }
-
- public GroupForm(String id, WebMarkupContainer groupList, Group group) {
- super(id, new CompoundPropertyModel<>(group));
- this.groupList = groupList;
- setOutputMarkupId(true);
-
- usersPanel = new GroupUsersPanel("users", getGroupId());
- add(usersPanel);
-
- add(userToadd = new Select2Choice<>("user2add", Model.of((User)null), new AdminUserChoiceProvider() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getDisplayValue(User choice) {
- return formatUser(choice);
- }
- }));
- userToadd.add(new AjaxFormComponentUpdatingBehavior("change") {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onUpdate(AjaxRequestTarget target) {
- Group o = GroupForm.this.getModelObject();
- User u = userToadd.getModelObject();
- boolean found = false;
- if (o.getId() != null) {
- found = null != getBean(GroupUserDao.class).getByGroupAndUser(o.getId(), u.getId());
- }
- if (!found && u != null) {
- for (GroupUser ou : usersPanel.getUsers2add()) {
- if (ou.getUser().getId().equals(u.getId())) {
- found = true;
- break;
- }
- }
- if (!found) {
- GroupUser ou = new GroupUser(o, u);
- usersPanel.getUsers2add().add(ou);
-
- userToadd.setModelObject(null);
- target.add(usersPanel, userToadd);
- }
- }
- }
- });
- // 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 boolean isNewBtnVisible() {
- return !hasGroupAdminLevel(getRights());
- }
-
- @Override
- protected boolean isDelBtnVisible() {
- return !hasGroupAdminLevel(getRights());
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
- final boolean isGroupAdmin = hasGroupAdminLevel(getRights());
- userToadd.setEnabled(!isGroupAdmin);
- add(new RequiredTextField<String>("name").setLabel(Model.of(getString("165"))));
- add(logo);
- add(new TextField<String>("tag").setLabel(Model.of(getString("admin.group.form.tag"))));
- add(new CheckBox("restricted").setLabel(Model.of(getString("restricted.group.files"))));
- add(new AjaxCheckBox("limited") {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onUpdate(AjaxRequestTarget target) {
- target.add(
- maxFilesSize.setEnabled(getModelObject())
- , maxRecordingsSize.setEnabled(getModelObject())
- , maxRooms.setEnabled(getModelObject())
- , recordingTtl.setEnabled(getModelObject())
- , reminderDays.setEnabled(getModelObject())
- );
- }
- }.setLabel(Model.of(getString("admin.group.form.limited"))));
- add(maxFilesSize.setLabel(Model.of(getString("admin.group.form.maxFilesSize"))).setEnabled(false).setOutputMarkupId(true));
- add(maxRecordingsSize.setLabel(Model.of(getString("admin.group.form.maxRecordingsSize"))).setEnabled(false).setOutputMarkupId(true));
- add(maxRooms.setLabel(Model.of(getString("admin.group.form.maxRooms"))).setEnabled(false).setOutputMarkupId(true));
- add(recordingTtl.setLabel(Model.of(getString("admin.group.form.recordingTtl"))).setEnabled(false).setOutputMarkupId(true));
- add(reminderDays.setLabel(Model.of(getString("admin.group.form.reminderDays"))).setEnabled(false).setOutputMarkupId(true));
- }
-
- public void updateView(AjaxRequestTarget target) {
- userToadd.setModelObject(null);
- usersPanel.update(getGroupId());
- maxFilesSize.setEnabled(getModelObject().isLimited());
- maxRecordingsSize.setEnabled(getModelObject().isLimited());
- maxRooms.setEnabled(getModelObject().isLimited());
- recordingTtl.setEnabled(getModelObject().isLimited());
- reminderDays.setEnabled(getModelObject().isLimited());
- logo.update();
- target.add(this, groupList);
- target.appendJavaScript("adminPanelInit();");
- }
-
- private long getGroupId() {
- return getModelObject().getId() != null ? getModelObject().getId() : 0;
- }
-
- @Override
- protected void onNewSubmit(AjaxRequestTarget target, Form<?> f) {
- setModelObject(new Group());
- updateView(target);
- }
-
- @Override
- protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
- Group org = getModelObject();
- if (org.getId() != null) {
- org = getBean(GroupDao.class).get(org.getId());
- } else {
- org = new Group();
- }
- setModelObject(org);
- updateView(target);
- }
-
- @Override
- protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) {
- getBean(GroupDao.class).delete(getModelObject(), getUserId());
- setModelObject(new Group());
- updateView(target);
- }
-
- @Override
- protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
- Group o = getModelObject();
- o = getBean(GroupDao.class).update(o, getUserId());
- setModelObject(o);
- for (GroupUser grpUser : usersPanel.getUsers2add()) {
- GroupUsersPanel.update(grpUser);
- }
- hideNewRecord();
- updateView(target);
- }
-
- @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.groups;
+
+import static org.apache.openmeetings.db.util.AuthLevelUtil.hasGroupAdminLevel;
+import static org.apache.openmeetings.util.OmFileHelper.getGroupLogo;
+import static org.apache.openmeetings.web.app.Application.getBean;
+import static org.apache.openmeetings.web.app.WebSession.getRights;
+import static org.apache.openmeetings.web.app.WebSession.getUserId;
+import static org.apache.openmeetings.web.util.GroupLogoResourceReference.getUrl;
+
+import java.io.File;
+
+import org.apache.openmeetings.core.converter.ImageConverter;
+import org.apache.openmeetings.db.dao.user.GroupDao;
+import org.apache.openmeetings.db.dao.user.GroupUserDao;
+import org.apache.openmeetings.db.entity.user.Group;
+import org.apache.openmeetings.db.entity.user.GroupUser;
+import org.apache.openmeetings.db.entity.user.User;
+import org.apache.openmeetings.util.StoredFile;
+import org.apache.openmeetings.web.admin.AdminBaseForm;
+import org.apache.openmeetings.web.admin.AdminUserChoiceProvider;
+import org.apache.openmeetings.web.common.UploadableImagePanel;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.ajax.form.AjaxFormValidatingBehavior;
+import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.CheckBox;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.NumberTextField;
+import org.apache.wicket.markup.html.form.RequiredTextField;
+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;
+import org.wicketstuff.select2.Select2Choice;
+
+public class GroupForm extends AdminBaseForm<Group> {
+ private static final long serialVersionUID = 1L;
+ private GroupUsersPanel usersPanel;
+ private final WebMarkupContainer groupList;
+ private final Select2Choice<User> userToadd;
+ private final NumberTextField<Integer> maxFilesSize = new NumberTextField<>("maxFilesSize");
+ private final NumberTextField<Integer> maxRecordingsSize = new NumberTextField<>("maxRecordingsSize");
+ private final NumberTextField<Integer> maxRooms = new NumberTextField<>("maxRooms");
+ private final NumberTextField<Integer> recordingTtl = new NumberTextField<>("recordingTtl");
+ private final NumberTextField<Integer> reminderDays = new NumberTextField<>("reminderDays");
+ private final UploadableImagePanel logo = new UploadableImagePanel("logo") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected String getImageUrl() {
+ return getUrl(getRequestCycle(), GroupForm.this.getModelObject().getId());
+ }
+
+ @Override
+ protected void processImage(StoredFile sf, File f) throws Exception {
+ getBean(ImageConverter.class).resize(f, getGroupLogo(GroupForm.this.getModelObject().getId(), false), null, 28);
+ }
+
+ @Override
+ protected String getTitle() {
+ return getString("admin.group.form.logo");
+ }
+ };
+
+ static String formatUser(User choice) {
+ return String.format("%s [%s %s]", choice.getLogin(), choice.getFirstname(), choice.getLastname());
+ }
+
+ public GroupForm(String id, WebMarkupContainer groupList, Group group) {
+ super(id, new CompoundPropertyModel<>(group));
+ this.groupList = groupList;
+ setOutputMarkupId(true);
+
+ usersPanel = new GroupUsersPanel("users", getGroupId());
+ add(usersPanel);
+
+ add(userToadd = new Select2Choice<>("user2add", Model.of((User)null), new AdminUserChoiceProvider() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getDisplayValue(User choice) {
+ return formatUser(choice);
+ }
+ }));
+ userToadd.add(new AjaxFormComponentUpdatingBehavior("change") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onUpdate(AjaxRequestTarget target) {
+ Group o = GroupForm.this.getModelObject();
+ User u = userToadd.getModelObject();
+ boolean found = false;
+ if (o.getId() != null) {
+ found = null != getBean(GroupUserDao.class).getByGroupAndUser(o.getId(), u.getId());
+ }
+ if (!found && u != null) {
+ for (GroupUser ou : usersPanel.getUsers2add()) {
+ if (ou.getUser().getId().equals(u.getId())) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ GroupUser ou = new GroupUser(o, u);
+ usersPanel.getUsers2add().add(ou);
+
+ userToadd.setModelObject(null);
+ target.add(usersPanel, userToadd);
+ }
+ }
+ }
+ });
+ // 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 boolean isNewBtnVisible() {
+ return !hasGroupAdminLevel(getRights());
+ }
+
+ @Override
+ protected boolean isDelBtnVisible() {
+ return !hasGroupAdminLevel(getRights());
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+ final boolean isGroupAdmin = hasGroupAdminLevel(getRights());
+ userToadd.setEnabled(!isGroupAdmin);
+ add(new RequiredTextField<String>("name").setLabel(Model.of(getString("165"))));
+ add(logo);
+ add(new TextField<String>("tag").setLabel(Model.of(getString("admin.group.form.tag"))));
+ add(new CheckBox("restricted").setLabel(Model.of(getString("restricted.group.files"))));
+ add(new AjaxCheckBox("limited") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onUpdate(AjaxRequestTarget target) {
+ target.add(
+ maxFilesSize.setEnabled(getModelObject())
+ , maxRecordingsSize.setEnabled(getModelObject())
+ , maxRooms.setEnabled(getModelObject())
+ , recordingTtl.setEnabled(getModelObject())
+ , reminderDays.setEnabled(getModelObject())
+ );
+ }
+ }.setLabel(Model.of(getString("admin.group.form.limited"))));
+ add(maxFilesSize.setLabel(Model.of(getString("admin.group.form.maxFilesSize"))).setEnabled(false).setOutputMarkupId(true));
+ add(maxRecordingsSize.setLabel(Model.of(getString("admin.group.form.maxRecordingsSize"))).setEnabled(false).setOutputMarkupId(true));
+ add(maxRooms.setLabel(Model.of(getString("admin.group.form.maxRooms"))).setEnabled(false).setOutputMarkupId(true));
+ add(recordingTtl.setLabel(Model.of(getString("admin.group.form.recordingTtl"))).setEnabled(false).setOutputMarkupId(true));
+ add(reminderDays.setLabel(Model.of(getString("admin.group.form.reminderDays"))).setEnabled(false).setOutputMarkupId(true));
+ }
+
+ public void updateView(AjaxRequestTarget target) {
+ userToadd.setModelObject(null);
+ usersPanel.update(getGroupId());
+ maxFilesSize.setEnabled(getModelObject().isLimited());
+ maxRecordingsSize.setEnabled(getModelObject().isLimited());
+ maxRooms.setEnabled(getModelObject().isLimited());
+ recordingTtl.setEnabled(getModelObject().isLimited());
+ reminderDays.setEnabled(getModelObject().isLimited());
+ logo.update();
+ target.add(this, groupList);
+ target.appendJavaScript("adminPanelInit();");
+ }
+
+ private long getGroupId() {
+ return getModelObject().getId() != null ? getModelObject().getId() : 0;
+ }
+
+ @Override
+ protected void onNewSubmit(AjaxRequestTarget target, Form<?> f) {
+ setModelObject(new Group());
+ updateView(target);
+ }
+
+ @Override
+ protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
+ Group org = getModelObject();
+ if (org.getId() != null) {
+ org = getBean(GroupDao.class).get(org.getId());
+ } else {
+ org = new Group();
+ }
+ setModelObject(org);
+ updateView(target);
+ }
+
+ @Override
+ protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) {
+ getBean(GroupDao.class).delete(getModelObject(), getUserId());
+ setModelObject(new Group());
+ updateView(target);
+ }
+
+ @Override
+ protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
+ Group o = getModelObject();
+ o = getBean(GroupDao.class).update(o, getUserId());
+ setModelObject(o);
+ for (GroupUser grpUser : usersPanel.getUsers2add()) {
+ GroupUsersPanel.update(grpUser);
+ }
+ hideNewRecord();
+ updateView(target);
+ }
+
+ @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/1cb3518f/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>