Fixing the translation problem in the content center (see #1630).
git-svn-id: https://svn.libreccm.org/ccm/trunk@2085 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
de925fdb3b
commit
9b263bec1a
|
|
@ -1113,3 +1113,10 @@ cms.ui.clear=Clear
|
||||||
cms.ui.item_search.create.folder_missing=No folder selected
|
cms.ui.item_search.create.folder_missing=No folder selected
|
||||||
cms.ui.images_links=
|
cms.ui.images_links=
|
||||||
cms.contenttypes.ui.person.alias.delete.label=Delete
|
cms.contenttypes.ui.person.alias.delete.label=Delete
|
||||||
|
cms.ui.contentcenter.mainpage.search=Search
|
||||||
|
cms.ui.contentcenter.mainpage.taskssections=Tasks/Sections
|
||||||
|
cms.ui.contentcenter.section=Section
|
||||||
|
cms.ui.contentcenter.action=Action
|
||||||
|
cms.ui.set_home_folder=Set as home folder
|
||||||
|
cms.ui.go_to_home_folder=Go to home folder
|
||||||
|
cms.ui.no_home_folder_selected=No home folder selected
|
||||||
|
|
|
||||||
|
|
@ -845,7 +845,7 @@ cms.ui.workflow.tasks=Aufgaben
|
||||||
cms.ui.workflow.task.view_locked=Reservierte Aufgaben anzeigen
|
cms.ui.workflow.task.view_locked=Reservierte Aufgaben anzeigen
|
||||||
cms.ui.workflow.task.view_unlocked=Freigegebene Aufgaben anzeigen
|
cms.ui.workflow.task.view_unlocked=Freigegebene Aufgaben anzeigen
|
||||||
cms.ui.workflow.task.view_all=Alle Aufgaben anzeigen
|
cms.ui.workflow.task.view_all=Alle Aufgaben anzeigen
|
||||||
cms.ui.workflow.task.item_title=Item Title
|
cms.ui.workflow.task.item_title=Titel des Dokuments
|
||||||
cms.ui.workflow.task.locking_user=Reserviert von\:
|
cms.ui.workflow.task.locking_user=Reserviert von\:
|
||||||
cms.ui.workflow.unlock_tasks=Alle meine Aufgaben f\u00fcr diesen Typ freigeben
|
cms.ui.workflow.unlock_tasks=Alle meine Aufgaben f\u00fcr diesen Typ freigeben
|
||||||
cms.ui.workflow.your_tasks=Zugewiesene Aufgaben
|
cms.ui.workflow.your_tasks=Zugewiesene Aufgaben
|
||||||
|
|
@ -1105,4 +1105,11 @@ cms.ui.type.minimum_number_of_values_bigger_than_maximum_number_of_values=Maxima
|
||||||
cms.ui.type.minimummaximum_number_of_values_cannot_be_negative=Keine negativen Werte erlaubt
|
cms.ui.type.minimummaximum_number_of_values_cannot_be_negative=Keine negativen Werte erlaubt
|
||||||
cms.ui.item_search.create.folder_missing=kein Ordner ausgew\u00e4hlt
|
cms.ui.item_search.create.folder_missing=kein Ordner ausgew\u00e4hlt
|
||||||
cms.ui.images_links=
|
cms.ui.images_links=
|
||||||
cms.contenttypes.ui.person.alias.delete.label=
|
cms.contenttypes.ui.person.alias.delete.label=L\u00f6schen
|
||||||
|
cms.ui.contentcenter.mainpage.search=Suche
|
||||||
|
cms.ui.contentcenter.mainpage.taskssections=Aufgaben/Content Sections
|
||||||
|
cms.ui.contentcenter.section=Content Section
|
||||||
|
cms.ui.contentcenter.action=Aktion
|
||||||
|
cms.ui.set_home_folder=Als Start-Ordner festlegen
|
||||||
|
cms.ui.go_to_home_folder=Zum Start-Ordner
|
||||||
|
cms.ui.no_home_folder_selected=Kein Start-Ordner festgelegt
|
||||||
|
|
|
||||||
|
|
@ -52,3 +52,10 @@ cms.ui.clear=
|
||||||
cms.ui.item_search.create.folder_missing=
|
cms.ui.item_search.create.folder_missing=
|
||||||
cms.ui.images_links=
|
cms.ui.images_links=
|
||||||
cms.contenttypes.ui.person.alias.delete.label=
|
cms.contenttypes.ui.person.alias.delete.label=
|
||||||
|
cms.ui.contentcenter.mainpage.search=
|
||||||
|
cms.ui.contentcenter.mainpage.taskssections=
|
||||||
|
cms.ui.contentcenter.section=
|
||||||
|
cms.ui.contentcenter.action=
|
||||||
|
cms.ui.set_home_folder=
|
||||||
|
cms.ui.go_to_home_folder=
|
||||||
|
cms.ui.no_home_folder_selected=
|
||||||
|
|
|
||||||
|
|
@ -583,3 +583,10 @@ cms.ui.clear=
|
||||||
cms.ui.item_search.create.folder_missing=
|
cms.ui.item_search.create.folder_missing=
|
||||||
cms.ui.images_links=
|
cms.ui.images_links=
|
||||||
cms.contenttypes.ui.person.alias.delete.label=
|
cms.contenttypes.ui.person.alias.delete.label=
|
||||||
|
cms.ui.contentcenter.mainpage.search=
|
||||||
|
cms.ui.contentcenter.mainpage.taskssections=
|
||||||
|
cms.ui.contentcenter.section=
|
||||||
|
cms.ui.contentcenter.action=
|
||||||
|
cms.ui.set_home_folder=
|
||||||
|
cms.ui.go_to_home_folder=
|
||||||
|
cms.ui.no_home_folder_selected=
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.ui;
|
package com.arsdigita.cms.ui;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.ActionLink;
|
import com.arsdigita.bebop.ActionLink;
|
||||||
import com.arsdigita.bebop.Form;
|
import com.arsdigita.bebop.Form;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
|
@ -92,34 +91,27 @@ public class FlatItemList extends SegmentedPanel
|
||||||
private static final String CMS_PRIVILEGES = "com.arsdigita.cms.getPrivileges";
|
private static final String CMS_PRIVILEGES = "com.arsdigita.cms.getPrivileges";
|
||||||
private static final String PRIVILEGE = "privilege";
|
private static final String PRIVILEGE = "privilege";
|
||||||
private static final String PRIVILEGE_NAME = "prettyName";
|
private static final String PRIVILEGE_NAME = "prettyName";
|
||||||
|
|
||||||
// The folder selectors
|
// The folder selectors
|
||||||
private FolderSelectionModel m_folderSel;
|
private FolderSelectionModel m_folderSel;
|
||||||
private FolderRequestLocal m_folder;
|
private FolderRequestLocal m_folder;
|
||||||
|
|
||||||
private NewItemForm m_newItem;
|
private NewItemForm m_newItem;
|
||||||
private SingleSelectionModel m_typeSel;
|
private SingleSelectionModel m_typeSel;
|
||||||
private CreationSelector m_selector;
|
private CreationSelector m_selector;
|
||||||
private FolderManipulator m_folderManip;
|
private FolderManipulator m_folderManip;
|
||||||
|
|
||||||
private FolderCreator m_folderCreator;
|
private FolderCreator m_folderCreator;
|
||||||
private ActionLink m_setHomeFolderAction;
|
private ActionLink m_setHomeFolderAction;
|
||||||
private ActionLink m_createFolderAction;
|
private ActionLink m_createFolderAction;
|
||||||
private ActionLink m_togglePrivateAction;
|
private ActionLink m_togglePrivateAction;
|
||||||
private Label m_homeFolderLabel;
|
private Label m_homeFolderLabel;
|
||||||
|
|
||||||
private Segment m_browseSeg;
|
private Segment m_browseSeg;
|
||||||
private Segment m_newItemSeg;
|
private Segment m_newItemSeg;
|
||||||
private Segment m_newFolderSeg;
|
private Segment m_newFolderSeg;
|
||||||
private Segment m_editFolderSeg;
|
private Segment m_editFolderSeg;
|
||||||
private Segment m_permissionsSeg;
|
private Segment m_permissionsSeg;
|
||||||
private CMSPermissionsPane m_permPane;
|
private CMSPermissionsPane m_permPane;
|
||||||
|
|
||||||
// Folder edit/rename functionality.
|
// Folder edit/rename functionality.
|
||||||
private ActionLink m_editFolderAction;
|
private ActionLink m_editFolderAction;
|
||||||
private FolderEditor m_folderEditor;
|
private FolderEditor m_folderEditor;
|
||||||
|
|
||||||
|
|
||||||
private Label m_contentLabel;
|
private Label m_contentLabel;
|
||||||
private ItemPath m_itemPath;
|
private ItemPath m_itemPath;
|
||||||
private Label m_chooseLabel;
|
private Label m_chooseLabel;
|
||||||
|
|
@ -135,11 +127,12 @@ public class FlatItemList extends SegmentedPanel
|
||||||
m_folder = folder;
|
m_folder = folder;
|
||||||
m_folderSel = model;
|
m_folderSel = model;
|
||||||
m_folderSel.addChangeListener(new ChangeListener() {
|
m_folderSel.addChangeListener(new ChangeListener() {
|
||||||
public void stateChanged(ChangeEvent e) {
|
public void stateChanged(ChangeEvent e) {
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
reset(s);
|
reset(s);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
});
|
||||||
|
|
||||||
setIdAttr("flat-item-list");
|
setIdAttr("flat-item-list");
|
||||||
|
|
||||||
|
|
@ -189,26 +182,34 @@ public class FlatItemList extends SegmentedPanel
|
||||||
m_editFolderAction.addActionListener(this);
|
m_editFolderAction.addActionListener(this);
|
||||||
browseActions.addAction(m_editFolderAction);
|
browseActions.addAction(m_editFolderAction);
|
||||||
|
|
||||||
m_setHomeFolderAction = new ActionLink(new Label("Set as home folder"));
|
m_setHomeFolderAction = new ActionLink(new Label(globalize("cms.ui.set_home_folder")));
|
||||||
m_setHomeFolderAction.addActionListener(this);
|
m_setHomeFolderAction.addActionListener(this);
|
||||||
browseActions.addAction(m_setHomeFolderAction);
|
browseActions.addAction(m_setHomeFolderAction);
|
||||||
|
|
||||||
m_homeFolderLabel = new Label(new PrintListener() {
|
m_homeFolderLabel = new Label(new PrintListener() {
|
||||||
public final void prepare(final PrintEvent e) {
|
public final void prepare(final PrintEvent e) {
|
||||||
Label label = (Label)e.getTarget();
|
Label label = (Label) e.getTarget();
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getContext().getUser();
|
||||||
|
|
||||||
Folder folder = Folder.getUserHomeFolder(user,CMS.getContext().getContentSection());
|
Folder folder = Folder.getUserHomeFolder(user, CMS.getContext().getContentSection());
|
||||||
if ( folder != null ) {
|
if (folder != null) {
|
||||||
String url = folder.getContentSection().getURL() + PageLocations.SECTION_PAGE + "?" + ContentSectionPage.SET_FOLDER + "=" + folder.getID();
|
String url = folder.getContentSection().getURL() + PageLocations.SECTION_PAGE + "?"
|
||||||
label.setLabel("Go to home folder: <a href=\"" + url + "\">" + folder.getLabel() + "</a>");
|
+ ContentSectionPage.SET_FOLDER + "=" + folder.getID();
|
||||||
} else {
|
//label.setLabel("Go to home folder: <a href=\"" + url + "\">" + folder.getLabel() + "</a>");
|
||||||
label.setLabel("<font color=\"red\">No home folder selected</font>");
|
label.setLabel(String.format("%s: <a href=\"%s\">%s</a>",
|
||||||
}
|
(String) globalize("cms.ui.go_to_home_folder").localize(),
|
||||||
label.setOutputEscaping(false);
|
url,
|
||||||
|
folder.getLabel()));
|
||||||
|
} else {
|
||||||
|
//label.setLabel("<font color=\"red\">No home folder selected</font>");
|
||||||
|
label.setLabel(String.format("<span style=\"color: red\">%s</span>",
|
||||||
|
(String)globalize("cms.ui.no_home_folder_selected").localize()));
|
||||||
}
|
}
|
||||||
});
|
label.setOutputEscaping(false);
|
||||||
browseActions.addAction(m_homeFolderLabel);
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
browseActions.addAction(m_homeFolderLabel);
|
||||||
|
|
||||||
m_newItem = new SectionNewItemForm("newItem");
|
m_newItem = new SectionNewItemForm("newItem");
|
||||||
m_newItem.addProcessListener(this);
|
m_newItem.addProcessListener(this);
|
||||||
|
|
@ -236,29 +237,30 @@ public class FlatItemList extends SegmentedPanel
|
||||||
}
|
}
|
||||||
query.close();
|
query.close();
|
||||||
|
|
||||||
m_permPane = new CMSPermissionsPane
|
m_permPane =
|
||||||
((PrivilegeDescriptor[]) privs.toArray
|
new CMSPermissionsPane((PrivilegeDescriptor[]) privs.toArray(new PrivilegeDescriptor[privs.size()]),
|
||||||
(new PrivilegeDescriptor[privs.size()]),
|
privNameMap,
|
||||||
privNameMap,
|
m_folderSel);
|
||||||
m_folderSel);
|
|
||||||
permActions.setSubject(m_permPane);
|
permActions.setSubject(m_permPane);
|
||||||
|
|
||||||
// An action
|
// An action
|
||||||
|
|
||||||
m_togglePrivateAction = new ActionLink(new Label(new PrintListener() {
|
m_togglePrivateAction = new ActionLink(new Label(new PrintListener() {
|
||||||
public void prepare(PrintEvent e) {
|
public void prepare(PrintEvent e) {
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
Label target = (Label) e.getTarget();
|
Label target = (Label) e.getTarget();
|
||||||
Folder currentFolder = m_folder.getFolder(state);
|
Folder currentFolder = m_folder.getFolder(state);
|
||||||
// ACSObject parent = currentFolder.getParent();
|
// ACSObject parent = currentFolder.getParent();
|
||||||
DataObject context = PermissionService.getContext(currentFolder);
|
DataObject context = PermissionService.getContext(currentFolder);
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
target.setLabel( (String) GlobalizationUtil.globalize("cms.ui.restore_default_permissions").localize());
|
target.setLabel((String) GlobalizationUtil.globalize("cms.ui.restore_default_permissions").
|
||||||
} else {
|
localize());
|
||||||
target.setLabel( (String) GlobalizationUtil.globalize("cms.ui.use_custom_permissions").localize());
|
} else {
|
||||||
}
|
target.setLabel((String) GlobalizationUtil.globalize("cms.ui.use_custom_permissions").localize());
|
||||||
}
|
}
|
||||||
}));
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
m_togglePrivateAction.addActionListener(this);
|
m_togglePrivateAction.addActionListener(this);
|
||||||
permActions.addAction(m_togglePrivateAction);
|
permActions.addAction(m_togglePrivateAction);
|
||||||
|
|
||||||
|
|
@ -286,8 +288,8 @@ public class FlatItemList extends SegmentedPanel
|
||||||
m_folderEditor.addSubmissionListener(this);
|
m_folderEditor.addSubmissionListener(this);
|
||||||
m_folderEditor.addProcessListener(this);
|
m_folderEditor.addProcessListener(this);
|
||||||
|
|
||||||
Form folderEditorForm = new Form( "fedit_form" );
|
Form folderEditorForm = new Form("fedit_form");
|
||||||
folderEditorForm.add( m_folderEditor );
|
folderEditorForm.add(m_folderEditor);
|
||||||
m_editFolderSeg.add(folderEditorForm);
|
m_editFolderSeg.add(folderEditorForm);
|
||||||
m_editFolderSeg.add(new Label("<br/>", false));
|
m_editFolderSeg.add(new Label("<br/>", false));
|
||||||
}
|
}
|
||||||
|
|
@ -304,14 +306,15 @@ public class FlatItemList extends SegmentedPanel
|
||||||
p.addComponentStateParam(this, m_typeSel.getStateParameter());
|
p.addComponentStateParam(this, m_typeSel.getStateParameter());
|
||||||
|
|
||||||
p.addActionListener(new ActionListener() {
|
p.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
if (state.isVisibleOnPage(FlatItemList.this)) {
|
if (state.isVisibleOnPage(FlatItemList.this)) {
|
||||||
showHideSegments(state);
|
showHideSegments(state);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -328,9 +331,9 @@ public class FlatItemList extends SegmentedPanel
|
||||||
// MP: This should be checked on the current folder instead of just
|
// MP: This should be checked on the current folder instead of just
|
||||||
// the content section.
|
// the content section.
|
||||||
boolean newItem =
|
boolean newItem =
|
||||||
sm.canAccess(state.getRequest(),
|
sm.canAccess(state.getRequest(),
|
||||||
SecurityManager.NEW_ITEM,
|
SecurityManager.NEW_ITEM,
|
||||||
folder);
|
folder);
|
||||||
|
|
||||||
if (!newItem) {
|
if (!newItem) {
|
||||||
browseMode(state);
|
browseMode(state);
|
||||||
|
|
@ -346,9 +349,9 @@ public class FlatItemList extends SegmentedPanel
|
||||||
|
|
||||||
User user = (User) Kernel.getContext().getParty();
|
User user = (User) Kernel.getContext().getParty();
|
||||||
PermissionDescriptor perm =
|
PermissionDescriptor perm =
|
||||||
new PermissionDescriptor(PrivilegeDescriptor.ADMIN,
|
new PermissionDescriptor(PrivilegeDescriptor.ADMIN,
|
||||||
folder,
|
folder,
|
||||||
user);
|
user);
|
||||||
|
|
||||||
if (PermissionService.checkPermission(perm)) {
|
if (PermissionService.checkPermission(perm)) {
|
||||||
m_permissionsSeg.setVisible(state, true);
|
m_permissionsSeg.setVisible(state, true);
|
||||||
|
|
@ -381,19 +384,19 @@ public class FlatItemList extends SegmentedPanel
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitted(FormSectionEvent e)
|
public void submitted(FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
if ( e.getSource() == m_folderCreator
|
if (e.getSource() == m_folderCreator
|
||||||
&& m_folderCreator.isCancelled(s) ) {
|
&& m_folderCreator.isCancelled(s)) {
|
||||||
browseMode(s);
|
browseMode(s);
|
||||||
throw new FormProcessException( (String) GlobalizationUtil.globalize("cms.ui.cancelled").localize());
|
throw new FormProcessException((String) GlobalizationUtil.globalize("cms.ui.cancelled").localize());
|
||||||
} else if (e.getSource() == m_folderEditor && m_folderEditor.isCancelled(s)) {
|
} else if (e.getSource() == m_folderEditor && m_folderEditor.isCancelled(s)) {
|
||||||
browseMode(s);
|
browseMode(s);
|
||||||
throw new FormProcessException( (String) GlobalizationUtil.globalize("cms.ui.cancelled").localize());
|
throw new FormProcessException((String) GlobalizationUtil.globalize("cms.ui.cancelled").localize());
|
||||||
} else if ( e.getSource() == m_folderManip.getTargetSelector() ) {
|
} else if (e.getSource() == m_folderManip.getTargetSelector()) {
|
||||||
// This only works if this submission listener is run
|
// This only works if this submission listener is run
|
||||||
// after the target selector's one
|
// after the target selector's one
|
||||||
if ( ! m_folderManip.getTargetSelector().isVisible(s) ) {
|
if (!m_folderManip.getTargetSelector().isVisible(s)) {
|
||||||
browseMode(s);
|
browseMode(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -421,8 +424,8 @@ public class FlatItemList extends SegmentedPanel
|
||||||
|
|
||||||
public void stateChanged(ChangeEvent e) {
|
public void stateChanged(ChangeEvent e) {
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
if ( e.getSource().equals(m_typeSel) ) {
|
if (e.getSource().equals(m_typeSel)) {
|
||||||
if ( ! m_typeSel.isSelected(s) ) {
|
if (!m_typeSel.isSelected(s)) {
|
||||||
browseMode(s);
|
browseMode(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -431,20 +434,19 @@ public class FlatItemList extends SegmentedPanel
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
Object source = e.getSource();
|
Object source = e.getSource();
|
||||||
if ( source == m_createFolderAction ) {
|
if (source == m_createFolderAction) {
|
||||||
newFolderMode(s);
|
newFolderMode(s);
|
||||||
} else if (source == m_editFolderAction) {
|
} else if (source == m_editFolderAction) {
|
||||||
m_permissionsSeg.setVisible(s, false);
|
m_permissionsSeg.setVisible(s, false);
|
||||||
m_editFolderSeg.setVisible(s, true);
|
m_editFolderSeg.setVisible(s, true);
|
||||||
}
|
} else if (source == m_togglePrivateAction) {
|
||||||
else if (source == m_togglePrivateAction) {
|
|
||||||
togglePermissions(s);
|
togglePermissions(s);
|
||||||
} else if ( source == m_setHomeFolderAction ) {
|
} else if (source == m_setHomeFolderAction) {
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getContext().getUser();
|
||||||
Folder folder = m_folder.getFolder(s);
|
Folder folder = m_folder.getFolder(s);
|
||||||
user = (User)DomainObjectFactory.newInstance(user.getOID());
|
user = (User) DomainObjectFactory.newInstance(user.getOID());
|
||||||
Folder.setUserHomeFolder(user,folder);
|
Folder.setUserHomeFolder(user, folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void togglePermissions(PageState state) {
|
private void togglePermissions(PageState state) {
|
||||||
|
|
@ -470,8 +472,8 @@ public class FlatItemList extends SegmentedPanel
|
||||||
if (section != null) {
|
if (section != null) {
|
||||||
PermissionService.setContext(currentFolder, section);
|
PermissionService.setContext(currentFolder, section);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Cannot set the context for a folder with " +
|
throw new IllegalStateException("Cannot set the context for a folder with "
|
||||||
"no parent and no Content Section");
|
+ "no parent and no Content Section");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -485,8 +487,8 @@ public class FlatItemList extends SegmentedPanel
|
||||||
if (liveSection != null) {
|
if (liveSection != null) {
|
||||||
PermissionService.setContext(liveVersion, liveSection);
|
PermissionService.setContext(liveVersion, liveSection);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Cannot set the context for a folder with " +
|
throw new IllegalStateException("Cannot set the context for a folder with "
|
||||||
"no parent and no Content Section");
|
+ "no parent and no Content Section");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -505,7 +507,8 @@ public class FlatItemList extends SegmentedPanel
|
||||||
ObjectPermissionCollection livePerms = PermissionService.getGrantedPermissions(liveVersion.getOID());
|
ObjectPermissionCollection livePerms = PermissionService.getGrantedPermissions(liveVersion.getOID());
|
||||||
while (livePerms.next()) {
|
while (livePerms.next()) {
|
||||||
if (!livePerms.isInherited()) {
|
if (!livePerms.isInherited()) {
|
||||||
PermissionDescriptor desc2 = new PermissionDescriptor(livePerms.getPrivilege(), liveVersion.getOID(),
|
PermissionDescriptor desc2 = new PermissionDescriptor(livePerms.getPrivilege(), liveVersion.
|
||||||
|
getOID(),
|
||||||
livePerms.getGranteeOID());
|
livePerms.getGranteeOID());
|
||||||
PermissionService.revokePermission(desc2);
|
PermissionService.revokePermission(desc2);
|
||||||
}
|
}
|
||||||
|
|
@ -535,7 +538,7 @@ public class FlatItemList extends SegmentedPanel
|
||||||
|
|
||||||
public void setPermissionLinkVis(PageState state) {
|
public void setPermissionLinkVis(PageState state) {
|
||||||
if (!Utilities.getSecurityManager(state).
|
if (!Utilities.getSecurityManager(state).
|
||||||
canAccess(state.getRequest(), SecurityManager.STAFF_ADMIN)) {
|
canAccess(state.getRequest(), SecurityManager.STAFF_ADMIN)) {
|
||||||
m_togglePrivateAction.setVisible(state, false);
|
m_togglePrivateAction.setVisible(state, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -549,6 +552,7 @@ public class FlatItemList extends SegmentedPanel
|
||||||
public ContentSection getContentSection(PageState s) {
|
public ContentSection getContentSection(PageState s) {
|
||||||
return CMS.getContext().getContentSection();
|
return CMS.getContext().getContentSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ public abstract class NewItemForm extends Form {
|
||||||
m_emptyLabel.setIdAttr("empty_label");
|
m_emptyLabel.setIdAttr("empty_label");
|
||||||
panel.add(m_emptyLabel);
|
panel.add(m_emptyLabel);
|
||||||
|
|
||||||
m_createLabel = new Label(globalize("cms.ui.authoring.create_new"), false);
|
m_createLabel = new Label((String)globalize("cms.ui.authoring.create_new").localize(), false);
|
||||||
m_createLabel.setIdAttr("create_label");
|
m_createLabel.setIdAttr("create_label");
|
||||||
panel.add(m_createLabel);
|
panel.add(m_createLabel);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,11 @@ public class ContentSectionContainer extends CMSContainer {
|
||||||
// add columns to the table
|
// add columns to the table
|
||||||
TableColumnModel columnModel = getColumnModel();
|
TableColumnModel columnModel = getColumnModel();
|
||||||
|
|
||||||
TableColumn contentSectionColumn = new TableColumn(colNo, COLUMN_SECTION);
|
//TableColumn contentSectionColumn = new TableColumn(colNo, COLUMN_SECTION);
|
||||||
|
TableColumn contentSectionColumn = new TableColumn(
|
||||||
|
colNo,
|
||||||
|
(String)GlobalizationUtil.globalize("cms.ui.contentcenter.section").localize(),
|
||||||
|
COLUMN_SECTION);
|
||||||
contentSectionColumn.setCellRenderer(new AdminURLTableCellRenderer());
|
contentSectionColumn.setCellRenderer(new AdminURLTableCellRenderer());
|
||||||
columnModel.add(contentSectionColumn);
|
columnModel.add(contentSectionColumn);
|
||||||
|
|
||||||
|
|
@ -302,7 +306,10 @@ public class ContentSectionContainer extends CMSContainer {
|
||||||
columnModel.add(locationColumn);
|
columnModel.add(locationColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
TableColumn actionColumn = new TableColumn(colNo ++, COLUMN_ACTION);
|
TableColumn actionColumn = new TableColumn(
|
||||||
|
colNo++,
|
||||||
|
(String)GlobalizationUtil.globalize("cms.ui.contentcenter.action").localize(),
|
||||||
|
COLUMN_ACTION);
|
||||||
actionColumn.setCellRenderer(new ActionTableCellRenderer());
|
actionColumn.setCellRenderer(new ActionTableCellRenderer());
|
||||||
columnModel.add(actionColumn);
|
columnModel.add(actionColumn);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,8 +145,14 @@ public class MainPage extends CMSApplicationPage implements ActionListener {
|
||||||
protected TabbedPane createTabbedPane() {
|
protected TabbedPane createTabbedPane() {
|
||||||
TabbedPane pane = new TabbedPane();
|
TabbedPane pane = new TabbedPane();
|
||||||
pane.setClassAttr(XSL_CLASS);
|
pane.setClassAttr(XSL_CLASS);
|
||||||
addToPane(pane, "Tasks/Sections", getTasksPane(m_typeSel, m_sectionSel));
|
//addToPane(pane, "Tasks/Sections", getTasksPane(m_typeSel, m_sectionSel));
|
||||||
addToPane(pane, "Search", getSearchPane());
|
//addToPane(pane, "Search", getSearchPane());
|
||||||
|
addToPane(pane,
|
||||||
|
(String)GlobalizationUtil.globalize("cms.ui.contentcenter.mainpage.taskssections").localize(),
|
||||||
|
getTasksPane(m_typeSel, m_sectionSel));
|
||||||
|
addToPane(pane,
|
||||||
|
(String)GlobalizationUtil.globalize("cms.ui.contentcenter.mainpage.search").localize(),
|
||||||
|
getSearchPane());
|
||||||
pane.addActionListener(this);
|
pane.addActionListener(this);
|
||||||
return pane;
|
return pane;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.ui.contentcenter;
|
package com.arsdigita.cms.ui.contentcenter;
|
||||||
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -89,29 +88,24 @@ import com.arsdigita.xml.Element;
|
||||||
public class TasksPanel extends CMSContainer {
|
public class TasksPanel extends CMSContainer {
|
||||||
|
|
||||||
private static Logger s_log =
|
private static Logger s_log =
|
||||||
Logger.getLogger(TasksPanel.class);
|
Logger.getLogger(TasksPanel.class);
|
||||||
|
|
||||||
// The default number of rows to show
|
// The default number of rows to show
|
||||||
private static final int DEFAULT_MAX_ROWS = 15;
|
private static final int DEFAULT_MAX_ROWS = 15;
|
||||||
|
|
||||||
// Number of tasks to show
|
// Number of tasks to show
|
||||||
private final int m_maxRows;
|
private final int m_maxRows;
|
||||||
|
|
||||||
private TaskList m_taskList;
|
private TaskList m_taskList;
|
||||||
private ActionLink m_viewAllLink;
|
private ActionLink m_viewAllLink;
|
||||||
private ActionLink m_viewShortLink;
|
private ActionLink m_viewShortLink;
|
||||||
private Paginator m_paginator;
|
private Paginator m_paginator;
|
||||||
private ActionLink m_viewLockLink,m_viewUnlockLink,m_viewAllLockLink;
|
private ActionLink m_viewLockLink, m_viewUnlockLink, m_viewAllLockLink;
|
||||||
private Label m_viewLockLabel,m_viewUnlockLabel,m_viewAllLockLabel;
|
private Label m_viewLockLabel, m_viewUnlockLabel, m_viewAllLockLabel;
|
||||||
private StringParameter m_sortDirectionParam;
|
private StringParameter m_sortDirectionParam;
|
||||||
private StringParameter m_sortTypeParam;
|
private StringParameter m_sortTypeParam;
|
||||||
private StringParameter m_lockFilterParam;
|
private StringParameter m_lockFilterParam;
|
||||||
|
|
||||||
// control link variable
|
// control link variable
|
||||||
private static final String TASK_ACTION = "taskAction";
|
private static final String TASK_ACTION = "taskAction";
|
||||||
private static final String SORT_DOWN = "sortActionUp";
|
private static final String SORT_DOWN = "sortActionUp";
|
||||||
private static final String SORT_UP = "sortActionDown";
|
private static final String SORT_UP = "sortActionDown";
|
||||||
|
|
||||||
private static final String LOCK_FILTER_TYPE = "lockFilterType";
|
private static final String LOCK_FILTER_TYPE = "lockFilterType";
|
||||||
private static final String SORT_TYPE = "sortType";
|
private static final String SORT_TYPE = "sortType";
|
||||||
private static final String SORT_DIRECTION = "sortDirection";
|
private static final String SORT_DIRECTION = "sortDirection";
|
||||||
|
|
@ -121,13 +115,11 @@ public class TasksPanel extends CMSContainer {
|
||||||
private static final String SORT_TITLE = "title";
|
private static final String SORT_TITLE = "title";
|
||||||
private static final String SORT_USER = "user";
|
private static final String SORT_USER = "user";
|
||||||
private static final String SORT_WORKFLOW = "workflow";
|
private static final String SORT_WORKFLOW = "workflow";
|
||||||
|
|
||||||
// IMAGES
|
// IMAGES
|
||||||
public static final String UP_ARROW_IMAGE =
|
public static final String UP_ARROW_IMAGE =
|
||||||
"/themes/heirfloom/images/gray-triangle-up.gif";
|
"/themes/heirfloom/images/gray-triangle-up.gif";
|
||||||
public static final String DOWN_ARROW_IMAGE =
|
public static final String DOWN_ARROW_IMAGE =
|
||||||
"/themes/heirfloom/images/gray-triangle-down.gif";
|
"/themes/heirfloom/images/gray-triangle-down.gif";
|
||||||
|
|
||||||
// CREATION PANE CONSTANTS
|
// CREATION PANE CONSTANTS
|
||||||
private Label m_selectorLabel;
|
private Label m_selectorLabel;
|
||||||
private CreationSelector m_selector;
|
private CreationSelector m_selector;
|
||||||
|
|
@ -143,7 +135,7 @@ public class TasksPanel extends CMSContainer {
|
||||||
**/
|
**/
|
||||||
public TasksPanel(ACSObjectSelectionModel typeModel,
|
public TasksPanel(ACSObjectSelectionModel typeModel,
|
||||||
ACSObjectSelectionModel sectionModel) {
|
ACSObjectSelectionModel sectionModel) {
|
||||||
this(DEFAULT_MAX_ROWS,typeModel,sectionModel);
|
this(DEFAULT_MAX_ROWS, typeModel, sectionModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -154,7 +146,7 @@ public class TasksPanel extends CMSContainer {
|
||||||
*
|
*
|
||||||
* @pre maxRows != null
|
* @pre maxRows != null
|
||||||
**/
|
**/
|
||||||
public TasksPanel(int maxRows,ACSObjectSelectionModel typeModel,
|
public TasksPanel(int maxRows, ACSObjectSelectionModel typeModel,
|
||||||
ACSObjectSelectionModel sectionModel) {
|
ACSObjectSelectionModel sectionModel) {
|
||||||
super();
|
super();
|
||||||
m_maxRows = maxRows;
|
m_maxRows = maxRows;
|
||||||
|
|
@ -168,7 +160,6 @@ public class TasksPanel extends CMSContainer {
|
||||||
addComponents();
|
addComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the components to this tasks panel
|
* Adds the components to this tasks panel
|
||||||
**/
|
**/
|
||||||
|
|
@ -178,26 +169,27 @@ public class TasksPanel extends CMSContainer {
|
||||||
|
|
||||||
// A label that says "Create $content_type in $section"
|
// A label that says "Create $content_type in $section"
|
||||||
m_selectorLabel = new Label(new PrintListener() {
|
m_selectorLabel = new Label(new PrintListener() {
|
||||||
public void prepare(PrintEvent e) {
|
public void prepare(PrintEvent e) {
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
Label t = (Label)e.getTarget();
|
Label t = (Label) e.getTarget();
|
||||||
|
|
||||||
ContentType type = (ContentType) m_typeSel.getSelectedObject(s);
|
ContentType type = (ContentType) m_typeSel.getSelectedObject(s);
|
||||||
ContentSection sec =
|
ContentSection sec =
|
||||||
(ContentSection) m_sectionSel.getSelectedObject(s);
|
(ContentSection) m_sectionSel.getSelectedObject(s);
|
||||||
|
|
||||||
StringBuffer buf = new StringBuffer(
|
StringBuffer buf = new StringBuffer(
|
||||||
GlobalizationUtil
|
GlobalizationUtil
|
||||||
.globalize("cms.ui.create").localize() + " ");
|
.globalize("cms.ui.create").localize() + " ");
|
||||||
buf.append(type.getLabel());
|
buf.append(type.getLabel());
|
||||||
buf.append(" in ");
|
buf.append(" in ");
|
||||||
buf.append(sec.getName());
|
buf.append(sec.getName());
|
||||||
|
|
||||||
t.setLabel(buf.toString());
|
t.setLabel(buf.toString());
|
||||||
t.setFontWeight(Label.BOLD);
|
t.setFontWeight(Label.BOLD);
|
||||||
t.setClassAttr("creationLabel");
|
t.setClassAttr("creationLabel");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
});
|
||||||
m_selectorLabel.setClassAttr("creationLabel");
|
m_selectorLabel.setClassAttr("creationLabel");
|
||||||
m_creationPane.add(m_selectorLabel);
|
m_creationPane.add(m_selectorLabel);
|
||||||
|
|
||||||
|
|
@ -215,66 +207,67 @@ public class TasksPanel extends CMSContainer {
|
||||||
// When a new type is selected, show the creation UI.
|
// When a new type is selected, show the creation UI.
|
||||||
// When the selection is cleared, return to section list
|
// When the selection is cleared, return to section list
|
||||||
m_typeSel.addChangeListener(new ChangeListener() {
|
m_typeSel.addChangeListener(new ChangeListener() {
|
||||||
public void stateChanged(ChangeEvent e) {
|
public void stateChanged(ChangeEvent e) {
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
boolean isSelected = m_typeSel.isSelected(s);
|
boolean isSelected = m_typeSel.isSelected(s);
|
||||||
|
|
||||||
m_sections.setVisible(s, !isSelected);
|
m_sections.setVisible(s, !isSelected);
|
||||||
m_creationPane.setVisible(s, isSelected);
|
m_creationPane.setVisible(s, isSelected);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
m_viewLockLink = new ActionLink(new
|
});
|
||||||
Label(GlobalizationUtil
|
|
||||||
.globalize("cms.ui.workflow.task.view_locked")));
|
m_viewLockLink = new ActionLink(new Label(GlobalizationUtil
|
||||||
|
.globalize("cms.ui.workflow.task.view_locked")));
|
||||||
m_viewLockLink.addActionListener(new ActionListener() {
|
m_viewLockLink.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
PageState ps = e.getPageState();
|
PageState ps = e.getPageState();
|
||||||
ps.setValue(m_lockFilterParam, "lock");
|
ps.setValue(m_lockFilterParam, "lock");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
m_viewUnlockLink = new ActionLink(new
|
});
|
||||||
Label(GlobalizationUtil
|
|
||||||
.globalize("cms.ui.workflow.task.view_unlocked")));
|
m_viewUnlockLink = new ActionLink(new Label(GlobalizationUtil
|
||||||
|
.globalize("cms.ui.workflow.task.view_unlocked")));
|
||||||
m_viewUnlockLink.addActionListener(new ActionListener() {
|
m_viewUnlockLink.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
PageState ps = e.getPageState();
|
PageState ps = e.getPageState();
|
||||||
ps.setValue(m_lockFilterParam, "unlock");
|
ps.setValue(m_lockFilterParam, "unlock");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
m_viewAllLockLink = new ActionLink(new
|
});
|
||||||
Label(GlobalizationUtil
|
|
||||||
.globalize("cms.ui.workflow.task.view_all")));
|
m_viewAllLockLink = new ActionLink(new Label(GlobalizationUtil
|
||||||
|
.globalize("cms.ui.workflow.task.view_all")));
|
||||||
m_viewAllLockLink.addActionListener(new ActionListener() {
|
m_viewAllLockLink.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
PageState ps = e.getPageState();
|
PageState ps = e.getPageState();
|
||||||
ps.setValue(m_lockFilterParam, "all");
|
ps.setValue(m_lockFilterParam, "all");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
});
|
||||||
|
|
||||||
m_viewLockLabel = new Label(GlobalizationUtil
|
m_viewLockLabel = new Label(GlobalizationUtil
|
||||||
.globalize("cms.ui.workflow.task.view_locked"));
|
.globalize("cms.ui.workflow.task.view_locked"));
|
||||||
m_viewLockLabel.setFontWeight(Label.BOLD);
|
m_viewLockLabel.setFontWeight(Label.BOLD);
|
||||||
m_viewUnlockLabel = new Label(GlobalizationUtil
|
m_viewUnlockLabel = new Label(GlobalizationUtil
|
||||||
.globalize("cms.ui.workflow.task.view_unlocked"));
|
.globalize("cms.ui.workflow.task.view_unlocked"));
|
||||||
m_viewUnlockLabel.setFontWeight(Label.BOLD);
|
m_viewUnlockLabel.setFontWeight(Label.BOLD);
|
||||||
m_viewAllLockLabel = new Label(GlobalizationUtil
|
m_viewAllLockLabel = new Label(GlobalizationUtil
|
||||||
.globalize("cms.ui.workflow.task.view_all"));
|
.globalize("cms.ui.workflow.task.view_all"));
|
||||||
m_viewAllLockLabel.setFontWeight(Label.BOLD);
|
m_viewAllLockLabel.setFontWeight(Label.BOLD);
|
||||||
|
|
||||||
add(new Label("<br />",false));
|
add(new Label("<br />", false));
|
||||||
add(m_viewLockLink);
|
add(m_viewLockLink);
|
||||||
add(m_viewLockLabel);
|
add(m_viewLockLabel);
|
||||||
add(new Label(" ",false));
|
add(new Label(" ", false));
|
||||||
add(m_viewUnlockLink);
|
add(m_viewUnlockLink);
|
||||||
add(m_viewUnlockLabel);
|
add(m_viewUnlockLabel);
|
||||||
add(new Label(" ",false));
|
add(new Label(" ", false));
|
||||||
add(m_viewAllLockLink);
|
add(m_viewAllLockLink);
|
||||||
add(m_viewAllLockLabel);
|
add(m_viewAllLockLabel);
|
||||||
add(new Label("<br />",false));
|
add(new Label("<br />", false));
|
||||||
add(new Label("<br />",false));
|
add(new Label("<br />", false));
|
||||||
|
|
||||||
add(getTasksList());
|
add(getTasksList());
|
||||||
add(getPaginator());
|
add(getPaginator());
|
||||||
|
|
@ -303,35 +296,36 @@ public class TasksPanel extends CMSContainer {
|
||||||
p.setVisibleDefault(m_viewAllLockLink, false);
|
p.setVisibleDefault(m_viewAllLockLink, false);
|
||||||
|
|
||||||
p.addActionListener(new ActionListener() {
|
p.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
String lockFilterType = getLockFilterType(state);
|
String lockFilterType = getLockFilterType(state);
|
||||||
|
|
||||||
if ( lockFilterType.equals("lock") ) {
|
if (lockFilterType.equals("lock")) {
|
||||||
m_viewLockLabel.setVisible(state,true);
|
m_viewLockLabel.setVisible(state, true);
|
||||||
m_viewLockLink.setVisible(state,false);
|
m_viewLockLink.setVisible(state, false);
|
||||||
m_viewUnlockLabel.setVisible(state,false);
|
m_viewUnlockLabel.setVisible(state, false);
|
||||||
m_viewUnlockLink.setVisible(state,true);
|
m_viewUnlockLink.setVisible(state, true);
|
||||||
m_viewAllLockLabel.setVisible(state,false);
|
m_viewAllLockLabel.setVisible(state, false);
|
||||||
m_viewAllLockLink.setVisible(state,true);
|
m_viewAllLockLink.setVisible(state, true);
|
||||||
} else if ( lockFilterType.equals("unlock") ) {
|
} else if (lockFilterType.equals("unlock")) {
|
||||||
m_viewLockLabel.setVisible(state,false);
|
m_viewLockLabel.setVisible(state, false);
|
||||||
m_viewLockLink.setVisible(state,true);
|
m_viewLockLink.setVisible(state, true);
|
||||||
m_viewUnlockLabel.setVisible(state,true);
|
m_viewUnlockLabel.setVisible(state, true);
|
||||||
m_viewUnlockLink.setVisible(state,false);
|
m_viewUnlockLink.setVisible(state, false);
|
||||||
m_viewAllLockLabel.setVisible(state,false);
|
m_viewAllLockLabel.setVisible(state, false);
|
||||||
m_viewAllLockLink.setVisible(state,true);
|
m_viewAllLockLink.setVisible(state, true);
|
||||||
} else {
|
} else {
|
||||||
m_viewLockLabel.setVisible(state,false);
|
m_viewLockLabel.setVisible(state, false);
|
||||||
m_viewLockLink.setVisible(state,true);
|
m_viewLockLink.setVisible(state, true);
|
||||||
m_viewUnlockLabel.setVisible(state,false);
|
m_viewUnlockLabel.setVisible(state, false);
|
||||||
m_viewUnlockLink.setVisible(state,true);
|
m_viewUnlockLink.setVisible(state, true);
|
||||||
m_viewAllLockLabel.setVisible(state,true);
|
m_viewAllLockLabel.setVisible(state, true);
|
||||||
m_viewAllLockLink.setVisible(state,false);
|
m_viewAllLockLink.setVisible(state, false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset(PageState state) {
|
public void reset(PageState state) {
|
||||||
|
|
@ -347,7 +341,6 @@ public class TasksPanel extends CMSContainer {
|
||||||
return m_paginator;
|
return m_paginator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the bebop List component to display the tasks
|
* Returns the bebop List component to display the tasks
|
||||||
**/
|
**/
|
||||||
|
|
@ -366,24 +359,24 @@ public class TasksPanel extends CMSContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getSortType(PageState state) {
|
protected String getSortType(PageState state) {
|
||||||
String sortType = (String)state.getValue(m_sortTypeParam);
|
String sortType = (String) state.getValue(m_sortTypeParam);
|
||||||
if ( sortType == null ) {
|
if (sortType == null) {
|
||||||
sortType = SORT_DATE;
|
sortType = SORT_DATE;
|
||||||
}
|
}
|
||||||
return sortType;
|
return sortType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getSortDirection(PageState state) {
|
protected String getSortDirection(PageState state) {
|
||||||
String sortDirection = (String)state.getValue(m_sortDirectionParam);
|
String sortDirection = (String) state.getValue(m_sortDirectionParam);
|
||||||
if ( sortDirection == null ) {
|
if (sortDirection == null) {
|
||||||
sortDirection = SORT_UP;
|
sortDirection = SORT_UP;
|
||||||
}
|
}
|
||||||
return sortDirection;
|
return sortDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getLockFilterType(PageState state) {
|
protected String getLockFilterType(PageState state) {
|
||||||
String lockFilterType = (String)state.getValue(m_lockFilterParam);
|
String lockFilterType = (String) state.getValue(m_lockFilterParam);
|
||||||
if ( lockFilterType == null || lockFilterType.equals("") ) {
|
if (lockFilterType == null || lockFilterType.equals("")) {
|
||||||
lockFilterType = "lock";
|
lockFilterType = "lock";
|
||||||
}
|
}
|
||||||
return lockFilterType;
|
return lockFilterType;
|
||||||
|
|
@ -392,47 +385,48 @@ public class TasksPanel extends CMSContainer {
|
||||||
/*
|
/*
|
||||||
* Adds filters to the task query
|
* Adds filters to the task query
|
||||||
*/
|
*/
|
||||||
protected void addQueryFilters(DataQuery query,Party party,PageState state){
|
protected void addQueryFilters(DataQuery query, Party party, PageState state) {
|
||||||
query.setParameter("userId", party.getID());
|
query.setParameter("userId", party.getID());
|
||||||
|
|
||||||
FilterFactory ff = query.getFilterFactory();
|
FilterFactory ff = query.getFilterFactory();
|
||||||
|
|
||||||
// TODO: remove this hard coding of "Author", "Edit", and "Deploy"
|
// TODO: remove this hard coding of "Author", "Edit", and "Deploy"
|
||||||
// TODO: remove this hard coding of "Author", "Edit", and "Deploy"
|
// TODO: remove this hard coding of "Author", "Edit", and "Deploy"
|
||||||
CompoundFilter authorFilter = ff.and();
|
CompoundFilter authorFilter = ff.and();
|
||||||
//cg query changed to refer to task type id
|
//cg query changed to refer to task type id
|
||||||
authorFilter.addFilter(ff.equals("taskType",CMSTaskType.AUTHOR));
|
authorFilter.addFilter(ff.equals("taskType", CMSTaskType.AUTHOR));
|
||||||
authorFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(CMSTaskType.AUTHOR),
|
authorFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(CMSTaskType.AUTHOR),
|
||||||
party, ff));
|
|
||||||
|
|
||||||
CompoundFilter approveFilter = ff.and();
|
|
||||||
approveFilter.addFilter(ff.equals("taskType",CMSTaskType.EDIT));
|
|
||||||
approveFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(CMSTaskType.EDIT),
|
|
||||||
party, ff));
|
party, ff));
|
||||||
|
|
||||||
CompoundFilter deployFilter = ff.and();
|
CompoundFilter approveFilter = ff.and();
|
||||||
deployFilter.addFilter(ff.equals("taskType",CMSTaskType.DEPLOY));
|
approveFilter.addFilter(ff.equals("taskType", CMSTaskType.EDIT));
|
||||||
deployFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(CMSTaskType.DEPLOY),
|
approveFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(CMSTaskType.EDIT),
|
||||||
party, ff));
|
party, ff));
|
||||||
|
|
||||||
CompoundFilter permissionFilter = ff.or();
|
CompoundFilter deployFilter = ff.and();
|
||||||
permissionFilter.addFilter(authorFilter);
|
deployFilter.addFilter(ff.equals("taskType", CMSTaskType.DEPLOY));
|
||||||
permissionFilter.addFilter(approveFilter);
|
deployFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(CMSTaskType.DEPLOY),
|
||||||
permissionFilter.addFilter(deployFilter);
|
party, ff));
|
||||||
|
|
||||||
query.addFilter(permissionFilter);
|
CompoundFilter permissionFilter = ff.or();
|
||||||
|
permissionFilter.addFilter(authorFilter);
|
||||||
|
permissionFilter.addFilter(approveFilter);
|
||||||
|
permissionFilter.addFilter(deployFilter);
|
||||||
|
|
||||||
String lockFilterType = getLockFilterType(state);
|
query.addFilter(permissionFilter);
|
||||||
if ( lockFilterType.equals("lock") ) {
|
|
||||||
query.addEqualsFilter("isLocked","t");
|
String lockFilterType = getLockFilterType(state);
|
||||||
query.addEqualsFilter("status","1");
|
if (lockFilterType.equals("lock")) {
|
||||||
} else if ( lockFilterType.equals("unlock") ) {
|
query.addEqualsFilter("isLocked", "t");
|
||||||
query.addEqualsFilter("isLocked","f");
|
query.addEqualsFilter("status", "1");
|
||||||
} // else show all
|
} else if (lockFilterType.equals("unlock")) {
|
||||||
|
query.addEqualsFilter("isLocked", "f");
|
||||||
|
} // else show all
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RootFolderSelectionModel
|
private static class RootFolderSelectionModel
|
||||||
extends FolderSelectionModel {
|
extends FolderSelectionModel {
|
||||||
|
|
||||||
ACSObjectSelectionModel m_sectionSel;
|
ACSObjectSelectionModel m_sectionSel;
|
||||||
|
|
||||||
public RootFolderSelectionModel(ACSObjectSelectionModel sectionSel) {
|
public RootFolderSelectionModel(ACSObjectSelectionModel sectionSel) {
|
||||||
|
|
@ -445,18 +439,20 @@ public class TasksPanel extends CMSContainer {
|
||||||
ContentSection sec = (ContentSection) m_sectionSel.getSelectedObject(s);
|
ContentSection sec = (ContentSection) m_sectionSel.getSelectedObject(s);
|
||||||
Assert.exists(sec);
|
Assert.exists(sec);
|
||||||
|
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getContext().getUser();
|
||||||
if ( user != null ) {
|
if (user != null) {
|
||||||
Folder folder = Folder.getUserHomeFolder(user,sec);
|
Folder folder = Folder.getUserHomeFolder(user, sec);
|
||||||
if ( folder != null ) {
|
if (folder != null) {
|
||||||
return folder.getID();
|
return folder.getID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sec.getRootFolder().getID();
|
return sec.getRootFolder().getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TasksPaginationModelBuilder implements PaginationModelBuilder {
|
private class TasksPaginationModelBuilder implements PaginationModelBuilder {
|
||||||
|
|
||||||
public int getTotalSize(Paginator paginator,
|
public int getTotalSize(Paginator paginator,
|
||||||
PageState state) {
|
PageState state) {
|
||||||
return numberTasksForUser(state);
|
return numberTasksForUser(state);
|
||||||
|
|
@ -465,13 +461,13 @@ public class TasksPanel extends CMSContainer {
|
||||||
public boolean isVisible(PageState state) {
|
public boolean isVisible(PageState state) {
|
||||||
return numberTasksForUser(state) > m_maxRows;
|
return numberTasksForUser(state) > m_maxRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TaskList extends SimpleComponent {
|
private class TaskList extends SimpleComponent {
|
||||||
|
|
||||||
private final static String QUERY_NAME =
|
private final static String QUERY_NAME =
|
||||||
"com.arsdigita.cms.workflow.getEnabledUserTasks";
|
"com.arsdigita.cms.workflow.getEnabledUserTasks";
|
||||||
|
|
||||||
private boolean m_paginate = false;
|
private boolean m_paginate = false;
|
||||||
|
|
||||||
public TaskList(boolean paginate) {
|
public TaskList(boolean paginate) {
|
||||||
|
|
@ -479,11 +475,11 @@ public class TasksPanel extends CMSContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataQuery makeQuery(PageState state) {
|
private DataQuery makeQuery(PageState state) {
|
||||||
User user = (User)Kernel.getContext().getParty();
|
User user = (User) Kernel.getContext().getParty();
|
||||||
|
|
||||||
DataQuery query = SessionManager.getSession()
|
DataQuery query = SessionManager.getSession()
|
||||||
.retrieveQuery(QUERY_NAME);
|
.retrieveQuery(QUERY_NAME);
|
||||||
addQueryFilters(query,user,state);
|
addQueryFilters(query, user, state);
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
@ -498,6 +494,7 @@ public class TasksPanel extends CMSContainer {
|
||||||
DataQuery query = makeQuery(state);
|
DataQuery query = makeQuery(state);
|
||||||
return new Long(query.size());
|
return new Long(query.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -509,7 +506,7 @@ public class TasksPanel extends CMSContainer {
|
||||||
DataQuery query = makeQuery(state);
|
DataQuery query = makeQuery(state);
|
||||||
|
|
||||||
String lockFilterType = getLockFilterType(state);
|
String lockFilterType = getLockFilterType(state);
|
||||||
content.addAttribute("lockFilterType",lockFilterType);
|
content.addAttribute("lockFilterType", lockFilterType);
|
||||||
|
|
||||||
if (m_paginate) {
|
if (m_paginate) {
|
||||||
query.setRange(new Integer(m_paginator.getFirst(state)),
|
query.setRange(new Integer(m_paginator.getFirst(state)),
|
||||||
|
|
@ -523,43 +520,34 @@ public class TasksPanel extends CMSContainer {
|
||||||
sortPostfix = " desc";
|
sortPostfix = " desc";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sortKey.equals(SORT_TITLE) ) {
|
if (sortKey.equals(SORT_TITLE)) {
|
||||||
query.setOrder("lower(pageTitle) " + sortPostfix +
|
query.setOrder("lower(pageTitle) " + sortPostfix + ", lower(status) asc, dueDate desc");
|
||||||
", lower(status) asc, dueDate desc");
|
} else if (sortKey.equals(SORT_DATE)) {
|
||||||
} else if ( sortKey.equals(SORT_DATE) ) {
|
query.setOrder("dueDate " + sortPostfix + ", lower(status) asc, lower(pageTitle) asc");
|
||||||
query.setOrder("dueDate " + sortPostfix +
|
} else if (sortKey.equals(SORT_USER)) {
|
||||||
", lower(status) asc, lower(pageTitle) asc");
|
query.setOrder("lockingUserID " + sortPostfix + ", lower(status) asc, dueDate desc "
|
||||||
} else if ( sortKey.equals(SORT_USER) ) {
|
+ ", lower(pageTitle) asc");
|
||||||
query.setOrder("lockingUserID " + sortPostfix +
|
} else if (sortKey.equals(SORT_STATUS)) {
|
||||||
", lower(status) asc, dueDate desc " +
|
query.setOrder("lower(status) " + sortPostfix + ", dueDate desc " + ", lower(pageTitle) asc");
|
||||||
", lower(pageTitle) asc");
|
|
||||||
} else if ( sortKey.equals(SORT_STATUS) ) {
|
|
||||||
query.setOrder("lower(status) " + sortPostfix +
|
|
||||||
", dueDate desc " +
|
|
||||||
", lower(pageTitle) asc");
|
|
||||||
|
|
||||||
} else if ( sortKey.equals(SORT_ACTION) ) {
|
} else if (sortKey.equals(SORT_ACTION)) {
|
||||||
query.setOrder("taskType " + sortPostfix +
|
query.setOrder("taskType " + sortPostfix + ", lower(status) asc, dueDate desc "
|
||||||
", lower(status) asc, dueDate desc " +
|
+ ", lower(pageTitle) asc");
|
||||||
", lower(pageTitle) asc"
|
} else if (sortKey.equals(SORT_WORKFLOW)) {
|
||||||
);
|
query.setOrder("processLabel " + sortPostfix + ", lower(status) asc, dueDate desc "
|
||||||
} else if ( sortKey.equals(SORT_WORKFLOW) ) {
|
+ ", lower(pageTitle) asc");
|
||||||
query.setOrder("processLabel " + sortPostfix +
|
|
||||||
", lower(status) asc, dueDate desc " +
|
|
||||||
", lower(pageTitle) asc"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap sections = new HashMap();
|
HashMap sections = new HashMap();
|
||||||
|
|
||||||
while (query.next()) {
|
while (query.next()) {
|
||||||
BigDecimal sectionID = (BigDecimal)query.get("sectionID");
|
BigDecimal sectionID = (BigDecimal) query.get("sectionID");
|
||||||
String sectionPath = (String)sections.get(sectionID);
|
String sectionPath = (String) sections.get(sectionID);
|
||||||
if (sectionPath == null) {
|
if (sectionPath == null) {
|
||||||
try {
|
try {
|
||||||
ContentSection section = (ContentSection)DomainObjectFactory
|
ContentSection section = (ContentSection) DomainObjectFactory
|
||||||
.newInstance(new OID(ContentSection.BASE_DATA_OBJECT_TYPE,
|
.newInstance(new OID(ContentSection.BASE_DATA_OBJECT_TYPE,
|
||||||
sectionID));
|
sectionID));
|
||||||
sectionPath = section.getPath();
|
sectionPath = section.getPath();
|
||||||
} catch (DataObjectNotFoundException ex) {
|
} catch (DataObjectNotFoundException ex) {
|
||||||
throw new UncheckedWrapperException("cannot find content section", ex);
|
throw new UncheckedWrapperException("cannot find content section", ex);
|
||||||
|
|
@ -570,19 +558,19 @@ public class TasksPanel extends CMSContainer {
|
||||||
Element task = content.newChildElement("cms:tasksPanelTask",
|
Element task = content.newChildElement("cms:tasksPanelTask",
|
||||||
CMS.CMS_XML_NS);
|
CMS.CMS_XML_NS);
|
||||||
|
|
||||||
BigDecimal itemID = (BigDecimal)query.get("itemID");
|
BigDecimal itemID = (BigDecimal) query.get("itemID");
|
||||||
String taskType = (String)query.get("taskType");
|
String taskType = (String) query.get("taskType");
|
||||||
|
|
||||||
task.addAttribute("taskID", query.get("taskID").toString());
|
task.addAttribute("taskID", query.get("taskID").toString());
|
||||||
task.addAttribute("processID", query.get("processID").toString());
|
task.addAttribute("processID", query.get("processID").toString());
|
||||||
task.addAttribute("taskLabel", (String)query.get("taskLabel"));
|
task.addAttribute("taskLabel", (String) query.get("taskLabel"));
|
||||||
task.addAttribute("taskDescription", (String)query.get("taskDescription"));
|
task.addAttribute("taskDescription", (String) query.get("taskDescription"));
|
||||||
task.addAttribute("processLabel", (String)query.get("processLabel"));
|
task.addAttribute("processLabel", (String) query.get("processLabel"));
|
||||||
|
|
||||||
String isLocked = (String)query.get("isLocked");
|
String isLocked = (String) query.get("isLocked");
|
||||||
task.addAttribute("isLocked", isLocked);
|
task.addAttribute("isLocked", isLocked);
|
||||||
if (query.get("dueDate") != null) {
|
if (query.get("dueDate") != null) {
|
||||||
java.util.Date d = (java.util.Date)query.get("dueDate");
|
java.util.Date d = (java.util.Date) query.get("dueDate");
|
||||||
SimpleDateFormat df = new SimpleDateFormat("EEE, MMM d, yyyy");
|
SimpleDateFormat df = new SimpleDateFormat("EEE, MMM d, yyyy");
|
||||||
|
|
||||||
task.addAttribute("dueDate", df.format(d));
|
task.addAttribute("dueDate", df.format(d));
|
||||||
|
|
@ -591,21 +579,21 @@ public class TasksPanel extends CMSContainer {
|
||||||
task.addAttribute("itemID", itemID.toString());
|
task.addAttribute("itemID", itemID.toString());
|
||||||
task.addAttribute("sectionID", query.get("sectionID").toString());
|
task.addAttribute("sectionID", query.get("sectionID").toString());
|
||||||
task.addAttribute("sectionPath", sectionPath);
|
task.addAttribute("sectionPath", sectionPath);
|
||||||
task.addAttribute("pageName", (String)query.get("pageName"));
|
task.addAttribute("pageName", (String) query.get("pageName"));
|
||||||
task.addAttribute("pageTitle", (String)query.get("pageTitle"));
|
task.addAttribute("pageTitle", (String) query.get("pageTitle"));
|
||||||
|
|
||||||
BigDecimal lockingUserID = (BigDecimal)query.get("lockingUserID");
|
BigDecimal lockingUserID = (BigDecimal) query.get("lockingUserID");
|
||||||
if (lockingUserID != null) {
|
if (lockingUserID != null) {
|
||||||
task.addAttribute("lockingUserID", lockingUserID.toString());
|
task.addAttribute("lockingUserID", lockingUserID.toString());
|
||||||
if ( !"f".equals(isLocked) ) {
|
if (!"f".equals(isLocked)) {
|
||||||
User lockingUser = User.retrieve(lockingUserID);
|
User lockingUser = User.retrieve(lockingUserID);
|
||||||
if ( lockingUser != null ) {
|
if (lockingUser != null) {
|
||||||
task.addAttribute("assignee",lockingUser.getDisplayName());
|
task.addAttribute("assignee", lockingUser.getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
task.addAttribute("taskType", taskType);
|
task.addAttribute("taskType", taskType);
|
||||||
task.addAttribute("taskTypeClass", (String)query.get("taskTypeClass"));
|
task.addAttribute("taskTypeClass", (String) query.get("taskTypeClass"));
|
||||||
task.addAttribute("status", query.get("status").toString());
|
task.addAttribute("status", query.get("status").toString());
|
||||||
|
|
||||||
// control event for locking a task
|
// control event for locking a task
|
||||||
|
|
@ -628,14 +616,13 @@ public class TasksPanel extends CMSContainer {
|
||||||
|
|
||||||
// m_actionLabel.generateXML(state, content);
|
// m_actionLabel.generateXML(state, content);
|
||||||
|
|
||||||
String[][] sortableHeaders =
|
String[][] sortableHeaders = {{SORT_TITLE, "cms.ui.workflow.task.item_title"},
|
||||||
{{SORT_TITLE, "cms.ui.workflow.task.item_title"},
|
{SORT_ACTION, "cms.ui.action"},
|
||||||
{SORT_ACTION, "cms.ui.action"},
|
{SORT_DATE, "cms.ui.tasks_due_date"},
|
||||||
{SORT_DATE, "cms.ui.tasks_due_date"},
|
{SORT_STATUS, "cms.ui.tasks_status_no_colon"},
|
||||||
{SORT_STATUS, "cms.ui.tasks_status_no_colon"},
|
{SORT_USER, "cms.ui.workflow.task.locking_user"},
|
||||||
{SORT_USER, "cms.ui.workflow.task.locking_user"},
|
{SORT_WORKFLOW, "cms.ui.workflow"}};
|
||||||
{SORT_WORKFLOW, "cms.ui.workflow"}};
|
for (int i = 0; i < sortableHeaders.length; i++) {
|
||||||
for (int i=0;i<sortableHeaders.length;i++) {
|
|
||||||
String header = sortableHeaders[i][0];
|
String header = sortableHeaders[i][0];
|
||||||
String labelKey = sortableHeaders[i][1];
|
String labelKey = sortableHeaders[i][1];
|
||||||
if (sortDirection.equals(SORT_UP) && header.equals(sortKey)) {
|
if (sortDirection.equals(SORT_UP) && header.equals(sortKey)) {
|
||||||
|
|
@ -644,7 +631,7 @@ public class TasksPanel extends CMSContainer {
|
||||||
state.setControlEvent(this, SORT_UP, header);
|
state.setControlEvent(this, SORT_UP, header);
|
||||||
}
|
}
|
||||||
SimpleContainer container = new SimpleContainer();
|
SimpleContainer container = new SimpleContainer();
|
||||||
container.add(new Label(GlobalizationUtil.globalize(labelKey)));
|
container.add(new Label((String)GlobalizationUtil.globalize(labelKey).localize()));
|
||||||
if (header.equals(sortKey)) {
|
if (header.equals(sortKey)) {
|
||||||
String imageURLStub = null;
|
String imageURLStub = null;
|
||||||
if (SORT_UP.equals(sortDirection)) {
|
if (SORT_UP.equals(sortDirection)) {
|
||||||
|
|
@ -664,7 +651,6 @@ public class TasksPanel extends CMSContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void respond(PageState state) throws ServletException {
|
public void respond(PageState state) throws ServletException {
|
||||||
String key = state.getControlEventName();
|
String key = state.getControlEventName();
|
||||||
|
|
@ -678,7 +664,7 @@ public class TasksPanel extends CMSContainer {
|
||||||
int tabNumber = ContentItemPage.AUTHORING_TAB;
|
int tabNumber = ContentItemPage.AUTHORING_TAB;
|
||||||
String sectionPath = item.getContentSection().getPath();
|
String sectionPath = item.getContentSection().getPath();
|
||||||
|
|
||||||
if ( wf != null ) {
|
if (wf != null) {
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getContext().getUser();
|
||||||
Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE);
|
Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE);
|
||||||
Iterator i = engine.getEnabledTasks(user, wf.getID()).iterator();
|
Iterator i = engine.getEnabledTasks(user, wf.getID()).iterator();
|
||||||
|
|
@ -686,11 +672,11 @@ public class TasksPanel extends CMSContainer {
|
||||||
CMSTask task = (CMSTask) i.next();
|
CMSTask task = (CMSTask) i.next();
|
||||||
Integer taskType = task.getTaskType().getID();
|
Integer taskType = task.getTaskType().getID();
|
||||||
|
|
||||||
if (taskType.equals(CMSTaskType.DEPLOY) ) {
|
if (taskType.equals(CMSTaskType.DEPLOY)) {
|
||||||
tabNumber = ContentItemPage.PUBLISHING_TAB;
|
tabNumber = ContentItemPage.PUBLISHING_TAB;
|
||||||
} else {
|
} else {
|
||||||
// see if item is locked; if not, lock
|
// see if item is locked; if not, lock
|
||||||
if ( !task.isLocked() ) {
|
if (!task.isLocked()) {
|
||||||
task.lock(user);
|
task.lock(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -700,11 +686,11 @@ public class TasksPanel extends CMSContainer {
|
||||||
String redirectURL = Web.getConfig().getDispatcherServletPath()
|
String redirectURL = Web.getConfig().getDispatcherServletPath()
|
||||||
+ sectionPath + "/admin/item.jsp?item_id="
|
+ sectionPath + "/admin/item.jsp?item_id="
|
||||||
+ itemID + "&set_tab=" + tabNumber;
|
+ itemID + "&set_tab=" + tabNumber;
|
||||||
throw new RedirectSignal(redirectURL,true);
|
throw new RedirectSignal(redirectURL, true);
|
||||||
} catch (DataObjectNotFoundException ex) {
|
} catch (DataObjectNotFoundException ex) {
|
||||||
throw new ServletException("Unknown content ID" + itemID);
|
throw new ServletException("Unknown content ID" + itemID);
|
||||||
}
|
}
|
||||||
} else if ( SORT_UP.equals(key) || SORT_DOWN.equals(key)) {
|
} else if (SORT_UP.equals(key) || SORT_DOWN.equals(key)) {
|
||||||
state.setValue(m_sortTypeParam, value);
|
state.setValue(m_sortTypeParam, value);
|
||||||
if (SORT_DOWN.equals(key)) {
|
if (SORT_DOWN.equals(key)) {
|
||||||
state.setValue(m_sortDirectionParam, SORT_DOWN);
|
state.setValue(m_sortDirectionParam, SORT_DOWN);
|
||||||
|
|
@ -715,17 +701,17 @@ public class TasksPanel extends CMSContainer {
|
||||||
throw new ServletException("Unknown control event: " + key);
|
throw new ServletException("Unknown control event: " + key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Filter getTaskFilter(CMSTaskType taskType
|
private static Filter getTaskFilter(CMSTaskType taskType, Party party, FilterFactory factory) {
|
||||||
, Party party, FilterFactory factory) {
|
|
||||||
PrivilegeDescriptor privilege;
|
PrivilegeDescriptor privilege;
|
||||||
String queryName;
|
String queryName;
|
||||||
String queryType;
|
String queryType;
|
||||||
OID partyOID = party.getOID();
|
OID partyOID = party.getOID();
|
||||||
privilege = taskType.getPrivilege();
|
privilege = taskType.getPrivilege();
|
||||||
|
|
||||||
return PermissionService.getFilterQuery(factory,"itemID",privilege,partyOID);
|
return PermissionService.getFilterQuery(factory, "itemID", privilege, partyOID);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,10 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
public class GlobalizationUtil {
|
public class GlobalizationUtil {
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
|
// public static String s_bundleName =
|
||||||
|
// "com.arsdigita.cms.util.CMSResourceBundle";
|
||||||
public static String s_bundleName =
|
public static String s_bundleName =
|
||||||
"com.arsdigita.cms.util.CMSResourceBundle";
|
"com.arsdigita.cms.CMSResources";
|
||||||
|
|
||||||
public static GlobalizedMessage globalize(String key) {
|
public static GlobalizedMessage globalize(String key) {
|
||||||
return new GlobalizedMessage(key, getBundleName());
|
return new GlobalizedMessage(key, getBundleName());
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,7 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class GlobalizedMessage {
|
public class GlobalizedMessage {
|
||||||
|
|
||||||
private static final Logger s_cat =
|
private static final Logger LOGGER = Logger.getLogger(GlobalizedMessage.class.getName());
|
||||||
Logger.getLogger(GlobalizedMessage.class.getName());
|
|
||||||
private String m_key = "";
|
private String m_key = "";
|
||||||
private String m_bundleName = "";
|
private String m_bundleName = "";
|
||||||
private Object[] m_args = null;
|
private Object[] m_args = null;
|
||||||
|
|
@ -60,7 +59,7 @@ public class GlobalizedMessage {
|
||||||
*
|
*
|
||||||
* @param key The key to use to look up a message in the ResourceBundle.
|
* @param key The key to use to look up a message in the ResourceBundle.
|
||||||
*/
|
*/
|
||||||
public GlobalizedMessage(String key) {
|
public GlobalizedMessage(final String key) {
|
||||||
setKey(key);
|
setKey(key);
|
||||||
setBundleName();
|
setBundleName();
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +73,7 @@ public class GlobalizedMessage {
|
||||||
* @param key The key to use to look up a message in the ResourceBundle.
|
* @param key The key to use to look up a message in the ResourceBundle.
|
||||||
* @param bundleName The base name of the target ResourceBundle.
|
* @param bundleName The base name of the target ResourceBundle.
|
||||||
*/
|
*/
|
||||||
public GlobalizedMessage(String key, String bundleName) {
|
public GlobalizedMessage(final String key, final String bundleName) {
|
||||||
setKey(key);
|
setKey(key);
|
||||||
setBundleName(bundleName);
|
setBundleName(bundleName);
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +91,7 @@ public class GlobalizedMessage {
|
||||||
* @param args An Object[] of arguments to interpolate into the retrieved
|
* @param args An Object[] of arguments to interpolate into the retrieved
|
||||||
* message.
|
* message.
|
||||||
*/
|
*/
|
||||||
public GlobalizedMessage(String key, Object[] args) {
|
public GlobalizedMessage(final String key, final Object[] args) {
|
||||||
this(key);
|
this(key);
|
||||||
setArgs(args);
|
setArgs(args);
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +108,7 @@ public class GlobalizedMessage {
|
||||||
* @param args An Object[] of arguments to interpolate into the retrieved
|
* @param args An Object[] of arguments to interpolate into the retrieved
|
||||||
* message.
|
* message.
|
||||||
*/
|
*/
|
||||||
public GlobalizedMessage(String key, String bundleName, Object[] args) {
|
public GlobalizedMessage(final String key, final String bundleName, final Object[] args) {
|
||||||
this(key, bundleName);
|
this(key, bundleName);
|
||||||
setArgs(args);
|
setArgs(args);
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +128,7 @@ public class GlobalizedMessage {
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
*/
|
*/
|
||||||
private void setKey(String key) {
|
private void setKey(final String key) {
|
||||||
if (key == null || key.length() == 0) {
|
if (key == null || key.length() == 0) {
|
||||||
throw new IllegalArgumentException("key cannot be empty.");
|
throw new IllegalArgumentException("key cannot be empty.");
|
||||||
}
|
}
|
||||||
|
|
@ -146,7 +145,7 @@ public class GlobalizedMessage {
|
||||||
setBundleName("com.arsdigita.dummy.DummyResources");
|
setBundleName("com.arsdigita.dummy.DummyResources");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBundleName(String bundleName) {
|
private void setBundleName(final String bundleName) {
|
||||||
if (bundleName == null || bundleName.length() == 0) {
|
if (bundleName == null || bundleName.length() == 0) {
|
||||||
throw new IllegalArgumentException("bundleName cannot be empty.");
|
throw new IllegalArgumentException("bundleName cannot be empty.");
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +153,7 @@ public class GlobalizedMessage {
|
||||||
m_bundleName = bundleName;
|
m_bundleName = bundleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setArgs(Object[] args) {
|
private void setArgs(final Object[] args) {
|
||||||
m_args = args;
|
m_args = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,7 +191,7 @@ public class GlobalizedMessage {
|
||||||
* java.text.MessageFormat class.
|
* java.text.MessageFormat class.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param req The current running request.
|
* @param request The current running request.
|
||||||
*
|
*
|
||||||
* @return Object Represents the localized version of this
|
* @return Object Represents the localized version of this
|
||||||
* message. The reason this method returns an Object and
|
* message. The reason this method returns an Object and
|
||||||
|
|
@ -201,7 +200,7 @@ public class GlobalizedMessage {
|
||||||
* bites. Maybe this class should have been called
|
* bites. Maybe this class should have been called
|
||||||
* GlobalizedObject?
|
* GlobalizedObject?
|
||||||
*/
|
*/
|
||||||
public Object localize(HttpServletRequest request) {
|
public Object localize(final HttpServletRequest request) {
|
||||||
return localize(com.arsdigita.globalization.GlobalizationHelper.getNegotiatedLocale());
|
return localize(com.arsdigita.globalization.GlobalizationHelper.getNegotiatedLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,34 +225,54 @@ public class GlobalizedMessage {
|
||||||
* bites. Maybe this class should have been called
|
* bites. Maybe this class should have been called
|
||||||
* GlobalizedObject?
|
* GlobalizedObject?
|
||||||
*/
|
*/
|
||||||
public Object localize(Locale locale) {
|
public Object localize(final Locale locale) {
|
||||||
Object message = getKey();
|
Object message = getKey();
|
||||||
ResourceBundle rb = null;
|
ResourceBundle resourceBundle = null;
|
||||||
|
|
||||||
if (locale == null) {
|
if (locale == null) {
|
||||||
throw new IllegalArgumentException("locale cannot be null.");
|
throw new IllegalArgumentException("locale cannot be null.");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rb = ResourceBundle.getBundle(getBundleName(), locale);
|
// jensp 2013-03-16:
|
||||||
|
// Previously, ResourceBundle#getBundle(String, Locale) was called here. That was causing problems under
|
||||||
|
// specific circumstances:
|
||||||
|
// - The browser of the user is set the english (britain), languge code en_GB
|
||||||
|
// - The system language of the server running CCM is set to german (de_DE).
|
||||||
|
// In this case, the ResourceBundle.getBundle method first tries to find a ResourceBundle for en_GB, than
|
||||||
|
// for en. Usally, both attempts will fail because the english labels are in the default bundle
|
||||||
|
// (no language code). The standard search algorithm of ResourceBundle#getBundle than falls back to the
|
||||||
|
// system language (the language of the SERVER), which is German is this case. Therefore the content center
|
||||||
|
// was shown with german texts...
|
||||||
|
// Luckily, there is a simple solution: The search algorithm is implemented in the inner class
|
||||||
|
// ResourceBundle.Control. There are also variants of the getBundle method which allow it to pass an
|
||||||
|
// custom implementation of ResouceBundle.Control. Also ResourceBundle.Control has a factory method which
|
||||||
|
// offers an implementation of ResourceBundle.Control which does not use the system language.
|
||||||
|
// Therefore, all what was to do was to change the call of getBundle here from
|
||||||
|
// ResourceBundle#getBundle(String, Locale) to ResourceBundle#getBundle(String, Locale, ResourceControl)
|
||||||
|
// with ResourceBundle.Control.getNoFallbackControl(List<String>).
|
||||||
|
resourceBundle = ResourceBundle.getBundle(
|
||||||
|
getBundleName(),
|
||||||
|
locale,
|
||||||
|
ResourceBundle.Control.getNoFallbackControl(ResourceBundle.Control.FORMAT_PROPERTIES));
|
||||||
} catch (MissingResourceException e) {
|
} catch (MissingResourceException e) {
|
||||||
if (s_cat.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
s_cat.debug(
|
LOGGER.debug(
|
||||||
"ResourceBundle " + getBundleName() + " was not found.");
|
"ResourceBundle " + getBundleName() + " was not found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (rb != null) {
|
if (resourceBundle == null) {
|
||||||
message = rb.getObject(getKey());
|
if (LOGGER.isDebugEnabled()) {
|
||||||
} else {
|
LOGGER.debug("No ResourceBundle available");
|
||||||
if (s_cat.isDebugEnabled()) {
|
|
||||||
s_cat.debug("No ResourceBundle available");
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
message = resourceBundle.getObject(getKey());
|
||||||
}
|
}
|
||||||
} catch (MissingResourceException e2) {
|
} catch (MissingResourceException e2) {
|
||||||
if (s_cat.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
s_cat.debug(getKey() + " was not found in the ResourceBundle.");
|
LOGGER.debug(getKey() + " was not found in the ResourceBundle.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,7 +301,9 @@ public class GlobalizedMessage {
|
||||||
*
|
*
|
||||||
* @return The contents in String form for debugging.
|
* @return The contents in String form for debugging.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getBundleName() + "#" + getKey();
|
return getBundleName() + "#" + getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue