CCM NG/ccm-cms: Language Tab of the ContentItemPage now works
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4835 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
d0c7265b13
commit
a57a121ebb
|
|
@ -29,7 +29,6 @@ import com.arsdigita.bebop.Resettable;
|
|||
import com.arsdigita.bebop.SimpleContainer;
|
||||
import com.arsdigita.bebop.SingleSelectionModel;
|
||||
import com.arsdigita.bebop.TabbedPane;
|
||||
import com.arsdigita.bebop.Text;
|
||||
import com.arsdigita.bebop.event.ActionEvent;
|
||||
import com.arsdigita.bebop.event.ActionListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
|
|
@ -42,7 +41,6 @@ import com.arsdigita.bebop.parameters.StringParameter;
|
|||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.PageLocations;
|
||||
import com.arsdigita.cms.dispatcher.CMSDispatcher;
|
||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||
import com.arsdigita.cms.ui.authoring.WizardSelector;
|
||||
import com.arsdigita.cms.ui.item.ContentItemRequestLocal;
|
||||
|
|
@ -57,7 +55,6 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.xml.Document;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
|
|
@ -71,9 +68,7 @@ import org.librecms.contentsection.ContentItemL10NManager;
|
|||
import org.librecms.contentsection.ContentItemRepository;
|
||||
import org.librecms.contentsection.ContentItemVersion;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentSectionManager;
|
||||
import org.librecms.contentsection.ContentType;
|
||||
import org.librecms.dispatcher.ItemResolver;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
|
@ -149,7 +144,7 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
|||
private final TabbedPane tabbedPane;
|
||||
private final StringParameter returnUrlParameter;
|
||||
private final ItemSelectionModel itemSelectionModel;
|
||||
private final SingleSelectionModel<String> selectedLanguageModel;
|
||||
// private final SingleSelectionModel<String> selectedLanguageModel;
|
||||
private final ACSObjectSelectionModel typeSelectionModel;
|
||||
private final ContentItemRequestLocal itemRequestLocal;
|
||||
private final Summary summaryPane;
|
||||
|
|
@ -238,15 +233,14 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
|||
itemSelectionModel = new ItemSelectionModel(itemId);
|
||||
|
||||
// Add the selected item language as parameter
|
||||
selectedLanguageParam = new StringParameter(
|
||||
SELECTED_LANGUAGE);
|
||||
selectedLanguageParam = new StringParameter(SELECTED_LANGUAGE);
|
||||
selectedLanguageParam.addParameterListener(
|
||||
new NotNullValidationListener(SELECTED_LANGUAGE));
|
||||
addGlobalStateParam(selectedLanguageParam);
|
||||
selectedLanguageModel = new ParameterSingleSelectionModel<>(
|
||||
selectedLanguageParam);
|
||||
selectedLanguageParam
|
||||
.setDefaultValue(KernelConfig.getConfig().getDefaultLanguage());
|
||||
// selectedLanguageModel = new ParameterSingleSelectionModel<>(
|
||||
// selectedLanguageParam);
|
||||
// selectedLanguageParam
|
||||
// .setDefaultValue(KernelConfig.getConfig().getDefaultLanguage());
|
||||
|
||||
// Add the content type global state parameter
|
||||
final LongParameter contentType = new LongParameter(CONTENT_TYPE);
|
||||
|
|
@ -282,7 +276,8 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
|||
summaryPane = new Summary(itemSelectionModel);
|
||||
wizardPane = new WizardSelector(itemSelectionModel, typeSelectionModel);
|
||||
languagesPane = new ItemLanguages(itemSelectionModel,
|
||||
selectedLanguageModel);
|
||||
// selectedLanguageModel,
|
||||
selectedLanguageParam);
|
||||
workflowPane = new ItemWorkflowAdminPane(itemId); // Make this use m_item XXX
|
||||
lifecyclePane = new ItemLifecycleAdminPane(itemRequestLocal);
|
||||
revisionsPane = new ItemRevisionAdminPane(itemRequestLocal);
|
||||
|
|
|
|||
|
|
@ -31,10 +31,9 @@ import com.arsdigita.bebop.event.PrintListener;
|
|||
import com.arsdigita.bebop.form.Option;
|
||||
import com.arsdigita.bebop.form.OptionGroup;
|
||||
import com.arsdigita.bebop.form.Submit;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
|
||||
import org.librecms.contentsection.ContentItem;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentType;
|
||||
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.ContentItemPage;
|
||||
|
|
@ -43,28 +42,21 @@ import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
|||
import org.librecms.util.LanguageUtil;
|
||||
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.toolbox.ui.ActionGroup;
|
||||
import com.arsdigita.toolbox.ui.LayoutPanel;
|
||||
import com.arsdigita.toolbox.ui.Section;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.Pair;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.web.RedirectSignal;
|
||||
import com.arsdigita.web.URL;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.workflow.Workflow;
|
||||
import org.libreccm.workflow.WorkflowTemplate;
|
||||
import org.librecms.contentsection.ContentItemL10NManager;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TooManyListenersException;
|
||||
import java.util.stream.Collectors;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
|
||||
import org.libreccm.core.UnexpectedErrorException;
|
||||
import org.librecms.CmsConstants;
|
||||
|
||||
/**
|
||||
|
|
@ -77,23 +69,28 @@ import org.librecms.CmsConstants;
|
|||
public class ItemLanguages extends LayoutPanel {
|
||||
|
||||
private final ItemSelectionModel selectionModel;
|
||||
private final SingleSelectionModel<String> selectedLanguage;
|
||||
// private final SingleSelectionModel<String> selectedLanguage;
|
||||
private final LanguageWidget languageWidget;
|
||||
private final Submit changeSubmit;
|
||||
private final StringParameter selectedLanguageParam;
|
||||
// private final Submit changeSubmit;
|
||||
private final Submit createSubmit;
|
||||
|
||||
/**
|
||||
* Constructs a new <code>ItemLanguages</code>.
|
||||
*
|
||||
* @param selectionModel the {@link ItemSelectionModel} which will supply
|
||||
* the current item
|
||||
* @param selectedLanguage {@link SingleSelectionModel} for the selected
|
||||
* language.
|
||||
* @param selectionModel the {@link ItemSelectionModel} which will
|
||||
* supply the current item
|
||||
* @param selectedLanguage {@link SingleSelectionModel} for the
|
||||
* selected language.
|
||||
* @param selectedLanguageParam
|
||||
*/
|
||||
public ItemLanguages(final ItemSelectionModel selectionModel,
|
||||
final SingleSelectionModel<String> selectedLanguage) {
|
||||
// final SingleSelectionModel<String> selectedLanguage,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
|
||||
this.selectionModel = selectionModel;
|
||||
this.selectedLanguage = selectedLanguage;
|
||||
// this.selectedLanguage = selectedLanguage;
|
||||
this.selectedLanguageParam = selectedLanguageParam;
|
||||
|
||||
final Section section = new Section(gz("cms.ui.item.languages"));
|
||||
setBody(section);
|
||||
|
|
@ -102,10 +99,23 @@ public class ItemLanguages extends LayoutPanel {
|
|||
section.setBody(group);
|
||||
|
||||
group.setSubject(new ItemLanguagesTable(selectionModel,
|
||||
selectedLanguage));
|
||||
// selectedLanguage,
|
||||
selectedLanguageParam));
|
||||
|
||||
final Form form = new Form("newLanguage", new BoxPanel(
|
||||
BoxPanel.HORIZONTAL));
|
||||
BoxPanel.HORIZONTAL)) {
|
||||
|
||||
@Override
|
||||
public boolean isVisible(final PageState state) {
|
||||
final ContentItem item = selectionModel.getSelectedItem(state);
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ContentItemL10NManager l10NManager = cdiUtil.findBean(
|
||||
ContentItemL10NManager.class);
|
||||
return !l10NManager.creatableLocales(item).isEmpty();
|
||||
}
|
||||
|
||||
};
|
||||
group.addAction(form);
|
||||
|
||||
form.setRedirecting(true);
|
||||
|
|
@ -121,12 +131,12 @@ public class ItemLanguages extends LayoutPanel {
|
|||
try {
|
||||
languageWidget.addPrintListener(new OptionPrinter());
|
||||
} catch (TooManyListenersException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
throw new UnexpectedErrorException(ex);
|
||||
}
|
||||
|
||||
form.add(languageWidget);
|
||||
changeSubmit = new Submit("change", gz("cms.ui.item.language.change"));
|
||||
form.add(changeSubmit);
|
||||
// changeSubmit = new Submit("change", gz("cms.ui.item.language.change"));
|
||||
// form.add(changeSubmit);
|
||||
createSubmit = new Submit("create", gz("cms.ui.item.language.add"));
|
||||
form.add(createSubmit);
|
||||
form.addProcessListener(new ProcessListener());
|
||||
|
|
@ -140,7 +150,8 @@ public class ItemLanguages extends LayoutPanel {
|
|||
@Override
|
||||
public final void prepare(final PrintEvent event) {
|
||||
final PageState state = event.getPageState();
|
||||
final OptionGroup optionGroup = (OptionGroup) event.getTarget();
|
||||
final OptionGroup target = (OptionGroup) event.getTarget();
|
||||
target.clearOptions();
|
||||
final ContentItem item = selectionModel.getSelectedItem(state);
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
|
|
@ -153,15 +164,15 @@ public class ItemLanguages extends LayoutPanel {
|
|||
item).stream()
|
||||
.map(locale -> locale.toString())
|
||||
.collect(Collectors.toList());
|
||||
final List<Pair> languages = languageUtil.convertToG11N(
|
||||
creatableLangs);
|
||||
final List<Pair> languages = languageUtil
|
||||
.convertToG11N(creatableLangs);
|
||||
|
||||
for (final Pair pair : languages) {
|
||||
final String langCode = (String) pair.getKey();
|
||||
final GlobalizedMessage langName
|
||||
= (GlobalizedMessage) pair
|
||||
.getValue();
|
||||
optionGroup.addOption(new Option(langCode, new Label(langName)));
|
||||
target.addOption(new Option(langCode, new Label(langName)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -179,32 +190,27 @@ public class ItemLanguages extends LayoutPanel {
|
|||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
final String lang = (String) languageWidget.getValue(state);
|
||||
final ContentItem item = (ContentItem) selectionModel
|
||||
.getSelectedItem(state);
|
||||
|
||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
||||
ConfigurationManager.class);
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class);
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
final String name = item.getName().getValue(defaultLocale);
|
||||
final String language = (String) languageWidget.getValue(state);
|
||||
final ContentItem item = selectionModel.getSelectedItem(state);
|
||||
|
||||
if (createSubmit.isSelected(state)) {
|
||||
final ContentSection section = item.getContentType().
|
||||
getContentSection();
|
||||
|
||||
Assert.exists(section, ContentSection.class);
|
||||
final ItemLanguagesController controller = cdiUtil
|
||||
.findBean(ItemLanguagesController.class);
|
||||
|
||||
final ContentItemL10NManager l10NManager = cdiUtil.findBean(
|
||||
ContentItemL10NManager.class);
|
||||
l10NManager.addLanguage(item, new Locale(lang));
|
||||
controller.addLanguage(item, language);
|
||||
|
||||
// redirect to ContentItemPage.AUTHORING_TAB of the new instance
|
||||
state.setValue(selectedLanguageParam, language);
|
||||
final String langParam = String
|
||||
.format("&%s=%s",
|
||||
ContentItemPage.SELECTED_LANGUAGE,
|
||||
language);
|
||||
final String target = String.join(
|
||||
"", URL.getDispatcherPath(),
|
||||
ContentItemPage.getItemURL(item,
|
||||
ContentItemPage.AUTHORING_TAB));
|
||||
"",
|
||||
URL.getDispatcherPath(),
|
||||
controller.getItemEditUrl(item),
|
||||
langParam);
|
||||
|
||||
throw new RedirectSignal(target, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
package com.arsdigita.cms.ui.item;
|
||||
|
||||
import com.arsdigita.bebop.table.RowData;
|
||||
import com.arsdigita.cms.ui.ContentItemPage;
|
||||
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
import org.librecms.contentsection.ContentItem;
|
||||
|
|
@ -41,7 +42,7 @@ import javax.transaction.Transactional;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
public class ItemLanguagesController {
|
||||
class ItemLanguagesController {
|
||||
|
||||
@Inject
|
||||
private ContentItemRepository itemRepo;
|
||||
|
|
@ -52,27 +53,27 @@ public class ItemLanguagesController {
|
|||
@Inject
|
||||
private GlobalizationHelper globalizationHelper;
|
||||
|
||||
public List<RowData<String>> retrieveLanguageVariants(final ContentItem item) {
|
||||
protected List<RowData<String>> retrieveLanguageVariants(
|
||||
final ContentItem item) {
|
||||
return retrieveLanguageVariants(item.getObjectId());
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<RowData<String>> retrieveLanguageVariants(final long itemId) {
|
||||
final Optional<ContentItem> item = itemRepo.findById(itemId);
|
||||
protected List<RowData<String>> retrieveLanguageVariants(final long itemId) {
|
||||
|
||||
if (!item.isPresent()) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"No content item with id %d found.", itemId));
|
||||
}
|
||||
final ContentItem item = itemRepo
|
||||
.findById(itemId)
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
"No ContentItem with ID %d in the database.", itemId)));
|
||||
|
||||
final List<Locale> availableLangs = new ArrayList<>(itemL10NManager
|
||||
.availableLanguages(item.get()));
|
||||
.availableLanguages(item));
|
||||
availableLangs.sort((locale1, locale2) -> {
|
||||
return locale1.toString().compareTo(locale2.toString());
|
||||
});
|
||||
|
||||
return availableLangs.stream()
|
||||
.map(lang -> createRow(item.get(), lang))
|
||||
.map(lang -> createRow(item, lang))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
|
@ -80,10 +81,61 @@ public class ItemLanguagesController {
|
|||
final Locale lang) {
|
||||
final RowData<String> row = new RowData<>(2);
|
||||
row.setRowKey(lang.toString());
|
||||
row.setColData(0, lang.getDisplayName(globalizationHelper.getNegotiatedLocale()));
|
||||
row.setColData(0, lang.getDisplayName(globalizationHelper
|
||||
.getNegotiatedLocale()));
|
||||
row.setColData(1, item.getTitle().getValue(lang));
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected int countLanguageVariants(final ContentItem item) {
|
||||
|
||||
final ContentItem contentItem = itemRepo
|
||||
.findById(item.getObjectId())
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
"No ContentItem with ID %d in the database.",
|
||||
item.getObjectId())));
|
||||
|
||||
return itemL10NManager.availableLanguages(contentItem).size();
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void addLanguage(final ContentItem item, final String language) {
|
||||
|
||||
final ContentItem contentItem = itemRepo
|
||||
.findById(item.getObjectId())
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
"No ContentItem with ID %d in the database.",
|
||||
item.getObjectId())));
|
||||
|
||||
itemL10NManager.addLanguage(contentItem, new Locale(language));
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void removeLanguage(final ContentItem item,
|
||||
final String language) {
|
||||
|
||||
final ContentItem contentItem = itemRepo
|
||||
.findById(item.getObjectId())
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
"No ContentItem with ID %d in the database.",
|
||||
item.getObjectId())));
|
||||
|
||||
itemL10NManager.removeLanguage(contentItem, new Locale(language));
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected String getItemEditUrl(final ContentItem item) {
|
||||
|
||||
final ContentItem contentItem = itemRepo
|
||||
.findById(item.getObjectId())
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
"No ContentItem with ID %d in the database.",
|
||||
item.getObjectId())));
|
||||
|
||||
return ContentItemPage.getItemURL(contentItem,
|
||||
ContentItemPage.AUTHORING_TAB);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,28 +22,29 @@ import com.arsdigita.bebop.Component;
|
|||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SingleSelectionModel;
|
||||
import com.arsdigita.bebop.Table;
|
||||
import com.arsdigita.bebop.Text;
|
||||
import com.arsdigita.bebop.event.TableActionEvent;
|
||||
import com.arsdigita.bebop.event.TableActionListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||
import com.arsdigita.bebop.table.TableColumn;
|
||||
import com.arsdigita.bebop.table.TableColumnModel;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.ContentItemPage;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.web.RedirectSignal;
|
||||
import com.arsdigita.web.URL;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.librecms.CmsConstants;
|
||||
import org.librecms.contentsection.ContentItem;
|
||||
import org.librecms.contentsection.ContentItemL10NManager;
|
||||
import org.librecms.util.LanguageUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
* Displays a list of all language instances of an item.
|
||||
*
|
||||
|
|
@ -55,7 +56,8 @@ public class ItemLanguagesTable extends Table {
|
|||
public static final int COL_DELETE = 2;
|
||||
|
||||
private final ItemSelectionModel itemSelectionModel;
|
||||
private final SingleSelectionModel<String> langSelectionModel;
|
||||
// private final SingleSelectionModel<String> langSelectionModel;
|
||||
private final StringParameter selectedLanguageParam;
|
||||
// private final TableColumn deleteColumn;
|
||||
|
||||
/**
|
||||
|
|
@ -68,12 +70,14 @@ public class ItemLanguagesTable extends Table {
|
|||
* selected language.
|
||||
*/
|
||||
public ItemLanguagesTable(final ItemSelectionModel itemSelectionModel,
|
||||
final SingleSelectionModel<String> langSelectionModel) {
|
||||
// final SingleSelectionModel<String> langSelectionModel,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
super();
|
||||
setIdAttr("item_languages_table");
|
||||
|
||||
this.itemSelectionModel = itemSelectionModel;
|
||||
this.langSelectionModel = langSelectionModel;
|
||||
// this.langSelectionModel = langSelectionModel;
|
||||
this.selectedLanguageParam = selectedLanguageParam;
|
||||
setModelBuilder(new ItemLanguagesTableModelBuilder(itemSelectionModel));
|
||||
|
||||
final TableColumnModel columnModel = getColumnModel();
|
||||
|
|
@ -102,6 +106,8 @@ public class ItemLanguagesTable extends Table {
|
|||
final int column) {
|
||||
|
||||
final Locale locale = new Locale((String) value);
|
||||
final String selectedLanguage = (String) state
|
||||
.getValue(selectedLanguageParam);
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final LanguageUtil langUtil = cdiUtil.findBean(
|
||||
|
|
@ -109,20 +115,25 @@ public class ItemLanguagesTable extends Table {
|
|||
|
||||
final Label label = new Label(langUtil.getLangFull(locale));
|
||||
|
||||
if (langSelectionModel.getSelectedKey(state).equals(key)) {
|
||||
// if (langSelectionModel.getSelectedKey(state).equals(key)) {
|
||||
if (selectedLanguage.equals(key)) {
|
||||
// Current variant, no link
|
||||
return label;
|
||||
} else {
|
||||
final String target = ContentItemPage.getItemURL(
|
||||
itemSelectionModel.getSelectedItem(state),
|
||||
ContentItemPage.AUTHORING_TAB);
|
||||
return new Link(label, target);
|
||||
return new ControlLink(label);
|
||||
|
||||
// final String target = ContentItemPage.getItemURL(
|
||||
// itemSelectionModel.getSelectedItem(state),
|
||||
// ContentItemPage.AUTHORING_TAB);
|
||||
// return new Link(label, target);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
columnModel.get(COL_DELETE).setCellRenderer(new TableCellRenderer() {
|
||||
columnModel.get(COL_DELETE)
|
||||
.setCellRenderer(new TableCellRenderer() {
|
||||
|
||||
@Override
|
||||
public Component getComponent(final Table table,
|
||||
|
|
@ -131,48 +142,87 @@ public class ItemLanguagesTable extends Table {
|
|||
final boolean isSelected,
|
||||
final Object key,
|
||||
final int row,
|
||||
final int column) {
|
||||
final int column
|
||||
) {
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ItemLanguagesController controller = cdiUtil
|
||||
.findBean(ItemLanguagesController.class);
|
||||
final ContentItem item = itemSelectionModel
|
||||
.getSelectedItem(state);
|
||||
|
||||
if (key
|
||||
.equals(KernelConfig.getConfig().getDefaultLanguage())
|
||||
|| controller.countLanguageVariants(item) <= 1) {
|
||||
return new Text(" ");
|
||||
} else {
|
||||
final ControlLink link = new ControlLink(new Label(
|
||||
new GlobalizedMessage("cms.ui.delete",
|
||||
CmsConstants.CMS_BUNDLE)));
|
||||
link.setConfirmation(new GlobalizedMessage(
|
||||
"cms.ui.delete.confirmation", CmsConstants.CMS_BUNDLE));
|
||||
"cms.ui.delete.confirmation",
|
||||
CmsConstants.CMS_BUNDLE));
|
||||
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
addTableActionListener(new TableActionListener() {
|
||||
addTableActionListener(
|
||||
new TableActionListener() {
|
||||
|
||||
@Override
|
||||
public void cellSelected(final TableActionEvent event)
|
||||
throws FormProcessException {
|
||||
|
||||
if (event.getColumn() != COL_DELETE) {
|
||||
//Nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
final ContentItem item = itemSelectionModel
|
||||
.getSelectedItem(state);
|
||||
final String selectedLang = (String) event.getRowKey();
|
||||
final String selectedLanguage = (String) event.getRowKey();
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ContentItemL10NManager l10nManager = cdiUtil.findBean(
|
||||
ContentItemL10NManager.class);
|
||||
final ItemLanguagesController controller = cdiUtil
|
||||
.findBean(ItemLanguagesController.class);
|
||||
|
||||
l10nManager.removeLanguage(item, new Locale(selectedLang));
|
||||
switch (event.getColumn()) {
|
||||
case COL_LANGUAGE: {
|
||||
state.setValue(selectedLanguageParam, selectedLanguage);
|
||||
final String langParam = String
|
||||
.format("&%s=%s",
|
||||
ContentItemPage.SELECTED_LANGUAGE,
|
||||
selectedLanguage);
|
||||
final String target = String.join(
|
||||
"",
|
||||
URL.getDispatcherPath(),
|
||||
controller.getItemEditUrl(item),
|
||||
langParam);
|
||||
throw new RedirectSignal(target, true);
|
||||
}
|
||||
case COL_DELETE: {
|
||||
if (selectedLanguage.equals(state.getValue(
|
||||
selectedLanguageParam))) {
|
||||
state.setValue(selectedLanguageParam,
|
||||
KernelConfig.getConfig()
|
||||
.getDefaultLanguage());
|
||||
}
|
||||
controller.removeLanguage(item, selectedLanguage);
|
||||
}
|
||||
default:
|
||||
//Nothing to do
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void headSelected(final TableActionEvent event) {
|
||||
public void headSelected(final TableActionEvent event
|
||||
) {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -359,7 +359,11 @@ public class ContentItemL10NManager {
|
|||
* set with all locales provided by any of the fields. After that the method
|
||||
* will iterate over all {@link LocalizedString} fields and check if the
|
||||
* {@link LocalizedString} has an entry for every language in the set. If
|
||||
* not an entry for the language is added.
|
||||
* not an entry for the language is added. The initial value is taken from
|
||||
* the variant for default language configured in
|
||||
* {@link KernelConfig#defaultLanguage}. If no value for the default locale
|
||||
* exists the value for the first found language from the list of supported
|
||||
* languages ({@link KernelConfig#supportedLanguages}) is used.
|
||||
*
|
||||
* @param item The item to normalise. The item <strong>must be</strong> the
|
||||
* <strong>draft version</strong> of the item! If a <em>live version</em> or
|
||||
|
|
|
|||
|
|
@ -8,10 +8,9 @@ ay=Aymara
|
|||
az=Azerbaijani
|
||||
ba=Bashkir
|
||||
be=Byelorussian
|
||||
bg=Bulgarian
|
||||
bh=Bihari
|
||||
bi=Bislama
|
||||
bn=Bengali;=Bangla
|
||||
bn=Bengali
|
||||
bo=Tibetan
|
||||
br=Breton
|
||||
ca=Catalan
|
||||
|
|
@ -20,21 +19,21 @@ cs=Czech
|
|||
cy=Welsh
|
||||
da=Danish
|
||||
de=German
|
||||
dz=Bhutani
|
||||
dz=Dzongkha (Bhutani)
|
||||
el=Greek
|
||||
en=English
|
||||
eo=Esperanto
|
||||
es=Spanish
|
||||
et=Estonian
|
||||
eu=Basque
|
||||
fa=Persian
|
||||
fa=Farsi (Persian)
|
||||
fi=Finnish
|
||||
fj=Fiji
|
||||
fo=Faroese
|
||||
fr=French
|
||||
fy=Frisian
|
||||
ga=Irish
|
||||
gd=Scots=Gaelic
|
||||
gd=Scottish Gaelic
|
||||
gl=Galician
|
||||
gn=Guarani
|
||||
gu=Gujarati
|
||||
|
|
@ -47,17 +46,15 @@ hy=Armenian
|
|||
ia=Interlingua
|
||||
id=Indonesian
|
||||
ie=Interlingue
|
||||
ik=Inupiak
|
||||
ik=Ik
|
||||
is=Icelandic
|
||||
it=Italian
|
||||
iu=Inuktitut
|
||||
iw=Hebrew
|
||||
ja=Japanese
|
||||
jw=Javanese
|
||||
ka=Georgian
|
||||
kk=Kazakh
|
||||
kl=Greenlandic
|
||||
km=Cambodian
|
||||
kl=Kalaallisut (Greenlandic)
|
||||
km=Khmer (Cambodian)
|
||||
kn=Kannada
|
||||
ko=Korean
|
||||
ks=Kashmiri
|
||||
|
|
@ -83,11 +80,11 @@ ne=Nepali
|
|||
nl=Dutch
|
||||
no=Norwegian
|
||||
oc=Occitan
|
||||
om==Oromo
|
||||
om=Oromo
|
||||
or=Oriya
|
||||
pa=Punjabi
|
||||
pl=Polish
|
||||
ps=Pashto,=Pushto
|
||||
ps=Pashto
|
||||
pt=Portuguese
|
||||
qu=Quechua
|
||||
rm=Rhaeto-Romance
|
||||
|
|
@ -98,7 +95,6 @@ rw=Kinyarwanda
|
|||
sa=Sanskrit
|
||||
sd=Sindhi
|
||||
sg=Sangho
|
||||
sh=Serbo-Croatian
|
||||
si=Sinhalese
|
||||
sk=Slovak
|
||||
sl=Slovenian
|
||||
|
|
@ -136,6 +132,6 @@ xh=Xhosa
|
|||
yi=Yiddish
|
||||
yo=Yoruba
|
||||
za=Zhuang
|
||||
zh=Chinese
|
||||
zh=Manarin Chinese
|
||||
zu=Zulu
|
||||
--=Undefined
|
||||
|
|
|
|||
|
|
@ -0,0 +1,137 @@
|
|||
aa=Afar
|
||||
ab=Abchasisch
|
||||
af=Afrikaans
|
||||
am=Amharisch
|
||||
ar=Arabisch
|
||||
as=Assamesisch
|
||||
ay=Aymara
|
||||
az=Aserbeidschanisch
|
||||
ba=Baschkirisch
|
||||
be=Wei\u00dfrussisch
|
||||
bh=Bihari
|
||||
bi=Bislama
|
||||
bn=Bengalisch
|
||||
bo=Tibetisch
|
||||
br=Bretonisch
|
||||
ca=Catalanisch
|
||||
co=Korsisch
|
||||
cs=Tschechisch
|
||||
cy=Walisisch
|
||||
da=D\u00e4nisch
|
||||
de=Deutsch
|
||||
dz=Dzongkha (Bhutanisch)
|
||||
el=Griechisch
|
||||
en=Englisch
|
||||
eo=Esperanto
|
||||
es=Spanisch
|
||||
et=Estnisch
|
||||
eu=Baskisch
|
||||
fa=Farsi (Persisch)
|
||||
fi=Finnisch
|
||||
fj=Fidschi
|
||||
fo=F\u00e4r\u00f6isch
|
||||
fr=Franz\u00f6sische
|
||||
fy=Friesisch
|
||||
ga=Irisch
|
||||
gd=Schottisch-g\u00e4lisch
|
||||
gl=Galicisch
|
||||
gn=Guarani
|
||||
gu=Gujarati
|
||||
ha=Hausa
|
||||
he=Ivrit (Hebrew)
|
||||
hi=Hindi
|
||||
hr=Kroatisch
|
||||
hu=Ungarisch
|
||||
hy=Armenisch
|
||||
ia=Interlingua
|
||||
id=Indonesisch
|
||||
ie=Interlingue
|
||||
ik=Ik
|
||||
is=Isl\u00e4ndisch
|
||||
it=Italienisch
|
||||
iu=Inuktitut
|
||||
ja=Japanisch
|
||||
ka=Georgisch
|
||||
kk=Kasachisch
|
||||
kl=Kalaallisut (Gr\u00f6nl\u00e4ndisch)
|
||||
km=Khmer (Kambodschanisch)
|
||||
kn=Kannada
|
||||
ko=Koreanisch
|
||||
ks=Kashmiri
|
||||
ku=Kurdisch
|
||||
ky=Kirgisisch
|
||||
la=Latein
|
||||
ln=Ling\u00e1la
|
||||
lo=Laotisch
|
||||
lt=Litauisch
|
||||
lv=Lettisch
|
||||
mg=Malagasy
|
||||
mi=Maorisch
|
||||
mk=Mazedonisch
|
||||
ml=Malayalam
|
||||
mn=Mongolisch
|
||||
mo=Moldauische
|
||||
mr=Marathi
|
||||
ms=Malaiisch
|
||||
mt=(Malti) Maltesisch
|
||||
my=Birmanisch
|
||||
na=Nauruisch
|
||||
ne=Nepali
|
||||
nl=Niederl\u00e4ndisch
|
||||
no=Norwegisch
|
||||
oc=Okzitanisch
|
||||
om=Oromo
|
||||
or=Oriya
|
||||
pa=Punjabi
|
||||
pl=Polnisch
|
||||
ps=Paschtu
|
||||
pt=Portugiesisch
|
||||
qu=Quechua
|
||||
rm=R\u00e4toromanisch
|
||||
rn=Kirundi
|
||||
ro=Rum\u00e4nisch
|
||||
ru=Russisch
|
||||
rw=Kinyarwanda
|
||||
sa=Sanskrit
|
||||
sd=Sindhi
|
||||
sg=Sangho
|
||||
si=Singhalesisch
|
||||
sk=Slowakisch
|
||||
sl=Slowenisch
|
||||
sm=Samoanisch
|
||||
sn=Shona
|
||||
so=Somali
|
||||
sq=Albanisch
|
||||
sr=Serbisch
|
||||
ss=Siswati
|
||||
st=Sesotho
|
||||
su=Sundanesisch
|
||||
sv=Schwedisch
|
||||
sw=Swahili
|
||||
ta=Tamil
|
||||
te=Telugu
|
||||
tg=Tadschikisch
|
||||
th=Thail\u00e4ndisch
|
||||
ti=Tigrinya
|
||||
tk=Turkmenisch
|
||||
tl=Tagalog
|
||||
tn=Setswana
|
||||
to=Tongaische
|
||||
tr=T\u00fcrkisch
|
||||
ts=Tsonga
|
||||
tt=Tatarisch
|
||||
tw=Twi
|
||||
ug=Uigurisch
|
||||
uk=Ukrainisch
|
||||
ur=Urdu
|
||||
uz=Usbekisch
|
||||
vi=Vietnamesisch
|
||||
vo=Volap\u00fck
|
||||
wo=Wolof
|
||||
xh=Xhosa
|
||||
yi=Jiddisch
|
||||
yo=Yoruba
|
||||
za=Zhuang
|
||||
zh=Mandarin (Chinese)
|
||||
zu=Zulu
|
||||
--=Undefined
|
||||
|
|
@ -330,3 +330,7 @@ cms.ui.workflow.task.user.add=Assign user
|
|||
cms.ui.workflow.task.locked_by=Locked by {0}
|
||||
cms.ui.workflow.task.locked_by_you=Locked by you
|
||||
cms.ui.edit=Edit
|
||||
cms.ui.language.header=Language
|
||||
cms.ui.language.title=Title
|
||||
cms.ui.action=Action
|
||||
cms.ui.item.language.add=Add language
|
||||
|
|
|
|||
|
|
@ -327,3 +327,7 @@ cms.ui.workflow.task.user.add=Benutzer zuordnen
|
|||
cms.ui.workflow.task.locked_by=Reserviert durch {0}
|
||||
cms.ui.workflow.task.locked_by_you=Von Ihnen reserviert
|
||||
cms.ui.edit=Bearbeiten
|
||||
cms.ui.language.header=Sprache
|
||||
cms.ui.language.title=Titel
|
||||
cms.ui.action=Aktion
|
||||
cms.ui.item.language.add=Sprache hinzuf\u00fcgen
|
||||
|
|
|
|||
|
|
@ -286,3 +286,7 @@ cms.ui.workflow.task.user.add=Assign user
|
|||
cms.ui.workflow.task.locked_by=Locked by {0}
|
||||
cms.ui.workflow.task.locked_by_you=Locked by you
|
||||
cms.ui.edit=Edit
|
||||
cms.ui.language.header=Language
|
||||
cms.ui.language.title=Title
|
||||
cms.ui.action=Action
|
||||
cms.ui.item.language.add=Add language
|
||||
|
|
|
|||
Loading…
Reference in New Issue