Admin-Seite für Subsites benutzbar gemacht:
- Labels für die Formularfelder hinzugefügt - ColumnPanel eingefügt, damit die Sachen untereinander stehen git-svn-id: https://svn.libreccm.org/ccm/trunk@1858 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
79d89bfe00
commit
3157d2ea88
|
|
@ -15,9 +15,9 @@
|
||||||
* 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.subsite.ui;
|
package com.arsdigita.subsite.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.ColumnPanel;
|
||||||
import com.arsdigita.bebop.Form;
|
import com.arsdigita.bebop.Form;
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.bebop.SaveCancelSection;
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
|
|
@ -37,6 +37,7 @@ import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.event.ParameterEvent;
|
import com.arsdigita.bebop.event.ParameterEvent;
|
||||||
import com.arsdigita.bebop.event.ParameterListener;
|
import com.arsdigita.bebop.event.ParameterListener;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.bebop.parameters.ParameterData;
|
import com.arsdigita.bebop.parameters.ParameterData;
|
||||||
|
|
@ -65,7 +66,6 @@ import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class creates the administration input form.
|
* Class creates the administration input form.
|
||||||
*
|
*
|
||||||
|
|
@ -76,10 +76,8 @@ public class SiteForm extends Form {
|
||||||
|
|
||||||
/** A logger instance. */
|
/** A logger instance. */
|
||||||
private static final Logger s_log = Logger.getLogger(SiteForm.class);
|
private static final Logger s_log = Logger.getLogger(SiteForm.class);
|
||||||
|
|
||||||
private SiteSelectionModel m_site;
|
private SiteSelectionModel m_site;
|
||||||
private BigDecimal siteDefaultRootPageID;
|
private BigDecimal siteDefaultRootPageID;
|
||||||
|
|
||||||
/** Input field subsite title */
|
/** Input field subsite title */
|
||||||
private TextField m_title;
|
private TextField m_title;
|
||||||
private TextField m_hostname;
|
private TextField m_hostname;
|
||||||
|
|
@ -89,16 +87,13 @@ public class SiteForm extends Form {
|
||||||
private CategoryPicker m_rootCategory;
|
private CategoryPicker m_rootCategory;
|
||||||
private SingleSelect m_themes;
|
private SingleSelect m_themes;
|
||||||
private SaveCancelSection m_buttons;
|
private SaveCancelSection m_buttons;
|
||||||
|
|
||||||
private final static String DEFAULT_APP = "DEFAULT_APP";
|
private final static String DEFAULT_APP = "DEFAULT_APP";
|
||||||
private final static String DEFAULT_APP_LABEL = "Site Wide Default ";
|
private final static String DEFAULT_APP_LABEL = "Site Wide Default ";
|
||||||
|
|
||||||
private final static String DEFAULT_STYLE = "DEFAULT_STYLE";
|
private final static String DEFAULT_STYLE = "DEFAULT_STYLE";
|
||||||
private final static String DEFAULT_STYLE_LABEL = "Site Wide Default ";
|
private final static String DEFAULT_STYLE_LABEL = "Site Wide Default ";
|
||||||
private final static String OTHER_STYLE = "OTHER_STYLE";
|
private final static String OTHER_STYLE = "OTHER_STYLE";
|
||||||
private final static String OTHER_STYLE_LABEL = "Other (type in box below)";
|
private final static String OTHER_STYLE_LABEL = "Other (type in box below)";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor create input widgets and adds them to form.
|
* Constructor create input widgets and adds them to form.
|
||||||
*
|
*
|
||||||
|
|
@ -107,23 +102,25 @@ public class SiteForm extends Form {
|
||||||
*/
|
*/
|
||||||
public SiteForm(String name, SiteSelectionModel site) {
|
public SiteForm(String name, SiteSelectionModel site) {
|
||||||
|
|
||||||
super(name, new SimpleContainer());
|
//super(name, new SimpleContainer());
|
||||||
|
super(name, new ColumnPanel(2));
|
||||||
setClassAttr("simpleForm");
|
setClassAttr("simpleForm");
|
||||||
setRedirecting(true);
|
setRedirecting(true);
|
||||||
|
|
||||||
m_site = site;
|
m_site = site;
|
||||||
String defAppPath = UI.getRootPageURL() ;
|
String defAppPath = UI.getRootPageURL();
|
||||||
s_log.debug("defAppPath is: " + defAppPath );
|
s_log.debug("defAppPath is: " + defAppPath);
|
||||||
siteDefaultRootPageID =
|
siteDefaultRootPageID =
|
||||||
Application.retrieveApplicationForPath(defAppPath )
|
Application.retrieveApplicationForPath(defAppPath)
|
||||||
.getID();
|
.getID();
|
||||||
|
|
||||||
/* Setup text input field for subsite title property */
|
/* Setup text input field for subsite title property */
|
||||||
m_title = new TextField(new StringParameter("title"));
|
m_title = new TextField(new StringParameter("title"));
|
||||||
m_title.addValidationListener(new NotNullValidationListener());
|
m_title.addValidationListener(new NotNullValidationListener());
|
||||||
m_title.setMetaDataAttribute("title", "Title");
|
m_title.setMetaDataAttribute("title", "Title");
|
||||||
m_title.setHint("Enter the title of the subsite, upto 80 characters");
|
m_title.setHint((String) SubsiteGlobalizationUtil.globalize("subsite.ui.title.hint").localize());
|
||||||
m_title.setSize(40);
|
m_title.setSize(40);
|
||||||
|
add(new Label(SubsiteGlobalizationUtil.globalize("subsite.ui.title.label")));
|
||||||
add(m_title); // adds title input field to form
|
add(m_title); // adds title input field to form
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -133,9 +130,8 @@ public class SiteForm extends Form {
|
||||||
m_hostname.addValidationListener(new HostNameValidationListener());
|
m_hostname.addValidationListener(new HostNameValidationListener());
|
||||||
m_hostname.setMetaDataAttribute("title", "Hostname");
|
m_hostname.setMetaDataAttribute("title", "Hostname");
|
||||||
m_hostname.setSize(40);
|
m_hostname.setSize(40);
|
||||||
m_hostname.setHint(
|
m_hostname.setHint((String) SubsiteGlobalizationUtil.globalize("subsite.ui.hostname.hint").localize());
|
||||||
"Enter the hostname for the subsite, eg business.example.com"
|
add(new Label(SubsiteGlobalizationUtil.globalize("subsite.ui.hostname.label")));
|
||||||
);
|
|
||||||
add(m_hostname); // adds hostname input field to form
|
add(m_hostname); // adds hostname input field to form
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -145,40 +141,38 @@ public class SiteForm extends Form {
|
||||||
m_description.setMetaDataAttribute("title", "Description");
|
m_description.setMetaDataAttribute("title", "Description");
|
||||||
m_description.setCols(45);
|
m_description.setCols(45);
|
||||||
m_description.setRows(4);
|
m_description.setRows(4);
|
||||||
m_description.setHint(
|
m_description.setHint((String) SubsiteGlobalizationUtil.globalize("subsite.ui.description.hint").localize());
|
||||||
"Enter a short description for the subsite, upto 4000 characters"
|
add(new Label(SubsiteGlobalizationUtil.globalize("subsite.ui.description.label")));
|
||||||
);
|
|
||||||
add(m_description); // adds description input field to form
|
add(m_description); // adds description input field to form
|
||||||
|
|
||||||
|
|
||||||
/* Setup selection box for subsite start page (front page) Application
|
/* Setup selection box for subsite start page (front page) Application
|
||||||
* by URL */
|
* by URL */
|
||||||
m_customFrontpageApp = new SingleSelect(
|
m_customFrontpageApp = new SingleSelect(
|
||||||
new StringParameter("customFrontpageApp"));
|
new StringParameter("customFrontpageApp"));
|
||||||
m_customFrontpageApp.setMetaDataAttribute("title",
|
m_customFrontpageApp.setMetaDataAttribute("title", "Front Page (url)");
|
||||||
"Front Page (url)");
|
|
||||||
// m_customFrontpageApp.setSize(40);
|
// m_customFrontpageApp.setSize(40);
|
||||||
m_customFrontpageApp.setHint(
|
m_customFrontpageApp.setHint((String) SubsiteGlobalizationUtil.globalize("subsite.ui.customfrontpage.hint").
|
||||||
"Select the name (url) of the subsite custom homepage");
|
localize());
|
||||||
try {
|
try {
|
||||||
m_customFrontpageApp.addPrintListener(new FrontpageAppListener());
|
m_customFrontpageApp.addPrintListener(new FrontpageAppListener());
|
||||||
} catch (TooManyListenersException ex) {
|
} catch (TooManyListenersException ex) {
|
||||||
throw new UncheckedWrapperException("This cannot happen", ex);
|
throw new UncheckedWrapperException("This cannot happen", ex);
|
||||||
}
|
}
|
||||||
|
add(new Label(SubsiteGlobalizationUtil.globalize("subsite.ui.customfrontpage.label")));
|
||||||
add(m_customFrontpageApp); // adds selectfield start page to form
|
add(m_customFrontpageApp); // adds selectfield start page to form
|
||||||
|
|
||||||
|
|
||||||
/* Setup selection box for themes */
|
/* Setup selection box for themes */
|
||||||
m_themes = new SingleSelect(new StringParameter("selectStyleDir"));
|
m_themes = new SingleSelect(new StringParameter("selectStyleDir"));
|
||||||
m_themes.setMetaDataAttribute("title", "XSLT Directory");
|
m_themes.setMetaDataAttribute("title", "XSLT Directory");
|
||||||
m_themes.setHint("Select an existing theme from the list, select" +
|
m_themes.setHint((String) SubsiteGlobalizationUtil.globalize("subsite.ui.theme.hint").localize());
|
||||||
" 'Other' to type something below or select" +
|
|
||||||
" 'Site Wide Default' to get the default themes." );
|
|
||||||
try {
|
try {
|
||||||
m_themes.addPrintListener(new ThemesListener());
|
m_themes.addPrintListener(new ThemesListener());
|
||||||
} catch (TooManyListenersException ex) {
|
} catch (TooManyListenersException ex) {
|
||||||
throw new UncheckedWrapperException("This cannot happen", ex);
|
throw new UncheckedWrapperException("This cannot happen", ex);
|
||||||
}
|
}
|
||||||
|
add(new Label(SubsiteGlobalizationUtil.globalize("subsite.ui.theme.label")));
|
||||||
add(m_themes); // adds themes selection box to form
|
add(m_themes); // adds themes selection box to form
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -186,27 +180,29 @@ public class SiteForm extends Form {
|
||||||
m_styleDir = new TextField(new StringParameter("styleDir"));
|
m_styleDir = new TextField(new StringParameter("styleDir"));
|
||||||
m_styleDir.setMetaDataAttribute("title", "XSLT Directory (Other)");
|
m_styleDir.setMetaDataAttribute("title", "XSLT Directory (Other)");
|
||||||
m_styleDir.setSize(40);
|
m_styleDir.setSize(40);
|
||||||
m_styleDir.setHint( "Enter the directory for the custom XSLT styles, "
|
m_styleDir.setHint("Enter the directory for the custom XSLT styles, or leave blank for the default styling.");
|
||||||
+"or leave blank for the default styling." );
|
add(new Label(SubsiteGlobalizationUtil.globalize("subsite.ui.styledir.label")));
|
||||||
add(m_styleDir); // adds inputfield style dir to form
|
add(m_styleDir); // adds inputfield style dir to form
|
||||||
|
|
||||||
|
|
||||||
/* Setup selection box for cagtegory domain */
|
/* Setup selection box for cagtegory domain */
|
||||||
m_rootCategory = (CategoryPicker)Classes.newInstance(
|
m_rootCategory = (CategoryPicker) Classes.newInstance(
|
||||||
Subsite.getConfig().getRootCategoryPicker(),
|
Subsite.getConfig().getRootCategoryPicker(),
|
||||||
new Class[] { String.class },
|
new Class[]{String.class},
|
||||||
new Object[] { "rootCategory" });
|
new Object[]{"rootCategory"});
|
||||||
if (m_rootCategory instanceof Widget) {
|
if (m_rootCategory instanceof Widget) {
|
||||||
((Widget)m_rootCategory)
|
((Widget) m_rootCategory).setMetaDataAttribute("title", "Root category");
|
||||||
.setMetaDataAttribute("title", "Root category");
|
((Widget) m_rootCategory).setHint((String) SubsiteGlobalizationUtil.globalize(
|
||||||
((Widget)m_rootCategory)
|
"subsite.ui.root_category.hint").localize());
|
||||||
.setHint("Select a root navigation category");
|
|
||||||
}
|
}
|
||||||
|
add(new Label(SubsiteGlobalizationUtil.globalize("subsite.ui.root_category.label")));
|
||||||
add(m_rootCategory); // adds domain category selection box to form
|
add(m_rootCategory); // adds domain category selection box to form
|
||||||
|
|
||||||
|
|
||||||
m_buttons = new SaveCancelSection();
|
m_buttons = new SaveCancelSection();
|
||||||
|
m_buttons.getSaveButton().setButtonLabel(SubsiteGlobalizationUtil.globalize("subsite.ui.save"));
|
||||||
m_buttons.getSaveButton().setHint("Save the details in the form");
|
m_buttons.getSaveButton().setHint("Save the details in the form");
|
||||||
|
m_buttons.getCancelButton().setButtonLabel(SubsiteGlobalizationUtil.globalize("subsite.ui.cancel"));
|
||||||
m_buttons.getCancelButton().setHint("Abort changes & reset the form");
|
m_buttons.getCancelButton().setHint("Abort changes & reset the form");
|
||||||
add(m_buttons);
|
add(m_buttons);
|
||||||
|
|
||||||
|
|
@ -221,8 +217,9 @@ public class SiteForm extends Form {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private class SiteSubmissionListener implements FormSubmissionListener {
|
private class SiteSubmissionListener implements FormSubmissionListener {
|
||||||
|
|
||||||
public void submitted(FormSectionEvent e)
|
public void submitted(FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
if (m_buttons.getCancelButton().isSelected(state)) {
|
if (m_buttons.getCancelButton().isSelected(state)) {
|
||||||
|
|
@ -230,6 +227,7 @@ public class SiteForm extends Form {
|
||||||
throw new FormProcessException("cancel pressed");
|
throw new FormProcessException("cancel pressed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -243,8 +241,8 @@ public class SiteForm extends Form {
|
||||||
FormData data = e.getFormData();
|
FormData data = e.getFormData();
|
||||||
// make sure that if a theme was typed in that the "other"
|
// make sure that if a theme was typed in that the "other"
|
||||||
// was selected in the theme selection box.
|
// was selected in the theme selection box.
|
||||||
String styleDir = (String)m_styleDir.getValue(state);
|
String styleDir = (String) m_styleDir.getValue(state);
|
||||||
String themeDir = (String)m_themes.getValue(state);
|
String themeDir = (String) m_themes.getValue(state);
|
||||||
if (styleDir != null) {
|
if (styleDir != null) {
|
||||||
styleDir = styleDir.trim();
|
styleDir = styleDir.trim();
|
||||||
}
|
}
|
||||||
|
|
@ -254,17 +252,13 @@ public class SiteForm extends Form {
|
||||||
// need to make sure the styleDir is null
|
// need to make sure the styleDir is null
|
||||||
if (OTHER_STYLE.equals(themeDir)) {
|
if (OTHER_STYLE.equals(themeDir)) {
|
||||||
if (StringUtils.emptyString(styleDir)) {
|
if (StringUtils.emptyString(styleDir)) {
|
||||||
data.addError(
|
data.addError(SubsiteGlobalizationUtil.globalize("subsite.ui.other_style_missing",
|
||||||
"If you choose '" + OTHER_STYLE_LABEL +
|
new String[]{OTHER_STYLE_LABEL}));
|
||||||
"' for the XSL Directory Select then " +
|
|
||||||
"you need to provide a style in the Text Field");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!StringUtils.emptyString(styleDir)) {
|
if (!StringUtils.emptyString(styleDir)) {
|
||||||
data.addError(
|
data.addError(SubsiteGlobalizationUtil.globalize("subsite.ui.other_style_invalid",
|
||||||
"In order to set a in the text field, " +
|
new String[]{OTHER_STYLE_LABEL}));
|
||||||
"the XSL Directory select box must say '" +
|
|
||||||
OTHER_STYLE_LABEL + "'");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -274,10 +268,8 @@ public class SiteForm extends Form {
|
||||||
try {
|
try {
|
||||||
Category testExist = m_rootCategory.getCategory(state);
|
Category testExist = m_rootCategory.getCategory(state);
|
||||||
String test = testExist.getDefaultDomainClass();
|
String test = testExist.getDefaultDomainClass();
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
data.addError(SubsiteGlobalizationUtil.globalize("subsite.ui.root_category_missing"));
|
||||||
data.addError(
|
|
||||||
"No valid category selected. Check category selection!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End if (!m_buttons ...)
|
} // End if (!m_buttons ...)
|
||||||
|
|
@ -289,27 +281,27 @@ public class SiteForm extends Form {
|
||||||
* Checks whether hostname is alreafy in use.
|
* Checks whether hostname is alreafy in use.
|
||||||
*/
|
*/
|
||||||
private class HostNameValidationListener implements ParameterListener {
|
private class HostNameValidationListener implements ParameterListener {
|
||||||
|
|
||||||
public void validate(ParameterEvent e) {
|
public void validate(ParameterEvent e) {
|
||||||
ParameterData data = e.getParameterData();
|
ParameterData data = e.getParameterData();
|
||||||
String hostname = (String)data.getValue();
|
String hostname = (String) data.getValue();
|
||||||
|
|
||||||
Site site = m_site.getSelectedSite(e.getPageState());
|
Site site = m_site.getSelectedSite(e.getPageState());
|
||||||
if (hostname != null && hostname.toString().length() > 0) {
|
if (hostname != null && hostname.toString().length() > 0) {
|
||||||
DataCollection sites = SessionManager.getSession()
|
DataCollection sites = SessionManager.getSession()
|
||||||
.retrieve(Site.BASE_DATA_OBJECT_TYPE);
|
.retrieve(Site.BASE_DATA_OBJECT_TYPE);
|
||||||
sites.addEqualsFilter("lower("+Site.HOSTNAME+")",
|
sites.addEqualsFilter("lower(" + Site.HOSTNAME + ")",
|
||||||
hostname.toLowerCase());
|
hostname.toLowerCase());
|
||||||
if (site != null) {
|
if (site != null) {
|
||||||
sites.addNotEqualsFilter(Site.ID, site.getID());
|
sites.addNotEqualsFilter(Site.ID, site.getID());
|
||||||
}
|
}
|
||||||
if (sites.size() > 0) {
|
if (sites.size() > 0) {
|
||||||
data.addError(
|
data.addError(SubsiteGlobalizationUtil.globalize("subsite.ui.hostname_already_in_use"));
|
||||||
"The host name " + hostname +
|
|
||||||
" is already used by another site");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -320,7 +312,7 @@ public class SiteForm extends Form {
|
||||||
private class SiteInitListener implements FormInitListener {
|
private class SiteInitListener implements FormInitListener {
|
||||||
|
|
||||||
public void init(FormSectionEvent e)
|
public void init(FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
Site site = m_site.getSelectedSite(state);
|
Site site = m_site.getSelectedSite(state);
|
||||||
|
|
@ -341,12 +333,11 @@ public class SiteForm extends Form {
|
||||||
|
|
||||||
// BigDecimal siteDefaultRootPageID
|
// BigDecimal siteDefaultRootPageID
|
||||||
BigDecimal currentFrontpageID = site.getFrontPage().getID();
|
BigDecimal currentFrontpageID = site.getFrontPage().getID();
|
||||||
s_log.debug(" Site default frontpage is: "+siteDefaultRootPageID
|
s_log.debug(" Site default frontpage is: " + siteDefaultRootPageID
|
||||||
+", Current frontpage is: "+currentFrontpageID) ;
|
+ ", Current frontpage is: " + currentFrontpageID);
|
||||||
m_customFrontpageApp.setValue(
|
m_customFrontpageApp.setValue(
|
||||||
state,
|
state,
|
||||||
currentFrontpageID == siteDefaultRootPageID ?
|
currentFrontpageID == siteDefaultRootPageID ? DEFAULT_APP : currentFrontpageID.toString());
|
||||||
DEFAULT_APP : currentFrontpageID.toString() );
|
|
||||||
|
|
||||||
String styleURL = site.getStyleDirectory();
|
String styleURL = site.getStyleDirectory();
|
||||||
// if the value is in the config map, then styleDir is
|
// if the value is in the config map, then styleDir is
|
||||||
|
|
@ -374,6 +365,7 @@ public class SiteForm extends Form {
|
||||||
m_rootCategory.setCategory(state, root);
|
m_rootCategory.setCategory(state, root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -382,7 +374,7 @@ public class SiteForm extends Form {
|
||||||
private class SiteProcessListener implements FormProcessListener {
|
private class SiteProcessListener implements FormProcessListener {
|
||||||
|
|
||||||
public void process(FormSectionEvent e)
|
public void process(FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
|
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
|
|
@ -390,8 +382,8 @@ public class SiteForm extends Form {
|
||||||
|
|
||||||
Site site = m_site.getSelectedSite(state);
|
Site site = m_site.getSelectedSite(state);
|
||||||
|
|
||||||
String style = (String)m_styleDir.getValue(state);
|
String style = (String) m_styleDir.getValue(state);
|
||||||
String theme = (String)m_themes.getValue(state);
|
String theme = (String) m_themes.getValue(state);
|
||||||
if (style != null) {
|
if (style != null) {
|
||||||
style = style.trim();
|
style = style.trim();
|
||||||
}
|
}
|
||||||
|
|
@ -404,27 +396,27 @@ public class SiteForm extends Form {
|
||||||
|
|
||||||
/* Pre-process selected frontpage application: retrieve application */
|
/* Pre-process selected frontpage application: retrieve application */
|
||||||
String subsiteSelectedFrontpage = (String) m_customFrontpageApp
|
String subsiteSelectedFrontpage = (String) m_customFrontpageApp
|
||||||
.getValue(state);
|
.getValue(state);
|
||||||
s_log.debug(" Site default frontpage ID is: " + siteDefaultRootPageID
|
s_log.debug(" Site default frontpage ID is: " + siteDefaultRootPageID
|
||||||
+", selected frontpage Value is: "
|
+ ", selected frontpage Value is: "
|
||||||
+subsiteSelectedFrontpage) ;
|
+ subsiteSelectedFrontpage);
|
||||||
Application frontpageApp ;
|
Application frontpageApp;
|
||||||
if (subsiteSelectedFrontpage.equals(DEFAULT_APP)) {
|
if (subsiteSelectedFrontpage.equals(DEFAULT_APP)) {
|
||||||
s_log.debug("About to create frontpage app ID: " + DEFAULT_APP );
|
s_log.debug("About to create frontpage app ID: " + DEFAULT_APP);
|
||||||
frontpageApp = Application
|
frontpageApp = Application
|
||||||
.retrieveApplication(siteDefaultRootPageID);
|
.retrieveApplication(siteDefaultRootPageID);
|
||||||
} else {
|
} else {
|
||||||
s_log.debug("About to create frontpage app ID: "
|
s_log.debug("About to create frontpage app ID: "
|
||||||
+ subsiteSelectedFrontpage );
|
+ subsiteSelectedFrontpage);
|
||||||
frontpageApp = Application
|
frontpageApp = Application
|
||||||
.retrieveApplication(new BigDecimal(subsiteSelectedFrontpage));
|
.retrieveApplication(new BigDecimal(subsiteSelectedFrontpage));
|
||||||
}
|
}
|
||||||
Assert.exists(frontpageApp,Application.class);
|
Assert.exists(frontpageApp, Application.class);
|
||||||
s_log.debug("Created frontpage app ID: " + frontpageApp.getID() );
|
s_log.debug("Created frontpage app ID: " + frontpageApp.getID());
|
||||||
|
|
||||||
if (site == null) { // (sub)site not yet exists, create new one
|
if (site == null) { // (sub)site not yet exists, create new one
|
||||||
|
|
||||||
if (!siteDefaultRootPageID.equals(frontpageApp.getID()) ) {
|
if (!siteDefaultRootPageID.equals(frontpageApp.getID())) {
|
||||||
|
|
||||||
// Previous version executed setRoot.... for newly created
|
// Previous version executed setRoot.... for newly created
|
||||||
// application, which were created for the purpose to serve
|
// application, which were created for the purpose to serve
|
||||||
|
|
@ -432,25 +424,25 @@ public class SiteForm extends Form {
|
||||||
// subsite with an added comment:
|
// subsite with an added comment:
|
||||||
// "NB, explicitly don't set cat on shared front page!"
|
// "NB, explicitly don't set cat on shared front page!"
|
||||||
s_log.debug("Front page application ID: "
|
s_log.debug("Front page application ID: "
|
||||||
+ frontpageApp.getID() );
|
+ frontpageApp.getID());
|
||||||
s_log.debug("About to set cat on dedicated front page." );
|
s_log.debug("About to set cat on dedicated front page.");
|
||||||
Category.setRootForObject(frontpageApp,root);
|
Category.setRootForObject(frontpageApp, root);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// actually create a new subsite
|
// actually create a new subsite
|
||||||
site = Site.create((String)m_title.getValue(state),
|
site = Site.create((String) m_title.getValue(state),
|
||||||
(String)m_description.getValue(state),
|
(String) m_description.getValue(state),
|
||||||
(String)m_hostname.getValue(state),
|
(String) m_hostname.getValue(state),
|
||||||
styleDir,
|
styleDir,
|
||||||
root,
|
root,
|
||||||
frontpageApp);
|
frontpageApp);
|
||||||
|
|
||||||
} else { // (sub)site already exists, modify mutable configuration
|
} else { // (sub)site already exists, modify mutable configuration
|
||||||
|
|
||||||
site.setTitle((String)m_title.getValue(state));
|
site.setTitle((String) m_title.getValue(state));
|
||||||
site.setDescription((String)m_description.getValue(state));
|
site.setDescription((String) m_description.getValue(state));
|
||||||
site.setHostname((String)m_hostname.getValue(state));
|
site.setHostname((String) m_hostname.getValue(state));
|
||||||
site.setStyleDirectory(styleDir);
|
site.setStyleDirectory(styleDir);
|
||||||
site.setRootCategory(root);
|
site.setRootCategory(root);
|
||||||
// XXX Check: Frontpage application was not mutable in previous
|
// XXX Check: Frontpage application was not mutable in previous
|
||||||
|
|
@ -462,14 +454,14 @@ public class SiteForm extends Form {
|
||||||
m_site.clearSelection(state);
|
m_site.clearSelection(state);
|
||||||
|
|
||||||
Application app = Application
|
Application app = Application
|
||||||
.retrieveApplicationForPath("/navigation/");
|
.retrieveApplicationForPath("/navigation/");
|
||||||
Category.setRootForObject(app,
|
Category.setRootForObject(app,
|
||||||
root,
|
root,
|
||||||
site.getTemplateContext().getContext());
|
site.getTemplateContext().getContext());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -477,29 +469,28 @@ public class SiteForm extends Form {
|
||||||
private class FrontpageAppListener implements PrintListener {
|
private class FrontpageAppListener implements PrintListener {
|
||||||
|
|
||||||
public void prepare(PrintEvent e) {
|
public void prepare(PrintEvent e) {
|
||||||
final SingleSelect target = (SingleSelect)e.getTarget();
|
final SingleSelect target = (SingleSelect) e.getTarget();
|
||||||
// final PageState state = e.getPageState();
|
// final PageState state = e.getPageState();
|
||||||
ApplicationCollection customApps ;
|
ApplicationCollection customApps;
|
||||||
|
|
||||||
// target.addOption(new Option(SELECT_APP, SELECT_APP_LABEL));
|
// target.addOption(new Option(SELECT_APP, SELECT_APP_LABEL));
|
||||||
target.addOption(new Option(DEFAULT_APP, DEFAULT_APP_LABEL));
|
target.addOption(new Option(DEFAULT_APP, DEFAULT_APP_LABEL));
|
||||||
|
|
||||||
String[] customAppTypes = (String[])Subsite.getConfig()
|
String[] customAppTypes = (String[]) Subsite.getConfig()
|
||||||
.getFrontPageApplicationTypes();
|
.getFrontPageApplicationTypes();
|
||||||
if ( customAppTypes != null) {
|
if (customAppTypes != null) {
|
||||||
for (int i=0; i < customAppTypes.length; i++) {
|
for (int i = 0; i < customAppTypes.length; i++) {
|
||||||
customApps = Application.retrieveAllApplications(
|
customApps = Application.retrieveAllApplications(
|
||||||
customAppTypes[i]);
|
customAppTypes[i]);
|
||||||
while(customApps.next()) {
|
while (customApps.next()) {
|
||||||
/* Create an entry for each application, consisting
|
/* Create an entry for each application, consisting
|
||||||
* of the (BigDecimal) ID as value and the URL as
|
* of the (BigDecimal) ID as value and the URL as
|
||||||
* label. */
|
* label. */
|
||||||
String appID = customApps.get(ACSObject.ID).toString() ;
|
String appID = customApps.get(ACSObject.ID).toString();
|
||||||
target.addOption( new
|
target.addOption(new Option(appID,
|
||||||
Option(appID ,
|
(customApps.getPrimaryURL()
|
||||||
( customApps.getPrimaryURL()
|
+ "(" + appID + ")")));
|
||||||
+"("+appID+")") ));
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -508,14 +499,13 @@ public class SiteForm extends Form {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private class ThemesListener implements PrintListener {
|
private class ThemesListener implements PrintListener {
|
||||||
|
|
||||||
public void prepare(PrintEvent e) {
|
public void prepare(PrintEvent e) {
|
||||||
SingleSelect target = (SingleSelect)e.getTarget();
|
SingleSelect target = (SingleSelect) e.getTarget();
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
Map themes = Subsite.getConfig().getThemes();
|
Map themes = Subsite.getConfig().getThemes();
|
||||||
Set entrySet = themes.entrySet();
|
Set entrySet = themes.entrySet();
|
||||||
|
|
@ -523,7 +513,7 @@ public class SiteForm extends Form {
|
||||||
if (entrySet != null) {
|
if (entrySet != null) {
|
||||||
Iterator entries = entrySet.iterator();
|
Iterator entries = entrySet.iterator();
|
||||||
while (entries.hasNext()) {
|
while (entries.hasNext()) {
|
||||||
Map.Entry entry = (Map.Entry)entries.next();
|
Map.Entry entry = (Map.Entry) entries.next();
|
||||||
target.addOption(new Option(entry.getKey().toString(),
|
target.addOption(new Option(entry.getKey().toString(),
|
||||||
entry.getValue().toString()),
|
entry.getValue().toString()),
|
||||||
state);
|
state);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.arsdigita.subsite.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SubsiteGlobalizationUtil {
|
||||||
|
|
||||||
|
public static final String BUNDLE_NAME = "com.arsdigita.subsite.ui.SubsiteResources";
|
||||||
|
|
||||||
|
public static GlobalizedMessage globalize(final String key) {
|
||||||
|
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GlobalizedMessage globalize(final String key,
|
||||||
|
final Object[] args) {
|
||||||
|
return new GlobalizedMessage(key, BUNDLE_NAME, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
# To change this template, choose Tools | Templates
|
||||||
|
# and open the template in the editor.
|
||||||
|
|
||||||
|
subsite.ui.title.hint=Enter the title of the subsite, upto 80 characters
|
||||||
|
subsite.ui.title.label=Title
|
||||||
|
subsite.ui.hostname.hint=Enter the hostname for the subsite, eg business.example.com
|
||||||
|
subsite.ui.hostname.label=Hostname
|
||||||
|
subsite.ui.description.hint=Enter a short description for the subsite, up to 4000 characters
|
||||||
|
subsite.ui.description.label=Description
|
||||||
|
subsite.ui.customfrontpage.hint=Select the name (url) of the subsite custom homepage
|
||||||
|
subsite.ui.customfrontpage.label=Front Page
|
||||||
|
subsite.ui.theme.hint=Select an existing theme from the list, select 'Other' to type something below or select 'Site Wide Default' to get the default themes.
|
||||||
|
subsite.ui.theme.label=Theme
|
||||||
|
subsite.ui.styledir.hint=Enter the directory for the custom XSLT styles, or leave blank for the default styling.
|
||||||
|
subsite.ui.styledir.label=Custom XSL directory
|
||||||
|
subsite.ui.root_category.hint=Select a root navigation category for the subsite
|
||||||
|
subsite.ui.root_category.label=Root category
|
||||||
|
subsite.ui.save=Save
|
||||||
|
subsite.ui.cancel=Cancel
|
||||||
|
subsite.ui.other_style_missing=If you choose {0} for the theme you need to provide a style in the text field
|
||||||
|
subsite.ui.other_style_invalid=To set custom XSL directory select {0} in for the theme
|
||||||
|
subsite.ui.root_category_missing=No root category selected
|
||||||
|
subsite.ui.hostname_already_in\ use=The hostname {0} is already used by another subsite
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
# To change this template, choose Tools | Templates
|
||||||
|
# and open the template in the editor.
|
||||||
|
|
||||||
|
subsite.ui.title.hint=Geben Sie den Titel der Subsite ein. Der Titel darf max. 80 Zeichen lang sein.
|
||||||
|
subsite.ui.title.label=Titel
|
||||||
|
subsite.ui.hostname.hint=Geben Sie den hostname, z.B. business.example.com, ein
|
||||||
|
subsite.ui.hostname.label=Hostname
|
||||||
|
subsite.ui.description.hint=Geben sie hier eine kurze Beschreibung der Seite ein (max. 4000 Zeichen)
|
||||||
|
subsite.ui.description.label=Beschreibung
|
||||||
|
subsite.ui.customfrontpage.hint=W\u00e4hlen Sie den Startseite f\u00fcr die Subsite
|
||||||
|
subsite.ui.customfrontpage.label=Startseite
|
||||||
|
subsite.ui.theme.hint=W\u00e4hlen Sie ein existierendes Theme aus. Um ein anderes Theme im Eingabefeld anzugeben w\u00e4hlen 'Other'. Um das Standard-Theme zu verwenden w\u00e4hlen Sie 'Site-Wide-Default'
|
||||||
|
subsite.ui.theme.label=Theme
|
||||||
|
subsite.ui.styledir.hint=Geben Sie den Pfad zu einem Verzeichnis mit eigenen XSL-Styles an. Um die Standard-Styles zu verwenden, lassen Sie das Feld leer.
|
||||||
|
subsite.ui.styledir.label=Zus\u00e4tzliches XSL Verzeichnis
|
||||||
|
subsite.ui.root_category.hint=W\u00e4hlen Sie das Kategoriensystem f\u00fcr die Subsite
|
||||||
|
subsite.ui.root_category.label=Kategoriensystem
|
||||||
|
subsite.ui.save=Speichern
|
||||||
|
subsite.ui.cancel=Abbrechen
|
||||||
|
subsite.ui.other_style_missing=Wenn Sie {0} f\u00fcr das Theme w\u00e4hlen, m\u00fcssen Sie im Textfeld ein Theme angeben
|
||||||
|
subsite.ui.other_style_invalid=Um ein eigenes Verzeichnis mit XSL-Styles anzugeben, w\u00e4hlen Sie {0} f\u00fcr das Theme
|
||||||
|
subsite.ui.root_category_missing=Kein Kategoriensystem ausgew\u00e4hlt
|
||||||
|
subsite.ui.hostname_already_in\ use=Der Hostname {0} wird bereits von einer anderen Subsite verwendet
|
||||||
Loading…
Reference in New Issue