]> git.imager.perl.org - bse.git/blobdiff - site/cgi-bin/modules/BSE/Dynamic/Article.pm
various changes to make URLs more context sensitive:
[bse.git] / site / cgi-bin / modules / BSE / Dynamic / Article.pm
index fcce86923cbbfe7c0b6bc0ec29d6e22e2451194c..a98c9b6555c0a7f94e38370ab640c5eb6760252d 100644 (file)
@@ -53,6 +53,7 @@ sub tags {
      dynmoveallkid => 
      [ tag_dynmove => $self, \$allkid_index, \$allkid_data, 
        "stepparent=$article->{id}" ],
+     url => [ tag_url => $self, $article ],
     );
 }
 
@@ -160,6 +161,22 @@ sub tag_dynmove {
   return make_arrows($self->{req}->cfg, $down_url, $up_url, $refresh_to, $img_prefix);
 }
 
+sub tag_url {
+  my ($self, $article, $name, $acts, $func, $templater) = @_;
+
+  my $item = $self->{admin} ? 'admin' : 'link';
+  my $article = $self->{req}->get_article($name)
+    or return "** unknown article $name **";
+
+  my $value = $article->{$item};
+
+  if ($article->{$item} =~ /^\w+:/ && $value !~ /^\w+:/) {
+    $value = $self->{req}->cfg->entryErr('site', 'url') . $value;
+  }
+  
+  return escape_html($value);
+}
+
 sub get_real_article {
   my ($self, $article) = @_;