Aktueller Stand des Applications Tab unter /ccm/admin/. Unter anderem können die Einstellungen für ccm-cms-publicpersonalprofile und ccm-themedirector (Anlegen neuer Themes) jetzt über /ccm/admin/ verwaltet werden. Außerdem ist es möglich neue Shortcuts und neue ContentSections über /ccm/admin anzulegen.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2231 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2013-06-28 13:46:46 +00:00
parent a30e4b7974
commit c62dd99a86
41 changed files with 951 additions and 246 deletions

View File

@ -13,7 +13,6 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
package com.arsdigita.cms.contentassets; package com.arsdigita.cms.contentassets;
import java.util.Date; import java.util.Date;
@ -40,8 +39,7 @@ import org.apache.log4j.Logger;
*/ */
public class Note extends ACSObject { public class Note extends ACSObject {
private static final Logger s_log = Logger.getLogger( Note.class ); private static final Logger s_log = Logger.getLogger(Note.class);
/** PDL stuff */ /** PDL stuff */
public static final String BASE_DATA_OBJECT_TYPE = public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contentassets.Note"; "com.arsdigita.cms.contentassets.Note";
@ -49,19 +47,18 @@ public class Note extends ACSObject {
static { static {
s_log.debug("Static initalizer is starting..."); s_log.debug("Static initalizer is starting...");
DomainObjectFactory.registerInstantiator( DomainObjectFactory.registerInstantiator(
BASE_DATA_OBJECT_TYPE, BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() { new DomainObjectInstantiator() {
@Override @Override
public DomainObjectInstantiator resolveInstantiator public DomainObjectInstantiator resolveInstantiator(DataObject dataObject) {
( DataObject dataObject ) { return this;
return this;
}
protected DomainObject doNewInstance( DataObject dataObject ) {
return new Note( dataObject );
}
} }
);
protected DomainObject doNewInstance(DataObject dataObject) {
return new Note(dataObject);
}
});
s_log.debug("Static initalizer finished."); s_log.debug("Static initalizer finished.");
} }
@ -73,125 +70,128 @@ public class Note extends ACSObject {
public static final String AUDIT = "auditing"; public static final String AUDIT = "auditing";
public static final String CREATION_DATE = AUDIT + "." public static final String CREATION_DATE = AUDIT + "."
+ BasicAuditTrail.CREATION_DATE; + BasicAuditTrail.CREATION_DATE;
private BasicAuditTrail auditTrail; private BasicAuditTrail auditTrail;
private boolean m_isNew = false; private boolean m_isNew = false;
private Note() { private Note() {
super( BASE_DATA_OBJECT_TYPE ); super(BASE_DATA_OBJECT_TYPE);
} }
public Note( String type ) { public Note(String type) {
super( type ); super(type);
} }
public Note( DataObject obj ) { public Note(DataObject obj) {
super( obj ); super(obj);
} }
public static Note create( ContentItem item ) { public static Note create(ContentItem item) {
DataCollection notes = getNotes( item ); DataCollection notes = getNotes(item);
long nextRank = notes.size(); long nextRank = notes.size();
Note note = new Note(); Note note = new Note();
note.set( OWNER, item ); note.set(OWNER, item);
note.set( RANK, new Long( (int)nextRank ) ); note.set(RANK, new Long((int) nextRank));
return note; return note;
} }
/** /**
* Register auditing observer * Register auditing observer
* (non-Javadoc) * (non-Javadoc)
* @see com.arsdigita.domain.DomainObject#initialize() * @see com.arsdigita.domain.DomainObject#initialize()
*/ */
@Override @Override
protected void initialize() { protected void initialize() {
super.initialize(); super.initialize();
DataObject dataObj = (DataObject) get(AUDIT); DataObject dataObj = (DataObject) get(AUDIT);
if (dataObj != null) { if (dataObj != null) {
auditTrail = new BasicAuditTrail(dataObj); auditTrail = new BasicAuditTrail(dataObj);
} else { } else {
// creates a new one when one doesn't already exist // creates a new one when one doesn't already exist
auditTrail = BasicAuditTrail.retrieveForACSObject(this); auditTrail = BasicAuditTrail.retrieveForACSObject(this);
} }
addObserver(new AuditingObserver(auditTrail)); addObserver(new AuditingObserver(auditTrail));
}
public String getContent() {
return (String) get( CONTENT );
} }
public void setContent( String content ) { public String getContent() {
set( CONTENT, content ); return (String) get(CONTENT);
}
public void setContent(String content) {
set(CONTENT, content);
} }
public long getRank() { public long getRank() {
Long rank = (Long) get( RANK ); Long rank = (Long) get(RANK);
Assert.exists( rank, Long.class ); Assert.exists(rank, Long.class);
return rank.longValue(); return rank.longValue();
} }
public void setRank( long newRank ) { public void setRank(long newRank) {
DataCollection notes = getNotes( getOwner() ); DataCollection notes = getNotes(getOwner());
if( newRank < 0 ) newRank = 0; if (newRank < 0) {
newRank = 0;
}
Note last = null; Note last = null;
long currentRank = 0; long currentRank = 0;
while( notes.next() ) { while (notes.next()) {
if( newRank == currentRank ) currentRank++; if (newRank == currentRank) {
currentRank++;
}
Note current = (Note) DomainObjectFactory.newInstance Note current = (Note) DomainObjectFactory.newInstance(notes.getDataObject());
( notes.getDataObject() );
if( equals( current ) ) continue; if (equals(current)) {
continue;
}
if( current.getRank() != currentRank ) if (current.getRank() != currentRank) {
current.set( RANK, new Long( currentRank ) ); current.set(RANK, new Long(currentRank));
}
currentRank++; currentRank++;
} }
notes.close(); notes.close();
if( newRank > currentRank ) if (newRank > currentRank) {
set( RANK, new Long( currentRank ) ); set(RANK, new Long(currentRank));
else } else {
set( RANK, new Long( newRank ) ); set(RANK, new Long(newRank));
}
} }
public ContentItem getOwner() { public ContentItem getOwner() {
DataObject obj = (DataObject) get( OWNER ); DataObject obj = (DataObject) get(OWNER);
Assert.exists( obj, DataObject.class ); Assert.exists(obj, DataObject.class);
return (ContentItem) DomainObjectFactory.newInstance( obj ); return (ContentItem) DomainObjectFactory.newInstance(obj);
} }
public User getNoteAuthor () { public User getNoteAuthor() {
return auditTrail.getCreationUser(); return auditTrail.getCreationUser();
} }
public Date getCreationDate () {
return auditTrail.getCreationDate();
}
public static DataCollection getNotes( ContentItem item ) {
Assert.exists( item, ContentItem.class );
if( s_log.isDebugEnabled() ) { public Date getCreationDate() {
s_log.debug( "Retrieving notes for " + item.getOID() ); return auditTrail.getCreationDate();
}
public static DataCollection getNotes(ContentItem item) {
Assert.exists(item, ContentItem.class);
if (s_log.isDebugEnabled()) {
s_log.debug("Retrieving notes for " + item.getOID());
} }
DataCollection notes = SessionManager.getSession().retrieve DataCollection notes = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
( BASE_DATA_OBJECT_TYPE );
notes.addEqualsFilter( OWNER, item.getID() ); notes.addEqualsFilter(OWNER, item.getID());
notes.addOrder( RANK ); notes.addOrder(RANK);
return notes; return notes;
} }
@ -199,23 +199,26 @@ public class Note extends ACSObject {
@Override @Override
protected void beforeDelete() { protected void beforeDelete() {
// Put this note at the end so other notes will be correctly reordered // Put this note at the end so other notes will be correctly reordered
setRank( Long.MAX_VALUE ); setRank(Long.MAX_VALUE);
} }
@Override @Override
protected void beforeSave() { protected void beforeSave() {
super.beforeSave(); super.beforeSave();
if( isNew() ) m_isNew = true; if (isNew()) {
m_isNew = true;
}
} }
@Override @Override
protected void afterSave() { protected void afterSave() {
super.afterSave(); super.afterSave();
if( m_isNew ) { if (m_isNew) {
PermissionService.setContext( this, getOwner() ); PermissionService.setContext(this, getOwner());
m_isNew = false; m_isNew = false;
} }
} }
} }

View File

@ -13,7 +13,6 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
package com.arsdigita.cms.contentassets; package com.arsdigita.cms.contentassets;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
@ -42,7 +41,7 @@ public class NotesInitializer extends ContentAssetInitializer {
* super class. * super class.
*/ */
public NotesInitializer() { public NotesInitializer() {
super( "ccm-cms-assets-notes.pdl.mf" ); super("ccm-cms-assets-notes.pdl.mf");
} }
/** /**
@ -50,74 +49,81 @@ public class NotesInitializer extends ContentAssetInitializer {
* @param ev * @param ev
*/ */
@Override @Override
public void init( DomainInitEvent ev ) { public void init(DomainInitEvent ev) {
super.init( ev ); super.init(ev);
ContentType.registerXSLFile( ContentType.registerXSLFile(
null, null,
"/themes/heirloom/contentassets/notes/xsl/index.xsl" ); "/themes/heirloom/contentassets/notes/xsl/index.xsl");
DomainObjectTraversal.registerAdapter( DomainObjectTraversal.registerAdapter(
Note.BASE_DATA_OBJECT_TYPE, Note.BASE_DATA_OBJECT_TYPE,
new SimpleDomainObjectTraversalAdapter(), new SimpleDomainObjectTraversalAdapter(),
SimpleXMLGenerator.ADAPTER_CONTEXT ); SimpleXMLGenerator.ADAPTER_CONTEXT);
SimpleEditStep.addAdditionalDisplayComponent(new NotesSummary()); SimpleEditStep.addAdditionalDisplayComponent(new NotesSummary());
} }
/** /**
* The base type against which the asset is defined, *
* @return The base type against which the asset is defined,
* typically com.arsdigita.cms.ContentPage * typically com.arsdigita.cms.ContentPage
*/ */
@Override
public String getBaseType() { public String getBaseType() {
return ContentPage.BASE_DATA_OBJECT_TYPE; return ContentPage.BASE_DATA_OBJECT_TYPE;
} }
/** /**
* Returns the path to the XML file defintions for the asset, eg: * @return the path to the XML file defintions for the asset, eg:
* /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml * /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
*/ */
@Override
public String getTraversalXML() { public String getTraversalXML() {
return TRAVERSAL_ADAPTER_BASE_DIR + "Notes.xml"; return TRAVERSAL_ADAPTER_BASE_DIR + "Notes.xml";
} }
/** /**
* The name of the association between the item * @return The name of the association between the item
* and the asset, eg 'fileAttachments'. * and the asset, eg 'fileAttachments'.
*/ */
@Override
public String getProperty() { public String getProperty() {
return Note.NOTES; return Note.NOTES;
} }
/** /**
* The class of the authoring kit step * @return The class of the authoring kit step
*/ */
@Override
public Class getAuthoringStep() { public Class getAuthoringStep() {
return NotesStep.class; return NotesStep.class;
} }
/** /**
* The label for the authoring step * @return The label for the authoring step
*/ */
@Override
public GlobalizedMessage getAuthoringStepLabel() { public GlobalizedMessage getAuthoringStepLabel() {
return new GlobalizedMessage( return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.notes_authoring_step_label", "com.arsdigita.cms.contentassets.notes_authoring_step_label",
"com.arsdigita.cms.contentassets.NotesResources" "com.arsdigita.cms.contentassets.NotesResources");
);
} }
/** /**
* The description for the authoring step * @return The description for the authoring step
*/ */
@Override
public GlobalizedMessage getAuthoringStepDescription() { public GlobalizedMessage getAuthoringStepDescription() {
return new GlobalizedMessage( return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.notes_authoring_step_description", "com.arsdigita.cms.contentassets.notes_authoring_step_description",
"com.arsdigita.cms.contentassets.NotesResources" "com.arsdigita.cms.contentassets.NotesResources");
);
} }
/** /**
* The sort key for the authoring step * @return The sort key for the authoring step
*/ */
@Override
public int getAuthoringStepSortKey() { public int getAuthoringStepSortKey() {
return NotesConfig.getInstance().getAssetStepSortKey(); return NotesConfig.getInstance().getAssetStepSortKey();
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-sci-types-personalpublicationsitem" name="ccm-sci-types-personalcontentcomponent"
prettyName="PersonalPublicationsItem" prettyName="PersonalContentComponent"
version="6.6.0" version="6.6.0"
release="1" release="1"
webapp="ROOT"> webapp="ROOT">

View File

@ -139,7 +139,7 @@ public class PublicPersonalProfileNavItemsAddForm
addInitListener(this); addInitListener(this);
addProcessListener(this); addProcessListener(this);
addValidationListener(this); addValidationListener(this);
addSubmissionListener(this);
} }
public void init(final FormSectionEvent fse) throws FormProcessException { public void init(final FormSectionEvent fse) throws FormProcessException {
@ -294,6 +294,8 @@ public class PublicPersonalProfileNavItemsAddForm
data.put(PublicPersonalProfileNavItem.LANG, ""); data.put(PublicPersonalProfileNavItem.LANG, "");
data.put(PublicPersonalProfileNavItem.LABEL, ""); data.put(PublicPersonalProfileNavItem.LABEL, "");
data.put(PublicPersonalProfileNavItem.GENERATOR_CLASS, ""); data.put(PublicPersonalProfileNavItem.GENERATOR_CLASS, "");
throw new FormProcessException("Canceled");
} }
} }
} }

