Weitere Verbesserungen an der Widget-Struktur des ItemSearchWidgets.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2331 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
17bef330e9
commit
a6961ddc99
|
|
@ -208,7 +208,7 @@ public class CMSItemSearchPage extends CMSApplicationPage {
|
||||||
*/
|
*/
|
||||||
protected ItemSearchFlatBrowsePane getFlatBrowsePane() {
|
protected ItemSearchFlatBrowsePane getFlatBrowsePane() {
|
||||||
if (m_flatBrowse == null) {
|
if (m_flatBrowse == null) {
|
||||||
m_flatBrowse = new ItemSearchFlatBrowsePane("flatBrowse");
|
m_flatBrowse = new ItemSearchFlatBrowsePane();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_flatBrowse;
|
return m_flatBrowse;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ 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.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.Tree;
|
import com.arsdigita.bebop.Tree;
|
||||||
import com.arsdigita.bebop.event.ActionEvent;
|
import com.arsdigita.bebop.event.ActionEvent;
|
||||||
|
|
@ -56,6 +57,7 @@ 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.folder.FolderTreeModelBuilder;
|
||||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
|
import com.arsdigita.toolbox.ui.LayoutPanel;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -69,12 +71,11 @@ import org.apache.log4j.Logger;
|
||||||
* @author David LutterKort <dlutter@redhat.com>
|
* @author David LutterKort <dlutter@redhat.com>
|
||||||
* @version $Id: ItemSearchBrowsePane.java 1166 2006-06-14 11:45:15Z fabrice $
|
* @version $Id: ItemSearchBrowsePane.java 1166 2006-06-14 11:45:15Z fabrice $
|
||||||
*/
|
*/
|
||||||
public class ItemSearchBrowsePane extends CMSContainer
|
public class ItemSearchBrowsePane extends SimpleContainer
|
||||||
implements Resettable, TreeExpansionListener, ChangeListener,
|
implements Resettable, TreeExpansionListener, ChangeListener,
|
||||||
FormProcessListener, FormSubmissionListener {
|
FormProcessListener, FormSubmissionListener {
|
||||||
|
|
||||||
private static final String CONTENT_TYPE_ID = "ct";
|
private static final String CONTENT_TYPE_ID = "ct";
|
||||||
|
|
||||||
private static final Logger s_log =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(ItemSearchBrowsePane.class);
|
Logger.getLogger(ItemSearchBrowsePane.class);
|
||||||
private FolderSelectionModel m_folderSel;
|
private FolderSelectionModel m_folderSel;
|
||||||
|
|
@ -87,12 +88,17 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
|
|
||||||
public ItemSearchBrowsePane() {
|
public ItemSearchBrowsePane() {
|
||||||
|
|
||||||
setClassAttr("sidebarNavPanel");
|
final LayoutPanel mainPanel = new LayoutPanel();
|
||||||
setAttribute("navbar-title", GlobalizationUtil.globalize("cms.ui.folder_browser").localize().toString());
|
|
||||||
|
|
||||||
Label l = new Label(GlobalizationUtil.globalize("cms.ui.folder_browser"));
|
setClassAttr("sidebarNavPanel");
|
||||||
l.setClassAttr("heading");
|
setAttribute("navbar-title",
|
||||||
add(l);
|
GlobalizationUtil.globalize("cms.ui.folder_browser").localize().toString());
|
||||||
|
|
||||||
|
final BoxPanel left = new BoxPanel(BoxPanel.VERTICAL);
|
||||||
|
|
||||||
|
Label label = new Label(GlobalizationUtil.globalize("cms.ui.folder_browser"));
|
||||||
|
label.setClassAttr("heading");
|
||||||
|
left.add(label);
|
||||||
|
|
||||||
// As described in ticket 20540, some clients do not want the option to pick items from other
|
// As described in ticket 20540, some clients do not want the option to pick items from other
|
||||||
// subsites through the ItemSearchBrowsePane. A new parameter has been added to allow the
|
// subsites through the ItemSearchBrowsePane. A new parameter has been added to allow the
|
||||||
|
|
@ -101,7 +107,6 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
s_log.debug("linksOnlyInSameSubsite value is " + linksOnlyInSameSubsite);
|
s_log.debug("linksOnlyInSameSubsite value is " + linksOnlyInSameSubsite);
|
||||||
|
|
||||||
m_tree = new Tree(new FolderTreeModelBuilder() {
|
m_tree = new Tree(new FolderTreeModelBuilder() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Folder getRoot(PageState ps) {
|
protected Folder getRoot(PageState ps) {
|
||||||
Folder root = getRootFolder(ps);
|
Folder root = getRootFolder(ps);
|
||||||
|
|
@ -111,6 +116,7 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
m_folderSel = createFolderSelectionModel();
|
m_folderSel = createFolderSelectionModel();
|
||||||
m_folderSel.addChangeListener(this);
|
m_folderSel.addChangeListener(this);
|
||||||
|
|
@ -126,14 +132,15 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
|
|
||||||
m_tree.setClassAttr("navbar");
|
m_tree.setClassAttr("navbar");
|
||||||
m_tree.addTreeExpansionListener(this);
|
m_tree.addTreeExpansionListener(this);
|
||||||
add(m_tree);
|
left.add(m_tree);
|
||||||
|
|
||||||
CMSContainer container = new CMSContainer();
|
// CMSContainer container = new CMSContainer();
|
||||||
container.setClassAttr("main");
|
left.setClassAttr("main");
|
||||||
|
|
||||||
|
final BoxPanel body = new BoxPanel(BoxPanel.VERTICAL);
|
||||||
m_browser = new ItemSearchFolderBrowser(m_folderSel);
|
m_browser = new ItemSearchFolderBrowser(m_folderSel);
|
||||||
container.add(m_browser);
|
body.add(m_browser);
|
||||||
container.add(m_browser.getPaginator());
|
body.add(m_browser.getPaginator());
|
||||||
|
|
||||||
// m_newItem = new SectionNewItemForm("newItem");
|
// m_newItem = new SectionNewItemForm("newItem");
|
||||||
// m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID));
|
// m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID));
|
||||||
|
|
@ -141,7 +148,10 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
//
|
//
|
||||||
// container.add(m_newItem);
|
// container.add(m_newItem);
|
||||||
|
|
||||||
add(container);
|
//add(container);
|
||||||
|
mainPanel.setLeft(left);
|
||||||
|
mainPanel.setBody(body);
|
||||||
|
add(mainPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -168,7 +178,6 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
sectionForm.addInitListener(new FormInitListener() {
|
sectionForm.addInitListener(new FormInitListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(FormSectionEvent ev) {
|
public void init(FormSectionEvent ev) {
|
||||||
PageState ps = ev.getPageState();
|
PageState ps = ev.getPageState();
|
||||||
|
|
@ -178,6 +187,7 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
m_section.setValue(ps, section.getOID());
|
m_section.setValue(ps, section.getOID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
sectionForm.add(m_section);
|
sectionForm.add(m_section);
|
||||||
|
|
@ -225,7 +235,6 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
// p.addComponentStateParam(this, m_typeSel.getStateParameter());
|
// p.addComponentStateParam(this, m_typeSel.getStateParameter());
|
||||||
|
|
||||||
p.addActionListener(new ActionListener() {
|
p.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
|
|
@ -234,6 +243,7 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
showHideSegments(state);
|
showHideSegments(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -352,7 +362,6 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
|
|
||||||
private FolderSelectionModel createFolderSelectionModel() {
|
private FolderSelectionModel createFolderSelectionModel() {
|
||||||
return new FolderSelectionModel("folder") {
|
return new FolderSelectionModel("folder") {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BigDecimal getRootFolderID(PageState ps) {
|
protected BigDecimal getRootFolderID(PageState ps) {
|
||||||
Folder root = getRootFolder(ps);
|
Folder root = getRootFolder(ps);
|
||||||
|
|
@ -362,6 +371,7 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
}
|
}
|
||||||
return root.getID();
|
return root.getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -375,5 +385,6 @@ public class ItemSearchBrowsePane extends CMSContainer
|
||||||
public ContentSection getContentSection(PageState s) {
|
public ContentSection getContentSection(PageState s) {
|
||||||
return CMS.getContext().getContentSection();
|
return CMS.getContext().getContentSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,8 @@ import java.util.StringTokenizer;
|
||||||
public class ItemSearchFolderBrowser extends Table {
|
public class ItemSearchFolderBrowser extends Table {
|
||||||
|
|
||||||
private static final org.apache.log4j.Logger s_log =
|
private static final org.apache.log4j.Logger s_log =
|
||||||
org.apache.log4j.Logger.
|
org.apache.log4j.Logger.getLogger(
|
||||||
getLogger(ItemSearchFolderBrowser.class);
|
ItemSearchFolderBrowser.class);
|
||||||
private static GlobalizedMessage[] s_headers = {
|
private static GlobalizedMessage[] s_headers = {
|
||||||
globalize("cms.ui.folder.name"),
|
globalize("cms.ui.folder.name"),
|
||||||
globalize("cms.ui.folder.title"),
|
globalize("cms.ui.folder.title"),
|
||||||
|
|
@ -349,7 +349,8 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
String widget =
|
String widget =
|
||||||
(String) state.getValue(new StringParameter(
|
(String) state.getValue(new StringParameter(
|
||||||
ItemSearchPopup.WIDGET_PARAM));
|
ItemSearchPopup.WIDGET_PARAM));
|
||||||
String searchWidget = (String) state.getValue(new StringParameter("searchWidget"));
|
String searchWidget = (String) state.getValue(
|
||||||
|
new StringParameter("searchWidget"));
|
||||||
boolean useURL =
|
boolean useURL =
|
||||||
"true".equals(state.getValue(new StringParameter(
|
"true".equals(state.getValue(new StringParameter(
|
||||||
ItemSearchPopup.URL_PARAM)));
|
ItemSearchPopup.URL_PARAM)));
|
||||||
|
|
@ -360,7 +361,8 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
coll.getDomainObject().getOID()) : id + " (" + name + ")";
|
coll.getDomainObject().getOID()) : id + " (" + name + ")";
|
||||||
String title = ((ContentPage) coll.getDomainObject()).getTitle();
|
String title = ((ContentPage) coll.getDomainObject()).getTitle();
|
||||||
|
|
||||||
Label js = new Label(generateJSLabel(id, widget, searchWidget, fillString, title),
|
Label js = new Label(
|
||||||
|
generateJSLabel(id, widget, searchWidget, fillString, title),
|
||||||
false);
|
false);
|
||||||
container.add(js);
|
container.add(js);
|
||||||
|
|
||||||
|
|
@ -377,13 +379,16 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateJSLabel(BigDecimal id, String widget, String searchWidget, String fill, String title) {
|
private String generateJSLabel(BigDecimal id, String widget, String searchWidget,
|
||||||
|
String fill, String title) {
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
buffer.append(" <script language=javascript> ");
|
buffer.append(" <script language=javascript> ");
|
||||||
buffer.append(" <!-- \n");
|
buffer.append(" <!-- \n");
|
||||||
buffer.append(" function fillItem").append(id).append("() { \n");
|
buffer.append(" function fillItem").append(id).append("() { \n");
|
||||||
buffer.append(" window.opener.document.").append(widget).append(".value=\"").append(fill).append("\";\n");
|
buffer.append(" window.opener.document.").append(widget).append(".value=\"").
|
||||||
buffer.append(" window.opener.document.").append(searchWidget).append(".value=\"").append(title.
|
append(fill).append("\";\n");
|
||||||
|
buffer.append(" window.opener.document.").append(searchWidget).append(".value=\"").
|
||||||
|
append(title.
|
||||||
replace("\"", "\\\"")).append("\";\n");
|
replace("\"", "\\\"")).append("\";\n");
|
||||||
// set protocol to 'other' in FCKEditor, else relative url prepended by http://
|
// set protocol to 'other' in FCKEditor, else relative url prepended by http://
|
||||||
if (Bebop.getConfig().getDHTMLEditor().equals(
|
if (Bebop.getConfig().getDHTMLEditor().equals(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue