phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] ged templates/base/css/default.css inc/class.ge...


From: Pascal Vilarem
Subject: [Phpgroupware-cvs] ged templates/base/css/default.css inc/class.ge...
Date: Tue, 03 Apr 2007 16:43:21 +0000

CVSROOT:        /sources/phpgroupware
Module name:    ged
Changes by:     Pascal Vilarem <maat>   07/04/03 16:43:21

Modified files:
        templates/base/css: default.css 
        inc            : class.ged_ui.inc.php 
        templates/base : file.tpl 

Log message:
        Download a zip of all linked documents

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/css/default.css?cvsroot=phpgroupware&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_ui.inc.php?cvsroot=phpgroupware&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/file.tpl?cvsroot=phpgroupware&r1=1.8&r2=1.9

Patches:
Index: templates/base/css/default.css
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/css/default.css,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- templates/base/css/default.css      2 Apr 2007 17:54:58 -0000       1.8
+++ templates/base/css/default.css      3 Apr 2007 16:43:21 -0000       1.9
@@ -84,6 +84,7 @@
 #ged_info .ged_file_metadata {
        font-size: 7pt;
        color: gray;
+  clear: both;
 }
 
 #ged_info #ged_file_references {

Index: inc/class.ged_ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_ui.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- inc/class.ged_ui.inc.php    2 Apr 2007 17:33:17 -0000       1.23
+++ inc/class.ged_ui.inc.php    3 Apr 2007 16:43:21 -0000       1.24
@@ -22,7 +22,7 @@
        var $debug=1;
        var $browser;
 
-       var $public_functions=array('browse'=>true, 'add_file'=>true, 
'add_folder'=>true, 'update_file'=>true, 'update_folder'=>true, 
'delete_folder'=>true, 'download'=>true, 'view'=>true, 'update_file'=>true, 
'delete_file'=>true, 'change_acl'=>true, 'approve_file'=>true, 'submit_file'=> 
true, 'accept_file'=> true, 'refuse_file'=> true, 'deliver_file'=> true, 
'reject_file'=> true );
+       var $public_functions=array('browse'=>true, 'add_file'=>true, 
'add_folder'=>true, 'update_file'=>true, 'update_folder'=>true, 
'delete_folder'=>true, 'download'=>true, 'package_download' => true, 
'view'=>true, 'update_file'=>true, 'delete_file'=>true, 'change_acl'=>true, 
'approve_file'=>true, 'submit_file'=> true, 'accept_file'=> true, 
'refuse_file'=> true, 'deliver_file'=> true, 'reject_file'=> true );
 
        var $icons;
 
@@ -215,7 +215,10 @@
 
                $this->t->set_var('reference_color', 'red');
 
-               $this->t->set_var('img_download-', 
$GLOBALS['phpgw']->common->image('ged', 'download'));
+               $this->t->set_var('image_download-48', 
$GLOBALS['phpgw']->common->image('ged', 'download-48'));
+               $this->t->set_var('image_download-32', 
$GLOBALS['phpgw']->common->image('ged', 'download-32'));
+               $this->t->set_var('image_download-16', 
$GLOBALS['phpgw']->common->image('ged', 'download-16'));
+               
                $this->t->set_var('img_view', 
$GLOBALS['phpgw']->common->image('ged', 'eye'));
                $this->t->set_var('img_edit_version', 
$GLOBALS['phpgw']->common->image('ged', 'admin_log'));
 
@@ -312,6 +315,71 @@
     
        }
 
+       // TODO acl here
+       function package_download()
+       {
+               $element_id=get_var('element_id',array('GET','POST'));
+               $version_id=get_var('version_id',array('GET','POST'));
+               
+               $theversion=$this->ged_dm->get_version_info($version_id);
+               $theversion_sterile_file_name = preg_replace( "/[^\w\.-]+/", 
"_", $theversion['name'] );
+               
+               
$thetempdir=$GLOBALS['phpgw_info']['server']['temp_dir']."/".$theversion_sterile_file_name;
+               
+               mkdir($thetempdir, 0700);
+               
+               $zip_file_name=$theversion_sterile_file_name.'.zip';
+               
$zip_file_name_full_path=$GLOBALS['phpgw_info']['server']['temp_dir']."/".$zip_file_name;
+               
+               
$list_relations_out=$this->ged_dm->list_version_relations_out($version_id);
+               
+               if ($list_relations_out !="")
+                       foreach ($list_relations_out as $list_relation)
+                       {
+                               
$version=$this->ged_dm->get_version_info($list_relation['version_id']);
+                               $filename=basename ($version['file_full_path']);
+                               $filenames[]=$thetempdir."/".$filename;
+                               copy($version['file_full_path'], 
$thetempdir."/".$filename);
+                       }
+               
+               // Création du zip
+               $retval=null;
+               exec ( "cd ".$GLOBALS['phpgw_info']['server']['temp_dir']."; 
/usr/bin/zip -r ".$theversion_sterile_file_name." 
".$theversion_sterile_file_name, $retval);
+               
+
+               if ($this->browser->is_ie())
+               {
+                       ini_set('zlib.output_compression', 'Off');
+                       header('Pragma: private');
+                       header('Cache-control: private, must-revalidate');
+                       header("Content-Type: application/force-download");
+                       header('Content-Disposition: attachment; 
filename="'.$zip_file_name.'"', false);
+                       $download_size=filesize($zip_file_name_full_path);
+                       header('Content-Length: '.$download_size, false);
+                       readfile($zip_file_name_full_path);
+               }
+               else
+               {
+                       header('Expires: '.gmdate('D, d M Y H:i:s') . ' GMT'); 
+                       header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' 
GMT', false); 
+                       header('Cache-Control: must-revalidate', false);
+                       header('Content-type: application/zip', false);
+                       header('Content-Disposition: attachment; 
filename="'.$zip_file_name.'"', false);
+                       $download_size=filesize($zip_file_name_full_path);
+                       header('Content-Length: '.$download_size, false);
+                       readfile($zip_file_name_full_path);
+    }
+    
+    foreach ( $filenames as $filename)
+    {
+       unlink($filename);
+    }
+    rmdir ($thetempdir);
+    unlink ($zip_file_name_full_path);
+
+               exit();
+    
+       }
 
        function draw_tree($focused_id=0, $parent_id=0, $path="", 
$element_info="", $expand=false)
        {
@@ -497,6 +565,16 @@
                        $this->t->fp('relations_list_handle', 'relations_list', 
True);
                }       
     
+               if ($list_relations_out !="")
+               {
+                       $link_data['menuaction']='ged.ged_ui.package_download';
+                       $link_data['focused_id']=$element_id;
+                       $link_data['version_id']=$version_id;
+                       $this->t->set_var('relation_link', 
$GLOBALS['phpgw']->link('/index.php', $link_data));
+                       
+                       $this->t->set_var('download_all_link', 
$GLOBALS['phpgw']->link('/index.php', $link_data));
+               }
+    
                
$list_relations_in=$this->ged_dm->list_version_relations_in($current_version['version_id']);
                
                $this->t->set_block('file_tpl', 'relations_list2', 
'relations_list2_handle');

Index: templates/base/file.tpl
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/file.tpl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- templates/base/file.tpl     2 Apr 2007 17:33:17 -0000       1.8
+++ templates/base/file.tpl     3 Apr 2007 16:43:21 -0000       1.9
@@ -6,6 +6,7 @@
 {lang_current_version_expiration_date} : {current_version_expiration_date}
 </div>
 
+<div style="float: right"><a href="{download_all_link}" ><img 
src="{image_download-32}"/></a></div>
 <div class="ged_title">Linking to :</div>
 <table id="ged_file_relations" cellspacing="0" cellpadding"0">
 <!-- BEGIN relations_list -->




reply via email to

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