View File

@ -30,14 +30,13 @@ import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.BasicPageForm;
/** /**
* Form to edit the basic properties of an SiteProxy. This form can be * Form to edit the basic properties of an SiteProxy. This form can be
* extended to create forms for SiteProxy subclasses. * extended to create forms for SiteProxy subclasses.
*/ */
public class SiteProxyPropertyForm extends BasicPageForm public class SiteProxyPropertyForm extends BasicPageForm
implements FormProcessListener, implements FormProcessListener,
FormInitListener { FormInitListener {
private TextField m_url; private TextField m_url;
@ -56,10 +55,9 @@ public class SiteProxyPropertyForm extends BasicPageForm
*/ */
protected void addWidgets() { protected void addWidgets() {
super.addWidgets(); super.addWidgets();
add(new Label("URL:")); add(new Label("URL:"));
ParameterModel urlParam ParameterModel urlParam = new StringParameter("url");
= new StringParameter("url");
m_url = new TextField(urlParam); m_url = new TextField(urlParam);
m_url.setSize(40); m_url.setSize(40);
add(m_url); add(m_url);
@ -67,24 +65,23 @@ public class SiteProxyPropertyForm extends BasicPageForm
/** Form initialisation hook. Fills widgets with data. */ /** Form initialisation hook. Fills widgets with data. */
public void init(FormSectionEvent fse) { public void init(FormSectionEvent fse) {
SiteProxy site SiteProxy site = (SiteProxy) super.initBasicWidgets(fse);
= (SiteProxy) super.initBasicWidgets(fse);
m_url.setValue(fse.getPageState(),
m_url.setValue(fse.getPageState(),
site.getURL()); site.getURL());
} }
/** Form processing hook. Saves SiteProxy object. */ /** Form processing hook. Saves SiteProxy object. */
public void process(FormSectionEvent fse) { public void process(FormSectionEvent fse) {
SiteProxy site SiteProxy site = (SiteProxy) super.processBasicWidgets(fse);
= (SiteProxy) super.processBasicWidgets(fse);
// save only if save button was pressed // save only if save button was pressed
if (site != null if (site != null
&& getSaveCancelSection().getSaveButton() && getSaveCancelSection().getSaveButton()
.isSelected(fse.getPageState())) { .isSelected(fse.getPageState())) {
site.setURL((String)m_url.getValue(fse.getPageState())); site.setURL((String) m_url.getValue(fse.getPageState()));
site.save(); site.save();
} }
} }
} }

View File

@ -0,0 +1,3 @@
com.arsdigita.cms.ContentCenterAppManager
com.arsdigita.cms.ServiceAppManager
com.arsdigita.cms.contentsection.ContentSectionAppManager

View File

@ -1017,3 +1017,4 @@ cms.ui.authoring.no_types_registered=No&nbsp;types&nbsp;registered
cms.ui.authoring.create_new=Create&nbsp;new: cms.ui.authoring.create_new=Create&nbsp;new:
cms.ui.authoring.go=Go cms.ui.authoring.go=Go
cms.ui.upload=File Upload cms.ui.upload=File Upload
cms.ui.section.new_section_name=Name of the new Content Section

View File

@ -1010,3 +1010,4 @@ cms.ui.authoring.create_new=Neuer&nbsp;Inhalt:
cms.ui.authoring.go=Anlegen cms.ui.authoring.go=Anlegen
#File Upload #File Upload
cms.ui.upload=Datei laden cms.ui.upload=Datei laden
cms.ui.section.new_section_name=Name der neuen Content Section

View File

@ -58,3 +58,4 @@ cms.ui.authoring.create_new=Create&nbsp;new:
cms.ui.authoring.go=Go cms.ui.authoring.go=Go
#File Upload #File Upload
cms.ui.upload=File Upload cms.ui.upload=File Upload
cms.ui.section.new_section_name=

View File

@ -539,3 +539,4 @@ cms.ui.authoring.go=Go
cms.ui.title=Title cms.ui.title=Title
#File Upload #File Upload
cms.ui.upload=Transf\u00e9re cms.ui.upload=Transf\u00e9re
cms.ui.section.new_section_name=

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class ContentCenterAppManager extends AbstractSingletonApplicationManager<ContentCenter> {
public Class<ContentCenter> getApplication() {
return ContentCenter.class;
}
/**
* ContentCenter has no global settings.
*
* @return A panel with a message that there no settings yet.
*/
public SimpleContainer getApplicationAdminForm() {
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
panel.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.no_settings")));
return panel;
}
}

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class ServiceAppManager extends AbstractSingletonApplicationManager<Service> {
public Class<Service> getApplication() {
return Service.class;
}
/**
*
* @return Just a panel with a label because this app has no settings yet.
*/
public SimpleContainer getApplicationAdminForm() {
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
panel.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.no_settings")));
return panel;
}
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.contentsection;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.ui.admin.applications.ApplicationManager;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class ContentSectionAppManager implements ApplicationManager<ContentSection> {
public Class<ContentSection> getApplication() {
return ContentSection.class;
}
public SimpleContainer getApplicationAdminForm() {
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
panel.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.no_settings")));
return panel;
}
public Form getApplicationCreateForm() {
return new ContentSectionCreateForm();
}
}

View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.contentsection;
import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext;
/**
* Form for creating a new ContentSection. Used by the {@link ContentSectionAppManager}.
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class ContentSectionCreateForm extends Form {
public final static String FORM_NAME = "ContentSectionCreateForm";
private final static String NEW_SECTION_NAME = "newSectionName";
private final SaveCancelSection saveCancelSection;
public ContentSectionCreateForm() {
super(FORM_NAME);
add(new Label(GlobalizationUtil.globalize("cms.ui.section.new_section_name")));
final TextField sectionNameField = new TextField(NEW_SECTION_NAME);
sectionNameField.setMaxLength(256);
sectionNameField.addValidationListener(new NotNullValidationListener());
sectionNameField.addValidationListener(new NotEmptyValidationListener());
add(sectionNameField);
saveCancelSection = new SaveCancelSection();
add(saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
addProcessListener(new ContentSectionCreateProcessListener());
addSubmissionListener(new ContentSectionSubmissionListener());
}
private class ContentSectionCreateProcessListener implements FormProcessListener {
private final ContentSectionConfig config = ContentSectionConfig.getInstance();
public ContentSectionCreateProcessListener() {
//Nothing for now
}
public void process(final FormSectionEvent event) throws FormProcessException {
final FormData data = event.getFormData();
final String newSectionName = data.getString(NEW_SECTION_NAME);
// final TransactionContext tctx = SessionManager.getSession().getTransactionContext();
// tctx.beginTxn();
ContentSectionSetup.setupContentSectionAppInstance(newSectionName,
config.getDefaultRoles(),
config.getDefaultWorkflows(),
config.isPubliclyViewable(),
config.getItemResolverClass(),
config.getTemplateResolverClass(),
config.getContentSectionsContentTypes(),
config.getUseSectionCategories(),
config.getCategoryFileList());
// tctx.commitTxn();
data.put(NEW_SECTION_NAME, "");
}
}
private class ContentSectionSubmissionListener implements FormSubmissionListener {
public ContentSectionSubmissionListener() {
//Nothing for now
}
public void submitted(final FormSectionEvent event) throws FormProcessException {
if (saveCancelSection.getCancelButton().isSelected(event.getPageState())) {
event.getFormData().put(NEW_SECTION_NAME, "");
throw new FormProcessException("Canceled");
}
}
}
}

View File

@ -49,16 +49,16 @@ class CategoryTreeModelBuilder extends LockableImpl
m_contextModel = contextModel; m_contextModel = contextModel;
} }
public final TreeModel makeModel(final Tree tree, final PageState state) { public final TreeModel makeModel(final Tree tree, final PageState state) {
final ContentSection section = CMS.getContext().getContentSection(); final ContentSection section = CMS.getContext().getContentSection();
final Category root = Category.getRootForObject(section, final Category root = Category.getRootForObject(section,
getUseContext(state)); getUseContext(state));
String order = ContentSection.getConfig().getCategoryTreeOrder(); String order = ContentSection.getConfig().getCategoryTreeOrder();
final CategoryTreeModelLite model = new CategoryTreeModelLite(root, order); final CategoryTreeModelLite model = new CategoryTreeModelLite(root, order);
return model; return model;
} }
private String getUseContext(PageState state) { private String getUseContext(PageState state) {
String context = null; String context = null;
if (m_contextModel != null) { if (m_contextModel != null) {

View File

@ -0,0 +1,2 @@
com.arsdigita.ui.admin.AdminAppManager
com.arsdigita.ui.login.LoginAppManager

View File

@ -132,7 +132,7 @@ public class GlobalizationHelper {
private static java.util.Locale scanLocale(String lang) { private static java.util.Locale scanLocale(String lang) {
// Protect against empty lang string // Protect against empty lang string
if (lang != null) { if ((lang != null) && !(lang.isEmpty())) {
// Split the string and create the Locale object // Split the string and create the Locale object
StringTokenizer paramValues = new StringTokenizer(lang, "_"); StringTokenizer paramValues = new StringTokenizer(lang, "_");
if (paramValues.countTokens() > 1) { if (paramValues.countTokens() > 1) {

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.ui.admin;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class AdminAppManager extends AbstractSingletonApplicationManager<Admin> {
public Class<Admin> getApplication() {
return Admin.class;
}
/**
* Just returns a empty panel. Admin app has no settings for now.
*
* @return
*/
public SimpleContainer getApplicationAdminForm() {
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
panel.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.no_settings")));
return panel;
}
}

View File

@ -127,3 +127,6 @@ ui.admin.MultiInstanceApplicationPane.create_instance=Create new instance
ui.admin.SingletonApplicationPane.manage.heading=Edit settings ui.admin.SingletonApplicationPane.manage.heading=Edit settings
ui.admin.SingletonApplicationPane.manage.no_admin_pane_found=No admin pane for applications of type '{0}' found. ui.admin.SingletonApplicationPane.manage.no_admin_pane_found=No admin pane for applications of type '{0}' found.
ui.admin.applications.ApplicationInfoSection.desc.label=Description ui.admin.applications.ApplicationInfoSection.desc.label=Description
ui.admin.applications.no_settings=This application has no settings (yet).
ui.admin.applications.form_not_compatible_now=This application administration form is not yet compatible with this application pane. Please use the applications own administration form.
ui.admin.applications.ApplicationInstancePane.manage.heading=Instance specific settings

View File

@ -127,3 +127,6 @@ ui.admin.MultiInstanceApplicationPane.create_instance=Neue instanz anlegen
ui.admin.SingletonApplicationPane.manage.heading=Eigenschaften bearbeiten ui.admin.SingletonApplicationPane.manage.heading=Eigenschaften bearbeiten
ui.admin.SingletonApplicationPane.manage.no_admin_pane_found=Keine Admin-Formular f\u00fcr Applikationen des Types {0} gefunden ui.admin.SingletonApplicationPane.manage.no_admin_pane_found=Keine Admin-Formular f\u00fcr Applikationen des Types {0} gefunden
ui.admin.applications.ApplicationInfoSection.desc.label=Beschreibung ui.admin.applications.ApplicationInfoSection.desc.label=Beschreibung
ui.admin.applications.no_settings=Diese Applikation hat (noch) keine Einstellungen.
ui.admin.applications.form_not_compatible_now=Das Formular zur Verwaltung dieser Application ist derzeit noch nicht kompatibel mit dieser Administrationsoberfl\u00e4che. Bitte nutzen Sie den Administrationsoberfl\u00e4che der Application.
ui.admin.applications.ApplicationInstancePane.manage.heading=Einstellungen der Instanz

View File

@ -127,3 +127,6 @@ ui.admin.MultiInstanceApplicationPane.create_instance=
ui.admin.SingletonApplicationPane.manage.heading= ui.admin.SingletonApplicationPane.manage.heading=
ui.admin.SingletonApplicationPane.manage.no_admin_pane_found= ui.admin.SingletonApplicationPane.manage.no_admin_pane_found=
ui.admin.applications.ApplicationInfoSection.desc.label= ui.admin.applications.ApplicationInfoSection.desc.label=
ui.admin.applications.no_settings=
ui.admin.applications.form_not_compatible_now=
ui.admin.applications.ApplicationInstancePane.manage.heading=

View File

@ -113,3 +113,6 @@ ui.admin.MultiInstanceApplicationPane.create_instance=
ui.admin.SingletonApplicationPane.manage.heading= ui.admin.SingletonApplicationPane.manage.heading=
ui.admin.SingletonApplicationPane.manage.no_admin_pane_found= ui.admin.SingletonApplicationPane.manage.no_admin_pane_found=
ui.admin.applications.ApplicationInfoSection.desc.label= ui.admin.applications.ApplicationInfoSection.desc.label=
ui.admin.applications.no_settings=
ui.admin.applications.form_not_compatible_now=
ui.admin.applications.ApplicationInstancePane.manage.heading=

View File

@ -171,7 +171,8 @@ public class ApplicationsAdministrationTab extends BoxPanel implements AdminCons
application, application,
managementForms.get(application.getClass().getName()).getApplicationAdminForm()); managementForms.get(application.getClass().getName()).getApplicationAdminForm());
} }
instancePanes.put(application.getClass().getName(), instPane); //instancePanes.put(application.getClass().getName(), instPane);
instancePanes.put(application.getPath(), instPane);
} }
@Override @Override

