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

View File

@ -13,7 +13,6 @@
* 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.contentassets;
import com.arsdigita.cms.ContentPage;
@ -42,7 +41,7 @@ public class NotesInitializer extends ContentAssetInitializer {
* super class.
*/
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
*/
@Override
public void init( DomainInitEvent ev ) {
super.init( ev );
public void init(DomainInitEvent ev) {
super.init(ev);
ContentType.registerXSLFile(
null,
"/themes/heirloom/contentassets/notes/xsl/index.xsl" );
DomainObjectTraversal.registerAdapter(
Note.BASE_DATA_OBJECT_TYPE,
new SimpleDomainObjectTraversalAdapter(),
SimpleXMLGenerator.ADAPTER_CONTEXT );
ContentType.registerXSLFile(
null,
"/themes/heirloom/contentassets/notes/xsl/index.xsl");
DomainObjectTraversal.registerAdapter(
Note.BASE_DATA_OBJECT_TYPE,
new SimpleDomainObjectTraversalAdapter(),
SimpleXMLGenerator.ADAPTER_CONTEXT);
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
*/
@Override
public String getBaseType() {
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
*/
@Override
public String getTraversalXML() {
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'.
*/
@Override
public String getProperty() {
return Note.NOTES;
}
/**
* The class of the authoring kit step
* @return The class of the authoring kit step
*/
@Override
public Class getAuthoringStep() {
return NotesStep.class;
}
/**
* The label for the authoring step
* @return The label for the authoring step
*/
@Override
public GlobalizedMessage getAuthoringStepLabel() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.notes_authoring_step_label",
"com.arsdigita.cms.contentassets.NotesResources"
);
"com.arsdigita.cms.contentassets.notes_authoring_step_label",
"com.arsdigita.cms.contentassets.NotesResources");
}
/**
* The description for the authoring step
* @return The description for the authoring step
*/
@Override
public GlobalizedMessage getAuthoringStepDescription() {
return new GlobalizedMessage(
"com.arsdigita.cms.contentassets.notes_authoring_step_description",
"com.arsdigita.cms.contentassets.NotesResources"
);
"com.arsdigita.cms.contentassets.notes_authoring_step_description",
"com.arsdigita.cms.contentassets.NotesResources");
}
/**
* The sort key for the authoring step
* @return The sort key for the authoring step
*/
@Override
public int getAuthoringStepSortKey() {
return NotesConfig.getInstance().getAssetStepSortKey();
}
}

View File

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

View File

