phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: bookmarks import.php,1.17,1.17.2.1 maintain.php,


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: bookmarks import.php,1.17,1.17.2.1 maintain.php,1.26.2.1,1.26.2.2 tree.php,1.26,1.26.2.1 view.php,1.18,1.18.2.1
Date: Fri, 15 Nov 2002 05:34:25 -0500

Update of /cvsroot/phpgroupware/bookmarks
In directory subversions:/tmp/cvs-serv23114

Modified Files:
      Tag: Version-0_9_14-branch
        import.php maintain.php tree.php view.php 
Log Message:
various patches ... #569, #558, #547, #546, #561 ... thanks michael totschnig

Index: import.php
===================================================================
RCS file: /cvsroot/phpgroupware/bookmarks/import.php,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -C2 -r1.17 -r1.17.2.1
*** import.php  17 Nov 2001 02:51:36 -0000      1.17
--- import.php  15 Nov 2002 10:34:23 -0000      1.17.2.1
***************
*** 1,252 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare - Bookmarks                                                 *
!   * http://www.phpgroupware.org                                              *
!   * Based on Bookmarker Copyright (C) 1998  Padraic Renaghan                 *
!   *                     http://www.renaghan.com/bookmarker                   *
!   * --------------------------------------------                             *
!   *  This program is free software; you can redistribute it and/or modify it *
!   *  under the terms of the GNU General Public License as published by the   *
!   *  Free Software Foundation; either version 2 of the License, or (at your  *
!   *  option) any later version.                                              *
!   \**************************************************************************/
! 
!       /* $Id$ */
! 
!       $GLOBALS['phpgw_info']['flags'] = array(
!               'currentapp'               => 'bookmarks',
!               'enable_categories_class' => True
!       );
!       include('../header.inc.php');
!       $GLOBALS['phpgw']->bookmarks = createobject('bookmarks.bookmarks');
! 
!       // Uncomment the echo line to return debugging info
!       function _debug($s)
!       {
!               //echo $s;
!       }
! 
!       // possible enhancements:
!       //  give option, that if url already exists, update existing row
!       //  give option, to load from csv file
!       //  give option, to load all urls into unassigned unassigned
!       //  give option, to delete bookmarks,cat,subcat before import
! 
!       // find existing category matching name, or
!       // create a new one. return id.
!       function getCategory($name)
!       {
!               global $cat_cache, $catNext;
! 
!               $db = $GLOBALS['phpgw']->db;
! 
!               _debug('<br>Testing for category: ' . $name);
!      
!               if (! $name)
!               {
!                       $name = 'No category';
!               }
! 
!               if ($cat_cache[$name] && $cat_cache[$name] != 0)
!               {
!                       _debug(' - ' . $name . ' is already cached');
!                       return $cat_cache[$name];
!               }
!               else
!               {
!                       if 
($GLOBALS['phpgw']->categories->exists('mains',$name))
!                       {
!                               $cat_cache[$name] = 
$GLOBALS['phpgw']->categories->name2id($name);
!                               _debug(' - ' . $name . ' already exists - id: ' 
. $cat_cache[$name]);
!                       }
!                       else
!                       {
!                               $GLOBALS['phpgw']->categories->add(array(
!                                       'name'   => $name,
!                                       'descr'  => '',
!                                       'parent' => 0,
!                                       'access' => '',
!                                       'data'   => ''
!                               ));
!                               $cat_cache[$name] = 
$GLOBALS['phpgw']->categories->name2id($name);
!                               _debug(' - ' . $name . ' does not exist - new 
id: ' . $cat_cache[$name]);
!                       }
! 
!                       return $cat_cache[$name];
!               }
!       }
! 
!       # find existing subcategory matching name, or
!       # create a new one. return id.
!       function getSubCategory ($name)
!       {
!               /*     global $subcat,$subcatNext,$default_subcategory;
! 
!               $db = $GLOBALS['phpgw']->db;
!               $upperName = strtoupper($name);
! 
!               if (! $name) {
!                       $subcat[$upperName] = $default_subcategory;
!                       return $default_subcategory;
!               }
! 
!               if (isset($subcat[$upperName])) {
!                       return $subcat[$upperName];
!               } else {
!                       $q  = "INSERT INTO bookmarks_subcategory (name, 
username) ";
!                       $q .= "VALUES ('" . addslashes($name) . "', '" . 
$GLOBALS['phpgw_info']["user"]["account_id"] . "') ";
! 
!                       $db->query($q,__LINE__,__FILE__);
!                       if ($db->Errno != 0) {
!                               $error_msg .= "<br>Error adding subcategory 
".$name." - ".$subcatNext;
!                               return -1;
!                       }
! 
!                       $db->query("select id from bookmarks_subcategory where 
name='" . addslashes($name) . "' and username='"
!                       . $GLOBALS['phpgw_info']["user"]["account_id"] . 
"'",__LINE__,__FILE__);
!                       $db->next_record();
! 
!                       $subcat[$upperName] = $db->f("id");
!                       $subcatNext++;
!                       return $db->f("id");
!               } */
!       }
! 
!       $GLOBALS['phpgw']->template->set_file(array(
!               'common'   => 'common.tpl',
!               'body'     => 'import.body.tpl'
!       ));
!       set_standard("import", &$GLOBALS['phpgw']->template);
! 
!       if ($import)
!       {
!               _debug('<p><b>DEBUG OUTPUT:</b>');
!               _debug('<br>file: ' . $bkfile);
!               _debug('<br>file_name: ' . $bkfile_name);
!               _debug('<br>file_size: ' . $bkfile_size);
!               _debug('<br>file_type: ' . $bkfile_type . '<p><b>URLs:</b>');
!               _debug('<table border="1" width="100%">');
!               _debug('<tr><td>cat id</td> <td>sub id</td> <td>name</td> 
<td>url</td> <td>add date</td> <td>change date</td> <td>vist date</td></tr>');
! 
!               if (empty($bkfile) || $bkfile == "none")
!               {
!                       $error_msg .= "<br>Netscape bookmark filename is 
required!";
!                       break;
!               }
!               $default_rating = 0;
! 
!               $fd = @fopen($bkfile,'r');
!               if ($fd)
!               {
!                       $inserts = 0;
!                       $folder_index = -1;
!                       $cat_index = -1;
!                       $scat_index = -1;
!                       $bookmarker->url_format_check = 0;
!                       $bookmarker->url_responds_check = false;
!    
!                       while ($line = @fgets($fd, 2048))
!                       {
!                               // URLs are recognized by A HREF tags in the NS 
file.
!                               if (eregi('<A HREF="([^"]*)[^>]*>(.*)</A>', 
$line, $match))
!                               {
!                                       $url_parts = @parse_url($match[1]);
!                                       if ($url_parts[scheme] == 'http' || 
$url_parts[scheme] == 'https' || $url_parts[scheme] == 'ftp' || 
$url_parts[scheme] == 'news')
!                                       {
!                                               reset($folder_stack);
!                                               unset($error_msg);
!                                               $cid  = 
$GLOBALS['phpgw']->categories->name2id('No category');
!                                               $scid = 0;
!                                               $i    = 0;
!                                               $keyw = '';
! 
! //                                            echo '<br>test: ' . 
$folder_index;
! 
!                                               while ($i <= $folder_index)
!                                               {
!                                                       if ($i == 0)
!                                                       {
!                                                               $cid = 
getCategory($folder_name_stack[$i]);
!                                                               $cid = 
($cid?$cid:0);
!                                                       }
!                                                       elseif ($i == 1)
!                                                       {
!                                                               $scid = 
getSubCategory($folder_name_stack[$i]);
!                                                               $scid = 
($scid?$scid:0);
!                                                       }
! 
!                                                       $keyw .= ' ' . 
$folder_name_stack[$i];
!                                                       $i++;
!                                               }
!                                               $values['category'] = 
sprintf('%s|%s',$cid,$scid);
!                                               $values['url']      = $match[1];
!                                               $values['name']     = $match[2];
!                                               $values['rating']   = 0;
! 
!                                               
eregi('ADD_DATE="([^"]*)"',$line,$add_info);
!                                               
eregi('LAST_VISIT="([^"]*)"',$line,$vist_info);
!                                               
eregi('LAST_MODIFIED="([^"]*)"',$line,$change_info);
! 
!                                               $values['timestamps'] = 
sprintf('%s,%s,%s',$add_info[1],$vist_info[1],$change_info[1]);
! 
!                                               $bid = -1;
!                                               if (! 
$GLOBALS['phpgw']->bookmarks->add(&$bid, $values, True))
!                                               {
!                                                       print("<br>" . 
$error_msg . "\n");
!                                                       $all_errors .= 
$error_msg;
!                                               }
!                                               else
!                                               {
!                                                       $inserts++;
!                                               }
! 
!                                               _debug(sprintf("<tr><td>%s</td> 
<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> 
</tr>",$cid,$scid,$match[2],$match[1],$add_info[1],$change_info[1],$vist_info[1]));
!                                       }
!                               }
! 
!                               // folders start with the folder name inside an 
<H3> tag,
!                               // and end with the close </DL> tag.
!                               // we use a stack to keep track of where we are 
in the
!                               // folder hierarchy.
!                               elseif (eregi('<H3[^>]*>(.*)</H3>', $line, 
$match))
!                               {
!                                       $folder_index ++;
!                                       $id = -1;
! 
!                                       if ($folder_index == 0)
!                                       {
!                                               $cat_index ++;
!                                               $cat_array[$cat_index] = 
$match[1];
!                                               $id = $cat_index + $cat_start;
!                                       }
!                                       elseif ($folder_index == 1)
!                                       {
!                                               $scat_index ++;
!                                               $scat_array[$scat_index] = 
$match[1];
!                                               $id = $scat_index + $scat_start;
!                                       }
!                                       $folder_stack[$folder_index] = $id;
!                                       $folder_name_stack[$folder_index] = 
$match[1];
!                               }
!                               elseif (eregi('</DL>', $line))
!                               {
!                                       $folder_index-- ;
!                               }
!                       }
!                       @fclose($fd);
!                       _debug('</table>');
!               }
!               else
!               {
!                       $error_msg .= "<br>Unable to open temp file " . $bkfile 
. " for import.";
!               }
! 
!               unset($msg);
!               $msg .= sprintf("<br>%s bookmarks imported from %s 
successfully.", $inserts, $bkfile_name);
!               $error_msg = $all_errors;
! //            break;
!       }
! 
!       
$GLOBALS['phpgw']->template->set_var('FORM_ACTION',$GLOBALS['phpgw']->link('/bookmarks/import.php'));
!       $GLOBALS['phpgw']->common->phpgw_footer();
! ?>
--- 1,265 ----
! <?php
!   /**************************************************************************\
!   * phpGroupWare - Bookmarks                                                 *
!   * http://www.phpgroupware.org                                              *
!   * Based on Bookmarker Copyright (C) 1998  Padraic Renaghan                 *
!   *                     http://www.renaghan.com/bookmarker                   *
!   * --------------------------------------------                             *
!   *  This program is free software; you can redistribute it and/or modify it *
!   *  under the terms of the GNU General Public License as published by the   *
!   *  Free Software Foundation; either version 2 of the License, or (at your  *
!   *  option) any later version.                                              *
!   \**************************************************************************/
! 
!       /* $Id$ */
! 
!       $GLOBALS['phpgw_info']['flags'] = array(
!               'currentapp'               => 'bookmarks',
!               'enable_categories_class' => True
!       );
!       include('../header.inc.php');
!       $GLOBALS['phpgw']->bookmarks = createobject('bookmarks.bookmarks');
! 
!       // Uncomment the echo line to return debugging info
!       function _debug($s)
!       {
!               //echo $s;
!       }
! 
!       // possible enhancements:
!       //  give option, that if url already exists, update existing row
!       //  give option, to load from csv file
!       //  give option, to load all urls into unassigned unassigned
!       //  give option, to delete bookmarks,cat,subcat before import
! 
!       // find existing category matching name, or
!       // create a new one. return id.
!       function getCategory($name)
!       {
!               global $cat_cache, $catNext;
! 
!               $db = $GLOBALS['phpgw']->db;
! 
!               _debug('<br>Testing for category: ' . $name);
!      
!               if (! $name)
!               {
!                       $name = 'No category';
!               }
! 
!               if ($cat_cache[$name] && $cat_cache[$name] != 0)
!               {
!                       _debug(' - ' . $name . ' is already cached');
!                       return $cat_cache[$name];
!               }
!               else
!               {
!                       if 
($GLOBALS['phpgw']->categories->exists('mains',$name))
!                       {
!                               $cat_cache[$name] = 
$GLOBALS['phpgw']->categories->name2id($name);
!                               _debug(' - ' . $name . ' already exists - id: ' 
. $cat_cache[$name]);
!                       }
!                       else
!                       {
!                               $GLOBALS['phpgw']->categories->add(array(
!                                       'name'   => $name,
!                                       'descr'  => '',
!                                       'parent' => 0,
!                                       'access' => '',
!                                       'data'   => ''
!                               ));
!                               $cat_cache[$name] = 
$GLOBALS['phpgw']->categories->name2id($name);
!                               _debug(' - ' . $name . ' does not exist - new 
id: ' . $cat_cache[$name]);
!                       }
! 
!                       return $cat_cache[$name];
!               }
!       }
! 
!       # find existing subcategory matching name, or
!       # create a new one. return id.
!       function getSubCategory ($name)
!       {
!               /*     global $subcat,$subcatNext,$default_subcategory;
! 
!               $db = $GLOBALS['phpgw']->db;
!               $upperName = strtoupper($name);
! 
!               if (! $name) {
!                       $subcat[$upperName] = $default_subcategory;
!                       return $default_subcategory;
!               }
! 
!               if (isset($subcat[$upperName])) {
!                       return $subcat[$upperName];
!               } else {
!                       $q  = "INSERT INTO bookmarks_subcategory (name, 
username) ";
!                       $q .= "VALUES ('" . addslashes($name) . "', '" . 
$GLOBALS['phpgw_info']["user"]["account_id"] . "') ";
! 
!                       $db->query($q,__LINE__,__FILE__);
!                       if ($db->Errno != 0) {
!                               $error_msg .= "<br>Error adding subcategory 
".$name." - ".$subcatNext;
!                               return -1;
!                       }
! 
!                       $db->query("select id from bookmarks_subcategory where 
name='" . addslashes($name) . "' and username='"
!                       . $GLOBALS['phpgw_info']["user"]["account_id"] . 
"'",__LINE__,__FILE__);
!                       $db->next_record();
! 
!                       $subcat[$upperName] = $db->f("id");
!                       $subcatNext++;
!                       return $db->f("id");
!               } */
!       }
! 
!       $GLOBALS['phpgw']->template->set_file(array(
!               'common'   => 'common.tpl',
!               'body'     => 'import.body.tpl'
!       ));
!       set_standard("import", &$GLOBALS['phpgw']->template);
! 
!       if ($import)
!       {
!               _debug('<p><b>DEBUG OUTPUT:</b>');
!               _debug('<br>file: ' . $bkfile);
!               _debug('<br>file_name: ' . $bkfile_name);
!               _debug('<br>file_size: ' . $bkfile_size);
!               _debug('<br>file_type: ' . $bkfile_type . '<p><b>URLs:</b>');
!               _debug('<table border="1" width="100%">');
!               _debug('<tr><td>cat id</td> <td>sub id</td> <td>name</td> 
<td>url</td> <td>add date</td> <td>change date</td> <td>vist date</td></tr>');
! 
!               if (empty($bkfile) || $bkfile == "none")
!               {
!                       $error_msg .= "<br>Netscape bookmark filename is 
required!";
!                       break;
!               }
!               $default_rating = 0;
! 
!               $fd = @fopen($bkfile,'r');
!               if ($fd)
!               {
!                       $inserts = 0;
!                       $folder_index = -1;
!                       $cat_index = -1;
!                       $scat_index = -1;
!                       $bookmarker->url_format_check = 0;
!                       $bookmarker->url_responds_check = false;
! 
!                       $utf8flag = False;
!    
!                       while ($line = @fgets($fd, 2048))
!                       {
!                               if ((strcmp('<META HTTP-EQUIV="Content-Type" 
CONTENT="text/html; charset=UTF-8">', rtrim($line)) == 0) && 
function_exists('iconv'))
!             {
!              $utf8flag = True;
!             }
!                               // URLs are recognized by A HREF tags in the NS 
file.
!                               elseif (eregi('<A HREF="([^"]*)[^>]*>(.*)</A>', 
$line, $match))
!                               {
!                                       $url_parts = @parse_url($match[1]);
!                                       if ($url_parts[scheme] == 'http' || 
$url_parts[scheme] == 'https' || $url_parts[scheme] == 'ftp' || 
$url_parts[scheme] == 'news')
!                                       {
!                                               reset($folder_stack);
!                                               unset($error_msg);
!                                               $cid  = 
$GLOBALS['phpgw']->categories->name2id('No category');
!                                               $scid = 0;
!                                               $i    = 0;
!                                               $keyw = '';
! 
! //                                            echo '<br>test: ' . 
$folder_index;
! 
!                                               while ($i <= $folder_index)
!                                               {
!                                                       if ($i == 0)
!                                                       {
!                                                               $cid = 
getCategory($folder_name_stack[$i]);
!                                                               $cid = 
($cid?$cid:0);
!                                                       }
!                                                       elseif ($i == 1)
!                                                       {
!                                                               $scid = 
getSubCategory($folder_name_stack[$i]);
!                                                               $scid = 
($scid?$scid:0);
!                                                       }
! 
!                                                       $keyw .= ' ' . 
$folder_name_stack[$i];
!                                                       $i++;
!                                               }
!                                               $values['category'] = 
sprintf('%s|%s',$cid,$scid);
!                                               $values['url']      = $match[1];
! 
!                                               //if iconv fails, fall back to 
undecoded string
!                                               $name_iconv = ($utf8flag ? 
iconv('UTF-8','ISO-8859-1',$match[2]) : False);
!                                               $values['name']     = 
($name_iconv ? $name_iconv : $match[2]);
!                                               $values['rating']   = 0;
! 
!                                               
eregi('ADD_DATE="([^"]*)"',$line,$add_info);
!                                               
eregi('LAST_VISIT="([^"]*)"',$line,$vist_info);
!                                               
eregi('LAST_MODIFIED="([^"]*)"',$line,$change_info);
! 
!                                               $values['timestamps'] = 
sprintf('%s,%s,%s',$add_info[1],$vist_info[1],$change_info[1]);
! 
!                                               $bid = -1;
!                                               if (! 
$GLOBALS['phpgw']->bookmarks->add(&$bid, $values, True))
!                                               {
!                                                       print("<br>" . 
$error_msg . "\n");
!                                                       $all_errors .= 
$error_msg;
!                                               }
!                                               else
!                                               {
!                                                       $inserts++;
!                                               }
! 
!                                               _debug(sprintf("<tr><td>%s</td> 
<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> 
</tr>",$cid,$scid,$match[2],$match[1],$add_info[1],$change_info[1],$vist_info[1]));
!                                       }
!                               }
! 
!                               // folders start with the folder name inside an 
<H3> tag,
!                               // and end with the close </DL> tag.
!                               // we use a stack to keep track of where we are 
in the
!                               // folder hierarchy.
!                               elseif (eregi('<H3[^>]*>(.*)</H3>', $line, 
$match))
!                               {
!                                       $folder_index ++;
!                                       $id = -1;
! 
!                                       //if iconv fails, fall back to 
undecoded string
!                                       $folder_name_iconv = ($utf8flag ? 
iconv('UTF-8','ISO-8859-1',$match[1]) : False);
!                                       $folder_name = ($folder_name_iconv ? 
$folder_name_iconv : $match[1]);
! 
!                                       if ($folder_index == 0)
!                                       {
!                                               $cat_index ++;
!                                               $cat_array[$cat_index] = 
$folder_name;
!                                               $id = $cat_index + $cat_start;
!                                       }
!                                       elseif ($folder_index == 1)
!                                       {
!                                               $scat_index ++;
!                                               $scat_array[$scat_index] = 
$folder_name;
!                                               $id = $scat_index + $scat_start;
!                                       }
!                                       $folder_stack[$folder_index] = $id;
!                                       $folder_name_stack[$folder_index] = 
$folder_name;
!                               }
!                               elseif (eregi('</DL>', $line))
!                               {
!                                       $folder_index-- ;
!                               }
!                       }
!                       @fclose($fd);
!                       _debug('</table>');
!               }
!               else
!               {
!                       $error_msg .= "<br>Unable to open temp file " . $bkfile 
. " for import.";
!               }
! 
!               unset($msg);
!               $msg .= sprintf("<br>%s bookmarks imported from %s 
successfully.", $inserts, $bkfile_name);
!               $error_msg = $all_errors;
! //            break;
!       }
! 
!       
$GLOBALS['phpgw']->template->set_var('FORM_ACTION',$GLOBALS['phpgw']->link('/bookmarks/import.php'));
!       $GLOBALS['phpgw']->common->phpgw_footer();
! ?>

Index: maintain.php
===================================================================
RCS file: /cvsroot/phpgroupware/bookmarks/maintain.php,v
retrieving revision 1.26.2.1
retrieving revision 1.26.2.2
diff -C2 -r1.26.2.1 -r1.26.2.2
*** maintain.php        10 Feb 2002 19:28:36 -0000      1.26.2.1
--- maintain.php        15 Nov 2002 10:34:23 -0000      1.26.2.2
***************
*** 1,200 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - Bookmarks                                              
   *
!       * http://www.phpgroupware.org                                           
   *
!       * Based on Bookmarker Copyright (C) 1998  Padraic Renaghan              
   *
!       *                     http://www.renaghan.com/bookmarker                
   *
!       * --------------------------------------------                          
   *
!       *  This program is free software; you can redistribute it and/or modify 
it *
!       *  under the terms of the GNU General Public License as published by 
the   *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
!       *  option) any later version.                                           
   *
!       
\**************************************************************************/
! 
!       /* $Id$ */
!   
!       $GLOBALS['phpgw_info']['flags'] = array(
!               'currentapp' => 'bookmarks',
!               'enable_nextmatchs_class' => True,
!               'enable_categories_class' => True,
!               'noheader'                => True,
!               'nonavbar'                => True
!       );
!       include('../header.inc.php');
! 
!       $GLOBALS['phpgw']->bookmarks = createobject('bookmarks.bookmarks');
! 
!       $edit_category_x = $GLOBALS['HTTP_POST_VARS']['edit_category_x'];
!       $edit_category_y = $GLOBALS['HTTP_POST_VARS']['edit_category_y'];
!       $delete_x        = $GLOBALS['HTTP_POST_VARS']['delete_x'];
!       $delete_y        = $GLOBALS['HTTP_POST_VARS']['delete_y'];
!       $cancel_x        = $GLOBALS['HTTP_POST_VARS']['cancel_x'];
!       $cancel_y        = $GLOBALS['HTTP_POST_VARS']['cancel_y'];
!       $bm_id           = $GLOBALS['HTTP_GET_VARS']['bm_id'] ? 
$GLOBALS['HTTP_GET_VARS']['bm_id'] : $GLOBALS['HTTP_POST_VARS']['bm_id'];
! 
!       if ($edit_category_x || $edit_category_y)
!       {
!               grab_form_values('maintain.php',True);
!               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=bookmarks&global_cats=True'));
!       }
! 
!       $location_info = $GLOBALS['phpgw']->bookmarks->read_session_data();
! 
!       if ($delete_x || $delete_y)
!       {
!               if (! 
$GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_DELETE))
!               {
!                       
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/list.php'));
!               }
!               else
!               {
!                       $GLOBALS['phpgw']->bookmarks->delete($bm_id);
!                       
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/' . 
$location_info['returnto']));
!               }
!       }
! 
!       if ($cancel_x || $cancel_y)
!       {
!               // TODO: If they go to categorys, it will not redirect them 
properly.
!               if ($location_info['returnto'] == 'maintain.php')
!               {
!                       $location_info = array(
!                               'start'    => 0,
!                               'returnto' => 'list.php'
!                       );
!                       
$GLOBALS['phpgw']->bookmarks->save_session_data($location_info);
!               }
!               if ($location_info['bm_id'])
!               {
!                       $extravars = 'bm_id=' . $location_info['bm_id'];
!               }
!               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/' . 
$location_info['returnto'],$extravars));
!       }
! 
!       if ($edit_x || $edit_y)
!       {
!               if (! 
$GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_EDIT))
!               {
!                       
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/list.php'));
!               }
!               else
!               {
!                       $GLOBALS['phpgw']->bookmarks->update($bm_id,$bookmark);
! 
!                       if ($location_info['bm_id'])
!                       {
!                               $extravars = 'bm_id=' . $bm_id;
!                       }
!                       
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/view.php',$extravars));
!               }       
!       }
! 
!       $location_info = $GLOBALS['phpgw']->bookmarks->read_session_data();
!       if ($location_info['returnto'] == 'maintain.php')
!       {
!               $bookmark['name']        = $location_info['bookmark_name'];
!               $bookmark['url']         = $location_info['bookmark_url'];
!               $bookmark['desc']        = $location_info['bookmark_desc'];
!               $bookmark['keywords']    = $location_info['bookmark_keywords'];
!               $bookmark['category']    = $location_info['bookmark_category'];
!               $bookmark['rating']      = $location_info['bookmark_rating'];
!       }
!       else if (! $edit_x || ! $edit_y)
!       {
!               $GLOBALS['phpgw']->db->query("select * from phpgw_bookmarks 
where bm_id='$bm_id'",__LINE__,__FILE__);
!               $GLOBALS['phpgw']->db->next_record();
! 
!               $bookmark['name']        = $GLOBALS['phpgw']->db->f('bm_name');
!               $bookmark['url']         = $GLOBALS['phpgw']->db->f('bm_url');
!               $bookmark['desc']        = $GLOBALS['phpgw']->db->f('bm_desc');
!               $bookmark['keywords']    = 
$GLOBALS['phpgw']->db->f('bm_keywords');
!               $bookmark['category']    = 
$GLOBALS['phpgw']->db->f('bm_category') . '|' . 
$GLOBALS['phpgw']->db->f('bm_subcategory');
!               $bookmark['rating']      = 
$GLOBALS['phpgw']->db->f('bm_rating');
!       }
! 
!       $GLOBALS['phpgw']->template->set_file(array(
!               'common_' => 'common.tpl',
!               'form'    => 'form.tpl'
!       ));
!       $GLOBALS['phpgw']->template->set_block('form','body');
!       $GLOBALS['phpgw']->template->set_block('form','form_info');
! 
!       $GLOBALS['phpgw']->common->phpgw_header();
!       include(PHPGW_APP_INC . '/header.inc.php');
!       echo parse_navbar();
! 
!       app_header(&$GLOBALS['phpgw']->template);
! 
!       if (empty($error_msg))
!       {
!               
date_information(&$GLOBALS['phpgw']->template,$GLOBALS['phpgw']->db->f('bm_info'));
! 
!               $rs[$bookmark['rating']] = ' selected';
!               $rating_select = '<select name="bookmark[rating]">'
!                       . ' <option value="0">--</option>'
!                       . ' <option value="1"' . $rs[1] . '>1 - ' . 
lang('Lowest') . '</option>'
!                       . ' <option value="2"' . $rs[2] . '>2</option>'
!                       . ' <option value="3"' . $rs[3] . '>3</option>'
!                       . ' <option value="4"' . $rs[4] . '>4</option>'
!                       . ' <option value="5"' . $rs[5] . '>5</option>'
!                       . ' <option value="6"' . $rs[6] . '>6</option>'
!                       . ' <option value="7"' . $rs[7] . '>7</option>'
!                       . ' <option value="8"' . $rs[8] . '>8</option>'
!                       . ' <option value="9"' . $rs[9] . '>9</option>'
!                       . ' <option value="10"' . $rs[10] . '>10 - ' . 
lang('Highest') . '</option>'
!                       . '</select>';
!     
!               $GLOBALS['phpgw']->template->set_var('lang_header',lang('Edit 
bookmark'));
!               
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
!               $GLOBALS['phpgw']->template->set_var('updated',$f_ts[2]);
!               
$GLOBALS['phpgw']->template->set_var('total_visits',$GLOBALS['phpgw']->db->f('bm_visits'));
! 
!               $GLOBALS['phpgw']->template->set_var('lang_owner',lang('Created 
by'));
!               $account = 
createobject('phpgwapi.accounts',$GLOBALS['phpgw']->db->f('bm_owner'));
!               $ad      = $account->read_repository();
!               
$GLOBALS['phpgw']->template->set_var('owner_value',$GLOBALS['phpgw']->common->display_fullname($ad['account_lid'],$ad['firstname'],$ad['lastname']));
! 
!               $GLOBALS['phpgw']->template->set_var('lang_added',lang('Date 
added'));
!               $GLOBALS['phpgw']->template->set_var('lang_updated',lang('Date 
last updated'));
!               $GLOBALS['phpgw']->template->set_var('lang_visited',lang('Date 
last visited'));
!               $GLOBALS['phpgw']->template->set_var('lang_visits',lang('Total 
visits'));
! 
!               $GLOBALS['phpgw']->template->parse('info','form_info');
! 
!               
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/bookmarks/maintain.php','bm_id='
 . $bm_id));
!               $GLOBALS['phpgw']->template->set_var('lang_url',lang('URL'));
!               $GLOBALS['phpgw']->template->set_var('lang_name',lang('Name'));
!               
$GLOBALS['phpgw']->template->set_var('lang_desc',lang('Description'));
!               
$GLOBALS['phpgw']->template->set_var('lang_keywords',lang('Keywords'));
! 
!               
$GLOBALS['phpgw']->template->set_var('lang_category',lang('Category'));
!               
$GLOBALS['phpgw']->template->set_var('lang_subcategory',lang('Sub Category'));
!               
$GLOBALS['phpgw']->template->set_var('lang_rating',lang('Rating'));
! 
!               
$GLOBALS['phpgw']->template->set_var('lang_access',lang('Private'));
!               $GLOBALS['phpgw']->template->set_var('input_access','<input 
type="checkbox" name="bookmark[access]" value="private"' . 
($bookmark['access']=='private'?' checked':'') . '>');
! 
!               
$GLOBALS['phpgw']->template->set_var('input_rating',$rating_select);
! 
!               
$GLOBALS['phpgw']->template->set_var('input_category',$GLOBALS['phpgw']->bookmarks->categories_list($bookmark['category']));
!               $GLOBALS['phpgw']->template->set_var('category_image','<input 
type="image" name="edit_category" src="' . PHPGW_IMAGES . '/edit.gif" 
border="0">');
!     
!   
!               $GLOBALS['phpgw']->template->set_var('input_url','<input 
name="bookmark[url]" size="60" maxlength="255" value="' . $bookmark['url'] . 
'">');
!               $GLOBALS['phpgw']->template->set_var('input_name','<input 
name="bookmark[name]" size="60" maxlength="255" value="' . $bookmark['name'] . 
'">');
!               $GLOBALS['phpgw']->template->set_var('input_desc','<textarea 
name="bookmark[desc]" rows="3" cols="60" wrap="virtual">' . $bookmark['desc'] . 
'</textarea>');
!               $GLOBALS['phpgw']->template->set_var('input_keywords','<input 
type="text" name="bookmark[keywords]" size="60" maxlength="255" value="' . 
$bookmark['keywords'] . '">');
! 
!               $GLOBALS['phpgw']->template->parse('BODY','body');
! 
!               if 
($GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_DELETE))
!               {
!                       
$GLOBALS['phpgw']->template->set_var('delete_button','<input type="image" 
name="delete" title="' . lang('Delete') . '" src="' . PHPGW_IMAGES . 
'/delete.gif" border="0">');
!               }
! 
!               $GLOBALS['phpgw']->template->set_var('cancel_button','<input 
type="image" name="cancel" title="' . lang('Done') . '" src="' . PHPGW_IMAGES . 
'/cancel.gif" border="0">');
!               $GLOBALS['phpgw']->template->set_var('form_link','<input 
type="image" name="edit" title="' . lang('Change Bookmark') . '" src="'
!                                          . PHPGW_IMAGES . '/save.gif" 
border="0">');
!       }
!       $GLOBALS['phpgw']->common->phpgw_footer();
! ?>
--- 1,200 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - Bookmarks                                              
   *
!       * http://www.phpgroupware.org                                           
   *
!       * Based on Bookmarker Copyright (C) 1998  Padraic Renaghan              
   *
!       *                     http://www.renaghan.com/bookmarker                
   *
!       * --------------------------------------------                          
   *
!       *  This program is free software; you can redistribute it and/or modify 
it *
!       *  under the terms of the GNU General Public License as published by 
the   *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
!       *  option) any later version.                                           
   *
!       
\**************************************************************************/
! 
!       /* $Id$ */
!   
!       $GLOBALS['phpgw_info']['flags'] = array(
!               'currentapp' => 'bookmarks',
!               'enable_nextmatchs_class' => True,
!               'enable_categories_class' => True,
!               'noheader'                => True,
!               'nonavbar'                => True
!       );
!       include('../header.inc.php');
! 
!       $GLOBALS['phpgw']->bookmarks = createobject('bookmarks.bookmarks');
! 
!       $edit_category_x = $GLOBALS['HTTP_POST_VARS']['edit_category_x'];
!       $edit_category_y = $GLOBALS['HTTP_POST_VARS']['edit_category_y'];
!       $delete_x        = $GLOBALS['HTTP_POST_VARS']['delete_x'];
!       $delete_y        = $GLOBALS['HTTP_POST_VARS']['delete_y'];
!       $cancel_x        = $GLOBALS['HTTP_POST_VARS']['cancel_x'];
!       $cancel_y        = $GLOBALS['HTTP_POST_VARS']['cancel_y'];
!       $bm_id           = $GLOBALS['HTTP_GET_VARS']['bm_id'] ? 
$GLOBALS['HTTP_GET_VARS']['bm_id'] : $GLOBALS['HTTP_POST_VARS']['bm_id'];
! 
!       if ($edit_category_x || $edit_category_y)
!       {
!               grab_form_values('maintain.php',True);
!               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=bookmarks&global_cats=True'));
!       }
! 
!       $location_info = $GLOBALS['phpgw']->bookmarks->read_session_data();
! 
!       if ($delete_x || $delete_y)
!       {
!               if (! 
$GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_DELETE))
!               {
!                       
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/list.php'));
!               }
!               else
!               {
!                       $GLOBALS['phpgw']->bookmarks->delete($bm_id);
!                       
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/' . 
$location_info['returnto']));
!               }
!       }
! 
!       if ($cancel_x || $cancel_y)
!       {
!               // TODO: If they go to categorys, it will not redirect them 
properly.
!               if ($location_info['returnto'] == 'maintain.php')
!               {
!                       $location_info = array(
!                               'start'    => 0,
!                               'returnto' => 'list.php'
!                       );
!                       
$GLOBALS['phpgw']->bookmarks->save_session_data($location_info);
!               }
!               if ($location_info['bm_id'])
!               {
!                       $extravars = 'bm_id=' . $location_info['bm_id'];
!               }
!               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/' . 
$location_info['returnto'],$extravars));
!       }
! 
!       if ($edit_x || $edit_y)
!       {
!               if (! 
$GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_EDIT))
!               {
!                       
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/list.php'));
!               }
!               else
!               {
!                       $GLOBALS['phpgw']->bookmarks->update($bm_id,$bookmark);
! 
!                       if ($location_info['bm_id'])
!                       {
!                               $extravars = 'bm_id=' . $bm_id;
!                       }
!                       
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/view.php',$extravars));
!               }       
!       }
! 
!       $location_info = $GLOBALS['phpgw']->bookmarks->read_session_data();
!       if ($location_info['returnto'] == 'maintain.php')
!       {
!               $bookmark['name']        = $location_info['bookmark_name'];
!               $bookmark['url']         = $location_info['bookmark_url'];
!               $bookmark['desc']        = $location_info['bookmark_desc'];
!               $bookmark['keywords']    = $location_info['bookmark_keywords'];
!               $bookmark['category']    = $location_info['bookmark_category'];
!               $bookmark['rating']      = $location_info['bookmark_rating'];
!       }
!       else if (! $edit_x || ! $edit_y)
!       {
!               $GLOBALS['phpgw']->db->query("select * from phpgw_bookmarks 
where bm_id='$bm_id'",__LINE__,__FILE__);
!               $GLOBALS['phpgw']->db->next_record();
! 
!               $bookmark['name']        = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('bm_name'));
!               $bookmark['url']         = $GLOBALS['phpgw']->db->f('bm_url');
!               $bookmark['desc']        = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('bm_desc'));
!               $bookmark['keywords']    = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('bm_keywords'));
!               $bookmark['category']    = 
$GLOBALS['phpgw']->db->f('bm_category') . '|' . 
$GLOBALS['phpgw']->db->f('bm_subcategory');
!               $bookmark['rating']      = 
$GLOBALS['phpgw']->db->f('bm_rating');
!       }
! 
!       $GLOBALS['phpgw']->template->set_file(array(
!               'common_' => 'common.tpl',
!               'form'    => 'form.tpl'
!       ));
!       $GLOBALS['phpgw']->template->set_block('form','body');
!       $GLOBALS['phpgw']->template->set_block('form','form_info');
! 
!       $GLOBALS['phpgw']->common->phpgw_header();
!       include(PHPGW_APP_INC . '/header.inc.php');
!       echo parse_navbar();
! 
!       app_header(&$GLOBALS['phpgw']->template);
! 
!       if (empty($error_msg))
!       {
!               
date_information(&$GLOBALS['phpgw']->template,$GLOBALS['phpgw']->db->f('bm_info'));
! 
!               $rs[$bookmark['rating']] = ' selected';
!               $rating_select = '<select name="bookmark[rating]">'
!                       . ' <option value="0">--</option>'
!                       . ' <option value="1"' . $rs[1] . '>1 - ' . 
lang('Lowest') . '</option>'
!                       . ' <option value="2"' . $rs[2] . '>2</option>'
!                       . ' <option value="3"' . $rs[3] . '>3</option>'
!                       . ' <option value="4"' . $rs[4] . '>4</option>'
!                       . ' <option value="5"' . $rs[5] . '>5</option>'
!                       . ' <option value="6"' . $rs[6] . '>6</option>'
!                       . ' <option value="7"' . $rs[7] . '>7</option>'
!                       . ' <option value="8"' . $rs[8] . '>8</option>'
!                       . ' <option value="9"' . $rs[9] . '>9</option>'
!                       . ' <option value="10"' . $rs[10] . '>10 - ' . 
lang('Highest') . '</option>'
!                       . '</select>';
!     
!               $GLOBALS['phpgw']->template->set_var('lang_header',lang('Edit 
bookmark'));
!               
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
!               $GLOBALS['phpgw']->template->set_var('updated',$f_ts[2]);
!               
$GLOBALS['phpgw']->template->set_var('total_visits',$GLOBALS['phpgw']->db->f('bm_visits'));
! 
!               $GLOBALS['phpgw']->template->set_var('lang_owner',lang('Created 
by'));
!               $account = 
createobject('phpgwapi.accounts',$GLOBALS['phpgw']->db->f('bm_owner'));
!               $ad      = $account->read_repository();
!               
$GLOBALS['phpgw']->template->set_var('owner_value',$GLOBALS['phpgw']->common->display_fullname($ad['account_lid'],$ad['firstname'],$ad['lastname']));
! 
!               $GLOBALS['phpgw']->template->set_var('lang_added',lang('Date 
added'));
!               $GLOBALS['phpgw']->template->set_var('lang_updated',lang('Date 
last updated'));
!               $GLOBALS['phpgw']->template->set_var('lang_visited',lang('Date 
last visited'));
!               $GLOBALS['phpgw']->template->set_var('lang_visits',lang('Total 
visits'));
! 
!               $GLOBALS['phpgw']->template->parse('info','form_info');
! 
!               
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/bookmarks/maintain.php','bm_id='
 . $bm_id));
!               $GLOBALS['phpgw']->template->set_var('lang_url',lang('URL'));
!               $GLOBALS['phpgw']->template->set_var('lang_name',lang('Name'));
!               
$GLOBALS['phpgw']->template->set_var('lang_desc',lang('Description'));
!               
$GLOBALS['phpgw']->template->set_var('lang_keywords',lang('Keywords'));
! 
!               
$GLOBALS['phpgw']->template->set_var('lang_category',lang('Category'));
!               
$GLOBALS['phpgw']->template->set_var('lang_subcategory',lang('Sub Category'));
!               
$GLOBALS['phpgw']->template->set_var('lang_rating',lang('Rating'));
! 
!               
$GLOBALS['phpgw']->template->set_var('lang_access',lang('Private'));
!               $GLOBALS['phpgw']->template->set_var('input_access','<input 
type="checkbox" name="bookmark[access]" value="private"' . 
($bookmark['access']=='private'?' checked':'') . '>');
! 
!               
$GLOBALS['phpgw']->template->set_var('input_rating',$rating_select);
! 
!               
$GLOBALS['phpgw']->template->set_var('input_category',$GLOBALS['phpgw']->bookmarks->categories_list($bookmark['category']));
!               $GLOBALS['phpgw']->template->set_var('category_image','<input 
type="image" name="edit_category" src="' . PHPGW_IMAGES . '/edit.gif" 
border="0">');
!     
!   
!               $GLOBALS['phpgw']->template->set_var('input_url','<input 
name="bookmark[url]" size="60" maxlength="255" value="' . $bookmark['url'] . 
'">');
!               $GLOBALS['phpgw']->template->set_var('input_name','<input 
name="bookmark[name]" size="60" maxlength="255" value="' . $bookmark['name'] . 
'">');
!               $GLOBALS['phpgw']->template->set_var('input_desc','<textarea 
name="bookmark[desc]" rows="3" cols="60" wrap="virtual">' . $bookmark['desc'] . 
'</textarea>');
!               $GLOBALS['phpgw']->template->set_var('input_keywords','<input 
type="text" name="bookmark[keywords]" size="60" maxlength="255" value="' . 
$bookmark['keywords'] . '">');
! 
!               $GLOBALS['phpgw']->template->parse('BODY','body');
! 
!               if 
($GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_DELETE))
!               {
!                       
$GLOBALS['phpgw']->template->set_var('delete_button','<input type="image" 
name="delete" title="' . lang('Delete') . '" src="' . PHPGW_IMAGES . 
'/delete.gif" border="0">');
!               }
! 
!               $GLOBALS['phpgw']->template->set_var('cancel_button','<input 
type="image" name="cancel" title="' . lang('Done') . '" src="' . PHPGW_IMAGES . 
'/cancel.gif" border="0">');
!               $GLOBALS['phpgw']->template->set_var('form_link','<input 
type="image" name="edit" title="' . lang('Change Bookmark') . '" src="'
!                                          . PHPGW_IMAGES . '/save.gif" 
border="0">');
!       }
!       $GLOBALS['phpgw']->common->phpgw_footer();
! ?>

Index: tree.php
===================================================================
RCS file: /cvsroot/phpgroupware/bookmarks/tree.php,v
retrieving revision 1.26
retrieving revision 1.26.2.1
diff -C2 -r1.26 -r1.26.2.1
*** tree.php    18 Nov 2001 15:46:25 -0000      1.26
--- tree.php    15 Nov 2002 10:34:23 -0000      1.26.2.1
***************
*** 1,165 ****
! <?php 
!       
/**************************************************************************\
!       * phpGroupWare - Bookmarks                                              
   *
!       * http://www.phpgroupware.org                                           
   *
!       * Based on Bookmarker Copyright (C) 1998  Padraic Renaghan              
   *
!       *                     http://www.renaghan.com/bookmarker                
   *
!       * --------------------------------------------                          
   *
!       *  This program is free software; you can redistribute it and/or modify 
it *
!       *  under the terms of the GNU General Public License as published by 
the   *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
!       *  option) any later version.                                           
   *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       $GLOBALS['phpgw_info']['flags'] = array(
!               'currentapp' => 'bookmarks'
!       );
!       include('../header.inc.php');
! 
!       $GLOBALS['phpgw']->bookmarks = createobject('bookmarks.bookmarks');
!       $GLOBALS['phpgw']->treemenu  = createobject('bookmarks.treemenu');
! 
!       $GLOBALS['phpgw']->treemenu->last_column_size = 500;
! 
!       $GLOBALS['phpgw']->template->set_file(array(
!               'common_' => 'common.tpl',
!               'body'    => 'list.body_tree.tpl'
!       ));
!       app_header(&$GLOBALS['phpgw']->template);
! 
! //    
$GLOBALS['phpgw']->template->set_var('list_mass_select_form',$GLOBALS['phpgw']->link('/bookmarks/mass_maintain.php'));
! //    $GLOBALS['phpgw']->template->set_var('lang_massupdate',lang('Mass 
update:'));
! //    $GLOBALS['phpgw']->template->set_var('massupdate_delete_icon','<input 
type="image" name="delete" border="0" src="' . PHPGW_IMAGES . '/delete.gif">');
! //    $GLOBALS['phpgw']->template->set_var('massupdate_mail_icon','<input 
type="image" name="mail" border="0" src="' . PHPGW_IMAGES . '/mail.gif">');
! 
!       
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
!       $GLOBALS['phpgw']->template->set_var('messages',lang('Tree view'));
! 
!       $location_info = $GLOBALS['phpgw']->bookmarks->read_session_data();
!       if (! is_array($location_info))
!       {
!               $location_info = array(
!                       'returnto' => 'tree.php'
!               );
!               $GLOBALS['phpgw']->bookmarks->save_session_data($location_info);
!       }
! 
!       if ($location_info['tree_postion'] && ! $p)
!       {
!               $p = $location_info['tree_postion'];
!       }
!       else
!       {
!               if ($p)
!               {
!                       $location_info = array(
!                               'returnto'     => 'tree.php',
!                               'tree_postion' => $p
!                       );
!                       
$GLOBALS['phpgw']->bookmarks->save_session_data($location_info);
!               }
!       }
! 
!       /*
!       if ($filter != 'private')
!       {
!               $filtermethod = "( bm_owner=" . 
$GLOBALS['phpgw_info']['user']['account_id'];
!               if (is_array($GLOBALS['phpgw']->bookmarks->grants))
!               {
!                       $grants = $GLOBALS['phpgw']->bookmarks->grants;
!                       while (list($user) = each($grants))
!                       {
!                               $public_user_list[] = $user;
!                       }
!                       reset($public_user_list);
!                       $filtermethod .= " OR (bm_access='public' AND bm_owner 
in(" . implode(',',$public_user_list) . ")))";
!               }
!               else
!               {
!                       $filtermethod .= ' )';
!               }
!       }
!       else
!       {
!               $filtermethod = ' bm_owner=' . 
$GLOBALS['phpgw_info']['user']['account_id'] . ' ';
!       }
!       */
! 
!       $categories = 
$GLOBALS['phpgw']->categories->return_array('mains',0,$GLOBALS['phpgw']->categories->total(),'','cat_name','',True);
! 
!       /* Added to keep track of displayed items, so they do not repeat */
!       $shown = array();
!       $db2 = $GLOBALS['phpgw']->db;
!       while ($cat = @each($categories))
!       {
!               $shown[] = $cat[1]['id'];
!               $tree[] = '.<a href="' . 
$GLOBALS['phpgw']->link('/bookmarks/list.php','bm_cat=' . $cat[1]['id']) . '">' 
. $cat[1]['name'] . '</a>' . '|';
! 
!               $subs = 
$GLOBALS['phpgw']->categories->return_array('subs',0,False,'','','',True,$cat[1]['id']);
!               while ($sub = @each($subs))
!               {
!                       $shown[] = $sub['value']['id'];
!                       $tree[] = '..' . '<a href="' . 
$GLOBALS['phpgw']->link('/bookmarks/list.php','bm_cat=' . $cat[1]['id'] . 
'&bm_subcat='
!                               . $sub['value']['id']) . '">' . 
$sub['value']['name'] . '</a>' . '|';
!                       $db2->query("select * from phpgw_bookmarks where 
bm_subcategory='" . $sub['value']['id'] . "' order by bm_name, 
bm_url",__LINE__,__FILE__);
!                       while ($db2->next_record())
!                       {
!                               $shown[] = $db2->f('bm_id');
!                               $_tree = '...' . $db2->f('bm_name') . '|'; // . 
'<input type="checkbox" name="item_cb[]" value="' . $db2->f('bm_id') . '">';
!                               if 
(($GLOBALS['phpgw']->bookmarks->grants[$db2->f('bm_owner')] & PHPGW_ACL_EDIT) 
|| ($db2->f('bm_owner') == $GLOBALS['phpgw_info']['user']['account_id']))
!                               {
!                                       $maintain_url  = 
$GLOBALS['phpgw']->link('/bookmarks/maintain.php','bm_id=' . $db2->f('bm_id'));
!                                       $maintain_link = sprintf('<a 
href="%s"><img src="%s/edit.gif" align="top" border="0" alt="%s"></a>', 
$maintain_url,PHPGW_IMAGES,lang('Edit this bookmark'));
!                                       $_tree        .= $maintain_link . 
'&nbsp;';
!                               }
!                               if 
(($GLOBALS['phpgw']->bookmarks->grants[$db2->f('bm_owner')] & PHPGW_ACL_READ) 
|| ($db2->f('bm_owner') == $GLOBALS['phpgw_info']['user']['account_id']))
!                               {
!                                       $view_url      = 
$GLOBALS['phpgw']->link('/bookmarks/view.php','bm_id=' . $db2->f('bm_id'));
!                                       $view_link     = sprintf('<a 
href="%s"><img src="%s/document.gif" align="top" border="0" alt="%s"></a>', 
$view_url,PHPGW_IMAGES,lang('View this bookmark'));
! 
! //                                    $mail_link     = sprintf('<a 
href="%s"><img align="top" border="0" src="%s/mail.gif" alt="%s"></a>',
! //                                            
$GLOBALS['phpgw']->link('/bookmarks/maillink.php','bm_id='.$db2->f("bm_id")),PHPGW_IMAGES,lang('Mail
 this bookmark'));
! 
!                                       $rating_link   = sprintf('<img 
src="%s/bar-%s.jpg">',PHPGW_IMAGES,$db2->f('bm_rating'));
!                                       $redirect_link = '<a href="' . 
$GLOBALS['phpgw']->link('/bookmarks/redirect.php','bm_id=' . $db2->f('bm_id')) 
. '" target="_new">' . $GLOBALS['phpgw']->strip_html($db2->f('bm_name')) . 
'</a>';
!                                       $_tree        .= $view_link . '&nbsp; 
&nbsp;' . $redirect_link;// . '</td><td align="right"></td><td>'
! //                                            . $db2->f('bm_desc') . 
'</td></tr></table>'; //$mail_link . $rating_link . $redirect_link;
!                               }
! 
!                               $tree[] = $_tree;
!                       }
!               }
! 
!               $db2->query("select * from phpgw_bookmarks where bm_category='" 
. $cat[1]['id'] . "' order by bm_name, bm_url",__LINE__,__FILE__);
!               while ($db2->next_record())
!               {
!                       if(in_array($db2->f('bm_id'),$shown))
!                       {
!                               continue;
!                       }
!                       $_tree = '..' . $db2->f('bm_name') . '|';
!                       if 
(($GLOBALS['phpgw']->bookmarks->grants[$db2->f('bm_owner')] & PHPGW_ACL_EDIT) 
|| ($db2->f('bm_owner') == $GLOBALS['phpgw_info']['user']['account_id']))
!                       {
!                               $maintain_url  = 
$GLOBALS['phpgw']->link('/bookmarks/maintain.php','bm_id=' . $db2->f('bm_id'));
!                               $maintain_link = sprintf('<a href="%s"><img 
src="%s/edit.gif" align="top" border="0" alt="%s"></a>', 
$maintain_url,PHPGW_IMAGES,lang('Edit this bookmark'));
!                               $_tree        .= $maintain_link . '&nbsp;';
!                       }
!                       if 
(($GLOBALS['phpgw']->bookmarks->grants[$db2->f('bm_owner')] & PHPGW_ACL_READ) 
|| ($db2->f('bm_owner') == $GLOBALS['phpgw_info']['user']['account_id']))
!                       {
!                               $view_url      = 
$GLOBALS['phpgw']->link('/bookmarks/view.php','bm_id=' . $db2->f('bm_id'));
!                               $view_link     = sprintf('<a href="%s"><img 
src="%s/document.gif" align="top" border="0" alt="%s"></a>', 
$view_url,PHPGW_IMAGES,lang('View this bookmark'));
! 
!                               $rating_link   = sprintf('<img 
src="%s/bar-%s.jpg">',PHPGW_IMAGES,$db2->f('bm_rating'));
!                               $redirect_link = '<a href="' . 
$GLOBALS['phpgw']->link('/bookmarks/redirect.php','bm_id=' . $db2->f('bm_id')) 
. '" target="_new">' . $GLOBALS['phpgw']->strip_html($db2->f('bm_name')) . 
'</a>';
!                               $_tree        .= $view_link . '&nbsp;' . 
$redirect_link;
!                       }
!                       $tree[] = $_tree;
!               }
!       }
! 
!       
$GLOBALS['phpgw']->template->set_var('BOOKMARK_LIST',$GLOBALS['phpgw']->treemenu->showmenu($tree,$p));
! 
!       $GLOBALS['phpgw']->common->phpgw_footer();
! ?>
--- 1,166 ----
! <?php 
!       
/**************************************************************************\
!       * phpGroupWare - Bookmarks                                              
   *
!       * http://www.phpgroupware.org                                           
   *
!       * Based on Bookmarker Copyright (C) 1998  Padraic Renaghan              
   *
!       *                     http://www.renaghan.com/bookmarker                
   *
!       * --------------------------------------------                          
   *
!       *  This program is free software; you can redistribute it and/or modify 
it *
!       *  under the terms of the GNU General Public License as published by 
the   *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
!       *  option) any later version.                                           
   *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       $GLOBALS['phpgw_info']['flags'] = array(
!               'currentapp' => 'bookmarks'
!       );
!       include('../header.inc.php');
! 
!       $GLOBALS['phpgw']->bookmarks = createobject('bookmarks.bookmarks');
!       $GLOBALS['phpgw']->treemenu  = createobject('bookmarks.treemenu');
! 
!       $GLOBALS['phpgw']->treemenu->last_column_size = 500;
! 
!       $GLOBALS['phpgw']->template->set_file(array(
!               'common_' => 'common.tpl',
!               'body'    => 'list.body_tree.tpl'
!       ));
!       app_header(&$GLOBALS['phpgw']->template);
! 
! //    
$GLOBALS['phpgw']->template->set_var('list_mass_select_form',$GLOBALS['phpgw']->link('/bookmarks/mass_maintain.php'));
! //    $GLOBALS['phpgw']->template->set_var('lang_massupdate',lang('Mass 
update:'));
! //    $GLOBALS['phpgw']->template->set_var('massupdate_delete_icon','<input 
type="image" name="delete" border="0" src="' . PHPGW_IMAGES . '/delete.gif">');
! //    $GLOBALS['phpgw']->template->set_var('massupdate_mail_icon','<input 
type="image" name="mail" border="0" src="' . PHPGW_IMAGES . '/mail.gif">');
! 
!       
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
!       $GLOBALS['phpgw']->template->set_var('messages',lang('Tree view'));
! 
!       $location_info = $GLOBALS['phpgw']->bookmarks->read_session_data();
!       if (! is_array($location_info))
!       {
!               $location_info = array(
!                       'returnto' => 'tree.php'
!               );
!               $GLOBALS['phpgw']->bookmarks->save_session_data($location_info);
!       }
! 
!       if ($location_info['tree_postion'] && ! $p)
!       {
!               $p = $location_info['tree_postion'];
!       }
!       else
!       {
!               if ($p)
!               {
!                       $location_info = array(
!                               'returnto'     => 'tree.php',
!                               'tree_postion' => $p
!                       );
!                       
$GLOBALS['phpgw']->bookmarks->save_session_data($location_info);
!               }
!       }
! 
!       /*
!       if ($filter != 'private')
!       {
!               $filtermethod = "( bm_owner=" . 
$GLOBALS['phpgw_info']['user']['account_id'];
!               if (is_array($GLOBALS['phpgw']->bookmarks->grants))
!               {
!                       $grants = $GLOBALS['phpgw']->bookmarks->grants;
!                       while (list($user) = each($grants))
!                       {
!                               $public_user_list[] = $user;
!                       }
!                       reset($public_user_list);
!                       $filtermethod .= " OR (bm_access='public' AND bm_owner 
in(" . implode(',',$public_user_list) . ")))";
!               }
!               else
!               {
!                       $filtermethod .= ' )';
!               }
!       }
!       else
!       {
!               $filtermethod = ' bm_owner=' . 
$GLOBALS['phpgw_info']['user']['account_id'] . ' ';
!       }
!       */
! 
!       $categories = 
$GLOBALS['phpgw']->categories->return_array('mains',0,False,'','cat_name','',True);
!  
! 
!       /* Added to keep track of displayed items, so they do not repeat */
!       $shown = array();
!       $db2 = $GLOBALS['phpgw']->db;
!       while ($cat = @each($categories))
!       {
!               $shown[] = $cat[1]['id'];
!               $tree[] = '.<a href="' . 
$GLOBALS['phpgw']->link('/bookmarks/list.php','bm_cat=' . $cat[1]['id']) . '">' 
. $cat[1]['name'] . '</a>' . '|';
! 
!               $subs = 
$GLOBALS['phpgw']->categories->return_array('subs',0,False,'','','',True,$cat[1]['id']);
!               while ($sub = @each($subs))
!               {
!                       $shown[] = $sub['value']['id'];
!                       $tree[] = '..' . '<a href="' . 
$GLOBALS['phpgw']->link('/bookmarks/list.php','bm_cat=' . $cat[1]['id'] . 
'&bm_subcat='
!                               . $sub['value']['id']) . '">' . 
$sub['value']['name'] . '</a>' . '|';
!                       $db2->query("select * from phpgw_bookmarks where 
bm_subcategory='" . $sub['value']['id'] . "' order by bm_name, 
bm_url",__LINE__,__FILE__);
!                       while ($db2->next_record())
!                       {
!                               $shown[] = $db2->f('bm_id');
!                               $_tree = '...' . $db2->f('bm_name') . '|'; // . 
'<input type="checkbox" name="item_cb[]" value="' . $db2->f('bm_id') . '">';
!                               if 
(($GLOBALS['phpgw']->bookmarks->grants[$db2->f('bm_owner')] & PHPGW_ACL_EDIT) 
|| ($db2->f('bm_owner') == $GLOBALS['phpgw_info']['user']['account_id']))
!                               {
!                                       $maintain_url  = 
$GLOBALS['phpgw']->link('/bookmarks/maintain.php','bm_id=' . $db2->f('bm_id'));
!                                       $maintain_link = sprintf('<a 
href="%s"><img src="%s/edit.gif" align="top" border="0" alt="%s"></a>', 
$maintain_url,PHPGW_IMAGES,lang('Edit this bookmark'));
!                                       $_tree        .= $maintain_link . 
'&nbsp;';
!                               }
!                               if 
(($GLOBALS['phpgw']->bookmarks->grants[$db2->f('bm_owner')] & PHPGW_ACL_READ) 
|| ($db2->f('bm_owner') == $GLOBALS['phpgw_info']['user']['account_id']))
!                               {
!                                       $view_url      = 
$GLOBALS['phpgw']->link('/bookmarks/view.php','bm_id=' . $db2->f('bm_id'));
!                                       $view_link     = sprintf('<a 
href="%s"><img src="%s/document.gif" align="top" border="0" alt="%s"></a>', 
$view_url,PHPGW_IMAGES,lang('View this bookmark'));
! 
! //                                    $mail_link     = sprintf('<a 
href="%s"><img align="top" border="0" src="%s/mail.gif" alt="%s"></a>',
! //                                            
$GLOBALS['phpgw']->link('/bookmarks/maillink.php','bm_id='.$db2->f("bm_id")),PHPGW_IMAGES,lang('Mail
 this bookmark'));
! 
!                                       $rating_link   = sprintf('<img 
src="%s/bar-%s.jpg">',PHPGW_IMAGES,$db2->f('bm_rating'));
!                                       $redirect_link = '<a href="' . 
$GLOBALS['phpgw']->link('/bookmarks/redirect.php','bm_id=' . $db2->f('bm_id')) 
. '" target="_new">' . $GLOBALS['phpgw']->strip_html($db2->f('bm_name')) . 
'</a>';
!                                       $_tree        .= $view_link . '&nbsp; 
&nbsp;' . $redirect_link;// . '</td><td align="right"></td><td>'
! //                                            . $db2->f('bm_desc') . 
'</td></tr></table>'; //$mail_link . $rating_link . $redirect_link;
!                               }
! 
!                               $tree[] = $_tree;
!                       }
!               }
! 
!               $db2->query("select * from phpgw_bookmarks where bm_category='" 
. $cat[1]['id'] . "' order by bm_name, bm_url",__LINE__,__FILE__);
!               while ($db2->next_record())
!               {
!                       if(in_array($db2->f('bm_id'),$shown))
!                       {
!                               continue;
!                       }
!                       $_tree = '..' . $db2->f('bm_name') . '|';
!                       if 
(($GLOBALS['phpgw']->bookmarks->grants[$db2->f('bm_owner')] & PHPGW_ACL_EDIT) 
|| ($db2->f('bm_owner') == $GLOBALS['phpgw_info']['user']['account_id']))
!                       {
!                               $maintain_url  = 
$GLOBALS['phpgw']->link('/bookmarks/maintain.php','bm_id=' . $db2->f('bm_id'));
!                               $maintain_link = sprintf('<a href="%s"><img 
src="%s/edit.gif" align="top" border="0" alt="%s"></a>', 
$maintain_url,PHPGW_IMAGES,lang('Edit this bookmark'));
!                               $_tree        .= $maintain_link . '&nbsp;';
!                       }
!                       if 
(($GLOBALS['phpgw']->bookmarks->grants[$db2->f('bm_owner')] & PHPGW_ACL_READ) 
|| ($db2->f('bm_owner') == $GLOBALS['phpgw_info']['user']['account_id']))
!                       {
!                               $view_url      = 
$GLOBALS['phpgw']->link('/bookmarks/view.php','bm_id=' . $db2->f('bm_id'));
!                               $view_link     = sprintf('<a href="%s"><img 
src="%s/document.gif" align="top" border="0" alt="%s"></a>', 
$view_url,PHPGW_IMAGES,lang('View this bookmark'));
! 
!                               $rating_link   = sprintf('<img 
src="%s/bar-%s.jpg">',PHPGW_IMAGES,$db2->f('bm_rating'));
!                               $redirect_link = '<a href="' . 
$GLOBALS['phpgw']->link('/bookmarks/redirect.php','bm_id=' . $db2->f('bm_id')) 
. '" target="_new">' . $GLOBALS['phpgw']->strip_html($db2->f('bm_name')) . 
'</a>';
!                               $_tree        .= $view_link . '&nbsp;' . 
$redirect_link;
!                       }
!                       $tree[] = $_tree;
!               }
!       }
! 
!       
$GLOBALS['phpgw']->template->set_var('BOOKMARK_LIST',$GLOBALS['phpgw']->treemenu->showmenu($tree,$p));
! 
!       $GLOBALS['phpgw']->common->phpgw_footer();
! ?>

Index: view.php
===================================================================
RCS file: /cvsroot/phpgroupware/bookmarks/view.php,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -C2 -r1.18 -r1.18.2.1
*** view.php    17 Nov 2001 02:51:36 -0000      1.18
--- view.php    15 Nov 2002 10:34:23 -0000      1.18.2.1
***************
*** 1,120 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - Bookmarks                                              
   *
!       * http://www.phpgroupware.org                                           
   *
!       * --------------------------------------------                          
   *
!       *  This program is free software; you can redistribute it and/or modify 
it *
!       *  under the terms of the GNU General Public License as published by 
the   *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
!       *  option) any later version.                                           
   *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       $GLOBALS['phpgw_info']['flags'] = array(
!               'currentapp'               => 'bookmarks',
!               'enable_nextmatchs_class'  => True,
!               'enable_categories_class'  => True,
!               'noheader'                 => True,
!               'nonavbar'                 => True
!       );
!       include('../header.inc.php');
! 
!       $GLOBALS['phpgw']->bookmarks = createobject('bookmarks.bookmarks');
! 
!       $location_info = $GLOBALS['phpgw']->bookmarks->read_session_data();
!       if ($cancel_x || $cancel_y)
!       {
!               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/' . 
$location_info['returnto'],'bm_cat=' . $location_info['bm_cat']));
!       }
! 
!       if ($edit_x || $edit_y)
!       {
!               $location_info['returnto'] = 'view.php';
!               $location_info['bm_id']    = $bm_id;
!               $GLOBALS['phpgw']->bookmarks->save_session_data($location_info);
!               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/maintain.php','bm_id='
 . $bm_id));
!       }
! 
!       $GLOBALS['phpgw']->template->set_file(array(
!               'common_'  => 'common.tpl',
!               'form'     => 'form.tpl',
!               'standard' => 'common.standard.tpl'
!       ));
!       $GLOBALS['phpgw']->template->set_block('form','body');
!       $GLOBALS['phpgw']->template->set_block('form','form_info');
! 
!       if (! $GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_READ))
!       {
!               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/list.php','bm_cat='
 . $location_info['bm_cat']));
!       }
! 
!       $GLOBALS['phpgw']->common->phpgw_header();
!       include(PHPGW_APP_INC . '/header.inc.php');
!       echo parse_navbar();
! 
!       app_header(&$GLOBALS['phpgw']->template);
! 
!       
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
! 
!       $GLOBALS['phpgw']->db->query("select * from phpgw_bookmarks where 
bm_id='$bm_id'",__LINE__,__FILE__);
!       $GLOBALS['phpgw']->db->next_record();
! 
!       
date_information(&$GLOBALS['phpgw']->template,$GLOBALS['phpgw']->db->f('bm_info'));
!       
$GLOBALS['phpgw']->template->set_var('total_visits',$GLOBALS['phpgw']->db->f('bm_visits'));
! 
!       $GLOBALS['phpgw']->template->set_var('lang_owner',lang('Created by'));
! 
!       $account = 
createobject('phpgwapi.accounts',$GLOBALS['phpgw']->db->f('bm_owner'));
!       $ad      = $account->read_repository();
!       
$GLOBALS['phpgw']->template->set_var('owner_value',$GLOBALS['phpgw']->common->display_fullname($ad['account_lid'],$ad['firstname'],$ad['lastname']));
! 
!       $GLOBALS['phpgw']->template->set_var('lang_added',lang('Date added'));
!       $GLOBALS['phpgw']->template->set_var('lang_updated',lang('Date last 
updated'));
!       $GLOBALS['phpgw']->template->set_var('lang_visited',lang('Date last 
visited'));
!       $GLOBALS['phpgw']->template->set_var('lang_visits',lang('Total 
visits'));
! 
!       $GLOBALS['phpgw']->template->parse('info','form_info');
! 
!       
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/bookmarks/view.php','bm_id='
 . $bm_id));
!       $GLOBALS['phpgw']->template->set_var('lang_url',lang('URL'));
!       $GLOBALS['phpgw']->template->set_var('lang_name',lang('Name'));
!       $GLOBALS['phpgw']->template->set_var('lang_desc',lang('Description'));
!       $GLOBALS['phpgw']->template->set_var('lang_keywords',lang('Keywords'));
! 
!       $GLOBALS['phpgw']->template->set_var('lang_category',lang('Category'));
!       $GLOBALS['phpgw']->template->set_var('lang_rating',lang('Rating'));
! 
!       $GLOBALS['phpgw']->template->set_var('lang_access',lang('Access'));
!       
$GLOBALS['phpgw']->template->set_var('input_access',lang($GLOBALS['phpgw']->db->f('bm_access')));
! 
!       $GLOBALS['phpgw']->template->set_var('lang_header',lang('View 
bookmark'));
! 
!       $GLOBALS['phpgw']->template->set_var('input_url','<a href="' . 
$GLOBALS['phpgw']->link('/bookmarks/redirect.php','bm_id=' . 
$GLOBALS['phpgw']->db->f('bm_id')) . '" target="_new">' . 
$GLOBALS['phpgw']->db->f('bm_url') . '</a>');
!       
$GLOBALS['phpgw']->template->set_var('input_name',$GLOBALS['phpgw']->db->f('bm_name'));
!       
$GLOBALS['phpgw']->template->set_var('input_desc',$GLOBALS['phpgw']->db->f('bm_desc'));
!       
$GLOBALS['phpgw']->template->set_var('input_keywords',$GLOBALS['phpgw']->db->f('bm_keywords'));
!       $GLOBALS['phpgw']->template->set_var('input_rating','<img src="' . 
$GLOBALS['phpgw']->common->get_image_path('bookmarks') . '/bar-' . 
$GLOBALS['phpgw']->db->f('bm_rating') . '.jpg">');
! 
!       $category    = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->categories->return_name($GLOBALS['phpgw']->db->f('bm_category')));
!       $subcategory = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->categories->return_name($GLOBALS['phpgw']->db->f('bm_subcategory')));
!       if ($subcategory)
!       {
!               $category .= ' :: ' . $subcategory;
!       }
!       $GLOBALS['phpgw']->template->set_var('input_category',$category);
! 
!       $GLOBALS['phpgw']->template->set_var('cancel_button','<input 
type="image" name="cancel" title="' . lang('Done') . '" src="' . PHPGW_IMAGES . 
'/cancel.gif" border="0">');
! 
!       if ($GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_EDIT))
!       {
!               $GLOBALS['phpgw']->template->set_var('edit_button','<input 
type="image" name="edit" title="' . lang('Edit') . '" src="' . PHPGW_IMAGES . 
'/edit.gif" border="0">');
!       }
! 
!       if ($GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_DELETE))
!       {
!               $GLOBALS['phpgw']->template->set_var('delete_button','<input 
type="image" name="delete" title="' . lang('Delete') . '" src="' . PHPGW_IMAGES 
. '/delete.gif" border="0">');
!       }
! 
!       $GLOBALS['phpgw']->common->phpgw_footer();
! ?>
--- 1,120 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - Bookmarks                                              
   *
!       * http://www.phpgroupware.org                                           
   *
!       * --------------------------------------------                          
   *
!       *  This program is free software; you can redistribute it and/or modify 
it *
!       *  under the terms of the GNU General Public License as published by 
the   *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
!       *  option) any later version.                                           
   *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       $GLOBALS['phpgw_info']['flags'] = array(
!               'currentapp'               => 'bookmarks',
!               'enable_nextmatchs_class'  => True,
!               'enable_categories_class'  => True,
!               'noheader'                 => True,
!               'nonavbar'                 => True
!       );
!       include('../header.inc.php');
! 
!       $GLOBALS['phpgw']->bookmarks = createobject('bookmarks.bookmarks');
! 
!       $location_info = $GLOBALS['phpgw']->bookmarks->read_session_data();
!       if ($cancel_x || $cancel_y)
!       {
!               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/' . 
$location_info['returnto'],'bm_cat=' . $location_info['bm_cat']));
!       }
! 
!       if ($edit_x || $edit_y)
!       {
!               $location_info['returnto'] = 'view.php';
!               $location_info['bm_id']    = $bm_id;
!               $GLOBALS['phpgw']->bookmarks->save_session_data($location_info);
!               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/maintain.php','bm_id='
 . $bm_id));
!       }
! 
!       $GLOBALS['phpgw']->template->set_file(array(
!               'common_'  => 'common.tpl',
!               'form'     => 'form.tpl',
!               'standard' => 'common.standard.tpl'
!       ));
!       $GLOBALS['phpgw']->template->set_block('form','body');
!       $GLOBALS['phpgw']->template->set_block('form','form_info');
! 
!       if (! $GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_READ))
!       {
!               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/bookmarks/list.php','bm_cat='
 . $location_info['bm_cat']));
!       }
! 
!       $GLOBALS['phpgw']->common->phpgw_header();
!       include(PHPGW_APP_INC . '/header.inc.php');
!       echo parse_navbar();
! 
!       app_header(&$GLOBALS['phpgw']->template);
! 
!       
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
! 
!       $GLOBALS['phpgw']->db->query("select * from phpgw_bookmarks where 
bm_id='$bm_id'",__LINE__,__FILE__);
!       $GLOBALS['phpgw']->db->next_record();
! 
!       
date_information(&$GLOBALS['phpgw']->template,$GLOBALS['phpgw']->db->f('bm_info'));
!       
$GLOBALS['phpgw']->template->set_var('total_visits',$GLOBALS['phpgw']->db->f('bm_visits'));
! 
!       $GLOBALS['phpgw']->template->set_var('lang_owner',lang('Created by'));
! 
!       $account = 
createobject('phpgwapi.accounts',$GLOBALS['phpgw']->db->f('bm_owner'));
!       $ad      = $account->read_repository();
!       
$GLOBALS['phpgw']->template->set_var('owner_value',$GLOBALS['phpgw']->common->display_fullname($ad['account_lid'],$ad['firstname'],$ad['lastname']));
! 
!       $GLOBALS['phpgw']->template->set_var('lang_added',lang('Date added'));
!       $GLOBALS['phpgw']->template->set_var('lang_updated',lang('Date last 
updated'));
!       $GLOBALS['phpgw']->template->set_var('lang_visited',lang('Date last 
visited'));
!       $GLOBALS['phpgw']->template->set_var('lang_visits',lang('Total 
visits'));
! 
!       $GLOBALS['phpgw']->template->parse('info','form_info');
! 
!       
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/bookmarks/view.php','bm_id='
 . $bm_id));
!       $GLOBALS['phpgw']->template->set_var('lang_url',lang('URL'));
!       $GLOBALS['phpgw']->template->set_var('lang_name',lang('Name'));
!       $GLOBALS['phpgw']->template->set_var('lang_desc',lang('Description'));
!       $GLOBALS['phpgw']->template->set_var('lang_keywords',lang('Keywords'));
! 
!       $GLOBALS['phpgw']->template->set_var('lang_category',lang('Category'));
!       $GLOBALS['phpgw']->template->set_var('lang_rating',lang('Rating'));
! 
!       $GLOBALS['phpgw']->template->set_var('lang_access',lang('Access'));
!       
$GLOBALS['phpgw']->template->set_var('input_access',lang($GLOBALS['phpgw']->db->f('bm_access')));
! 
!       $GLOBALS['phpgw']->template->set_var('lang_header',lang('View 
bookmark'));
! 
!       $GLOBALS['phpgw']->template->set_var('input_url','<a href="' . 
$GLOBALS['phpgw']->link('/bookmarks/redirect.php','bm_id=' . 
$GLOBALS['phpgw']->db->f('bm_id')) . '" target="_new">' . 
$GLOBALS['phpgw']->db->f('bm_url') . '</a>');
!       
$GLOBALS['phpgw']->template->set_var('input_name',$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('bm_name')));
!       
$GLOBALS['phpgw']->template->set_var('input_desc',$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('bm_desc')));
!       
$GLOBALS['phpgw']->template->set_var('input_keywords',$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('bm_keywords')));
!       $GLOBALS['phpgw']->template->set_var('input_rating','<img src="' . 
$GLOBALS['phpgw']->common->get_image_path('bookmarks') . '/bar-' . 
$GLOBALS['phpgw']->db->f('bm_rating') . '.jpg">');
! 
!       $category    = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->categories->return_name($GLOBALS['phpgw']->db->f('bm_category')));
!       $subcategory = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->categories->return_name($GLOBALS['phpgw']->db->f('bm_subcategory')));
!       if ($subcategory)
!       {
!               $category .= ' :: ' . $subcategory;
!       }
!       $GLOBALS['phpgw']->template->set_var('input_category',$category);
! 
!       $GLOBALS['phpgw']->template->set_var('cancel_button','<input 
type="image" name="cancel" title="' . lang('Done') . '" src="' . PHPGW_IMAGES . 
'/cancel.gif" border="0">');
! 
!       if ($GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_EDIT))
!       {
!               $GLOBALS['phpgw']->template->set_var('edit_button','<input 
type="image" name="edit" title="' . lang('Edit') . '" src="' . PHPGW_IMAGES . 
'/edit.gif" border="0">');
!       }
! 
!       if ($GLOBALS['phpgw']->bookmarks->check_perms($bm_id,PHPGW_ACL_DELETE))
!       {
!               $GLOBALS['phpgw']->template->set_var('delete_button','<input 
type="image" name="delete" title="' . lang('Delete') . '" src="' . PHPGW_IMAGES 
. '/delete.gif" border="0">');
!       }
! 
!       $GLOBALS['phpgw']->common->phpgw_footer();
! ?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]