phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] folders/inc class.bofolders.inc.php,1.2,1.3


From: Philipp Kamps <address@hidden>
Subject: [Phpgroupware-cvs] folders/inc class.bofolders.inc.php,1.2,1.3
Date: Mon, 17 Nov 2003 17:28:08 +0000

Update of /cvsroot/phpgroupware/folders/inc
In directory subversions:/tmp/cvs-serv18764/inc

Modified Files:
        class.bofolders.inc.php 
Log Message:
a hook is proceed to get the content of folders

Index: class.bofolders.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/folders/inc/class.bofolders.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** class.bofolders.inc.php     7 Nov 2003 17:01:09 -0000       1.2
--- class.bofolders.inc.php     17 Nov 2003 17:28:05 -0000      1.3
***************
*** 1,15 ****
  <?php
!       
/**************************************************************************\
!       * phpGroupWare - Folders                                                
   *
!       * http://www.phpgroupware.org                                           
   *
!       * Written by Philipp Kamps <address@hidden>               *
!       * --------------------------------------------                          
   *
!       *  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$ */
  
        include ('folders/phplayersmenu/lib/PHPLIB.php');
--- 1,11 ----
  <?php
! /**
!  * folders module
!  * @author Philipp Kamps <address@hidden>
!  * @copyright Copyright (C) 2003 Free Software Foundation http://www.fsf.org/
!  * @license http://www.fsf.org/licenses/gpl.html GNU General Public License
!  * @package folders
!  * @version $Id$
!  */
  
        include ('folders/phplayersmenu/lib/PHPLIB.php');
***************
*** 28,32 ****
                 );
                var $mid;
-               var $db;
                var $debug = false;
  
--- 24,27 ----
***************
*** 34,53 ****
                function bofolders()
                {
-                       $this->db = $GLOBALS['phpgw']->db;
- 
                        $this->mid = new phpGWTreeMenu();
  
                        $this->mid->setLibjsdir('folders/phplayersmenu/libjs');
!                       
//$this->mid->setDirroot(PHPGW_SERVER_ROOT.'/folders/'); // not correctly 
working :-(
!                       $this->mid->setImgwww('folders/phplayersmenu/images/');
!                       $this->mid->setImgdir('folders/phplayersmenu/images/');
  
  /*
                        $this->account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->folds['folders'] = 
$GLOBALS['phpgw_info']['user']['preferences']['folders'];
- */
-                       $this->group            = 
CreateObject('phpgwapi.accounts');
                        $this->imapcon          = 
CreateObject('email.mail_dcom');
                        $this->mailmsg          = 
CreateObject('email.mail_msg');
                        $this->bo               = 
CreateObject('email.bopreferences');
  
--- 29,47 ----
                function bofolders()
                {
                        $this->mid = new phpGWTreeMenu();
  
                        $this->mid->setLibjsdir('folders/phplayersmenu/libjs');
!                       //$this->mid->setDirroot(PHPGW_SERVER_ROOT); // not 
correctly working :-(
!                       $this->mid->setImgwww('./');
!                       $this->mid->setImgdir('/var/www/phpgw-pb-tpl/');
  
  /*
                        $this->account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->folds['folders'] = 
$GLOBALS['phpgw_info']['user']['preferences']['folders'];
                        $this->imapcon          = 
CreateObject('email.mail_dcom');
                        $this->mailmsg          = 
CreateObject('email.mail_msg');
+ 
+ */
+                       $this->group            = 
CreateObject('phpgwapi.accounts');
                        $this->bo               = 
CreateObject('email.bopreferences');
  
***************
*** 56,170 ****
                function buildFolders($menuname)
                {
!                       if 
($GLOBALS['phpgw_info']['user']['apps']['email']['enabled'] == true)
!                       {
!                               $mailFolders = $this->get_mailFolders();
!                       }
!                       $this->mid->scanTableForMenu($menuname,'',$this->db, 
$mailFolders);
!               }
! 
!               function parseFolders($menuname)
!               {
!                       return $this->mid->newTreeMenu($menuname);
!               }
! 
! 
! /**
! * The method provides the list of email folders
! * @access privat
! * @return array
! */
!               function get_mailFolders()
!                {
!                       // make sure we have msg object and a server stream
!                       $this->msg_bootstrap = 
CreateObject("email.msg_bootstrap");
!                       
$this->msg_bootstrap->ensure_mail_msg_exists('email.bofolder.folder', 
$this->debug);
!                       
!                       $standard_account = array ('acctnum'        => 0,
!                                                  'status'         => 
'enabled',
!                                                  'display_string' => '[0] 
standard'
!                                                  );
  
!                       $extra_account_list = $this->bo->ex_accounts_list();
!                       
!                       array_unshift($extra_account_list, $standard_account);
!                       $account_list = $extra_account_list;
  
!                       $return = array();
!                       for ($i=0; $i < count($account_list); $i++)
                        {
!                               if ($account_list[$i]['status'] == 'enabled')
                                {
!                                       $account_name = 
substr($account_list[$i]['display_string'],(strrpos($account_list[$i]['display_string'],']')+2));
!                                       $account_name = lang('mailbox').' 
\''.$account_name.'\'';
!                                       $return[] = array('id'        => 
strval($account_list[$i]['acctnum']+1),
!                                                   'name'      => 
$account_name,
!                                                   'parent_id' => '0',
!                                                   'icon'      => 'email.png'
!                                                        );
! 
!                                       $folder_list_i = 
$GLOBALS['phpgw']->msg->get_arg_value('folder_list',$account_list[$i]['acctnum']);
! 
!                                       for ($j=0; $j < count($folder_list_i); 
$j++)
                                        {
!       
!                                               $separator = 
$this->get_IMAP_folder_separator($folder_list_i[$j]['folder_long']);
!                                               $path = explode($separator, 
$folder_list_i[$j]['folder_long']);
! 
!                                               // calculate parent folder
!                                               if (count($path) == 1)
!                                               {
!                                                       $parent = 
strval($account_list[$i]['acctnum']+1);
!                                               }
!                                               else
!                                               {
!                                                       //special handling for 
the courir server
!                                                       if ( $path[count($path) 
- 2] == 'INBOX' && $separator == '.' )
!                                                       {
!                                                               $parent = 
strval($account_list[$i]['acctnum']+1);
!                                                       }
!                                                       else
!                                                       {
!                                                               $parent = 
$path[count($path) - 2].strval($account_list[$i]['acctnum']+1);
!                                                       }
!                                               }
!                                               
!                                               // parse link to view email 
folder
!                                               $folderName = 
$GLOBALS['phpgw']->msg->prep_folder_out($folder_list_i[$j]['folder_long']);
!                                               $folderLink = 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.index'.
!                                                                               
      '&fldball[folder]='.$folderName.
!                                                                               
      '&fldball[acctnum]='.$account_list[$i]['acctnum']
!                                                                               
      );
!                                               
!                                               $return[] = array ('id'        
=> $path[count($path)-1].strval($account_list[$i]['acctnum']+1),
!                                                                  'name'      
=> $path[count($path)-1],
!                                                                  'title'     
=> $folder_list_i[$j]['folder_long'],
!                                                                  'icon'      
=> 'email.png',
!                                                            'parent_id' => 
$parent,
!                                                            'href'      => 
$folderLink,
!                                                            'target'    => 
'_parent'
!                                                                  );
                                        }
                                }
                        }
!                       return $return;
                }
  
!               function get_IMAP_folder_separator($string)
                {
!                       //exchange
!                       if (strpos($string, '/'))
!                       {
!                               $separator = '/';
!                       }
!                       //courir
!                       elseif (strpos($string, '.'))
!                       {
!                               $separator = '.';
!                       }
!                       else
!                       {
!                               $separator = 'I doubt this string is used 
somewhere';
!                       }
!                       return $separator;
                }
        }
--- 50,77 ----
                function buildFolders($menuname)
                {
!                       $hookContent = 
$GLOBALS['phpgw']->hooks->process('getFolderContent');
  
!                       echo "<pre>";
!                       print_r($hookContent);
!                       echo "</pre>";
  
!                       //$this->mid->scanTableForMenu($menuname,'', 
$hookContent['folders']['content']);
!                       $folderContent = array();
!                       while(list($key, $value) = each($hookContent))
                        {
!                               if (is_array($hookContent[$key]['content']))
                                {
!                                       while (list($xkey, $value) = 
each($hookContent[$key]['content']))
                                        {
!                                               $folderContent[$xkey] = 
$hookContent[$key]['content'][$xkey];
                                        }
                                }
                        }
!                       $this->mid->scanTableForMenu($menuname,'', 
$folderContent);
                }
  
!               function parseFolders($menuname)
                {
!                       return $this->mid->newTreeMenu($menuname);
                }
        }





reply via email to

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