ItemSearchWidget aktueller Stand

git-svn-id: https://svn.libreccm.org/ccm/trunk@1768 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2012-07-14 16:56:33 +00:00
parent 9bea8c4ad1
commit fc69327e92
17 changed files with 290 additions and 124 deletions

View File

@ -1103,3 +1103,5 @@ cms.ui.item_search.flat.filter.submit=Filter
cms.ui.item_search.selected=Selected content item (id) cms.ui.item_search.selected=Selected content item (id)
cms.ui.item_search.create=Create new cms.ui.item_search.create=Create new
cms.ui.item_search.create.folder_select=Select folder cms.ui.item_search.create.folder_select=Select folder
cms.ui.search.create.select_close=Select item and close
cms.ui.search.create.select_edit=Select item and edit

View File

@ -1094,3 +1094,5 @@ cms.ui.item_search.flat.filter.submit=Filtern
cms.ui.item_search.selected=Ausgew\u00e4hltes Content Item (ID) cms.ui.item_search.selected=Ausgew\u00e4hltes Content Item (ID)
cms.ui.item_search.create=Neu anlegen cms.ui.item_search.create=Neu anlegen
cms.ui.item_search.create.folder_select=Ordner ausw\u00e4hlen cms.ui.item_search.create.folder_select=Ordner ausw\u00e4hlen
cms.ui.search.create.select_close=Item ausw\u00e4hlen und schlie\u00dfen
cms.ui.search.create.select_edit=Item ausw\u00e4hlen und weiter bearbeiten

View File

@ -42,3 +42,5 @@ cms.ui.item_search.flat.filter.submit=
cms.ui.item_search.selected= cms.ui.item_search.selected=
cms.ui.item_search.create= cms.ui.item_search.create=
cms.ui.item_search.create.folder_select= cms.ui.item_search.create.folder_select=
cms.ui.search.create.select_close=
cms.ui.search.create.select_edit=

View File

@ -573,3 +573,5 @@ cms.ui.item_search.flat.filter.submit=
cms.ui.item_search.selected= cms.ui.item_search.selected=
cms.ui.item_search.create= cms.ui.item_search.create=
cms.ui.item_search.create.folder_select= cms.ui.item_search.create.folder_select=
cms.ui.search.create.select_close=
cms.ui.search.create.select_edit=

View File

@ -29,4 +29,5 @@ 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";
} }

View File

@ -133,6 +133,8 @@ public class ContentItemPage extends CMSPage implements ActionListener {
private ItemRevisionAdminPane m_revisionsPane; private ItemRevisionAdminPane m_revisionsPane;
private ItemTemplates m_templatesPane; private ItemTemplates m_templatesPane;
private Link m_previewLink; private Link m_previewLink;
private GlobalNavigation m_globalNavigation;
private ContentItemContextBar m_contextBar;
private class ItemRequestLocal extends ContentItemRequestLocal { private class ItemRequestLocal extends ContentItemRequestLocal {
@ -194,8 +196,11 @@ public class ContentItemPage extends CMSPage implements ActionListener {
m_returnURL = new StringParameter(RETURN_URL); m_returnURL = new StringParameter(RETURN_URL);
addGlobalStateParam(m_returnURL); addGlobalStateParam(m_returnURL);
add(new GlobalNavigation()); m_globalNavigation = new GlobalNavigation();
add(new ContentItemContextBar(m_itemModel)); add(m_globalNavigation);
m_contextBar = new ContentItemContextBar(m_itemModel);
add(m_contextBar);
// Create panels. // Create panels.
m_summaryPane = new Summary(m_itemModel); m_summaryPane = new Summary(m_itemModel);
@ -416,7 +421,7 @@ public class ContentItemPage extends CMSPage implements ActionListener {
* @param tab The index of the tab to display * @param tab The index of the tab to display
*/ */
public static String getItemURL(ContentItem item, int tab) { public static String getItemURL(ContentItem item, int tab) {
final ContentSection section = ContentSection.getContentSection(item); final ContentSection section = item.getContentSection();
if (section == null) { if (section == null) {
return null; return null;
@ -505,4 +510,12 @@ public class ContentItemPage extends CMSPage implements ActionListener {
&& STREAMLINED_CREATION_ACTIVE.equals(state.getRequest(). && STREAMLINED_CREATION_ACTIVE.equals(state.getRequest().
getParameter(STREAMLINED_CREATION)); getParameter(STREAMLINED_CREATION));
} }
protected TabbedPane getTabbedPane() {
return m_tabbedPane;
}
protected WizardSelector getWizardPane() {
return m_wizardPane;
}
} }

View File

@ -5,30 +5,44 @@
package com.arsdigita.cms.ui; package com.arsdigita.cms.ui;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.Page; import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel; import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.SegmentedPanel; import com.arsdigita.bebop.SegmentedPanel;
import com.arsdigita.bebop.SegmentedPanel.Segment; import com.arsdigita.bebop.SegmentedPanel.Segment;
import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.SingleSelectionModel;
import com.arsdigita.bebop.event.ActionEvent; import com.arsdigita.bebop.event.FormCancelListener;
import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener; import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.AuthoringKit;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.CreationSelector; import com.arsdigita.cms.ui.authoring.CreationSelector;
import com.arsdigita.cms.ui.authoring.NewItemForm; import com.arsdigita.cms.ui.authoring.NewItemForm;
import com.arsdigita.cms.ui.authoring.WizardSelector;
import com.arsdigita.cms.ui.folder.FlatFolderPicker; import com.arsdigita.cms.ui.folder.FlatFolderPicker;
import com.arsdigita.cms.ui.folder.FolderItemPane;
import com.arsdigita.cms.ui.folder.FolderRequestLocal; import com.arsdigita.cms.ui.folder.FolderRequestLocal;
import com.arsdigita.cms.ui.folder.FolderSelectionModel; import com.arsdigita.cms.ui.folder.FolderSelectionModel;
import com.arsdigita.cms.ui.folder.FolderTreeModelBuilder; import com.arsdigita.cms.ui.item.ContentItemRequestLocal;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.persistence.OID;
import com.arsdigita.web.RedirectSignal;
import com.arsdigita.web.URL;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
@ -38,29 +52,37 @@ import java.math.BigDecimal;
*/ */
class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListener, FormSubmissionListener { class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListener, FormSubmissionListener {
public static final String WIDGET_PARAM = "widget";
public static final String SEARCHWIDGET_PARAM = "searchWidget";
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 NewItemForm m_newItem; private final NewItemForm m_newItem;
private SingleSelectionModel m_typeSel; private final SingleSelectionModel m_typeSel;
private FlatFolderPicker m_folderPicker; private final FlatFolderPicker m_folderPicker;
//private final BaseTree m_tree; //private final BaseTree m_tree;
private final SingleSelectionModel m_model; private final SingleSelectionModel m_model;
private final FolderSelectionModel m_folderSel; // To support legacy UI code private final FolderSelectionModel m_folderSel; // To support legacy UI code
private final FolderRequestLocal m_folder; private final FolderRequestLocal m_folder;
private final CreationSelector m_creator; private final CreationSelector m_creator;
private final ItemSearchPage parent; private final ItemSearchPage m_parent;
private SegmentedPanel m_segPanel; private final ContentItemRequestLocal m_contentItem = new ContentItemRequestLocal() {
private Segment m_creationSeg; };
private Segment m_newItemSeg; private final Link m_selectCloseLink;
private final Link m_selectEditLink;
private final SegmentedPanel m_segPanel;
private final Segment m_creationSeg;
private final Segment m_newItemSeg;
private final Segment m_linkSeg;
public ItemSearchCreateItemPane(final ItemSearchPage parent) { public ItemSearchCreateItemPane(final ItemSearchPage parent) {
super(); super();
this.parent = parent; this.m_parent = parent;
m_segPanel = new SegmentedPanel("itemSearchCreate"); m_segPanel = new SegmentedPanel("itemSearchCreate");
m_creationSeg = new Segment(); m_creationSeg = new Segment();
m_newItemSeg = new Segment(); m_newItemSeg = new Segment();
m_linkSeg = new Segment();
m_newItem = new SectionNewItemForm("newItem"); m_newItem = new SectionNewItemForm("newItem");
//m_newItem.addProcessListener(this); //m_newItem.addProcessListener(this);
@ -78,7 +100,25 @@ class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListen
m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID)); m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID));
// m_typeSel.addChangeListener(this); // m_typeSel.addChangeListener(this);
m_creator = new CreationSelector(m_typeSel, m_folderSel); m_creator = new CreationSelector(m_typeSel, m_folderSel) {
@Override
public void editItem(final PageState state, final ContentItem item) {
//final ContentSection section = getContentSection(state);
//final String nodeURL = URL.getDispatcherPath() + section.getPath() + "/";
//final String target = ItemSearchContentItemPage.getItemURL(nodeURL, item.getID(),
// ContentItemPage.AUTHORING_TAB, true);
//throw new RedirectSignal(target, true);
m_creationSeg.setVisible(state, false);
m_linkSeg.setVisible(state, true);
m_contentItem.set(state, item);
}
};
m_creationSeg.add(m_creator); m_creationSeg.add(m_creator);
m_creationSeg.add(new Label("<br/>", false)); m_creationSeg.add(new Label("<br/>", false));
@ -96,9 +136,81 @@ class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListen
m_segPanel.add(m_newItemSeg); m_segPanel.add(m_newItemSeg);
m_segPanel.add(m_creationSeg); m_segPanel.add(m_creationSeg);
add(m_segPanel); add(m_segPanel);
m_selectCloseLink = new Link(
(String) GlobalizationUtil.globalize("cms.ui.search.create.select_close").localize(),
new PrintListener() {
public void prepare(final PrintEvent event) {
final Link target = (Link) event.getTarget();
final PageState state = event.getPageState();
final ContentItem item = m_contentItem.getContentItem(state);
final String title;
if (item instanceof ContentPage) {
title = ((ContentPage) item).getTitle();
} else {
title = item.getName();
}
final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
+ "window.opener.document.%s.value=\"%s\";"
+ "self.close();"
+ "return false;",
widget,
item.getID().toString(),
searchWidget,
title));
}
});
m_selectEditLink = new Link((String) GlobalizationUtil.globalize("cms.ui.search.create.select_edit").localize(),
new PrintListener() {
public void prepare(final PrintEvent event) {
final Link target = (Link) event.getTarget();
final PageState state = event.getPageState();
final ContentItem item = m_contentItem.getContentItem(state);
final String title;
if (item instanceof ContentPage) {
title = ((ContentPage) item).getTitle();
} else {
title = item.getName();
}
final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
final ContentSection section = item.getContentSection();
final String nodeURL = section.getPath() + "/";
final String linkTarget = ContentItemPage.getItemURL(nodeURL, item.getID(),
ContentItemPage.AUTHORING_TAB, true);
target.setTarget(linkTarget);
target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
+ "window.opener.document.%s.value=\"%s\";",
widget,
item.getID().toString(),
searchWidget,
title));
}
});
final BoxPanel linkPanel = new BoxPanel(BoxPanel.VERTICAL);
linkPanel.add(m_selectCloseLink);
linkPanel.add(m_selectEditLink);
m_linkSeg.add(linkPanel);
m_segPanel.add(m_linkSeg);
} }
@Override @Override
@ -107,6 +219,7 @@ class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListen
page.setVisibleDefault(m_newItemSeg, true); page.setVisibleDefault(m_newItemSeg, true);
page.setVisibleDefault(m_creationSeg, false); page.setVisibleDefault(m_creationSeg, false);
page.setVisibleDefault(m_linkSeg, false);
page.addComponentStateParam(this, m_typeSel.getStateParameter()); page.addComponentStateParam(this, m_typeSel.getStateParameter());
page.addComponentStateParam(this, m_folderSel.getStateParameter()); page.addComponentStateParam(this, m_folderSel.getStateParameter());
@ -117,29 +230,14 @@ class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListen
final BigDecimal typeID = m_newItem.getTypeID(state); final BigDecimal typeID = m_newItem.getTypeID(state);
m_typeSel.setSelectedKey(state, typeID); m_typeSel.setSelectedKey(state, typeID);
final BigDecimal folderId = (BigDecimal) m_folderPicker.getValue(state); final OID folderOID = OID.valueOf((String) m_folderPicker.getValue(state));
m_folderSel.setSelectedKey(state, folderId); m_folderSel.setSelectedKey(state, folderOID.get("id"));
m_newItemSeg.setVisible(state, false); m_newItemSeg.setVisible(state, false);
m_creationSeg.setVisible(state, true); m_creationSeg.setVisible(state, true);
} }
public void process(final FormSectionEvent fse) throws FormProcessException { public void process(final FormSectionEvent fse) throws FormProcessException {
final PageState state = fse.getPageState(); //Nothing
final Object source = fse.getSource();
//if (source == m_newItem) {
final BigDecimal typeID = m_newItem.getTypeID(state);
m_typeSel.setSelectedKey(state, typeID);
final BigDecimal folderId = (BigDecimal) m_folderPicker.getValue(state);
m_folderSel.setSelectedKey(state, folderId);
//m_newItem.setVisible(state, false);
//m_creator.setVisible(state, true);
m_newItemSeg.setVisible(state, false);
m_creationSeg.setVisible(state, true);
//parent.setTabActive(state, this, true);
//newItemMode(state);
//}
} }
private static class SectionNewItemForm extends NewItemForm { private static class SectionNewItemForm extends NewItemForm {
@ -151,5 +249,6 @@ class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListen
public ContentSection getContentSection(PageState s) { public ContentSection getContentSection(PageState s) {
return CMS.getContext().getContentSection(); return CMS.getContext().getContentSection();
} }
} }
} }

View File

@ -5,7 +5,6 @@ import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.GridPanel;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link; import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.Page; import com.arsdigita.bebop.Page;
@ -13,7 +12,6 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.PaginationModelBuilder; import com.arsdigita.bebop.PaginationModelBuilder;
import com.arsdigita.bebop.Paginator; import com.arsdigita.bebop.Paginator;
import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormProcessListener;
@ -37,14 +35,10 @@ import com.arsdigita.cms.Folder;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.Session; import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.SessionManager;
import com.arsdigita.toolbox.ui.DataQueryBuilder;
import com.arsdigita.toolbox.ui.DataTable;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.bouncycastle.asn1.ess.ContentIdentifier;
/** /**
* *
@ -297,7 +291,10 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
final ContentPage page = new ContentPage((BigDecimal) key); final ContentPage page = new ContentPage((BigDecimal) key);
link.setOnClick(String.format( link.setOnClick(String.format(
"window.opener.document.%s.value=\"%s\";window.opener.document.%s.value=\"%s\";self.close();return false;", "window.opener.document.%s.value=\"%s\";"
+ "window.opener.document.%s.value=\"%s\";"
+ "self.close();"
+ "return false;",
widget, widget,
key.toString(), key.toString(),
searchWidget, searchWidget,

View File

@ -61,6 +61,7 @@ public class ItemSearchWidget extends FormSection
//private Hidden m_selected; //private Hidden m_selected;
private TextField m_selected; private TextField m_selected;
private TextField m_item; private TextField m_item;
private Hidden m_publish;
private Submit m_search; private Submit m_search;
private Submit m_clear; private Submit m_clear;
private Label m_jsLabel; private Label m_jsLabel;
@ -78,6 +79,7 @@ public class ItemSearchWidget extends FormSection
public static final String BEBOP_ITEM_SEARCH = "bebop:itemSearch"; public static final String BEBOP_ITEM_SEARCH = "bebop:itemSearch";
public static final String SEARCH = "search"; public static final String SEARCH = "search";
public static final boolean LIMIT_TO_CONTENT_SECTION = false; public static final boolean LIMIT_TO_CONTENT_SECTION = false;
public static final String PUBLISH = "publish";
private class ItemFragment extends TextField { private class ItemFragment extends TextField {
@ -184,18 +186,18 @@ public class ItemSearchWidget extends FormSection
} }
/** /**
* Construct a new ItemSearchWidget. The model must be an * Construct a new ItemSearchWidget. The model must be an ItemSearchParameter
* ItemSearchParameter
*/ */
public ItemSearchWidget(ParameterModel model) { public ItemSearchWidget(ParameterModel model) {
this(model, null); this(model, null);
} }
/** /**
* Construct a new ItemSearchWidget. The model must be an * Construct a new ItemSearchWidget. The model must be an ItemSearchParameter
* ItemSearchParameter *
* @param model * @param model
* @param contentType *param
* contentType
*/ */
public ItemSearchWidget(final ParameterModel model, final ContentType contentType) { public ItemSearchWidget(final ParameterModel model, final ContentType contentType) {
super(new BoxPanel(BoxPanel.VERTICAL)); super(new BoxPanel(BoxPanel.VERTICAL));
@ -203,7 +205,7 @@ public class ItemSearchWidget extends FormSection
if (!(model instanceof ItemSearchParameter)) { if (!(model instanceof ItemSearchParameter)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"The ItemSearch widget " + model.getName() "The ItemSearch widget " + model.getName()
+ " must be backed by a ItemSearchParameter parmeter model"); + " must be backed by a ItemSearchParameter parameter model");
} }
m_name = model.getName(); m_name = model.getName();
@ -225,10 +227,12 @@ public class ItemSearchWidget extends FormSection
m_selected = new ItemFragment(model, this); m_selected = new ItemFragment(model, this);
final Label selectedItemLabel = new Label(selectedLabelText); final Label selectedItemLabel = new Label(selectedLabelText);
selectedItemLabel.addPrintListener(new PrintListener() { selectedItemLabel.addPrintListener(new PrintListener() {
public void prepare(final PrintEvent event) { public void prepare(final PrintEvent event) {
final Label target = (Label) event.getTarget(); final Label target = (Label) event.getTarget();
target.setLabel(selectedLabelText); target.setLabel(selectedLabelText);
} }
}); });
final Label searchLabel = new Label(searchLabelText); final Label searchLabel = new Label(searchLabelText);
searchLabel.addPrintListener(new PrintListener() { searchLabel.addPrintListener(new PrintListener() {
@ -237,8 +241,13 @@ public class ItemSearchWidget extends FormSection
final Label target = (Label) event.getTarget(); final Label target = (Label) event.getTarget();
target.setLabel(searchLabelText); target.setLabel(searchLabelText);
} }
}); });
//m_item = new ItemFragment(model, this); //m_item = new ItemFragment(model, this);
m_publish = new Hidden(PUBLISH);
add(m_publish);
m_item = new TextField(m_searchModel); m_item = new TextField(m_searchModel);
m_search = new SearchFragment(m_searchName, this); m_search = new SearchFragment(m_searchName, this);
m_clear = new ClearFragment(m_clearName, this); m_clear = new ClearFragment(m_clearName, this);
@ -277,9 +286,10 @@ 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"
+ " aWindow = window.open(\"" + url + "&query=\" + document.getElementById('" + m_item.getName() + "').value , " + " aWindow = window.open(\"" + url + "&query=\" + document.getElementById('" + m_item.
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=no,width=\" + screen.width*0.5 + \",height=\" + screen.height*0.5 + \",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 "
+ "return false;\n" + "return false;\n"
+ " } \n" + " } \n"
+ " --> \n" + " --> \n"
@ -363,6 +373,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());
} 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
} }

View File

@ -18,24 +18,29 @@
*/ */
package com.arsdigita.cms.ui.authoring; package com.arsdigita.cms.ui.authoring;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.MapComponentSelectionModel; import com.arsdigita.bebop.MapComponentSelectionModel;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.SingleSelectionModel;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.cms.AuthoringKit; import com.arsdigita.cms.AuthoringKit;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentTypeCollection; import com.arsdigita.cms.ContentTypeCollection;
import com.arsdigita.cms.ui.ScriptPrinter;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.toolbox.ui.LayoutPanel;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* Selects a component based on content type. Helper class for {@link * Selects a component based on content type. Helper class for {@link
* com.arsdigita.cms.ui.authoring.WizardSelector}. * com.arsdigita.cms.ui.authoring.WizardSelector}.
@ -46,18 +51,16 @@ public abstract class AuthoringKitSelector extends SimpleContainer {
private static Logger s_log = private static Logger s_log =
Logger.getLogger(AuthoringKitSelector.class); Logger.getLogger(AuthoringKitSelector.class);
private Map m_comps; private Map m_comps;
private MapComponentSelectionModel m_sel; private MapComponentSelectionModel m_sel;
ContentTypeCollection m_types; ContentTypeCollection m_types;
private ScriptPrinter scriptPrinter;
/** /**
* Construct a new AuthoringKitSelector. Load all the possible * Construct a new AuthoringKitSelector. Load all the possible authoring kits from the database and construct
* authoring kits from the database and construct components * components for them.
* for them.
* *
* @param model the {@link ItemSelectionModel} which will * @param model the {@link ItemSelectionModel} which will supply the selector with the id of a content type
* supply the selector with the id of a content type
* *
* @pre itemModel != null * @pre itemModel != null
*/ */
@ -70,25 +73,26 @@ public abstract class AuthoringKitSelector extends SimpleContainer {
m_types = ContentType.getAllContentTypes(); m_types = ContentType.getAllContentTypes();
if (m_types.isEmpty()) { if (m_types.isEmpty()) {
m_types.close(); m_types.close();
throw new IllegalStateException( (String) GlobalizationUtil.globalize("cms.ui.authoring.no_content_types_were_found").localize()); throw new IllegalStateException((String) GlobalizationUtil.globalize(
"cms.ui.authoring.no_content_types_were_found").localize());
} }
} }
// Overloaded add methods // Overloaded add methods
@Override
public void add(Component c) { public void add(Component c) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
// Overloaded add methods // Overloaded add methods
@Override
public void add(Component c, int constraints) { public void add(Component c, int constraints) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
/** /**
* Instantiate all the authoring kit wizards. * Instantiate all the authoring kit wizards. The child class should call this method after it is done with
* The child class should call this method after it is done * initialization
* with initialization
*/ */
protected void processKit() { protected void processKit() {
while (m_types.next()) { while (m_types.next()) {
@ -102,24 +106,39 @@ public abstract class AuthoringKitSelector extends SimpleContainer {
s_log.info("Added component " + c + " for " s_log.info("Added component " + c + " for "
+ type.getAssociatedObjectType()); + type.getAssociatedObjectType());
} }
if (c instanceof LayoutPanel) {
Label label = new Label("", false);
label.addPrintListener(new PrintListener() {
public void prepare(final PrintEvent event) {
final Label label = (Label) event.getTarget();
if (scriptPrinter != null) {
label.setLabel(scriptPrinter.printScript(event.getPageState()));
}
}
});
((LayoutPanel) c).setBottom(label);
}
} }
} }
} }
/** /**
* Instantiate an authoring kit component. Child classes should * Instantiate an authoring kit component. Child classes should override this to do the right thing. It is
* override this to do the right thing. It is permissible for this * permissible for this method to return null.
* method to return null.
* *
* @param kit for this kit * @param kit for this kit
* @param type for this type * @param type for this type
*/ */
protected abstract Component instantiateKitComponent( protected abstract Component instantiateKitComponent(
AuthoringKit kit, ContentType type AuthoringKit kit, ContentType type);
);
/** /**
* @param id The content type id * @param id The content type id
*
* @return The component the given type id * @return The component the given type id
*/ */
public Component getComponent(BigDecimal id) { public Component getComponent(BigDecimal id) {
@ -144,5 +163,4 @@ public abstract class AuthoringKitSelector extends SimpleContainer {
c.generateXML(state, parent); c.generateXML(state, parent);
} }
} }
} }

