cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r124364 - /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java
Date Thu, 06 Jan 2005 11:28:56 GMT
Author: cziegeler
Date: Thu Jan  6 03:28:54 2005
New Revision: 124364

URL: http://svn.apache.org/viewcvs?view=rev&rev=124364
Log:
Support for self as target
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java?view=diff&rev=124364&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java&r1=124363&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java&r2=124364
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java
Thu Jan  6 03:28:54 2005
@@ -105,6 +105,9 @@
     /** The prefix */
     protected String prefix;
 
+    /** Handle target self as no target? */
+    protected boolean ignoreTargetSelf;
+    
     /**
      * @see AbstractTransformer#setup(SourceResolver, Map, String, Parameters)
      */
@@ -113,6 +116,8 @@
                       String src,
                       Parameters par)
     throws ProcessingException, SAXException, IOException {
+        this.ignoreTargetSelf = par.getParameterAsBoolean("ignore-target-self", false);
+        
         this.copletInstanceData =
             ProxyTransformer.getInstanceData(
                 this.manager,
@@ -183,14 +188,14 @@
         } else if ("link".equalsIgnoreCase(name)) {
             handleTag("href", uri, name, raw, attributes, false, false);
         } else if ("a".equalsIgnoreCase(name)) {
-            handleTag(
-                "href",
-                uri,
-                name,
-                raw,
-                attributes,
-                true,
-                (attributes.getIndex("target") > -1));
+            boolean direct;
+            final String v = attributes.getValue("target");
+            if ( v == null || (this.ignoreTargetSelf && v.equals("self")) ) {
+                direct = false;
+            } else {
+                direct = true;
+            }
+            handleTag("href", uri, name, raw, attributes, true, direct);
         } else if ("menu-item".equalsIgnoreCase(name)) {
             handleTag("href", uri, name, raw, attributes, true, false);
         } else if ("input".equalsIgnoreCase(name)) {
@@ -277,7 +282,14 @@
             || remoteURI.startsWith("mailto:")) {
             super.startElement(uri, elementName, raw, attributes);
         } else {
-            if (attributes.getIndex("target") > -1 || direct) {
+            boolean evalTarget;
+            final String v = attributes.getValue("target");
+            if ( v == null || (this.ignoreTargetSelf && v.equals("self")) ) {
+                evalTarget = false;
+            } else {
+                evalTarget = true;
+            }
+            if (evalTarget || direct) {
                 try {
                     remoteURI =
                         ProxyTransformer.resolveURI(remoteURI, documentBase);

Mime
View raw message