Author: sshyrkov
Date: Thu Nov 8 11:41:54 2007
New Revision: 19071
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D19071&repname=
=3Djahia
Log:
1) Added beans for the jahia include tag lookup operations
2) New tag used for inserting Jahia top menu toolbar (<h:topbar/>)
Added:
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/In=
cludesBean.java
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/Lo=
okupBaseBean.java
Modified:
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/Ja=
hiaBean.java
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/Te=
mplatePathResolverBean.java
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/We=
bPathResolverBean.java
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/engines/Engin=
eRenderer.java
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/var/shared_te=
mplates/basic.jar
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/var/shared_te=
mplates/custom_v1.jar
Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans=
/IncludesBean.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/IncludesBean.java&re=
v=3D19071&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/In=
cludesBean.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/In=
cludesBean.java Thu Nov 8 11:41:54 2007
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2002-2007 Jahia Ltd
+ *
+ * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (J=
CDDL), =
+ * Version 1.0 (the "License"), or (at your option) any later version; you=
may =
+ * not use this file except in compliance with the License. You should hav=
e =
+ * received a copy of the License along with this program; if not, you may=
obtain =
+ * a copy of the License at =
+ *
+ * http://www.jahia.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software =
+ * distributed under the License is distributed on an "AS IS" BASIS, =
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied=
. =
+ * See the License for the specific language governing permissions and =
+ * limitations under the License.
+ */
+package org.jahia.data.beans;
+
+import org.jahia.params.ProcessingContext;
+
+/**
+ * Proxy class for resolving templates and Web resources path considering
+ * template set inheritance introduced with the Jahia Include Tag.
+ * =
+ * @author Sergiy Shyrkov
+ */
+public class IncludesBean {
+
+ private TemplatePathResolverBean templatePathResolver;
+
+ private WebPathResolverBean webPathResolver;
+
+ IncludesBean(final ProcessingContext processingContext) {
+ templatePathResolver =3D new TemplatePathResolverBean(processingCo=
ntext
+ .getSite().getTemplatePackageName());
+ webPathResolver =3D new WebPathResolverBean(processingContext.getS=
ite()
+ .getTemplatePackageName(), processingContext.getContextPat=
h());
+ }
+
+ public TemplatePathResolverBean getTemplatePath() {
+ return templatePathResolver;
+ }
+
+ public WebPathResolverBean getWebPath() {
+ return webPathResolver;
+ }
+}
Modified: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/be=
ans/JahiaBean.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-INCLUD=
E-TAG-BRANCH/core/src/java/org/jahia/data/beans/JahiaBean.java&rev=3D19071&=
repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/Ja=
hiaBean.java (original)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/Ja=
hiaBean.java Thu Nov 8 11:41:54 2007
@@ -16,6 +16,7 @@
* limitations under the License.
*/package org.jahia.data.beans;
=
+import org.apache.log4j.Logger;
import org.jahia.exceptions.JahiaException;
import org.jahia.params.ProcessingContext;
import org.jahia.registries.ServicesRegistry;
@@ -32,18 +33,17 @@
=
public class JahiaBean {
=
- private static final org.apache.log4j.Logger logger =3D
- org.apache.log4j.Logger.getLogger(JahiaBean.class);
+ private static final Logger logger =3D Logger.getLogger(JahiaBean.clas=
s);
=
private ProcessingContext processingContext;
-
- public JahiaBean() {
- }
-
+ =
+ private IncludesBean includesBean;
+ =
public JahiaBean(final ProcessingContext processingContext) {
this.processingContext =3D processingContext;
+ includesBean =3D new IncludesBean(processingContext);
}
-
+ =
public SiteBean getSite(final String name) {
try {
final JahiaSite jahiaSite =3D ServicesRegistry.getInstance().g=
etJahiaSitesService().getSite(name);
@@ -53,4 +53,8 @@
return null;
}
}
+
+ public IncludesBean getIncludes() {
+ return includesBean;
+ }
}
\ No newline at end of file
Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans=
/LookupBaseBean.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/LookupBaseBean.java&=
rev=3D19071&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/Lo=
okupBaseBean.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/Lo=
okupBaseBean.java Thu Nov 8 11:41:54 2007
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2002-2007 Jahia Ltd
+ *
+ * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (J=
CDDL), =
+ * Version 1.0 (the "License"), or (at your option) any later version; you=
may =
+ * not use this file except in compliance with the License. You should hav=
e =
+ * received a copy of the License along with this program; if not, you may=
obtain =
+ * a copy of the License at =
+ *
+ * http://www.jahia.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software =
+ * distributed under the License is distributed on an "AS IS" BASIS, =
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied=
. =
+ * See the License for the specific language governing permissions and =
+ * limitations under the License.
+ */
+package org.jahia.data.beans;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Acts as a proxy for calling single argument methods from the JSP scope.
+ * =
+ * @author Sergiy Shyrkov
+ */
+abstract class LookupBaseBean implements Map {
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+
+ }
+
+ public boolean containsKey(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean containsValue(Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set entrySet() {
+ throw new UnsupportedOperationException();
+ }
+
+ public abstract Object get(Object key);
+
+ public boolean isEmpty() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set keySet() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object put(Object arg0, Object arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void putAll(Map arg0) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int size() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection values() {
+ throw new UnsupportedOperationException();
+ }
+}
Modified: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/be=
ans/TemplatePathResolverBean.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-INCLUD=
E-TAG-BRANCH/core/src/java/org/jahia/data/beans/TemplatePathResolverBean.ja=
va&rev=3D19071&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/Te=
mplatePathResolverBean.java (original)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/Te=
mplatePathResolverBean.java Thu Nov 8 11:41:54 2007
@@ -17,10 +17,6 @@
*/
package org.jahia.data.beans;
=
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
import org.jahia.registries.ServicesRegistry;
import org.jahia.services.templates.JahiaTemplateManagerService;
=
@@ -39,7 +35,7 @@
* =
* In one of our templates we make a call to this tag as follows:
* ...
- * ${templatePathResolver['common/header.jsp']}
+ * ${jahia.includes.templatePath['common/header.jsp']}
* ...
* =
* The result will be as follows, if:
@@ -59,7 +55,7 @@
* @author Sergiy Shyrkov
* @see JahiaTemplateManagerService
*/
-public class TemplatePathResolverBean implements Map {
+public class TemplatePathResolverBean extends LookupBaseBean {
=
public static final String REQUEST_ATTRIBUTE_NAME =3D "templatePathLoo=
kup";
=
@@ -76,23 +72,6 @@
this.templatePackageName =3D currentTemplatePackageName;
}
=
- public void clear() {
- throw new UnsupportedOperationException();
-
- }
-
- public boolean containsKey(Object key) {
- throw new UnsupportedOperationException();
- }
-
- public boolean containsValue(Object value) {
- throw new UnsupportedOperationException();
- }
-
- public Set entrySet() {
- throw new UnsupportedOperationException();
- }
-
/**
* Resolves the specified path (which is related to the root folder of=
the
* template set) into the actual path, considering template set inheri=
tance.
@@ -109,27 +88,6 @@
return resolvedPath !=3D null ? resolvedPath : path;
}
=
- public boolean isEmpty() {
- throw new UnsupportedOperationException();
- }
-
- public Set keySet() {
- throw new UnsupportedOperationException();
- }
-
- public Object put(Object arg0, Object arg1) {
- throw new UnsupportedOperationException();
- }
-
- public void putAll(Map arg0) {
- throw new UnsupportedOperationException();
-
- }
-
- public Object remove(Object key) {
- throw new UnsupportedOperationException();
- }
-
/**
* Resolves the specified path (which is related to the root folder of=
the
* template set) into the actual path, considering template set inheri=
tance.
@@ -143,12 +101,4 @@
return ServicesRegistry.getInstance().getJahiaTemplateManagerServi=
ce()
.resolveResourcePath(path, templatePackageName);
}
-
- public int size() {
- throw new UnsupportedOperationException();
- }
-
- public Collection values() {
- throw new UnsupportedOperationException();
- }
}
Modified: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/be=
ans/WebPathResolverBean.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-INCLUD=
E-TAG-BRANCH/core/src/java/org/jahia/data/beans/WebPathResolverBean.java&re=
v=3D19071&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/We=
bPathResolverBean.java (original)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/data/beans/We=
bPathResolverBean.java Thu Nov 8 11:41:54 2007
@@ -35,7 +35,7 @@
* =
* In one of our templates we make a call to this tag as follows:
* ...
- * <img src=3D"${webPathResolver['common/logo.gif']}&qu=
ot; alt=3D"logo"/>
+ * <img src=3D"${jahia.includes.webPath['common/logo.gi=
f']}" alt=3D"logo"/>
* ...
* =
* The result will be as follows, if:
Modified: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/engines=
/EngineRenderer.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-INCLUD=
E-TAG-BRANCH/core/src/java/org/jahia/engines/EngineRenderer.java&rev=3D1907=
1&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/engines/Engin=
eRenderer.java (original)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/engines/Engin=
eRenderer.java Thu Nov 8 11:41:54 2007
@@ -148,19 +148,13 @@
}
request.setAttribute ("currentSite",
new SiteBean (jParams.getSite (), jParams));
- request.setAttribute ("currentJahia", new JahiaBean (jParams));
+ JahiaBean jahiaBean =3D new JahiaBean(jParams);
+ request.setAttribute ("currentJahia", jahiaBean);
request.setAttribute ("currentUser", jParams.getUser ());
request.setAttribute ("currentRequest",
new RequestBean (new GuiBean (jParams), jParams));
=
- request.setAttribute(
- TemplatePathResolverBean.REQUEST_ATTRIBUTE_NAME,
- new TemplatePathResolverBean(jParams.getSite()
- .getTemplatePackageName()));
- request.setAttribute(WebPathResolverBean.REQUEST_ATTRIBUTE_NAM=
E,
- new WebPathResolverBean(jParams.getSite()
- .getTemplatePackageName(), jParams.getRequest()
- .getContextPath()));
+ request.setAttribute("jahia", jahiaBean);
=
boolean isIE =3D false;
final String userAgent =3D jParams.getRequest ().getHeader ("u=
ser-agent");
Modified: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/var/sha=
red_templates/basic.jar
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-INCLUD=
E-TAG-BRANCH/core/src/webapp/WEB-INF/var/shared_templates/basic.jar&rev=3D1=
9071&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Binary files - no diff available.
Modified: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/var/sha=
red_templates/custom_v1.jar
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-INCLUD=
E-TAG-BRANCH/core/src/webapp/WEB-INF/var/shared_templates/custom_v1.jar&rev=
=3D19071&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Binary files - no diff available.
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list