phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc class.vfs_shared.inc.php,1.1,1.2


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.vfs_shared.inc.php,1.1,1.2
Date: Tue, 04 Mar 2003 13:15:40 -0500

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv20474

Modified Files:
        class.vfs_shared.inc.php 
Log Message:
sim's patch #1218: vfs patch (to implement "view" method)


Index: class.vfs_shared.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.vfs_shared.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.vfs_shared.inc.php    17 Feb 2003 19:33:07 -0000      1.1
--- class.vfs_shared.inc.php    4 Mar 2003 18:15:38 -0000       1.2
***************
*** 272,275 ****
--- 272,325 ----
                function read ($data) { return False; }
  
+                /*!
+               @function view
+               @abstract Views the specified file (does not return!)
+               @param string filename
+               @param relatives Relativity array
+               @result None (doesnt return)
+               @discussion By default this function just reads the file and
+               outputs it too the browser, after setting the content-type 
header 
+               appropriately.  For some other VFS implementations though, there
+               may be some more sensible way of viewing the file.
+               */
+                function view($data)
+                {
+                       
+                       $default_values = array
+                               (
+                                       'relatives'     => array 
(RELATIVE_CURRENT)
+                               );
+                       $data = array_merge ($this->default_values ($data, 
$default_values), $data);
+  
+                       $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nonavbar'] = true;
+                       $GLOBALS['phpgw_info']['flags']['noappheader'] = true;
+                       $GLOBALS['phpgw_info']['flags']['noappfooter'] = true;
+                       $ls_array = $this->ls (array (
+                                       'string'        =>  $data['string'],
+                                       'relatives'     => $data['relatives'],
+                                       'checksubdirs'  => False,
+                                       'nofiles'       => True
+                               )
+                       );
+               
+                       if ($ls_array[0]['mime_type'])
+                       {
+                               $mime_type = $ls_array[0]['mime_type'];
+                       }
+                       elseif ($GLOBALS['settings']['viewtextplain'])
+                       {
+                               $mime_type = 'text/plain';
+                       }
+               
+                       header('Content-type: ' . $mime_type);
+                       echo $this->read (array (
+                                       'string'        =>  $data['string'],
+                                       'relatives'     => $data['relatives'],
+                               )
+                       );              
+                       exit(); 
+                }
+               
                /*!
                 * @function write





reply via email to

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