[trean] Open links in new windows

Hubert Yeh cwyeh@pest.yichi.org
Wed Oct 9 18:22:35 2002


This is a multi-part message in MIME format.

---------------------- multipart/mixed attachment
Hi, all:

   I have just made some minor changes in templates files in order to make
users can choose to open their bookmark links in new windows or not. I'm
afraid my changes might break the coding style of Mike's. Anyway, enjoys it
if you need that. :)

  BTW, since I'm not sure if users will wish to open all links in single
window but not horde's, I would like to know if this option is necessary.
Any suggestion is welcome. :)

BR
Chih-Wei Yeh

---------------------- multipart/mixed attachment
diff -ruN trean/config/prefs.php.dist trean.new/config/prefs.php.dist=0A=
--- trean/config/prefs.php.dist	Fri Aug 30 14:36:24 2002=0A=
+++ trean.new/config/prefs.php.dist	Thu Oct 10 01:03:48 2002=0A=
@@ -54,3 +54,12 @@=0A=
     'type' =3D> 'checkbox',=0A=
     'desc' =3D> _("Display edit buttons when displaying Bookmarks?")=0A=
 );=0A=
+=0A=
+// Open links in new windows?=0A=
+$_prefs['show_in_new_window'] =3D array(=0A=
+    'value' =3D> 1,=0A=
+    'locked' =3D> false,=0A=
+    'shared' =3D> false,=0A=
+    'type' =3D> 'checkbox',=0A=
+    'desc' =3D> _("Open links in new windows")=0A=
+);=0A=
diff -ruN trean/templates/bookmark/1line.inc =
trean.new/templates/bookmark/1line.inc=0A=
--- trean/templates/bookmark/1line.inc	Tue Aug 27 00:11:36 2002=0A=
+++ trean.new/templates/bookmark/1line.inc	Thu Oct 10 01:00:41 2002=0A=
@@ -4,7 +4,13 @@=0A=
         <?php echo Horde::img('protocol/' . $protocol . '.png'); =
?>&nbsp;=0A=
     </td>=0A=
     <td width=3D"100%">=0A=
-        &nbsp; <?php echo Horde::link($url, $name) ?><?php echo $name =
?></a><?php echo (empty($description) ? '' : ' - ') . $description ?>=0A=
+        &nbsp; =0A=
+<?php if ($prefs->getValue('show_in_new_window') =3D=3D '1'): ?>=0A=
+   <?php echo Horde::link($url, $name, '', $url . time()) ?>=0A=
+<?php else: ?>=0A=
+   <?php echo Horde::link($url, $name) ?>=0A=
+<?php endif; ?>=0A=
+<?php echo $name ?></a><?php echo (empty($description) ? '' : ' - ') . =
$description ?>=0A=
     </td>=0A=
 </tr>=0A=
 </table>=0A=
diff -ruN trean/templates/bookmark/2line.inc =
trean.new/templates/bookmark/2line.inc=0A=
--- trean/templates/bookmark/2line.inc	Mon Aug 26 12:10:01 2002=0A=
+++ trean.new/templates/bookmark/2line.inc	Thu Oct 10 01:01:02 2002=0A=
@@ -4,7 +4,13 @@=0A=
         <?php echo Horde::img('protocol/' . $protocol . '.png'); =
?>&nbsp;=0A=
     </td>=0A=
     <td width=3D"100%">=0A=
-        &nbsp; <?php echo Horde::link($url, $name) ?><?php echo $name =
?> <span class=3D'small'>(<?php echo $url ?>)</span></a>=0A=
+        &nbsp; =0A=
+<?php if ($prefs->getValue('show_in_new_window') =3D=3D '1'): ?>=0A=
+   <?php echo Horde::link($url, $name, '', $url . time()) ?>=0A=
+<?php else: ?>=0A=
+   <?php echo Horde::link($url, $name) ?>=0A=
+<?php endif; ?>=0A=
+<?php echo $name ?> <span class=3D'small'>(<?php echo $url =
?>)</span></a>=0A=
         <br/> &nbsp; &nbsp; <?php echo $description ?>=0A=
     </td>=0A=
 </tr>=0A=
diff -ruN trean/templates/bookmark/standard.inc =
trean.new/templates/bookmark/standard.inc=0A=
--- trean/templates/bookmark/standard.inc	Fri Aug 30 14:36:25 2002=0A=
+++ trean.new/templates/bookmark/standard.inc	Thu Oct 10 00:59:13 2002=0A=
@@ -31,7 +31,13 @@=0A=
 <?php endif; ?>=0A=
 <tr>=0A=
     <td width=3D"100%" style=3D"white-space:normal">=0A=
-        &nbsp; &nbsp; <?php echo Horde::link($url, $name) ?><?php echo =
(strlen($url) > 40) ? substr($url,0, 40) . '...': $url ?></a>=0A=
+        &nbsp; &nbsp; =0A=
+<?php if ($prefs->getValue('show_in_new_window') =3D=3D '1'): ?>=0A=
+   <?php echo Horde::link($url, $name, '', $url . time()) ?>=0A=
+<?php else: ?>=0A=
+   <?php echo Horde::link($url, $name) ?>=0A=
+<?php endif; ?>=0A=
+<?php echo (strlen($url) > 40) ? substr($url,0, 40) . '...': $url ?></a>=0A=
     </td>=0A=
 </tr>=0A=
 </table>=0A=

---------------------- multipart/mixed attachment--