View File

@ -31,6 +31,7 @@ import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormValidationListener; import com.arsdigita.bebop.event.FormValidationListener;
import com.arsdigita.bebop.form.Hidden;
import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.parameters.TrimmedStringParameter; import com.arsdigita.bebop.parameters.TrimmedStringParameter;
@ -66,6 +67,7 @@ public abstract class BasicItemForm
private final ItemSelectionModel m_itemModel; private final ItemSelectionModel m_itemModel;
private SaveCancelSection m_saveCancelSection; private SaveCancelSection m_saveCancelSection;
private FormSection m_widgetSection; private FormSection m_widgetSection;
public static final String CONTENT_ITEM_ID = ContentItem.ID;
public static final String NAME = ContentItem.NAME; public static final String NAME = ContentItem.NAME;
public static final String TITLE = ContentPage.TITLE; public static final String TITLE = ContentPage.TITLE;
public static final String LANGUAGE = ContentItem.LANGUAGE; public static final String LANGUAGE = ContentItem.LANGUAGE;
@ -138,6 +140,11 @@ public abstract class BasicItemForm
protected void addWidgets() { protected void addWidgets() {
//add(new FormErrorDisplay(this), ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT); //add(new FormErrorDisplay(this), ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
//add(new Label("id"));
final Hidden id = new Hidden(CONTENT_ITEM_ID);
//final TextField id = new TextField(CONTENT_ITEM_ID);
add(id);
// JavaScript auto-name generation is off by default. // JavaScript auto-name generation is off by default.
// It is turned on under the following circumstances // It is turned on under the following circumstances
// //

View File

@ -123,6 +123,7 @@ public abstract class BasicPageForm extends BasicItemForm {
if (item != null) { if (item != null) {
// Preset fields // Preset fields
data.put(CONTENT_ITEM_ID, item.getID().toString());
data.put(NAME, item.getName()); data.put(NAME, item.getName());
data.put(TITLE, item.getTitle()); data.put(TITLE, item.getTitle());
// data.put(DESCRIPTION, item.getDescription()); // data.put(DESCRIPTION, item.getDescription());

View File

@ -18,6 +18,7 @@
*/ */
package com.arsdigita.cms.ui.authoring; package com.arsdigita.cms.ui.authoring;
import com.arsdigita.bebop.Label;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -26,9 +27,12 @@ import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.ActionEvent; import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionListener; import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.event.RequestEvent; import com.arsdigita.bebop.event.RequestEvent;
import com.arsdigita.bebop.event.RequestListener; import com.arsdigita.bebop.event.RequestListener;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.ui.ContentItemPage; import com.arsdigita.cms.ui.ContentItemPage;

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.ui.authoring;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Resettable; import com.arsdigita.bebop.Resettable;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.SingleSelectionModel;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.cms.AuthoringKit; import com.arsdigita.cms.AuthoringKit;
@ -29,6 +30,7 @@ import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.toolbox.ui.LayoutPanel;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import java.math.BigDecimal; import java.math.BigDecimal;

View File

@ -8,6 +8,7 @@ import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.event.PrintEvent; import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.Folder; import com.arsdigita.cms.Folder;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
@ -21,15 +22,18 @@ import java.util.TooManyListenersException;
public abstract class AbstractFolderPicker extends SingleSelect { public abstract class AbstractFolderPicker extends SingleSelect {
public AbstractFolderPicker(String name) { public AbstractFolderPicker(String name) {
super(new OIDParameter(name)); //super(new OIDParameter(name));
super(new StringParameter(name));
try { try {
addPrintListener(new PrintListener() { addPrintListener(new PrintListener() {
@Override @Override
public void prepare(PrintEvent ev) { public void prepare(PrintEvent ev) {
addOptions(ev.getPageState(), addOptions(ev.getPageState(),
(SingleSelect) ev.getTarget()); (SingleSelect) ev.getTarget());
} }
}); });
} catch (TooManyListenersException ex) { } catch (TooManyListenersException ex) {
throw new RuntimeException("this cannot happen"); throw new RuntimeException("this cannot happen");
@ -37,20 +41,21 @@ public abstract class AbstractFolderPicker extends SingleSelect {
} }
public Folder getFolder(PageState state) { public Folder getFolder(PageState state) {
OID oid = (OID)getValue(state); OID oid = OID.valueOf((String) getValue(state));//(OID) getValue(state);
if (oid == null) { if (oid == null) {
return null; return null;
} } else {
return (Folder) DomainObjectFactory.newInstance(oid); return (Folder) DomainObjectFactory.newInstance(oid);
} }
}
public void setCategory(PageState state, public void setFolder(PageState state,
Folder folder) { Folder folder) {
if (folder == null) { if (folder == null) {
setValue(state, null); setValue(state, null);
} else { } else {
setValue(state, folder.getOID()); setValue(state, folder.getOID().toString());
} }
} }

View File

@ -25,7 +25,7 @@ public class FlatFolderPicker extends AbstractFolderPicker {
} }
protected void addOptions(PageState state, SingleSelect target) { protected void addOptions(PageState state, SingleSelect target) {
target.addOption(new Option(null, "")); target.addOption(new Option("", ""));
final ContentSection section = CMS.getContext().getContentSection(); final ContentSection section = CMS.getContext().getContentSection();
//final String sectionName = section.getName(); //final String sectionName = section.getName();
@ -70,7 +70,7 @@ public class FlatFolderPicker extends AbstractFolderPicker {
path = String.format("%s/%s", prefix, folder.getName()); path = String.format("%s/%s", prefix, folder.getName());
} }
target.addOption(new Option(folder.getID().toString(), path)); target.addOption(new Option(folder.getOID().toString(), path));
final ItemCollection children = folder.getChildren(); final ItemCollection children = folder.getChildren();
children.addEqualsFilter("objectType", Folder.BASE_DATA_OBJECT_TYPE); children.addEqualsFilter("objectType", Folder.BASE_DATA_OBJECT_TYPE);