View File

@ -21,7 +21,6 @@ package com.arsdigita.ui.admin.applications;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.table.TableColumn; import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
@ -51,13 +50,17 @@ public class MultiInstanceApplicationPane<T extends Application> extends BaseApp
final ApplicationCollection applications = Application.retrieveAllApplications(applicationType. final ApplicationCollection applications = Application.retrieveAllApplications(applicationType.
getApplicationObjectType()); getApplicationObjectType());
applications.rewind();
final Table table = new Table(); final Table table = new Table();
table.getColumnModel().add(new TableColumn(COL_TITLE, GlobalizationUtil.globalize( table.getColumnModel().add(new TableColumn(COL_TITLE,
"ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_title.header"))); new Label(GlobalizationUtil.globalize(
table.getColumnModel().add(new TableColumn(COL_URL, GlobalizationUtil.globalize( "ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_title.header"))));
"ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_url.header"))); table.getColumnModel().add(new TableColumn(COL_URL,
table.getColumnModel().add(new TableColumn(COL_DESC, GlobalizationUtil.globalize( new Label(GlobalizationUtil.globalize(
"ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_desc.header"))); "ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_url.header"))));
table.getColumnModel().add(new TableColumn(COL_DESC,
new Label(GlobalizationUtil.globalize(
"ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_desc.header"))));
table.setModelBuilder(new ApplicationInstancesTableModelBuilder(applications)); table.setModelBuilder(new ApplicationInstancesTableModelBuilder(applications));
@ -110,6 +113,9 @@ public class MultiInstanceApplicationPane<T extends Application> extends BaseApp
} }
public boolean nextRow() { public boolean nextRow() {
if (applications.isAfterLast()) {
applications.rewind();
}
return applications.next(); return applications.next();
} }

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.ui.login;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class LoginAppManager extends AbstractSingletonApplicationManager<Login> {
public Class<Login> getApplication() {
return Login.class;
}
/**
* Just returns a empty panel. Admin app has no settings for now.
*
* @return
*/
public SimpleContainer getApplicationAdminForm() {
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
panel.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.no_settings")));
return panel;
}
}

View File

@ -0,0 +1 @@
com.arsdigita.london.search.SearchAppManager

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.london.search;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class SearchAppManager extends AbstractSingletonApplicationManager<Search>{
public Class<Search> getApplication() {
return Search.class;
}
public SimpleContainer getApplicationAdminForm() {
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
panel.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.no_settings")));
return panel;
}
}

View File

@ -0,0 +1 @@
com.arsdigita.london.terms.TermsAppManager

View File

@ -29,7 +29,7 @@
<usePageTitle/> <usePageTitle/>
</title> </title>
<useCSSLoader/> <useCSSLoader/>
<useFancybox> <useFancybox/>
<useMathJax/> <useMathJax/>
</head> </head>
<body> <body>

View File

@ -0,0 +1 @@
com.arsdigita.cms.scipublications.SciPublicationsAppManager

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.scipublications;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class SciPublicationsAppManager extends AbstractSingletonApplicationManager<SciPublications> {
public Class<SciPublications> getApplication() {
return SciPublications.class;
}
/**
*
* @return Just a simple Message for now because this applications has no settings yet.
*/
public SimpleContainer getApplicationAdminForm() {
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
panel.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.no_settings")));
return panel;
}
}

View File

@ -0,0 +1 @@
com.arsdigita.shortcuts.ShortcutsAppManager

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.shortcuts;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.shortcuts.ui.AdminPanel;
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class ShortcutsAppManager extends AbstractSingletonApplicationManager<Shortcuts>{
public Class<Shortcuts> getApplication() {
return Shortcuts.class;
}
public SimpleContainer getApplicationAdminForm() {
return new AdminPanel();
}
}

