Author: ssmiweve
Date: 2008-01-31 14:21:08 +0100 (Thu, 31 Jan 2008)
New Revision: 6072
Modified:
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/AbstractVelocityTemplateTag.java
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/SearchTabIncludeTag.java
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/SearchTabMainTag.java
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/VelocityTemplateTag.java
Log:
(12:30:17) Anna: I have a problem, been talking to Magne about it and found the
problem, but he reccomended to talk to you about how to solve it
(12:31:29) Anna: the searchTabInclude macro don't work in a xml sitesearch
(12:31:45) Anna: this runs: #macro(searchTabInclude $includeName)
(12:31:56) Anna: but never this: #if($includeName && $layout)
(12:32:38) Anna: magne said he had a similar problem with mobil.sesam.no
(12:32:52) Mck: where is #macro(searchTabInclude $includeName) ?
$layout is defined in SearchTabIncludeTag or SearchTabMainInclude
one of these must be used somewhere along the way.
(12:33:34) Anna: searchTabInclude in sesat-kernel generic
(12:34:24) Anna: works great in all other sitesearches, but this special one
that print xml to the screen has problems
(12:35:06) Anna: the main template runs, but doesn't include the other vm files
in it, and the logs say that it has search results
(12:35:20) Mck: how does the request get from the xxDecorator.jsp to the
velocity template?
(12:36:48) Anna: wrote debug messages in generic VM_site_library and saw that
the first "if" in "searchTabInclude" macro don't run, but the macro itself runs
(12:40:45) Mck: yeah. that's because $layout hasn't been defined yet :)
it's defined in either SearchTabIncludeTag.java or SearchTabMainInclude.java
but you must be getting to that macro without having run through either!
(13:48:10) Anna: if it help, it did work yesterday morning
(13:50:03) Mck: oh. ok :) that does help
(13:50:55) Anna: don't now exact what time, but somewhere in the afternoon it
stopped working...
(14:15:12) Anna: r6060 is working
(14:15:36) Mck: i got a fix coming.
(14:17:50) Anna: great =)
Modified:
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/AbstractVelocityTemplateTag.java
===================================================================
---
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/AbstractVelocityTemplateTag.java
2008-01-31 12:51:26 UTC (rev 6071)
+++
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/AbstractVelocityTemplateTag.java
2008-01-31 13:21:08 UTC (rev 6072)
@@ -1,4 +1,4 @@
-/* Copyright (2006-2007) Schibsted Søk AS
+/* Copyright (2006-2008) Schibsted Søk AS
* This file is part of SESAT.
*
* SESAT is free software: you can redistribute it and/or modify
@@ -13,9 +13,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with SESAT. If not, see <http://www.gnu.org/licenses/>.
-
- */
-/*
+ *
* AbstractImportVelocityTemplateTag.java
*
* Created on May 26, 2006, 3:17 PM
@@ -35,10 +33,14 @@
import javax.servlet.jsp.tagext.JspFragment;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import no.sesat.search.datamodel.DataModel;
+import no.sesat.search.datamodel.generic.StringDataObject;
import no.sesat.search.http.filters.SiteLocatorFilter;
+import no.sesat.search.run.RunningQueryImpl;
import no.sesat.search.site.Site;
import no.sesat.search.site.config.SiteConfiguration;
import no.sesat.search.site.config.TextMessages;
+import no.sesat.search.view.config.SearchTab;
+import no.sesat.search.view.config.SearchTab.Layout;
import no.sesat.search.view.velocity.VelocityEngineFactory;
import org.apache.log4j.Logger;
import org.apache.velocity.Template;
@@ -75,6 +77,24 @@
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
+
+ /** Find (and initialise into the PageContext) the layout this request is
to use.
+ *
+ * @param datamodel
+ * @return
+ */
+ protected final Layout findLayout(final DataModel datamodel){
+
+ final PageContext cxt = (PageContext) getJspContext();
+ final SearchTab tab = datamodel.getPage().getCurrentTab();
+ final StringDataObject layoutDO =
datamodel.getParameters().getValue(RunningQueryImpl.PARAM_LAYOUT);
+ final Layout layout = null != cxt.getAttribute("layout") ?
(Layout)cxt.getAttribute("layout") : null != layoutDO
+ ? tab.getLayouts().get(layoutDO.getXmlEscaped())
+ : tab.getDefaultLayout();
+ cxt.setAttribute("layout", layout);
+ return layout;
+ }
+
protected final Site getSiteManually(final PageContext cxt) {
Site site = null;
try {
Modified:
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/SearchTabIncludeTag.java
===================================================================
---
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/SearchTabIncludeTag.java
2008-01-31 12:51:26 UTC (rev 6071)
+++
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/SearchTabIncludeTag.java
2008-01-31 13:21:08 UTC (rev 6072)
@@ -1,4 +1,4 @@
-/* Copyright (2006-2007) Schibsted Søk AS
+/* Copyright (2006-2008) Schibsted Søk AS
* This file is part of SESAT.
*
* SESAT is free software: you can redistribute it and/or modify
@@ -13,9 +13,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with SESAT. If not, see <http://www.gnu.org/licenses/>.
-
- */
-/*
+ *
* ImportSearchTabIncludeTag.java
*
* Created on May 26, 2006, 3:17 PM
@@ -68,6 +66,7 @@
/**
* Setter for the template attribute.
+ * @param include
*/
public void setInclude(final String include) {
this.include = include;
@@ -76,18 +75,14 @@
/**Called by the container to invoke this tag.
* The implementation of this method is provided by the tag library
developer,
* and handles all tag processing, body iteration, etc.
+ * @throws javax.servlet.jsp.JspException
+ * @throws java.io.IOException
*/
@Override
public void doTag() throws JspException, IOException {
final PageContext cxt = (PageContext) getJspContext();
- final DataModel datamodel = (DataModel)
cxt.findAttribute(DataModel.KEY);
- final SearchTab tab = datamodel.getPage().getCurrentTab();
- final StringDataObject layoutDO =
datamodel.getParameters().getValue(RunningQueryImpl.PARAM_LAYOUT);
- final Layout layout = null != cxt.getAttribute("layout") ?
(Layout)cxt.getAttribute("layout") : null != layoutDO
- ? tab.getLayouts().get(layoutDO.getXmlEscaped())
- : tab.getDefaultLayout();
- cxt.setAttribute("layout", layout);
+ final Layout layout = findLayout((DataModel)
cxt.findAttribute(DataModel.KEY));
if(null != layout.getInclude(include) &&
layout.getInclude(include).length() > 0 ){
Modified:
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/SearchTabMainTag.java
===================================================================
---
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/SearchTabMainTag.java
2008-01-31 12:51:26 UTC (rev 6071)
+++
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/SearchTabMainTag.java
2008-01-31 13:21:08 UTC (rev 6072)
@@ -1,4 +1,4 @@
-/* Copyright (2006-2007) Schibsted Søk AS
+/* Copyright (2006-2008) Schibsted Søk AS
* This file is part of SESAT.
*
* SESAT is free software: you can redistribute it and/or modify
@@ -77,12 +77,7 @@
final PageContext cxt = (PageContext) getJspContext();
final DataModel datamodel = (DataModel)
cxt.findAttribute(DataModel.KEY);
- final SearchTab tab = datamodel.getPage().getCurrentTab();
- final StringDataObject layoutDO =
datamodel.getParameters().getValue(RunningQueryImpl.PARAM_LAYOUT);
- final Layout layout = null != cxt.getAttribute("layout") ?
(Layout)cxt.getAttribute("layout") : null != layoutDO
- ? tab.getLayouts().get(layoutDO.getXmlEscaped())
- : tab.getDefaultLayout();
- cxt.setAttribute("layout", layout);
+ final Layout layout = findLayout(datamodel);
final String front = null != layout.getFront() && 0 <
layout.getFront().length()
? layout.getFront()
Modified:
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/VelocityTemplateTag.java
===================================================================
---
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/VelocityTemplateTag.java
2008-01-31 12:51:26 UTC (rev 6071)
+++
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/VelocityTemplateTag.java
2008-01-31 13:21:08 UTC (rev 6072)
@@ -1,4 +1,4 @@
-/* Copyright (2006-2007) Schibsted Søk AS
+/* Copyright (2006-2008) Schibsted Søk AS
* This file is part of SESAT.
*
* SESAT is free software: you can redistribute it and/or modify
@@ -13,9 +13,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with SESAT. If not, see <http://www.gnu.org/licenses/>.
-
- */
-/*
+ *
* ImportVelocityTemplateTag.java
*
* Created on May 26, 2006, 3:17 PM
@@ -26,6 +24,8 @@
import java.util.HashMap;
import java.util.Map;
import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import no.sesat.search.datamodel.DataModel;
import org.apache.log4j.Logger;
@@ -65,10 +65,12 @@
/**Called by the container to invoke this tag.
* The implementation of this method is provided by the tag library
developer,
* and handles all tag processing, body iteration, etc.
+ * @throws javax.servlet.jsp.JspException
*/
@Override
public void doTag() throws JspException {
+
findLayout((DataModel)((PageContext)getJspContext()).findAttribute(DataModel.KEY));
final Map<String,Object> map = new HashMap<String,Object>();
map.put("commandName", command != null ? command : this.template);
importTemplate(this.template, map);
@@ -77,6 +79,7 @@
/**
* Setter for the template attribute.
+ * @param value
*/
public void setTemplate(final String value) {
this.template = value;
@@ -84,6 +87,7 @@
/**
* Setter for the command attribute.
+ * @param value
*/
public void setCommand(final String value) {
this.command = value;
Property changes on:
branches/2.16/war/src/main/java/no/sesat/search/view/taglib/VelocityTemplateTag.java
___________________________________________________________________
Name: svn:keywords
+ Id
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits