Add short name to groups.
[demoscenemusic.git] / src / main / java / net / pterodactylus / demoscenemusic / page / admin / AddGroupPage.java
index 1fd7d11..55cd521 100644 (file)
@@ -61,12 +61,16 @@ public class AddGroupPage extends AdminBasePage {
                super.processTemplate(templateContext, request);
                if (request.getMethod() == Method.POST) {
                        String name = request.getServletRequest().getParameter("name").trim();
+                       String shortName = request.getServletRequest().getParameter("shortName").trim();
                        if (name.length() == 0) {
                                templateContext.set("error", "no-name-given");
                                return;
                        }
+                       if (shortName.length() == 0) {
+                               shortName = null;
+                       }
                        try {
-                               Group group = getCore().getDataManager().createGroup(name);
+                               Group group = getCore().getDataManager().createGroup(name, shortName);
                                throw new RedirectException("admin.edit-group?id=" + group.getId());
                        } catch (DatabaseException de1) {
                                throw new RuntimeException("Could not create group.", de1);