View File

@ -0,0 +1 @@
com.arsdigita.subsite.SubsiteAppManager

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.subsite;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class SubsiteAppManager extends AbstractSingletonApplicationManager<Subsite>{
public Class<Subsite> getApplication() {
return Subsite.class;
}
public SimpleContainer getApplicationAdminForm() {
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
final Label warnLabel = new Label(GlobalizationUtil.globalize("ui.admin.applications.form_not_compatible_now"));
warnLabel.setClassAttr("warning");
panel.add(warnLabel);
panel.add(new Link("Subsite Admin", "/admin/subsite"));
return panel;
}
}

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.subsite.ui;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.subsite.Subsite;
import com.arsdigita.ui.admin.GlobalizationUtil;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class AppManagerPanel extends SimpleContainer {
// private final SiteSelectionModel selectionModel = new SiteSelectionModel(new BigDecimalParameter("site"));
public AppManagerPanel() {
super(Subsite.SUBSITE_XML_PREFIX + "controlCenter",
Subsite.SUBSITE_XML_NS);
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
final Label warnLabel = new Label(GlobalizationUtil.globalize("ui.admin.applications.form_not_compatible_now"));
warnLabel.setClassAttr("warning");
add(warnLabel);
panel.add(warnLabel);
panel.add(new Link("", "/ccm/admin/subsite"));
// add(new SiteListing(selectionModel));
// add(new SiteForm("site", selectionModel));
add(panel);
}
@Override
public void register(final Page page) {
super.register(page);
// page.addGlobalStateParam(selectionModel.getStateParameter());
}
}