@ -139,7 +139,7 @@ public class PublicPersonalProfileNavItemsAddForm
addInitListener(this);
addProcessListener(this);
addValidationListener(this);
addSubmissionListener(this);
}
public void init(final FormSectionEvent fse) throws FormProcessException {
@ -294,6 +294,8 @@ public class PublicPersonalProfileNavItemsAddForm
data.put(PublicPersonalProfileNavItem.LANG, "");
data.put(PublicPersonalProfileNavItem.LABEL, "");
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.ui.authoring.BasicPageForm;
/**
* Form to edit the basic properties of an SiteProxy. This form can be
* extended to create forms for SiteProxy subclasses.
*/
public class SiteProxyPropertyForm extends BasicPageForm
implements FormProcessListener,
FormInitListener {
implements FormProcessListener,
FormInitListener {
private TextField m_url;
@ -56,10 +55,9 @@ public class SiteProxyPropertyForm extends BasicPageForm
*/
protected void addWidgets() {
super.addWidgets();
add(new Label("URL:"));
ParameterModel urlParam
= new StringParameter("url");
ParameterModel urlParam = new StringParameter("url");
m_url = new TextField(urlParam);
m_url.setSize(40);
add(m_url);
@ -67,24 +65,23 @@ public class SiteProxyPropertyForm extends BasicPageForm
/** Form initialisation hook. Fills widgets with data. */
public void init(FormSectionEvent fse) {
SiteProxy site
= (SiteProxy) super.initBasicWidgets(fse);
m_url.setValue(fse.getPageState(),
SiteProxy site = (SiteProxy) super.initBasicWidgets(fse);
m_url.setValue(fse.getPageState(),
site.getURL());
}
/** Form processing hook. Saves SiteProxy object. */
public void process(FormSectionEvent fse) {
SiteProxy site
= (SiteProxy) super.processBasicWidgets(fse);
SiteProxy site = (SiteProxy) super.processBasicWidgets(fse);
// save only if save button was pressed
if (site != null
&& getSaveCancelSection().getSaveButton()
.isSelected(fse.getPageState())) {
site.setURL((String)m_url.getValue(fse.getPageState()));
&& getSaveCancelSection().getSaveButton()
.isSelected(fse.getPageState())) {
site.setURL((String) m_url.getValue(fse.getPageState()));
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.go=Go
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
#File Upload
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
#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
#File Upload
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;
}
public final TreeModel makeModel(final Tree tree, final PageState state) {
final ContentSection section = CMS.getContext().getContentSection();
final Category root = Category.getRootForObject(section,
final Category root = Category.getRootForObject(section,
getUseContext(state));
String order = ContentSection.getConfig().getCategoryTreeOrder();
final CategoryTreeModelLite model = new CategoryTreeModelLite(root, order);
return model;
}
private String getUseContext(PageState state) {
String context = 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) {
// Protect against empty lang string
if (lang != null) {
if ((lang != null) && !(lang.isEmpty())) {
// Split the string and create the Locale object
StringTokenizer paramValues = new StringTokenizer(lang, "_");
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.no_admin_pane_found=No admin pane for applications of type '{0}' found.
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.no_admin_pane_found=Keine Admin-Formular f\u00fcr Applikationen des Types {0} gefunden
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.no_admin_pane_found=
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.no_admin_pane_found=
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,
managementForms.get(application.getClass().getName()).getApplicationAdminForm());
}
instancePanes.put(application.getClass().getName(), instPane);
//instancePanes.put(application.getClass().getName(), instPane);
instancePanes.put(application.getPath(), instPane);
}
@Override

View File

@ -21,7 +21,6 @@ package com.arsdigita.ui.admin.applications;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableModel;
@ -51,13 +50,17 @@ public class MultiInstanceApplicationPane<T extends Application> extends BaseApp
final ApplicationCollection applications = Application.retrieveAllApplications(applicationType.
getApplicationObjectType());
applications.rewind();
final Table table = new Table();
table.getColumnModel().add(new TableColumn(COL_TITLE, GlobalizationUtil.globalize(
"ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_title.header")));
table.getColumnModel().add(new TableColumn(COL_URL, GlobalizationUtil.globalize(
"ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_url.header")));
table.getColumnModel().add(new TableColumn(COL_DESC, GlobalizationUtil.globalize(
"ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_desc.header")));
table.getColumnModel().add(new TableColumn(COL_TITLE,
new Label(GlobalizationUtil.globalize(
"ui.admin.applicationsMultiInstanceApplicationPane.instances.table.col_title.header"))));
table.getColumnModel().add(new TableColumn(COL_URL,
new Label(GlobalizationUtil.globalize(
"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));
@ -110,6 +113,9 @@ public class MultiInstanceApplicationPane<T extends Application> extends BaseApp
}
public boolean nextRow() {
if (applications.isAfterLast()) {
applications.rewind();
}
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/>
</title>
<useCSSLoader/>
<useFancybox>
<useFancybox/>
<useMathJax/>
</head>
<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;
import com.arsdigita.bebop.Page;
import com.arsdigita.subsite.Subsite;
import com.arsdigita.bebop.SimpleContainer;
@ -26,20 +27,16 @@ import com.arsdigita.bebop.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",
Subsite.SUBSITE_XML_NS);
m_site = site;
add(new SiteListing(m_site));
add(new SiteForm("site", m_site));
}
add(new SiteListing(selectionModel));
add(new SiteForm("site", selectionModel));
}
}

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.DataObject;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection;
import org.apache.log4j.Logger;
@ -48,6 +49,24 @@ public class ThemeDirector extends Application {
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) {
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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
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.Form;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.List;
import com.arsdigita.bebop.PageState;
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.Submit;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.persistence.SessionManager;
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.Cancellable;
import com.arsdigita.toolbox.ui.SelectionPanel;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.web.Web;
import java.math.BigDecimal;
import java.util.TooManyListenersException;
import org.apache.log4j.Logger;
/**
@ -63,51 +57,45 @@ import org.apache.log4j.Logger;
* to show the correct forms/containers on the left
*/
public class ThemeControlPanel extends SelectionPanel implements ThemeDirectorConstants {
private static final Logger s_log = Logger.getLogger(ThemeControlPanel.class);
private ThemeSelectionModel m_theme;
private ThemeContainer m_themeContainer;
private Form m_themeForm;
private BigDecimalParameter m_defaultThemeParam = new BigDecimalParameter( "defaultTheme" );
private static final Logger LOGGER = Logger.getLogger(ThemeControlPanel.class);
private final ThemeSelectionModel selectionModel;
//private final ThemeContainer themeContainer;
private final Form themeForm;
private final BigDecimalParameter defaultThemeParam = new BigDecimalParameter("defaultTheme");
public ThemeControlPanel() {
super(new Label(GlobalizationUtil.globalize("theme.available_themes")),
new ThemeListModelBuilder());
setIntroPane(new Label(GlobalizationUtil.globalize
("theme.select_or_create")));
setIntroPane(new Label(GlobalizationUtil.globalize("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
m_theme = new ThemeSelectionModel(getSelectionModel());
m_themeContainer = new ThemeContainer(m_theme, getBody());
setItemPane(m_themeContainer);
selectionModel = new ThemeSelectionModel(getSelectionModel());
final ThemeContainer themeContainer = new ThemeContainer(selectionModel, getBody());
setItemPane(themeContainer);
// add the "create a theme" form
m_themeForm = new ThemeForm("themeForm", m_theme);
m_themeForm.addSubmissionListener
(new CancelListener((Cancellable)m_themeForm, getBody()));
m_themeForm.addProcessListener(new FormProcessListener() {
public void process(FormSectionEvent e)
throws FormProcessException {
resetPane(e.getPageState());
}
});
themeForm = new ThemeForm("themeForm", selectionModel);
themeForm.addSubmissionListener(new CancelListener((Cancellable) themeForm, getBody()));
themeForm.addProcessListener(new FormProcessListener() {
public void process(final FormSectionEvent event) throws FormProcessException {
resetPane(event.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() {
public void actionPerformed(ActionEvent e) {
m_theme.setSelectedObject(e.getPageState(), null);
m_themeForm.setVisible(e.getPageState(), true);
}
});
getBody().add(m_themeForm);
getBody().connect(addThemeLink, m_themeForm);
public void actionPerformed(final ActionEvent event) {
selectionModel.setSelectedObject(event.getPageState(), null);
themeForm.setVisible(event.getPageState(), true);
}
});
getBody().add(themeForm);
getBody().connect(addThemeLink, themeForm);
addAction(addThemeLink, ActionGroup.ADD);
// 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,
// css, etc).
/*
getBody().add(new Label(GlobalizationUtil
.globalize("theme.download_default_base_styles")));
Link downloadFilesLink = new Link(new Label(GlobalizationUtil.globalize
("theme.download_default_base_styles")),
"download/" + ALL_STYLES_ZIP_NAME);
addAction(downloadFilesLink, ActionGroup.ADD);
*/
getBody().add(new Label(GlobalizationUtil
.globalize("theme.download_default_base_styles")));
Link downloadFilesLink = new Link(new Label(GlobalizationUtil.globalize
("theme.download_default_base_styles")),
"download/" + ALL_STYLES_ZIP_NAME);
addAction(downloadFilesLink, ActionGroup.ADD);
*/
// add the "Select Standard Theme" form
Form defaultThemeForm = createDefaultThemeForm();
addAction( defaultThemeForm );
final Form defaultThemeForm = createDefaultThemeForm();
addAction(defaultThemeForm);
}
private Form createDefaultThemeForm() {
Form defaultThemeForm = new Form("defaultThemeForm", new SimpleContainer());
defaultThemeForm.add( new Label( GlobalizationUtil.globalize
( "theme.set_default_theme" ) ) );
final Form defaultThemeForm = new Form("defaultThemeForm", new SimpleContainer());
defaultThemeForm.add(new Label(GlobalizationUtil.globalize("theme.set_default_theme")));
SingleSelect themes = new SingleSelect( m_defaultThemeParam );
themes.addOption( new Option( null, new Label( GlobalizationUtil.globalize( "theme.none" ) ) ) );
final SingleSelect themes = new SingleSelect(defaultThemeParam);
themes.addOption(new Option(null, new Label(GlobalizationUtil.globalize("theme.none"))));
try {
themes.addPrintListener( new PrintListener() {
public void prepare( PrintEvent ev ) {
SingleSelect target = (SingleSelect) ev.getTarget();
DataCollection options = SessionManager.getSession().retrieve
( Theme.BASE_DATA_OBJECT_TYPE );
options.addNotEqualsFilter( Theme.LAST_PUBLISHED_DATE, null );
options.addOrder( Theme.TITLE );
while( options.next() ) {
target.addOption( new Option( options.get( Theme.ID ).toString(),
options.get( Theme.TITLE ).toString() ) );
themes.addPrintListener(new PrintListener() {
public void prepare(final PrintEvent event) {
final SingleSelect target = (SingleSelect) event.getTarget();
final DataCollection options = SessionManager.getSession().retrieve(Theme.BASE_DATA_OBJECT_TYPE);
options.addNotEqualsFilter(Theme.LAST_PUBLISHED_DATE, null);
options.addOrder(Theme.TITLE);
while (options.next()) {
target.addOption(new Option(options.get(Theme.ID).toString(),
options.get(Theme.TITLE).toString()));
}
}
} );
} catch( TooManyListenersException ex ) {
});
} catch (TooManyListenersException ex) {
// 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() {
public void init( FormSectionEvent ev ) {
FormData data = ev.getFormData();
defaultThemeForm.addInitListener(new FormInitListener() {
public void init(final FormSectionEvent event) {
final FormData data = event.getFormData();
ThemeDirector app = (ThemeDirector) Web.getContext().getApplication();
Theme theme = app.getDefaultTheme();
//ThemeDirector app = (ThemeDirector) Web.getContext().getApplication();
final ThemeDirector app = ThemeDirector.getThemeDirector();
final Theme theme = app.getDefaultTheme();
if( null != theme )
data.put( m_defaultThemeParam.getName(), theme.getID() );
if (null != theme) {
data.put(defaultThemeParam.getName(), theme.getID());
}
}
} );
defaultThemeForm.addProcessListener( new FormProcessListener() {
public void process( FormSectionEvent ev ) {
FormData data = ev.getFormData();
BigDecimal themeID = (BigDecimal) data.get( m_defaultThemeParam.getName() );
});
defaultThemeForm.addProcessListener(new FormProcessListener() {
public void process(final FormSectionEvent event) {
final FormData data = event.getFormData();
final BigDecimal themeID = (BigDecimal) data.get(defaultThemeParam.getName());
Theme theme = null;
if( null != themeID ) {
theme = Theme.retrieve( themeID );
if (null != themeID) {
theme = Theme.retrieve(themeID);
}
ThemeDirector app = (ThemeDirector) Web.getContext().getApplication();
app.setDefaultTheme( theme );
//ThemeDirector app = (ThemeDirector) Web.getContext().getApplication();
final ThemeDirector app = ThemeDirector.getThemeDirector();
app.setDefaultTheme(theme);
}
} );
});
return defaultThemeForm;
}
private void resetPane(PageState state) {
private void resetPane(final PageState state) {
getBody().reset(state);
if (getSelectionModel().isSelected(state)) {
s_log.debug("The selection model is selected; displaying " +
"the item pane");
LOGGER.debug("The selection model is selected; displaying the item pane");
getBody().push(state, getItemPane());
}
}
}