CCM NG: First part of admin UI for Sites

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5084 8810af33-2d31-482b-a856-94f89814c4df
jensp 2017-10-25 18:19:44 +00:00
parent 111934301b
commit b93a6484d9
9 changed files with 241 additions and 0 deletions

View File

@ -33,6 +33,7 @@ import com.arsdigita.ui.admin.applications.ApplicationsTab;
import com.arsdigita.ui.admin.categories.CategoriesTab;
import com.arsdigita.ui.admin.configuration.ConfigurationTab;
import com.arsdigita.ui.admin.importexport.ImportExportTab;
import com.arsdigita.ui.admin.sites.SitesTab;
import com.arsdigita.web.BaseApplicationServlet;
import com.arsdigita.web.LoginSignal;
import com.arsdigita.xml.Document;
@ -135,6 +136,11 @@ public class AdminServlet extends BaseApplicationServlet {
ADMIN_BUNDLE)),
new ConfigurationTab());
tabbedPane.addTab(
new Label(new GlobalizedMessage("ui.admin.tab.sites.title",
ADMIN_BUNDLE)),
new SitesTab());
tabbedPane.addTab(
new Label(new GlobalizedMessage("ui.admin.tab.workflows.title",
ADMIN_BUNDLE)),

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.ui.admin.sites;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Text;
import com.arsdigita.toolbox.ui.LayoutPanel;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class SitesTab extends LayoutPanel {
public SitesTab() {
super();
super.setClassAttr("sidebarNavPanel");
final BoxPanel left = new BoxPanel(BoxPanel.VERTICAL);
final BoxPanel right = new BoxPanel(BoxPanel.VERTICAL);
right.add(new Text("Sites placeholder"));
setLeft(left);
setRight(right);
}
}

View File

@ -0,0 +1,63 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.ui.admin.sites;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.globalization.GlobalizedMessage;
import static com.arsdigita.ui.admin.AdminUiConstants.*;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class SitesTable extends Table {
public static final int COL_SITE_DOMAIN = 0;
public static final int COL_IS_DEFAULT_SITE = 1;
public static final int COL_DEFAULT_THEME = 2;
public SitesTable() {
super();
super.setIdAttr("sitesTable");
super.setStyleAttr("width: 30em");
setEmptyView(new Label(new GlobalizedMessage("ui.admin.sites.no_sites",
ADMIN_BUNDLE)));
final TableColumnModel columnModel = getColumnModel();
columnModel.add(new TableColumn(
COL_SITE_DOMAIN,
new Label(new GlobalizedMessage("ui.admin.sites.table.domain"))));
columnModel.add(new TableColumn(
COL_IS_DEFAULT_SITE,
new Label(new GlobalizedMessage("ui.admin.sites.table.default_site"))));
columnModel.add(new TableColumn(
COL_DEFAULT_THEME,
new Label(new GlobalizedMessage("ui.admin.sites.table.default_theme"))));
super.setModelBuilder(new SitesTableModelBuilder());
}
}

View File

@ -0,0 +1,80 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.ui.admin.sites;
import com.arsdigita.bebop.table.TableModel;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.sites.Site;
import org.libreccm.sites.SiteRepository;
import java.util.Iterator;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class SitesTableModel implements TableModel {
private final Iterator<Site> iterator;
private Site current;
public SitesTableModel() {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final SiteRepository siteRepo = cdiUtil.findBean(SiteRepository.class);
iterator = siteRepo.findAll().iterator();
}
@Override
public int getColumnCount() {
return 3;
}
@Override
public boolean nextRow() {
if (iterator.hasNext()) {
current = iterator.next();
return true;
} else {
return false;
}
}
@Override
public Object getElementAt(final int columnIndex) {
switch (columnIndex) {
case SitesTable.COL_SITE_DOMAIN:
return current.getDomainOfSite();
case SitesTable.COL_IS_DEFAULT_SITE:
return current.isDefaultSite();
case SitesTable.COL_DEFAULT_THEME:
return current.getDefaultTheme();
default:
throw new IllegalArgumentException("Illegal column index");
}
}
@Override
public Object getKeyAt(final int columnIndex) {
return current.getObjectId();
}
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.ui.admin.sites;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.util.LockableImpl;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class SitesTableModelBuilder
extends LockableImpl
implements TableModelBuilder {
@Override
public TableModel makeModel(final Table table, final PageState state) {
return new SitesTableModel();
}
}

View File

@ -615,3 +615,4 @@ ui.user.groups.remove=Remove
ui.user.roles.remove=Remove
ui.role.parties.remove=Remove
ui.admin.role_edit.description.label=Description
ui.admin.tab.sites.title=Sites

View File

@ -619,3 +619,4 @@ ui.user.groups.remove=Entfernen
ui.user.roles.remove=Entfernen
ui.role.parties.remove=Entfernen
ui.admin.role_edit.description.label=Beschreibung
ui.admin.tab.sites.title=Sites

View File

@ -612,3 +612,4 @@ ui.user.groups.remove=Remove
ui.user.roles.remove=Remove
ui.role.parties.remove=Remove
ui.admin.role_edit.description.label=Description
ui.admin.tab.sites.title=Sites

View File

@ -603,3 +603,4 @@ ui.user.groups.remove=Remove
ui.user.roles.remove=Remove
ui.role.parties.remove=Remove
ui.admin.role_edit.description.label=Description
ui.admin.tab.sites.title=Sites