View File

@ -18,6 +18,7 @@
package com.arsdigita.subsite.ui; package com.arsdigita.subsite.ui;
import com.arsdigita.bebop.Page;
import com.arsdigita.subsite.Subsite; import com.arsdigita.subsite.Subsite;
import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SimpleContainer;
@ -26,20 +27,16 @@ import com.arsdigita.bebop.SimpleContainer;
* *
*/ */
public class ControlCenterPanel extends SimpleContainer { public class ControlCenterPanel extends SimpleContainer {
private SiteSelectionModel m_site;
/** /**
* *
* @param site * @param selectionModel
*/ */
public ControlCenterPanel(SiteSelectionModel site) { public ControlCenterPanel(final SiteSelectionModel selectionModel) {
super(Subsite.SUBSITE_XML_PREFIX + "controlCenter", super(Subsite.SUBSITE_XML_PREFIX + "controlCenter",
Subsite.SUBSITE_XML_NS); Subsite.SUBSITE_XML_NS);
m_site = site; add(new SiteListing(selectionModel));
add(new SiteForm("site", selectionModel));
add(new SiteListing(m_site)); }
add(new SiteForm("site", m_site));
}
} }

View File

@ -0,0 +1 @@
com.arsdigita.themedirector.ThemeDirectorAppManager

View File

@ -22,6 +22,7 @@ import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -48,6 +49,24 @@ public class ThemeDirector extends Application {
return s_config; return s_config;
} }
/**
* ThemeDirector is a singleton for now.
*
* @return The application instance of the theme director
*/
public static ThemeDirector getThemeDirector() {
final ApplicationCollection apps = Application.retrieveAllApplications(BASE_DATA_OBJECT_TYPE);
final ThemeDirector themeDirector;
if (apps.next()) {
themeDirector = (ThemeDirector) apps.getApplication();
} else {
themeDirector = null;
}
apps.close();
return themeDirector;
}
public ThemeDirector(DataObject obj) { public ThemeDirector(DataObject obj) {
super(obj); super(obj);
} }

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2013 Jens Pelzetter
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.themedirector;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.themedirector.ui.ThemeControlPanel;
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class ThemeDirectorAppManager extends AbstractSingletonApplicationManager<ThemeDirector> {
public Class<ThemeDirector> getApplication() {
return ThemeDirector.class;
}
public SimpleContainer getApplicationAdminForm() {
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
panel.add(new ThemeControlPanel());
return panel;
}
}

