phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: infolog/inc class.bolink.inc.php,1.11,1.12


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: infolog/inc class.bolink.inc.php,1.11,1.12
Date: Sat, 22 Feb 2003 07:23:58 -0500

Update of /cvsroot/phpgroupware/infolog/inc
In directory subversions:/tmp/cvs-serv9788

Modified Files:
        class.bolink.inc.php 
Log Message:
1) changed pseudo-appname of attached files from 'vfs' to 'file' and made it a 
class-var
2) renamed vfs_view into get_file
3) changed behavior on deleting links for an not yet existing entry: was just 
unset before and is now set to False to be not overwriten by eTemplate's 
reload-circles

Index: class.bolink.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/infolog/inc/class.bolink.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** class.bolink.inc.php        20 Oct 2002 15:05:50 -0000      1.11
--- class.bolink.inc.php        22 Feb 2003 12:23:54 -0000      1.12
***************
*** 22,26 ****
        @abstract generalized linking between entries of phpGroupware apps - BO 
layer
        @discussion This class is the BO-layer of the links
!       @discussion Links have to ends each pointing to an entry, an entry is a 
double:
        @discussion app   app-name or directory-name of an phpgw application, 
eg. 'infolog'
        @discussion id    this is the id, eg. an integer or a tupple like 
'0:INBOX:1234'
--- 22,26 ----
        @abstract generalized linking between entries of phpGroupware apps - BO 
layer
        @discussion This class is the BO-layer of the links
!       @discussion Links have two ends each pointing to an entry, each entry 
is a double:
        @discussion app   app-name or directory-name of an phpgw application, 
eg. 'infolog'
        @discussion id    this is the id, eg. an integer or a tupple like 
'0:INBOX:1234'
***************
*** 71,74 ****
--- 71,75 ----
                var $vfs;
                var $vfs_basedir='/infolog';
+               var $vfs_appname='file';        // pseudo-appname for own 
file-attachments in vfs, this is NOT the vfs-app
                var $valid_pathes = array();
                var $send_file_ips = array();
***************
*** 81,85 ****
                                'title' => True,
                                'view'  => True,
!                               'vfs_view' => True
                        );
                        $this->vfs = CreateObject('infolog.vfs');
--- 82,86 ----
                                'title' => True,
                                'view'  => True,
!                               'get_file' => True
                        );
                        $this->vfs = CreateObject('infolog.vfs');
***************
*** 102,108 ****
                @param $app1 app of $id1
                @param $id1 id of item to linkto or 0 if item not yet created 
or array with links 
!                       of not created item or $file-array if $app1 == 'vfs' 
(see below)
                @param $app2 app of 2.linkend or array with links ($id2 not 
used)
!               @param $id2 id of 2. item of $file-array if $app2 == 'vfs' (see 
below)
                @param $file array with informations about the file in format 
of the etemplate file-type
                @param $file['name'] name of the file (no directory)
--- 103,109 ----
                @param $app1 app of $id1
                @param $id1 id of item to linkto or 0 if item not yet created 
or array with links 
!                       of not created item or $file-array if $app1 == 
$this->vfs_appname (see below)
                @param $app2 app of 2.linkend or array with links ($id2 not 
used)
!               @param $id2 id of 2. item of $file-array if $app2 == 
$this->vfs_appname (see below)
                @param $file array with informations about the file in format 
of the etemplate file-type
                @param $file['name'] name of the file (no directory)
***************
*** 124,128 ****
                                echo 
"<p>bolink.link('$app1',$id1,'$app2',$id2,'$remark',$owner,$lastmod)</p>\n";
                        }
!                       if (!$app1 || !$app2 || !$id1 && is_array($id2) || 
$app1 == $app2 && $id1 == $id2)
                        {
                                return False;
--- 125,129 ----
                                echo 
"<p>bolink.link('$app1',$id1,'$app2',$id2,'$remark',$owner,$lastmod)</p>\n";
                        }
!                       if (!$app1 || !$app2 || $app1 == $app2 && $id1 == $id2)
                        {
                                return False;
***************
*** 134,138 ****
                                        $id1 = array( );
                                }
!                               $link_id = "$app2:$id2";
                                $id1[$link_id] = array(
                                        'app' => $app2,
--- 135,139 ----
                                        $id1 = array( );
                                }
!                               $link_id = $app2 != $this->vfs_appname ? 
"$app2:$id2" : "$app2:$id2[name]";
                                $id1[$link_id] = array(
                                        'app' => $app2,
***************
*** 143,146 ****
--- 144,151 ----
                                        'lastmod' => time()
                                );
+                               if ($this->debug)
+                               {
+                                       _debug_array($id1);
+                               }
                                return $link_id;
                        }
***************
*** 151,155 ****
                                while ($link_id && list(,$link) = each($app2))
                                {
!                                       if ($link['app'] == 'vfs')
                                        {
                                                $link_id = 
-intval($this->attach_file($app1,$id1,$link['id'],$link['remark']));
--- 156,164 ----
                                while ($link_id && list(,$link) = each($app2))
                                {
!                                       if (!is_array($link))   // check for 
unlink-marker
!                                       {
!                                               continue;
!                                       }
!                                       if ($link['app'] == $this->vfs_appname)
                                        {
                                                $link_id = 
-intval($this->attach_file($app1,$id1,$link['id'],$link['remark']));
***************
*** 163,171 ****
                                return $link_id;
                        }
!                       if ($app1 == 'vfs')
                        {
                                return 
-intval($this->attach_file($app2,$id2,$id1,$remark));
                        }
!                       elseif ($app2 == 'vfs')
                        {
                                return 
-intval($this->attach_file($app1,$id1,$id2,$remark));
--- 172,180 ----
                                return $link_id;
                        }
!                       if ($app1 == $this->vfs_appname)
                        {
                                return 
-intval($this->attach_file($app2,$id2,$id1,$remark));
                        }
!                       elseif ($app2 == $this->vfs_appname)
                        {
                                return 
-intval($this->attach_file($app1,$id1,$id2,$remark));
***************
*** 198,202 ****
                                        while ($link = current($id))
                                        {
!                                               if ($only_app && $not_only == 
($link['app'] == $only_app))
                                                {
                                                        continue;
--- 207,212 ----
                                        while ($link = current($id))
                                        {
!                                               if (!is_array($link) ||         
// check for unlink-marker
!                                                   $only_app && $not_only == 
($link['app'] == $only_app))
                                                {
                                                        continue;
***************
*** 210,215 ****
                        $ids = solink::get_links($app,$id,$only_app,$order);
  
!                       if (empty($only_apps) || $only_apps == 'vfs' ||
!                           ($only_app[0] == '!' && $only_app != '!vfs'))
                        {
                                if ($vfs_ids = $this->list_attached($app,$id))
--- 220,225 ----
                        $ids = solink::get_links($app,$id,$only_app,$order);
  
!                       if (empty($only_apps) || $only_apps == 
$this->vfs_appname ||
!                           ($only_app[0] == '!' && $only_app != 
'!'.$this->vfs_appname))
                        {
                                if ($vfs_ids = $this->list_attached($app,$id))
***************
*** 235,239 ****
                        if (is_array($id))
                        {
!                               if (isset($id[$app_link_id]))
                                {
                                        return $id[$app_link_id];
--- 245,249 ----
                        if (is_array($id))
                        {
!                               if (isset($id[$app_link_id]) && 
is_array($id[$app_link_id]))    // check for unlinked-marker
                                {
                                        return $id[$app_link_id];
***************
*** 241,245 ****
                                return False;
                        }
!                       if (intval($app_link_id) < 0 || $app_link_id == 'vfs' 
|| $app2 == 'vfs')
                        {
                                if (intval($app_link_id) < 0)   // vfs link_id ?
--- 251,255 ----
                                return False;
                        }
!                       if (intval($app_link_id) < 0 || $app_link_id == 
$this->vfs_appname || $app2 == $this->vfs_appname)
                        {
                                if (intval($app_link_id) < 0)   // vfs link_id ?
***************
*** 247,251 ****
                                        return 
$this->fileinfo2link(-$app_link_id);
                                }
!                               if ($app_link_id == 'vfs')
                                {
                                        return 
$this->info_attached($app2,$id2,$id);
--- 257,261 ----
                                        return 
$this->fileinfo2link(-$app_link_id);
                                }
!                               if ($app_link_id == $this->vfs_appname)
                                {
                                        return 
$this->info_attached($app2,$id2,$id);
***************
*** 273,281 ****
                                return $this->delete_attached(-$link_id);
                        }
!                       elseif ($app == 'vfs')
                        {
                                return $this->delete_attached($app2,$id2,$id);
                        }
!                       elseif ($app2 == 'vfs')
                        {
                                return $this->delete_attached($app,$id,$id2);
--- 283,291 ----
                                return $this->delete_attached(-$link_id);
                        }
!                       elseif ($app == $this->vfs_appname)
                        {
                                return $this->delete_attached($app2,$id2,$id);
                        }
!                       elseif ($app2 == $this->vfs_appname)
                        {
                                return $this->delete_attached($app,$id,$id2);
***************
*** 285,293 ****
                                return 
solink::unlink($link_id,$app,$id,$owner,$app2,$id2);
                        }
!                       $result = isset($id[$link_id]);
! 
!                       unset($id[$link_id]);
  
!                       return $result;
                }
  
--- 295,305 ----
                                return 
solink::unlink($link_id,$app,$id,$owner,$app2,$id2);
                        }
!                       if (isset($id[$link_id]))
!                       {
!                               $id[$link_id] = False;  // set the unlink marker
  
!                               return True;
!                       }
!                       return False;
                }
  
***************
*** 296,300 ****
                @syntax app_list(   )
                @author ralfbecker
!               @abstrac get list/array of link-aware apps the user has rights 
to use 
                @result array( $app => lang($app), ... )
                */
--- 308,312 ----
                @syntax app_list(   )
                @author ralfbecker
!               @abstrac get list/array of link-aware apps the user has rights 
to use
                @result array( $app => lang($app), ... )
                */
***************
*** 348,353 ****
                                echo "<p>bolink::title('$app','$id')</p>\n";
                        }
!                       if ($app == 'vfs')
                        {
                                if (is_array($link))
                                {
--- 360,370 ----
                                echo "<p>bolink::title('$app','$id')</p>\n";
                        }
!                       if ($app == $this->vfs_appname)
                        {
+                               if (is_array($id) && $link)
+                               {
+                                       $link = $id;
+                                       $id = $link['name'];
+                               }
                                if (is_array($link))
                                {
***************
*** 364,370 ****
                                                }
                                        }
!                                       $size = ' '.$size;
                                }
!                               return $id.$size;
                        }
                        if ($app == '' || !is_array($reg = 
$this->app_register[$app]) || !isset($reg['title']))
--- 381,387 ----
                                                }
                                        }
!                                       $extra = ': '.$link['type'] . ' '.$size;
                                }
!                               return $id.$extra;
                        }
                        if ($app == '' || !is_array($reg = 
$this->app_register[$app]) || !isset($reg['title']))
***************
*** 386,392 ****
                function view($app,$id,$link='')
                {
!                       if ($app == 'vfs' && !empty($id) && is_array($link))
                        {
!                               return $this->vfs_view($link);
                        }
                        if ($app == '' || !is_array($reg = 
$this->app_register[$app]) || !isset($reg['view']) || !isset($reg['view_id']))
--- 403,409 ----
                function view($app,$id,$link='')
                {
!                       if ($app == $this->vfs_appname && !empty($id) && 
is_array($link))
                        {
!                               return $this->get_file($link);
                        }
                        if ($app == '' || !is_array($reg = 
$this->app_register[$app]) || !isset($reg['view']) || !isset($reg['view_id']))
***************
*** 412,421 ****
                }
                
!               function vfs_view($link='')
                {
                        if (is_array($link))
                        {
                                return array(
!                                       'menuaction' => 
'infolog.bolink.vfs_view',
                                        'app' => $link['app2'],
                                        'id'  => $link['id2'],
--- 429,438 ----
                }
                
!               function get_file($link='')
                {
                        if (is_array($link))
                        {
                                return array(
!                                       'menuaction' => 
'infolog.bolink.get_file',
                                        'app' => $link['app2'],
                                        'id'  => $link['id2'],
***************
*** 436,440 ****
                        $local = $this->attached_local($app,$id,$filename,
                                
get_var('REMOTE_ADDR',Array('SERVER')),$browser->is_windows());
!                       
                        if ($local)
                        {
--- 453,457 ----
                        $local = $this->attached_local($app,$id,$filename,
                                
get_var('REMOTE_ADDR',Array('SERVER')),$browser->is_windows());
! 
                        if ($local)
                        {
***************
*** 625,629 ****
                        {
                                $fileinfo = $this->vfs->fileinfo($fileinfo);
!                               list(,$fileinfo) = each($fileinfo);
  
                                if (!is_array($fileinfo))
--- 642,646 ----
                        {
                                $fileinfo = $this->vfs->fileinfo($fileinfo);
!                               list(,$fileinfo) = each($fileinfo); 
  
                                if (!is_array($fileinfo))
***************
*** 635,643 ****
                        list($y,$m,$d) = explode('-',$lastmod);
                        $lastmod = mktime(0,0,0,$m,$d,$y);
!                       
                        $dir_parts = 
array_reverse(explode('/',$fileinfo['directory']));
  
                        return array(
!                               'app'       => 'vfs',
                                'id'        => $fileinfo['name'],
                                'app2'      => $dir_parts[1],
--- 652,660 ----
                        list($y,$m,$d) = explode('-',$lastmod);
                        $lastmod = mktime(0,0,0,$m,$d,$y);
! 
                        $dir_parts = 
array_reverse(explode('/',$fileinfo['directory']));
  
                        return array(
!                               'app'       => $this->vfs_appname,
                                'id'        => $fileinfo['name'],
                                'app2'      => $dir_parts[1],
***************
*** 648,652 ****
                                'lastmod'   => $lastmod,
                                'size'      => $fileinfo['size'],
!                               'mime_type' => $fileinfo['mime_type']
                        );
                }
--- 665,669 ----
                                'lastmod'   => $lastmod,
                                'size'      => $fileinfo['size'],
!                               'type'      => $fileinfo['mime_type']
                        );
                }
***************
*** 722,726 ****
                        $link = $this->vfs->readlink 
($this->vfs_path($app,$id,$filename), array (RELATIVE_ROOT));
  
!                       if ($link)
                        {
                                reset($this->link_pathes); $fname = '';
--- 739,743 ----
                        $link = $this->vfs->readlink 
($this->vfs_path($app,$id,$filename), array (RELATIVE_ROOT));
  
!                       if ($link && is_array($this->link_pathes))
                        {
                                reset($this->link_pathes); $fname = '';





reply via email to

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