Item11141: 2.4.5 adds unwanted link to %ACTION%

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: ActionTrackerPlugin
Branches:
Reported By: TarekUnger
Waiting For:
Last Change By: CrawfordCurrie
In Version 2.4.5 the behavior of the %ACTION% Macro changed if you use the $link in the format specification. Versions prior to 2.4.5 doesn't render it in %ACTION% (only in %ACTIONSEARCH%, where it should be).

ActionTrackerPlugin 2.4.4:
2011-09-22 093605.jpg

ActionTrackerPlugin 2.4.5:
2011-09-22 093425.jpg

It's useless in the Macro, because it links to itself (and it's ugly).

The Problem is the Action.pm module in ActionTrackerPlugin library. I don't know why you added the following lines to the _formatField_link method, but you should remove it, or do something against the rendering in the %ACTION% Macro

--- 2_4_4_Action.pm    Wed May 18 19:52:08 2011
+++ 2_4_5_Action.pm    Thu May 26 19:32:50 2011
@@ -846,6 +846,10 @@
              )
            );
          $text .= $jump;
+    } else {
+    $text = Foswiki::Func::getViewUrl( $this->{web}, $this->{topic} )
+                  . '#'
+                  . $this->getAnchor();
      }
      return $text;
  }

-- TarekUnger - 22 Sep 2011

In previous releases the link was rendered as an image target (like a little shield image). This conditional in Action.PM seems to be the problem:
    if ( $asHTML && defined($type) && $type eq 'href' ) {
It is evaluating as false and consequently it is rendering the link as text instead of the nice little icon. If you change this line to read like this:
     if ( $asHTML && defined($type) && ($type eq 'name' || $type eq 'href') ) {
Then it will render the shield image in both places (which I think is the desired behavior). No comment on why the link was added as a default in the %ACTION% macro... I assume this is probably templated somewhere. Maybe a developer can comment on why this changed...

-- JamesPeverill - 23 Sep 2011

I'm not at all clear what the problem is here. I just ran up the ATP, 2.4.5, default installation, and it's working just fine. Have you modified/customised the action template?

FYI the link should render to a target icon, in both action searches and in action views. The reason it is rendered in an action view is so that when the page is frozen (snapshotted by, for example, PublishPlugin) then the link is still present and the static page can still be used to get to the original action. So Tarek's analysis is closer to the mark but what I don't understand why the link is rendered as plain text rather than an image.

-- CrawfordCurrie - 24 Sep 2011

l8r - after a bit of experimentation I see the problem. The ideas above address the symptom, but not the cause, unfortunately, but the following patch fixes it.
Index: lib/Foswiki/Plugins/ActionTrackerPlugin.pm
===================================================================
--- lib/Foswiki/Plugins/ActionTrackerPlugin.pm   (revision 12575)
+++ lib/Foswiki/Plugins/ActionTrackerPlugin.pm   (working copy)
@@ -68,7 +68,7 @@
             if ($actionGroup) {
                 $text .=
           $actionGroup->formatAsHTML(
-         $defaultFormat, 'name', 'atpDef' );
+         $defaultFormat, 'href', 'atpDef' );
                 $actionGroup = undef;
             }
             $text .= $entry;
@@ -76,7 +76,7 @@
     }
     if ($actionGroup) {
         $text .=
-       $actionGroup->formatAsHTML( $defaultFormat, 'name', 'atpDef' );
+       $actionGroup->formatAsHTML( $defaultFormat, 'href', 'atpDef' );
     }
 
     $_[0] = $text;

I'll upload an update in the next day or so.

-- CrawfordCurrie - 24 Sep 2011

Thanks for the fast respond.
Now you render the target icon in the ACTION Macro. That was not my intention.

The Problem is the rendering by itself. As i described above. Versions before 2.4.5 doesn't render the $link at all (Nether as icon or as link) in the ACTION Macro (Shown in the first picture). It's useless, because the link go to itself.

Conclusion:
  • Render the $link in %ACTIONSEARCH% (and other places?)
  • Don't render the $link in %ACTION%, ignore the variable (behavior before 2.4.5)

-- TarekUnger - 26 Sep 2011

No. Rendering the link in the %ACTION% presentation was a requirement, as I explained above.

-- CrawfordCurrie - 26 Sep 2011
 

ItemTemplate edit

Summary 2.4.5 adds unwanted link to %ACTION%
ReportedBy TarekUnger
Codebase 1.1.3
SVN Range
AppliesTo Extension
Component ActionTrackerPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins ActionTrackerPlugin:0dc8e1e61219
TargetRelease n/a
ReleasedIn n/a
Topic revision: r6 - 26 Sep 2011, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy