- ItemSearchWidget aktueller Stand
- Testweise Integration der neuen Features in PublicationAuthorAddForm git-svn-id: https://svn.libreccm.org/ccm/trunk@1769 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
fc69327e92
commit
2e137a3c94
|
|
@ -29,5 +29,4 @@ package com.arsdigita.cms;
|
||||||
public interface PageLocations {
|
public interface PageLocations {
|
||||||
public String SECTION_PAGE = "admin/index.jsp";
|
public String SECTION_PAGE = "admin/index.jsp";
|
||||||
public String ITEM_PAGE = "admin/item.jsp";
|
public String ITEM_PAGE = "admin/item.jsp";
|
||||||
public String ITEM_SEARCH_ITEM_PAGE = "admin/itemsearchitem.jsp";
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListen
|
||||||
|
|
||||||
public static final String WIDGET_PARAM = "widget";
|
public static final String WIDGET_PARAM = "widget";
|
||||||
public static final String SEARCHWIDGET_PARAM = "searchWidget";
|
public static final String SEARCHWIDGET_PARAM = "searchWidget";
|
||||||
|
public static final String PUBLISHWIDGET_PARAM = "publishWidget";
|
||||||
private static final String CONTENT_TYPE_ID = "ct";
|
private static final String CONTENT_TYPE_ID = "ct";
|
||||||
private static final String FOLDER_ID = "folder_id";
|
private static final String FOLDER_ID = "folder_id";
|
||||||
private final NewItemForm m_newItem;
|
private final NewItemForm m_newItem;
|
||||||
|
|
@ -156,15 +157,19 @@ class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListen
|
||||||
|
|
||||||
final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
|
final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
|
||||||
final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
|
final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
|
||||||
|
final String publishWidget = (String) state.getValue(new StringParameter(PUBLISHWIDGET_PARAM));
|
||||||
|
|
||||||
target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
|
target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
|
||||||
|
+ "window.opener.document.%s.value=\"%s\";"
|
||||||
+ "window.opener.document.%s.value=\"%s\";"
|
+ "window.opener.document.%s.value=\"%s\";"
|
||||||
+ "self.close();"
|
+ "self.close();"
|
||||||
+ "return false;",
|
+ "return false;",
|
||||||
widget,
|
widget,
|
||||||
item.getID().toString(),
|
item.getID().toString(),
|
||||||
searchWidget,
|
searchWidget,
|
||||||
title));
|
title,
|
||||||
|
publishWidget,
|
||||||
|
Boolean.TRUE.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -187,6 +192,7 @@ class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListen
|
||||||
|
|
||||||
final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
|
final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
|
||||||
final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
|
final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
|
||||||
|
final String publishWidget = (String) state.getValue(new StringParameter(PUBLISHWIDGET_PARAM));
|
||||||
|
|
||||||
final ContentSection section = item.getContentSection();
|
final ContentSection section = item.getContentSection();
|
||||||
final String nodeURL = section.getPath() + "/";
|
final String nodeURL = section.getPath() + "/";
|
||||||
|
|
@ -194,11 +200,14 @@ class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListen
|
||||||
ContentItemPage.AUTHORING_TAB, true);
|
ContentItemPage.AUTHORING_TAB, true);
|
||||||
target.setTarget(linkTarget);
|
target.setTarget(linkTarget);
|
||||||
target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
|
target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
|
||||||
|
+ "window.opener.document.%s.value=\"%s\";"
|
||||||
+ "window.opener.document.%s.value=\"%s\";",
|
+ "window.opener.document.%s.value=\"%s\";",
|
||||||
widget,
|
widget,
|
||||||
item.getID().toString(),
|
item.getID().toString(),
|
||||||
searchWidget,
|
searchWidget,
|
||||||
title));
|
title,
|
||||||
|
publishWidget,
|
||||||
|
Boolean.TRUE.toString()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ public class ItemSearchPage extends CMSPage {
|
||||||
addGlobalStateParam(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
|
addGlobalStateParam(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
|
||||||
addGlobalStateParam(new StringParameter(ItemSearchPopup.WIDGET_PARAM));
|
addGlobalStateParam(new StringParameter(ItemSearchPopup.WIDGET_PARAM));
|
||||||
addGlobalStateParam(new StringParameter("searchWidget"));
|
addGlobalStateParam(new StringParameter("searchWidget"));
|
||||||
|
addGlobalStateParam(new StringParameter("publishWidget"));
|
||||||
|
|
||||||
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
||||||
addGlobalStateParam(m_sectionId);
|
addGlobalStateParam(m_sectionId);
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ public class ItemSearchWidget extends FormSection
|
||||||
if (typeURLFrag != null) {
|
if (typeURLFrag != null) {
|
||||||
params.setParameter("single_type", typeURLFrag);
|
params.setParameter("single_type", typeURLFrag);
|
||||||
}
|
}
|
||||||
|
params.setParameter("publishWidget", formName + ".elements['" + m_publish.getName() + "']");
|
||||||
|
|
||||||
String searchURL = WorkspaceServlet.getURLStubForClass(
|
String searchURL = WorkspaceServlet.getURLStubForClass(
|
||||||
ItemSearchPage.class.getName());
|
ItemSearchPage.class.getName());
|
||||||
|
|
@ -286,10 +286,18 @@ public class ItemSearchWidget extends FormSection
|
||||||
//+ m_item.getName().replace('.', '_')
|
//+ m_item.getName().replace('.', '_')
|
||||||
+ m_selected.getName().replace('.', '_')
|
+ m_selected.getName().replace('.', '_')
|
||||||
+ "Popup(theForm) { \n"
|
+ "Popup(theForm) { \n"
|
||||||
|
+ "var width = screen.width * 0.5;\n"
|
||||||
|
+ "var height = screen.height * 0.5;\n"
|
||||||
|
+ "if ((width < 800) && (screen.width >= 800)) {\n"
|
||||||
|
+ "width = 800;\n"
|
||||||
|
+ "}\n"
|
||||||
|
+ "if ((height < 600) && (screen.height >= 600)) {\n"
|
||||||
|
+ "height = 600;\n"
|
||||||
|
+ "}\n"
|
||||||
+ " aWindow = window.open(\"" + url + "&query=\" + document.getElementById('" + m_item.
|
+ " aWindow = window.open(\"" + url + "&query=\" + document.getElementById('" + m_item.
|
||||||
getName() + "').value , "
|
getName() + "').value , "
|
||||||
//+ "\"search\", \"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes\");\n"
|
//+ "\"search\", \"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes\");\n"
|
||||||
+ "\"search\", \"toolbar=yes,width=\" + screen.width*0.5 + \",height=\" + screen.height*0.5 + \",status=no,scrollbars=yes,resize=yes\");\n "
|
+ "\"search\", \"toolbar=no,width=\" + width + \",height=\" + height + \",status=no,scrollbars=yes,resize=yes\");\n "
|
||||||
+ "return false;\n"
|
+ "return false;\n"
|
||||||
+ " } \n"
|
+ " } \n"
|
||||||
+ " --> \n"
|
+ " --> \n"
|
||||||
|
|
@ -373,7 +381,7 @@ public class ItemSearchWidget extends FormSection
|
||||||
m_topHR.setVisible(s, false);
|
m_topHR.setVisible(s, false);
|
||||||
m_bottomHR.setVisible(s, false);
|
m_bottomHR.setVisible(s, false);
|
||||||
m_search.setVisible(s, true);
|
m_search.setVisible(s, true);
|
||||||
e.getFormData().put(PUBLISH, Boolean.TRUE.toString());
|
e.getFormData().put(PUBLISH, Boolean.FALSE.toString());
|
||||||
} catch (IllegalStateException ex) {
|
} catch (IllegalStateException ex) {
|
||||||
// component is in metaform. nothing to do here. Custom generateXML must hide for us
|
// component is in metaform. nothing to do here. Custom generateXML must hide for us
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,21 @@ import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||||
import com.arsdigita.bebop.form.CheckboxGroup;
|
import com.arsdigita.bebop.form.CheckboxGroup;
|
||||||
import com.arsdigita.bebop.form.Option;
|
import com.arsdigita.bebop.form.Option;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.cms.ContentTypeLifecycleDefinition;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.AuthorshipCollection;
|
import com.arsdigita.cms.contenttypes.AuthorshipCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.lifecycle.Lifecycle;
|
||||||
|
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.workflow.simple.TaskException;
|
||||||
|
import com.arsdigita.workflow.simple.Workflow;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -75,8 +82,7 @@ public class PublicationAuthorAddForm
|
||||||
"publications.ui.authors.selectAuthor").localize()));
|
"publications.ui.authors.selectAuthor").localize()));
|
||||||
m_itemSearch = new ItemSearchWidget(
|
m_itemSearch = new ItemSearchWidget(
|
||||||
ITEM_SEARCH,
|
ITEM_SEARCH,
|
||||||
ContentType.findByAssociatedObjectType(GenericPerson.class.
|
ContentType.findByAssociatedObjectType(GenericPerson.class.getName()));
|
||||||
getName()));
|
|
||||||
add(m_itemSearch);
|
add(m_itemSearch);
|
||||||
|
|
||||||
selectedAuthorLabel = new Label("");
|
selectedAuthorLabel = new Label("");
|
||||||
|
|
@ -98,8 +104,7 @@ public class PublicationAuthorAddForm
|
||||||
Boolean editor;
|
Boolean editor;
|
||||||
|
|
||||||
author = ((PublicationAuthorsPropertyStep) editStep).getSelectedAuthor();
|
author = ((PublicationAuthorsPropertyStep) editStep).getSelectedAuthor();
|
||||||
editor = ((PublicationAuthorsPropertyStep) editStep).
|
editor = ((PublicationAuthorsPropertyStep) editStep).isSelectedAuthorEditor();
|
||||||
isSelectedAuthorEditor();
|
|
||||||
|
|
||||||
if (author == null) {
|
if (author == null) {
|
||||||
s_log.warn("No author selected.");
|
s_log.warn("No author selected.");
|
||||||
|
|
@ -134,8 +139,7 @@ public class PublicationAuthorAddForm
|
||||||
|
|
||||||
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
GenericPerson author;
|
GenericPerson author;
|
||||||
author = ((PublicationAuthorsPropertyStep) editStep).
|
author = ((PublicationAuthorsPropertyStep) editStep).getSelectedAuthor();
|
||||||
getSelectedAuthor();
|
|
||||||
|
|
||||||
Boolean editor;
|
Boolean editor;
|
||||||
|
|
||||||
|
|
@ -152,6 +156,25 @@ public class PublicationAuthorAddForm
|
||||||
getInstance(publication.getLanguage());
|
getInstance(publication.getLanguage());
|
||||||
|
|
||||||
publication.addAuthor(authorToAdd, editor);
|
publication.addAuthor(authorToAdd, editor);
|
||||||
|
|
||||||
|
final String publishStr = data.getString(ItemSearchWidget.PUBLISH);
|
||||||
|
final Boolean publish = Boolean.valueOf(publishStr);
|
||||||
|
if (publish) {
|
||||||
|
final LifecycleDefinition lifecycleDef = ContentTypeLifecycleDefinition.getLifecycleDefinition(
|
||||||
|
authorToAdd.getContentSection(), authorToAdd.getContentType());
|
||||||
|
|
||||||
|
if (lifecycleDef == null) {
|
||||||
|
s_log.warn(String.format("Cannot publish item %s because it has no default lifecycle",
|
||||||
|
authorToAdd.getOID().toString()));
|
||||||
|
} else {
|
||||||
|
authorToAdd.publish(lifecycleDef, new Date());
|
||||||
|
authorToAdd.getLifecycle().start();
|
||||||
|
final Workflow workflow = Workflow.getObjectWorkflow(authorToAdd);
|
||||||
|
if (workflow != null) {
|
||||||
|
workflow.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
AuthorshipCollection authors;
|
AuthorshipCollection authors;
|
||||||
|
|
||||||
|
|
@ -167,8 +190,7 @@ public class PublicationAuthorAddForm
|
||||||
|
|
||||||
((PublicationAuthorsPropertyStep) editStep).setSelectedAuthor(
|
((PublicationAuthorsPropertyStep) editStep).setSelectedAuthor(
|
||||||
null);
|
null);
|
||||||
((PublicationAuthorsPropertyStep) editStep).
|
((PublicationAuthorsPropertyStep) editStep).setSelectedAuthorEditor(null);
|
||||||
setSelectedAuthorEditor(null);
|
|
||||||
|
|
||||||
authors.close();
|
authors.close();
|
||||||
}
|
}
|
||||||
|
|
@ -208,8 +230,7 @@ public class PublicationAuthorAddForm
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
GenericPerson author = (GenericPerson) data.get(ITEM_SEARCH);
|
GenericPerson author = (GenericPerson) data.get(ITEM_SEARCH);
|
||||||
if (author == null) {
|
if (author == null) {
|
||||||
author = ((PublicationAuthorsPropertyStep) editStep).
|
author = ((PublicationAuthorsPropertyStep) editStep).getSelectedAuthor();
|
||||||
getSelectedAuthor();
|
|
||||||
editing = true;
|
editing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -234,4 +255,5 @@ public class PublicationAuthorAddForm
|
||||||
authors.close();
|
authors.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue