parent
01b47b29d9
commit
b146cd833c
|
|
@ -35,12 +35,12 @@ class FolderEditForm extends FolderBaseForm {
|
||||||
|
|
||||||
private static Logger LOGGER = LogManager.getLogger(FolderEditForm.class);
|
private static Logger LOGGER = LogManager.getLogger(FolderEditForm.class);
|
||||||
|
|
||||||
private final FolderRequestLocal m_folder;
|
private final FolderRequestLocal folderRequestLocal;
|
||||||
|
|
||||||
public FolderEditForm(final FolderRequestLocal folder) {
|
public FolderEditForm(final FolderRequestLocal folder) {
|
||||||
super("folder-edit");
|
super("folder-edit");
|
||||||
|
|
||||||
m_folder = folder;
|
folderRequestLocal = folder;
|
||||||
|
|
||||||
// XXX need to do name uniqueness valdation on m_fragment here
|
// XXX need to do name uniqueness valdation on m_fragment here
|
||||||
// as well.
|
// as well.
|
||||||
|
|
@ -68,7 +68,7 @@ class FolderEditForm extends FolderBaseForm {
|
||||||
public final void init(final FormSectionEvent e) {
|
public final void init(final FormSectionEvent e) {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
final Category folder = m_folder.getFolder(state);
|
final Category folder = folderRequestLocal.getFolder(state);
|
||||||
|
|
||||||
m_title.setValue(state, folder.getDisplayName());
|
m_title.setValue(state, folder.getDisplayName());
|
||||||
m_fragment.setValue(state, folder.getName());
|
m_fragment.setValue(state, folder.getName());
|
||||||
|
|
@ -80,7 +80,7 @@ class FolderEditForm extends FolderBaseForm {
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
final Category folder = m_folder.getFolder(state);
|
final Category folder = folderRequestLocal.getFolder(state);
|
||||||
|
|
||||||
folder.setDisplayName((String) m_title.getValue(state));
|
folder.setDisplayName((String) m_title.getValue(state));
|
||||||
folder.setName((String) m_fragment.getValue(state));
|
folder.setName((String) m_fragment.getValue(state));
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,10 @@ public class FolderEditorForm extends FolderForm {
|
||||||
final Folder folder = getCurrentFolder(state);
|
final Folder folder = getCurrentFolder(state);
|
||||||
data.put(NAME, folder.getName());
|
data.put(NAME, folder.getName());
|
||||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
final FolderEditorFormController controller = cdiUtil.findBean(
|
||||||
ConfigurationManager.class);
|
FolderEditorFormController.class
|
||||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
);
|
||||||
KernelConfig.class);
|
data.put(TITLE, controller.getFolderTitle(folder));
|
||||||
data.put(TITLE,
|
|
||||||
folder.getTitle().getValue(kernelConfig.getDefaultLocale()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.ui.folder;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
|
import org.librecms.contentsection.Folder;
|
||||||
|
import org.librecms.contentsection.FolderRepository;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
public class FolderEditorFormController {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ConfigurationManager confManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private FolderRepository folderRepository;
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String getFolderTitle(final Folder ofFolder) {
|
||||||
|
final Folder folder = folderRepository
|
||||||
|
.findById(Objects.requireNonNull(ofFolder).getObjectId())
|
||||||
|
.orElseThrow(
|
||||||
|
() -> new IllegalArgumentException(
|
||||||
|
String.format("No folder with ID %d available.",
|
||||||
|
ofFolder.getObjectId())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||||
|
KernelConfig.class
|
||||||
|
);
|
||||||
|
return folder.getTitle().getValue(kernelConfig.getDefaultLocale());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -362,7 +362,46 @@ class LifecycleAdminPaneController {
|
||||||
phaseDefinition.setDefaultDuration(duration);
|
phaseDefinition.setDefaultDuration(duration);
|
||||||
|
|
||||||
phaseDefRepo.save(phaseDefinition);
|
phaseDefRepo.save(phaseDefinition);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String getLifecycleDefinitionName(
|
||||||
|
final LifecycleDefinition ofCycle
|
||||||
|
) {
|
||||||
|
final LifecycleDefinition cycle = lifecycleDefRepo.findById(
|
||||||
|
Objects.requireNonNull(ofCycle).getDefinitionId()
|
||||||
|
).orElseThrow(
|
||||||
|
() -> new IllegalArgumentException(
|
||||||
|
String.format(
|
||||||
|
"No LifecycleDefinition with ID %d available",
|
||||||
|
ofCycle.getDefinitionId()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||||
|
KernelConfig.class
|
||||||
|
);
|
||||||
|
return cycle.getLabel().getValue(kernelConfig.getDefaultLocale());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String getLifecycleDefinitionDescription(
|
||||||
|
final LifecycleDefinition ofCycle
|
||||||
|
) {
|
||||||
|
final LifecycleDefinition cycle = lifecycleDefRepo.findById(
|
||||||
|
Objects.requireNonNull(ofCycle).getDefinitionId()
|
||||||
|
).orElseThrow(
|
||||||
|
() -> new IllegalArgumentException(
|
||||||
|
String.format(
|
||||||
|
"No LifecycleDefinition with ID %d available",
|
||||||
|
ofCycle.getDefinitionId()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||||
|
KernelConfig.class
|
||||||
|
);
|
||||||
|
return cycle.getDescription().getValue(kernelConfig.getDefaultLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,17 @@ class LifecycleEditForm extends BaseLifecycleForm {
|
||||||
final LifecycleDefinition cycle = selectedDefinition
|
final LifecycleDefinition cycle = selectedDefinition
|
||||||
.getLifecycleDefinition(state);
|
.getLifecycleDefinition(state);
|
||||||
|
|
||||||
getLifecycleName().setValue(state, cycle.getLabel());
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
getLifecycleDescription().setValue(state, cycle.getDescription());
|
final LifecycleAdminPaneController controller = cdiUtil.findBean(
|
||||||
|
LifecycleAdminPaneController.class
|
||||||
|
);
|
||||||
|
|
||||||
|
getLifecycleName().setValue(
|
||||||
|
state, controller.getLifecycleDefinitionName(cycle)
|
||||||
|
);
|
||||||
|
getLifecycleDescription().setValue(
|
||||||
|
state, controller.getLifecycleDefinitionDescription(cycle)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue