phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: wcm/inc class.uielement.inc.php,1.17,1.18 class.


From: Miles Lott <address@hidden>
Subject: [Phpgroupware-cvs] CVS: wcm/inc class.uielement.inc.php,1.17,1.18 class.uisite.inc.php,1.16,1.17
Date: Sun, 24 Mar 2002 08:08:17 -0500

Update of /cvsroot/phpgroupware/wcm/inc
In directory subversions:/tmp/cvs-serv29328/inc

Modified Files:
        class.uielement.inc.php class.uisite.inc.php 
Log Message:
Handle file uploads via element edit page (expects writeable full path spec)



Index: class.uielement.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/wcm/inc/class.uielement.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** class.uielement.inc.php     23 Mar 2002 13:36:19 -0000      1.17
--- class.uielement.inc.php     24 Mar 2002 13:08:14 -0000      1.18
***************
*** 274,283 ****
                        $GLOBALS['phpgw']->template->set_unknowns('remove');
  
!                       $element_id = $GLOBALS['HTTP_POST_VARS']['element_id'] 
? $GLOBALS['HTTP_POST_VARS']['element_id'] : 
$GLOBALS['HTTP_GET_VARS']['element_id'];
  
                        $element = $this->bo->read($element_id);
!                       $element['element_type'] = 
$GLOBALS['HTTP_POST_VARS']['element_type'] ? 
$GLOBALS['HTTP_POST_VARS']['element_type'] : $element['element_type'];
  
!                       if ($GLOBALS['HTTP_POST_VARS']['submit'])
                        {
                                $errorcount = 0;
--- 274,284 ----
                        $GLOBALS['phpgw']->template->set_unknowns('remove');
  
!                       $element_id = get_var('element_id',array('POST','GET'));
!                       $uploadfile = $GLOBALS['HTTP_POST_FILES']['uploadfile'];
  
                        $element = $this->bo->read($element_id);
! //                    $element['element_type'] = 
get_var('element_type'array('POST','GET'));
  
!                       if($GLOBALS['HTTP_POST_VARS']['submit'] || 
$GLOBALS['HTTP_POST_VARS']['action'])
                        {
                                $errorcount = 0;
***************
*** 290,299 ****
                                }
  
!                               if (!$GLOBALS['HTTP_POST_VARS']['element_name'])
                                {
                                        $error[$errorcount++] = lang('Please 
enter a name for that element !');
                                }
  
!                               if (!$error)
                                {
                                        $element_info = array(
--- 291,300 ----
                                }
  
!                               if(!$GLOBALS['HTTP_POST_VARS']['element_name'])
                                {
                                        $error[$errorcount++] = lang('Please 
enter a name for that element !');
                                }
  
!                               if(!$error)
                                {
                                        $element_info = array(
***************
*** 313,323 ****
                                        $element_id = $element['element_id'];
                                }
                        }
  
!                       if ($errorcount)
                        {
                                
$GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
                        }
!                       if (($GLOBALS['HTTP_POST_VARS']['submit']) && (!$error) 
&& (!$errorcount))
                        {
                                if($GLOBALS['HTTP_GET_VARS']['element_id'])
--- 314,338 ----
                                        $element_id = $element['element_id'];
                                }
+ 
+                               if($uploadfile)
+                               {
+                                       
if($GLOBALS['HTTP_POST_VARS']['element_source'])
+                                       {
+                                               $fn = 
$GLOBALS['HTTP_POST_VARS']['element_source'];
+                                       }
+                                       else
+                                       {
+                                               $element['element_source'] = 
$uploadfile['name'];
+                                               $fn = $uploadfile['name'];
+                                       }
+                                       copy($uploadfile['tmp_name'],$fn);
+                               }
                        }
  
!                       if($errorcount)
                        {
                                
$GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
                        }
!                       if(($GLOBALS['HTTP_POST_VARS']['submit']) && (!$error) 
&& (!$errorcount))
                        {
                                if($GLOBALS['HTTP_GET_VARS']['element_id'])
***************
*** 330,334 ****
                                }
                        }
!                       if ((!$GLOBALS['HTTP_POST_VARS']['submit']) && 
(!$error) && (!$errorcount))
                        {
                                
$GLOBALS['phpgw']->template->set_var('message','');
--- 345,349 ----
                                }
                        }
!                       if((!$GLOBALS['HTTP_POST_VARS']['submit']) && (!$error) 
&& (!$errorcount))
                        {
                                
$GLOBALS['phpgw']->template->set_var('message','');
***************
*** 416,423 ****
--- 431,444 ----
                                case 2:
                                        $_type = '<input name="element_source" 
size="50" value="' . $element['element_source'] . '">';
+                                       
$GLOBALS['phpgw']->template->set_var('lang_source',lang('Element File Path'));
                                        
$GLOBALS['phpgw']->template->set_var('multipart','ENCTYPE="multipart/form-data" 
');
                                        
$GLOBALS['phpgw']->template->set_var('lang_file',lang('File'));
                                        
$GLOBALS['phpgw']->template->set_var('lang_upload',lang('Upload'));
+                                       if(@stat($element['element_source']))
+                                       {
+                                               
$GLOBALS['phpgw']->template->set_var('uploaded',lang('File exists'));
+                                       }
                                        $_file = 
$GLOBALS['phpgw']->template->fp('out','file');
+                                       break;
                                case 1:
                                default:

Index: class.uisite.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/wcm/inc/class.uisite.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** class.uisite.inc.php        24 Mar 2002 12:32:21 -0000      1.16
--- class.uisite.inc.php        24 Mar 2002 13:08:14 -0000      1.17
***************
*** 216,220 ****
                        
$GLOBALS['phpgw']->template->set_block('form','page','pagehandle');
  
!                       $site_id =get_var('site_id',array('POST','GET'));
                        $site = $this->bo->read($site_id);
  
--- 216,220 ----
                        
$GLOBALS['phpgw']->template->set_block('form','page','pagehandle');
  
!                       $site_id = get_var('site_id',array('POST','GET'));
                        $site = $this->bo->read($site_id);
  




reply via email to

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