View File

@ -15,21 +15,13 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
package com.arsdigita.themedirector.ui; package com.arsdigita.themedirector.ui;
import com.arsdigita.themedirector.Theme;
import com.arsdigita.themedirector.ThemeDirector;
import com.arsdigita.themedirector.ThemeDirectorConstants;
import com.arsdigita.themedirector.ui.listeners.CancelListener;
import com.arsdigita.themedirector.util.GlobalizationUtil;
import com.arsdigita.bebop.ActionLink; import com.arsdigita.bebop.ActionLink;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.List; import com.arsdigita.bebop.List;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SimpleContainer;
@ -44,17 +36,19 @@ import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.SingleSelect; import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.form.Submit; import com.arsdigita.bebop.form.Submit;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.themedirector.Theme;
import com.arsdigita.themedirector.ThemeDirector;
import com.arsdigita.themedirector.ThemeDirectorConstants;
import com.arsdigita.themedirector.ui.listeners.CancelListener;
import com.arsdigita.themedirector.util.GlobalizationUtil;
import com.arsdigita.toolbox.ui.ActionGroup; import com.arsdigita.toolbox.ui.ActionGroup;
import com.arsdigita.toolbox.ui.Cancellable; import com.arsdigita.toolbox.ui.Cancellable;
import com.arsdigita.toolbox.ui.SelectionPanel; import com.arsdigita.toolbox.ui.SelectionPanel;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.web.Web;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.TooManyListenersException; import java.util.TooManyListenersException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -63,51 +57,45 @@ import org.apache.log4j.Logger;
* to show the correct forms/containers on the left * to show the correct forms/containers on the left
*/ */
public class ThemeControlPanel extends SelectionPanel implements ThemeDirectorConstants { public class ThemeControlPanel extends SelectionPanel implements ThemeDirectorConstants {
private static final Logger s_log = Logger.getLogger(ThemeControlPanel.class);
private ThemeSelectionModel m_theme; private static final Logger LOGGER = Logger.getLogger(ThemeControlPanel.class);
private ThemeContainer m_themeContainer; private final ThemeSelectionModel selectionModel;
private Form m_themeForm; //private final ThemeContainer themeContainer;
private BigDecimalParameter m_defaultThemeParam = new BigDecimalParameter( "defaultTheme" ); private final Form themeForm;
private final BigDecimalParameter defaultThemeParam = new BigDecimalParameter("defaultTheme");
public ThemeControlPanel() { public ThemeControlPanel() {
super(new Label(GlobalizationUtil.globalize("theme.available_themes")), super(new Label(GlobalizationUtil.globalize("theme.available_themes")),
new ThemeListModelBuilder()); new ThemeListModelBuilder());
setIntroPane(new Label(GlobalizationUtil.globalize setIntroPane(new Label(GlobalizationUtil.globalize("theme.select_or_create")));
("theme.select_or_create")));
((List) getSelector()).setEmptyView(new Label(GlobalizationUtil.globalize("theme.none_available")));
((List)getSelector()).setEmptyView
(new Label(GlobalizationUtil.globalize("theme.none_available")));
// add the theme container // add the theme container
m_theme = new ThemeSelectionModel(getSelectionModel()); selectionModel = new ThemeSelectionModel(getSelectionModel());
m_themeContainer = new ThemeContainer(m_theme, getBody()); final ThemeContainer themeContainer = new ThemeContainer(selectionModel, getBody());
setItemPane(m_themeContainer); setItemPane(themeContainer);
// add the "create a theme" form // add the "create a theme" form
m_themeForm = new ThemeForm("themeForm", m_theme); themeForm = new ThemeForm("themeForm", selectionModel);
m_themeForm.addSubmissionListener themeForm.addSubmissionListener(new CancelListener((Cancellable) themeForm, getBody()));
(new CancelListener((Cancellable)m_themeForm, getBody())); themeForm.addProcessListener(new FormProcessListener() {
m_themeForm.addProcessListener(new FormProcessListener() { public void process(final FormSectionEvent event) throws FormProcessException {
public void process(FormSectionEvent e) resetPane(event.getPageState());
throws FormProcessException { }
resetPane(e.getPageState());
}
});
ActionLink addThemeLink = });
new ActionLink(new Label(GlobalizationUtil.globalize
("theme.create_new_theme"))); final ActionLink addThemeLink = new ActionLink(new Label(GlobalizationUtil.globalize("theme.create_new_theme")));
addThemeLink.addActionListener(new ActionListener() { addThemeLink.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(final ActionEvent event) {
m_theme.setSelectedObject(e.getPageState(), null); selectionModel.setSelectedObject(event.getPageState(), null);
m_themeForm.setVisible(e.getPageState(), true); themeForm.setVisible(event.getPageState(), true);
} }
}); });
getBody().add(m_themeForm); getBody().add(themeForm);
getBody().connect(addThemeLink, m_themeForm); getBody().connect(addThemeLink, themeForm);
addAction(addThemeLink, ActionGroup.ADD); addAction(addThemeLink, ActionGroup.ADD);
// add the "Download default base styxle" form // add the "Download default base styxle" form
@ -116,85 +104,87 @@ public class ThemeControlPanel extends SelectionPanel implements ThemeDirectorCo
// package installed, probably filtered by theme file extensions (xsl, // package installed, probably filtered by theme file extensions (xsl,
// css, etc). // css, etc).
/* /*
getBody().add(new Label(GlobalizationUtil getBody().add(new Label(GlobalizationUtil
.globalize("theme.download_default_base_styles"))); .globalize("theme.download_default_base_styles")));
Link downloadFilesLink = new Link(new Label(GlobalizationUtil.globalize Link downloadFilesLink = new Link(new Label(GlobalizationUtil.globalize
("theme.download_default_base_styles")), ("theme.download_default_base_styles")),
"download/" + ALL_STYLES_ZIP_NAME); "download/" + ALL_STYLES_ZIP_NAME);
addAction(downloadFilesLink, ActionGroup.ADD); addAction(downloadFilesLink, ActionGroup.ADD);
*/ */
// add the "Select Standard Theme" form // add the "Select Standard Theme" form
Form defaultThemeForm = createDefaultThemeForm(); final Form defaultThemeForm = createDefaultThemeForm();
addAction( defaultThemeForm ); addAction(defaultThemeForm);
} }
private Form createDefaultThemeForm() { private Form createDefaultThemeForm() {
Form defaultThemeForm = new Form("defaultThemeForm", new SimpleContainer()); final Form defaultThemeForm = new Form("defaultThemeForm", new SimpleContainer());
defaultThemeForm.add( new Label( GlobalizationUtil.globalize defaultThemeForm.add(new Label(GlobalizationUtil.globalize("theme.set_default_theme")));
( "theme.set_default_theme" ) ) );
SingleSelect themes = new SingleSelect( m_defaultThemeParam ); final SingleSelect themes = new SingleSelect(defaultThemeParam);
themes.addOption( new Option( null, new Label( GlobalizationUtil.globalize( "theme.none" ) ) ) ); themes.addOption(new Option(null, new Label(GlobalizationUtil.globalize("theme.none"))));
try { try {
themes.addPrintListener( new PrintListener() { themes.addPrintListener(new PrintListener() {
public void prepare( PrintEvent ev ) { public void prepare(final PrintEvent event) {
SingleSelect target = (SingleSelect) ev.getTarget(); final SingleSelect target = (SingleSelect) event.getTarget();
final DataCollection options = SessionManager.getSession().retrieve(Theme.BASE_DATA_OBJECT_TYPE);
DataCollection options = SessionManager.getSession().retrieve options.addNotEqualsFilter(Theme.LAST_PUBLISHED_DATE, null);
( Theme.BASE_DATA_OBJECT_TYPE ); options.addOrder(Theme.TITLE);
options.addNotEqualsFilter( Theme.LAST_PUBLISHED_DATE, null ); while (options.next()) {
options.addOrder( Theme.TITLE ); target.addOption(new Option(options.get(Theme.ID).toString(),
while( options.next() ) { options.get(Theme.TITLE).toString()));
target.addOption( new Option( options.get( Theme.ID ).toString(),
options.get( Theme.TITLE ).toString() ) );
} }
} }
} ); });
} catch( TooManyListenersException ex ) { } catch (TooManyListenersException ex) {
// Don't be stupid // Don't be stupid
throw new UncheckedWrapperException( "An impossible, pointless exception occurred", ex ); throw new UncheckedWrapperException("An impossible, pointless exception occurred", ex);
} }
defaultThemeForm.add( themes ); defaultThemeForm.add(themes);
defaultThemeForm.add( new Submit( GlobalizationUtil.globalize( "theme.save" ) ) ); defaultThemeForm.add(new Submit(GlobalizationUtil.globalize("theme.save")));
defaultThemeForm.addInitListener( new FormInitListener() { defaultThemeForm.addInitListener(new FormInitListener() {
public void init( FormSectionEvent ev ) { public void init(final FormSectionEvent event) {
FormData data = ev.getFormData(); final FormData data = event.getFormData();
ThemeDirector app = (ThemeDirector) Web.getContext().getApplication(); //ThemeDirector app = (ThemeDirector) Web.getContext().getApplication();
Theme theme = app.getDefaultTheme(); final ThemeDirector app = ThemeDirector.getThemeDirector();
final Theme theme = app.getDefaultTheme();
if( null != theme ) if (null != theme) {
data.put( m_defaultThemeParam.getName(), theme.getID() ); data.put(defaultThemeParam.getName(), theme.getID());
}
} }
} );
defaultThemeForm.addProcessListener( new FormProcessListener() { });
public void process( FormSectionEvent ev ) {
FormData data = ev.getFormData(); defaultThemeForm.addProcessListener(new FormProcessListener() {
BigDecimal themeID = (BigDecimal) data.get( m_defaultThemeParam.getName() ); public void process(final FormSectionEvent event) {
final FormData data = event.getFormData();
final BigDecimal themeID = (BigDecimal) data.get(defaultThemeParam.getName());
Theme theme = null; Theme theme = null;
if( null != themeID ) { if (null != themeID) {
theme = Theme.retrieve( themeID ); theme = Theme.retrieve(themeID);
} }
ThemeDirector app = (ThemeDirector) Web.getContext().getApplication(); //ThemeDirector app = (ThemeDirector) Web.getContext().getApplication();
app.setDefaultTheme( theme ); final ThemeDirector app = ThemeDirector.getThemeDirector();
app.setDefaultTheme(theme);
} }
} );
});
return defaultThemeForm; return defaultThemeForm;
} }
private void resetPane(PageState state) { private void resetPane(final PageState state) {
getBody().reset(state); getBody().reset(state);
if (getSelectionModel().isSelected(state)) { if (getSelectionModel().isSelected(state)) {
s_log.debug("The selection model is selected; displaying " + LOGGER.debug("The selection model is selected; displaying the item pane");
"the item pane");
getBody().push(state, getItemPane()); getBody().push(state, getItemPane());
} }
} }
} }