From 9c7a80b93da4a259a96df13e2d1b8c0ecd628d43 Mon Sep 17 00:00:00 2001 From: quasi Date: Thu, 20 Jun 2013 13:30:39 +0000 Subject: [PATCH] Ticket #1468: /ccm/search Application ist nicht (mehr) Subsite-Aware MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem ist, daß das DefaultNavigationModel nichts von Subsite weiß. Daher muß für die Suche ein anderes NavigationModel verwendet werden. DIe Integration ist noch nicht schön, aber ich habe zur Zeit keine bessere Idee. Hinzugefügt * SearchNavigationModel * JSPs für search git-svn-id: https://svn.libreccm.org/ccm/trunk@2223 8810af33-2d31-482b-a856-94f89814c4df --- .../6.6.1-6.6.2/cms_item_image_attachment.sql | 21 +++++++ .../web/templates/ccm-ldn-search/advanced.jsp | 28 +++++++++ .../web/templates/ccm-ldn-search/index.jsp | 29 ++++++++++ .../web/templates/ccm-ldn-search/remote.jsp | 28 +++++++++ .../subsite/SearchNavigationModel.java | 58 +++++++++++++++++++ 5 files changed, 164 insertions(+) create mode 100644 ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/default/upgrade/6.6.1-6.6.2/cms_item_image_attachment.sql create mode 100644 ccm-sci-bundle/web/templates/ccm-ldn-search/advanced.jsp create mode 100644 ccm-sci-bundle/web/templates/ccm-ldn-search/index.jsp create mode 100644 ccm-sci-bundle/web/templates/ccm-ldn-search/remote.jsp create mode 100644 ccm-subsite/src/com/arsdigita/subsite/SearchNavigationModel.java diff --git a/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/default/upgrade/6.6.1-6.6.2/cms_item_image_attachment.sql b/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/default/upgrade/6.6.1-6.6.2/cms_item_image_attachment.sql new file mode 100644 index 000000000..605c80399 --- /dev/null +++ b/ccm-cms-assets-imagestep/sql/ccm-cms-assets-imagestep/default/upgrade/6.6.1-6.6.2/cms_item_image_attachment.sql @@ -0,0 +1,21 @@ +-- +-- Copyright (C) 2010 Peter Boy. All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id: upd_acs_objects.sql $ + + +alter table cms_item_image_attachement add column sort_key integer set default 1; \ No newline at end of file diff --git a/ccm-sci-bundle/web/templates/ccm-ldn-search/advanced.jsp b/ccm-sci-bundle/web/templates/ccm-ldn-search/advanced.jsp new file mode 100644 index 000000000..e13e9826b --- /dev/null +++ b/ccm-sci-bundle/web/templates/ccm-ldn-search/advanced.jsp @@ -0,0 +1,28 @@ + + + + + + + + DispatcherHelper.cacheDisable(response); + + + + + + + ((com.arsdigita.navigation.ui.category.Path) categoryPath).setModel(new com.arsdigita.subsite.SearchNavigationModel()); + ((com.arsdigita.navigation.ui.category.Menu) categoryMenu).setModel(new com.arsdigita.subsite.SearchNavigationModel()); + + + + + + diff --git a/ccm-sci-bundle/web/templates/ccm-ldn-search/index.jsp b/ccm-sci-bundle/web/templates/ccm-ldn-search/index.jsp new file mode 100644 index 000000000..d8ca3142c --- /dev/null +++ b/ccm-sci-bundle/web/templates/ccm-ldn-search/index.jsp @@ -0,0 +1,29 @@ + + + + + + + + DispatcherHelper.cacheDisable(response); + + + + + + + ((com.arsdigita.navigation.ui.category.Path) categoryPath).setModel(new com.arsdigita.subsite.SearchNavigationModel()); + ((com.arsdigita.navigation.ui.category.Menu) categoryMenu).setModel(new com.arsdigita.subsite.SearchNavigationModel()); + + + + + + + diff --git a/ccm-sci-bundle/web/templates/ccm-ldn-search/remote.jsp b/ccm-sci-bundle/web/templates/ccm-ldn-search/remote.jsp new file mode 100644 index 000000000..c0cbe323d --- /dev/null +++ b/ccm-sci-bundle/web/templates/ccm-ldn-search/remote.jsp @@ -0,0 +1,28 @@ + + + + + + + + DispatcherHelper.cacheDisable(response); + + + + + + + ((com.arsdigita.navigation.ui.category.Path) categoryPath).setModel(new com.arsdigita.subsite.SearchNavigationModel()); + ((com.arsdigita.navigation.ui.category.Menu) categoryMenu).setModel(new com.arsdigita.subsite.SearchNavigationModel()); + + + + + + diff --git a/ccm-subsite/src/com/arsdigita/subsite/SearchNavigationModel.java b/ccm-subsite/src/com/arsdigita/subsite/SearchNavigationModel.java new file mode 100644 index 000000000..b8f25250e --- /dev/null +++ b/ccm-subsite/src/com/arsdigita/subsite/SearchNavigationModel.java @@ -0,0 +1,58 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.arsdigita.subsite; + +import com.arsdigita.categorization.Category; +import com.arsdigita.kernel.ACSObject; +import com.arsdigita.navigation.AbstractNavigationModel; + +/** + * + * @author Sören Bernstein (quasimodo) + */ +public class SearchNavigationModel extends AbstractNavigationModel { + + @Override + protected ACSObject loadObject() { + Category category = getCategory(); + if (category == null) { + return null; + } + return category.getIndexObject(); + } + + @Override + protected Category loadCategory() { + Category[] path = getCategoryPath(); + if (path == null + || path.length == 0) { + return null; + } + return path[path.length - 1]; + } + + @Override + protected Category[] loadCategoryPath() { + if (Subsite.getContext().hasSite()) { + Category path[] = new Category[1]; + Site subsite = Subsite.getContext().getSite(); + path[0] = subsite.getRootCategory(); + return path; + } else { + return null; + } + } + + @Override + protected Category loadRootCategory() { + + if (Subsite.getContext().hasSite()) { + Site subsite = Subsite.getContext().getSite(); + return subsite.getRootCategory(); + } else { + return null; + } + } +}