[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: attribute urlopts in navbar doesn't seem to work



On Thu, Oct 25, 2001 at 05:20:54PM +0200, Werner Heuser wrote:
> Hi,
> 
> I would like to use the urlopts feature as follows:
> <navbar:button url="index.html" id=index urlopts="title=titletest"
> hint="MobiliX Start Page" txt="MobiliX">
> but I can't get it to work. The title tag doesn't occur in the 
> rendered HTML code. I have tried to quote it (
> urlopts="title=\"titletest\"" ),
> but this doesn't help. Do you have any recommendations?

Huh?  It is indeed documented, but not implemented, sorry.
I will instead propose another scheme, with generic attributes:

  <navbar:button url="index.html" id=index :a:title="titletest"
  hint="MobiliX Start Page" txt="MobiliX">

You need to apply attached patch against wml::des::navbar

-- 
Denis Barbier
WML Maintainer
Index: navbar.src
===================================================================
RCS file: /home/barbier/Projets/Wml/cvs/wml/wml_include/des/navbar.src,v
retrieving revision 1.39
diff -u -u -r1.39 navbar.src
--- navbar.src	2001/06/18 23:34:03	1.39
+++ navbar.src	2001/10/25 21:20:29
@@ -180,7 +180,7 @@
 #
 <set-var __buttoncnt=1 />
 <define-tag navbar:button>
-<preserve id alias txt alt img hint url target urlopts menu />
+<preserve id alias txt alt img hint url target menu />
 <set-var %attributes />
 <increment __countbuttons />
 <if <get-var alias /> <set-var id= /> />
@@ -193,6 +193,7 @@
     <set-var alias="_nav_" /> />
 <subst-in-var id "[^a-zA-Z0-9]" "_" />
 <subst-in-var alias "[^a-zA-Z0-9]" "_" />
+
 <perl>
 {
     my $B = {};
@@ -206,11 +207,30 @@
     $B->{HINT}   = qq|<get-var hint />|;
     $B->{URL}    = '<get-var url />';
     $B->{TARGET} = '<get-var target />';
-    $B->{URLOPTS}= '<get-var urlopts />';
     $B->{MENU}   = '<get-var menu />';
+
+    my %tag_attr<get-var id /> = ();
+<set-var __list_tags="a\nimg" />
+<set-var __list_sel="N\nS\nSS" />
+<foreach __tag __list_tags>
+  <set-var __nb_attr=<attributes-quote <attributes-extract
+        :<get-var __tag />:(.*) %attributes /> /> />
+  <foreach __sel __list_sel>
+    $tag_attr<get-var id />{'<get-var __tag /><get-var __sel />'} =  qq(<or
+      <attributes-quote <attributes-extract
+          :<get-var __tag />\\.<get-var __sel />:(.*) %attributes /> />
+      <get-var __nb_attr /> />);
+  </foreach>
+</foreach>
+    #   Perform some clean ups
+    foreach my $key (keys %tag_attr<get-var id />) {
+        $tag_attr<get-var id />{$key} =~ s/^\s*/ /;
+        delete $tag_attr<get-var id />{$key} if $tag_attr<get-var id />{$key} =~ m/^\s*$/;
+    }
+    $B->{TAG_ATTR}= \%tag_attr<get-var id />;
 }
 </perl>
-<restore  id alias txt alt img hint url target urlopts menu />
+<restore  id alias txt alt img hint url target menu />
 </define-tag>
 
 #   this is a special case since its body can contain any Perl
@@ -346,7 +366,6 @@
     my @imgstar  = split(':', $CFG->{IMGSTAR});
     my $imgbase  = $CFG->{IMGBASE};
     my $urlbase  = $CFG->{URLBASE};
-    my $urlopts  = $CFG->{URLOPTS};
     $txtcol_n    = $CFG->{TXTCOL_N} if $txtcol_n eq '';
     $txtcol_s    = $CFG->{TXTCOL_S} if $txtcol_s eq '';
     my $filter   = $CFG->{FILTER};
@@ -400,6 +419,7 @@
         my $target = ($B->{TARGET} eq '' ? $CFG->{TARGET} : $B->{TARGET});
         my $hint   = $B->{HINT};
         my $menu   = $B->{MENU};
+        my %extra_attr = %{$B->{TAG_ATTR}};
 
         my $idselect = ($select eq $id or ($select eq $alias and $alias ne '') ? 1 : 0);
         my $buttontype = 'N';
@@ -487,8 +507,7 @@
                           qq# onfocus="self.status = '$hint'; return true"# .
                           qq# onblur="self.status = ''; return true"#;
                 }
-                $O .= '<*a href="'.$url.'"'.$target.$js.$tag_attr{'a'.$buttontype}.'>'.
-                      $txt.'<*/a>';
+                $O .= '<*a href="'.$url.'"'.$target.$js.$tag_attr{'a'.$buttontype}.$extra_attr{'a'.$buttontype}.'>'.$txt.'<*/a>';
             }
         }
         else {
@@ -919,13 +938,6 @@
 =item target=I<STR>
 
 A target frame or window where the hyperlink is redirected to.
-
-=item urlopts=I<STR>
-
-With HTML 4.0, hyper-text links accept a wide range of attributes, This
-attribute deprecate B<target> which must be coded
-
-     urlopts="target=name"
 
 =item menu=I<STR>