[20937] New Feature : Import/ Export of project trees and better relation management form

Pascal Vilarem <[email protected]> Thu, 07 Jan 2010 14:46:04 +0000
Newsgroups gmane.comp.web.phpgroupware.cvs
Message-ID <[email protected]>
Revision: 20937
          http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20937
Author:   maat
Date:     2010-01-07 14:46:03 +0000 (Thu, 07 Jan 2010)
Log Message:
-----------
New Feature : Import/Export of project trees and better relation management form

Modified Paths:
--------------
    modules/ged/trunk/inc/class.ged_dm.inc.php
    modules/ged/trunk/inc/class.ged_ui.inc.php
    modules/ged/trunk/templates/base/browse.tpl
    modules/ged/trunk/templates/base/css/default.css
    modules/ged/trunk/templates/base/import_project.tpl
    modules/ged/trunk/templates/base/search.tpl
    modules/ged/trunk/templates/base/update_file.tpl

Modified: modules/ged/trunk/inc/class.ged_dm.inc.php
===================================================================
--- modules/ged/trunk/inc/class.ged_dm.inc.php	2010-01-05 21:40:00 UTC (rev 20936)
+++ modules/ged/trunk/inc/class.ged_dm.inc.php	2010-01-07 14:46:03 UTC (rev 20937)
@@ -177,6 +177,19 @@
 		$the_str2=$this->db->db_addslashes($the_str);
 		return ($the_str2);
 	}
+	function clean_str_folder($str)
+	{
+		$str2='';
+		for($i=0; $i<strlen($str);++$i)
+		{
+			if($str[$i] == '/')
+				$str2.='-'; 
+			else 
+				$str2.=$str[$i];
+		}
+		
+		return $str2;
+	}
 	
 	function get_file_extention($filename)
 	{
@@ -3275,9 +3288,6 @@
 		
 		// DEBUG
 		//print ( $sql);
-		$this->db->query($sql);
-
-		$i=0;
 		while ($this->db->next_record())
 		{
 			$element_id=$this->db->f('element_id');
@@ -3861,6 +3871,228 @@
 		return ($out);
 	}
 	
+	function list_ged_status()
+	{
+		$list=null;
+		
+		$sql="SELECT * FROM phpgw_flows_statuses";
+		
+		$this->db->query($sql);
+
+		$i=0;
+		while ($this->db->next_record())
+		{
+			if($this->db->f('app') == "ged")
+			{
+				$list[$i]['status_name']=$this->db->f('status_name');
+				$list[$i]['status_id']=$this->db->f('status_id');
+			}
+			
+			$i ++;
+		}
+			
+		$this->db->unlock();
+		
+		return ($list);
+	}
+
+	function get_action($transition_id)
+	{
+		
+		
+		$sql="SELECT action FROM phpgw_flows_transitions where transition = ".$transition_id;
+		
+		$this->db->query($sql);
+
+		$act='';
+		if($this->db->next_record())
+		{
+			$act = $this->db->f('action');		
+			
+		}
+			
+		$this->db->unlock();
+		
+		return ($act);
+	}
+	
+	function list_ged_action()
+	{
+		$list=array();
+		
+		$sql="SELECT distinct action FROM phpgw_flows_transitions";
+		
+		$this->db->query($sql);
+
+		$i=0;
+		while ($this->db->next_record())
+		{
+			$list[$i]=$this->db->f('action');		
+			$i ++;
+		}
+			
+		$this->db->unlock();
+		
+		return ($list);
+	}
+	
+	function is_project_root($id)
+	{
+
+		$sql="SELECT DISTINCT project_root FROM ged_elements where project_root <> 0";
+		
+		$this->db->query($sql);
+
+		
+		while ($this->db->next_record())
+		{
+			if($this->db->f('project_root') == $id)
+			{
+				
+				$this->db->unlock();
+				return true;
+			}	
+		}		
+		$this->db->unlock();
+		return false;
+	}
+	
+	function is_file($str)
+	{
+		if($str[0]=='[')
+		return true;
+//		return preg_match ( '/\[*\]/'  , $str );
+		
+	}
+	function supp_tag($str)
+	{
+		if(strlen($str)<=1)
+		{
+			return false;
+		}
+		$bool=false;
+		$split_str='';
+		$str_tab=array("major" => "", "minor" => "", "draft" => "","file_name" => "");
+		$bool2=0;
+		for($i=1;$i<strlen($str);$i++)
+		{
+			if($str[$i]==']')
+				$bool=true;
+			else if($str[$i]==' ')
+			{
+				++$bool2;
+			}
+			else if(!$bool)
+			{
+				$split_str.=$str[$i];
+			}
+			else if($bool2>=2)
+			{
+				$str_tab['file_name'].=$str[$i]; 
+			}
+		}
+		
+		list($str_tab['major'],$str_tab['minor'], $str_tab['draft']) = split('\.', $split_str);
+		$tab_test=split('\.', $split_str);
+		return $str_tab;
+		
+	}
+	
+	
+	function export_project($id,$tmp_path)
+	{
+		
+		$sql="SELECT * FROM ged_elements E left join ged_versions V on E.element_id = V.element_id where E.project_root=".$id." order by E.parent_id,E.element_id";
+		
+		$this->db->query($sql);
+		$project_name='';
+		$parent_array = array();
+		$short_tmp_path='/';
+		$tmp_parent_id=0;
+		$o=0;
+		$element_id=0;
+		$name='';
+		while ($this->db->next_record())
+		{
+			$j=0;
+			$name=$this->clean_str_folder($this->db->f('name'));
+			if($project_name == '')//premier tour uniquement
+			{
+				$project_name=$this->db->f('name');
+				$element_id=$this->db->f('2');	
+			}
+			if($this->db->f('parent_id') != $tmp_parent_id )
+			{
+				
+					$short_tmp_path='';
+					$i=$this->db->f('parent_id');
+					while($i>=$id)
+					{
+						$result[++$o]="le short pass = ".$parent_array[$i]."/".$short_tmp_path;
+							$short_tmp_path=$parent_array[$i]."/".$short_tmp_path;
+							$i=$parent_array['parent_'.$i];
+					}
+					$short_tmp_path="/".$short_tmp_path;
+					$tmp_parent_id=$this->db->f('parent_id');
+					
+					
+			}
+		
+			if ($this->db->f('5') == "folder")
+			{
+				if(file_exists($tmp_path.$short_tmp_path.'/'.$name))
+				{
+					while(file_exists($tmp_path.$short_tmp_path.'/'.$name."(".$j.")"))
+						++$j;
+					$name.="($j)";
+					$parent_array[$this->db->f('2')]=$name;
+					$parent_array['parent_'.$this->db->f('2')]=$this->db->f('parent_id');
+					$result[++$o]="mkdir : ".$tmp_path.$short_tmp_path.$name;
+				
+					$result[++$o]="réponse : ".mkdir($tmp_path.$short_tmp_path."/".$name, 0700);
+					
+				}
+				else
+				{
+					$parent_array[$this->db->f('2')]=$name;
+					$parent_array['parent_'.$this->db->f('2')]=$this->db->f('parent_id');
+					$result[++$o]="mkdir : ".$tmp_path.$short_tmp_path.$name;
+				
+					$result[++$o]="réponse : ".mkdir($tmp_path.$short_tmp_path."/".$name, 0700);
+				}
+			
+			}
+			else if($this->db->f('5') == "file")
+			{
+				
+				
+				if(!file_exists($tmp_path.$short_tmp_path.'/'.$name))
+				{
+				
+					$result[++$o]="mkdir : ".$tmp_path.$short_tmp_path.$name;
+					$result[++$o]="réponse : ".mkdir($tmp_path.$short_tmp_path.'/'.$name,0700);
+				}
+				elseif(file_exists($tmp_path.$short_tmp_path.'/'.$name) && $element_id!=$this->db->f('2'))
+				{
+					
+					while(file_exists($tmp_path.$short_tmp_path.'/'.$name."(".$j.")"))
+						++$j;
+					$name.="($j)";
+					$result[++$o]="mkdir : ".$tmp_path.$short_tmp_path.$name;
+					$result[++$o]="réponse : ".mkdir($tmp_path.$short_tmp_path.'/'.$name,0700);
+					
+				}
+				$result[++$o]="copy : ".$tmp_path.$short_tmp_path.$name.'/['.$this->db->f('major').'.'.$this->db->f('minor').'.'.$this->db->f('draft')."] - ".$this->db->f('file_name');
+				
+				$result[++$o]="réponse : ".copy($this->datadir."/".$this->db->f('stored_name'),$tmp_path.$short_tmp_path.'/'.$name.'/['.$this->db->f('major').'.'.$this->db->f('minor').'.'.$this->db->f('draft')."] - ".$this->db->f('file_name'));	
+			}		
+			$element_id=$this->db->f('2');
+		}		
+	//	die(var_dump($result).var_dump($parent_array));	
+		$this->db->unlock();
+		return $project_name;
+	}
+
 	function get_project_status($project_root)
 	{
 		

Modified: modules/ged/trunk/inc/class.ged_ui.inc.php
===================================================================
--- modules/ged/trunk/inc/class.ged_ui.inc.php	2010-01-05 21:40:00 UTC (rev 20936)
+++ modules/ged/trunk/inc/class.ged_ui.inc.php	2010-01-07 14:46:03 UTC (rev 20937)
@@ -45,6 +45,8 @@
 		'browse'=>true, 
 		'add_file'=>true, 
 		'add_folder'=>true, 
+		'export_project'=>true,
+		'import_project'=>true,
 		'update_folder'=>true,
 		'move_folder' => true,
 		'delete_folder'=>true, 
@@ -1098,7 +1100,23 @@
 					$add_folder_link=$GLOBALS['phpgw']->link('/index.php', $link_data);
 					$this->t->set_var('update_folder', "<a href=\"".$add_folder_link."\">".lang('Update folder')."</a>" );
 
+					if($this->ged_dm->is_project_root($focused_id))
+					{
+						$link_data=null;
+						$link_data['menuaction']='ged.ged_ui.export_project';
+						$link_data['element_id']=$focused_id;
+						$add_folder_link=$GLOBALS['phpgw']->link('/index.php', $link_data);
+						$this->t->set_var('export_project', "<a href=\"".$add_folder_link."\">".lang('Export project')."</a>" );
 				}
+					if($focused_id==0 || $focused_element['project_root']==0)
+					{
+						$link_data=null;
+						$link_data['menuaction']='ged.ged_ui.import_project';
+						$link_data['parent_id']=$focused_id;
+						$add_folder_link=$GLOBALS['phpgw']->link('/index.php', $link_data);
+						$this->t->set_var('import_project', "<a href=\"".$add_folder_link."\">".lang('Import project')."</a>" );
+					}
+				}
 					
 				// TODO if acl acl add a change acl link
 				if ( $this->ged_dm->can_change_acl($focused_id) )
@@ -2090,24 +2108,25 @@
 		$this->set_template_defaults();
 		$this->display_app_header();
 		
-//		$link_data=null;
-//		$link_data['menuaction']='ged.ged_ui.search';
-//		$link_data['kp3']=$GLOBALS['phpgw_info']['user']['kp3'];
-//		$link_data['sessionid']=$GLOBALS['sessionid'];
-//		$link_data['click_history']=$_GET['click_history'];
-//		$search_url=$GLOBALS['phpgw_info']['server']['webserver_url'];
-//				
-//		$this->t->set_var('menuaction', $link_data['menuaction']);
-//		$this->t->set_var('kp3', $link_data['kp3']);
-//		$this->t->set_var('sessionid', $link_data['sessionid']);
-//		$this->t->set_var('click_history', $link_data['click_history']);
-//		$this->t->set_var('action_search', $search_url);
-
 		$link_data=null;
 		$link_data['menuaction']='ged.ged_ui.search';
-		$link_data['focused_id']=$result_query['element_id'];
-		$this->t->set_var('action_search', $GLOBALS['phpgw']->link('/index.php', $link_data));
+		$link_data['kp3']=$GLOBALS['phpgw_info']['user']['kp3'];
+		$link_data['sessionid']=$GLOBALS['sessionid'];
+		$link_data['click_history']=$_GET['click_history'];
+		$search_url=$GLOBALS['phpgw_info']['server']['webserver_url'];
 		
+		$this->t->set_var('menuaction', $link_data['menuaction']);
+		$this->t->set_var('kp3', $link_data['kp3']);
+		$this->t->set_var('sessionid', $link_data['sessionid']);
+		$this->t->set_var('click_history', $link_data['click_history']);
+		$this->t->set_var('action_search', $search_url);
+		$this->t->set_var('status_field', 'status_name[]');
+		$this->t->set_var('project_field', 'project_name[]');
+		$this->t->set_var('docs_field', 'doc_name[]');
+		$this->t->set_var('date_deb_field', 'date_deb');
+		$this->t->set_var('date_fin_field', 'date_fin');
+		
+		
 		// Search
 		if($error_message!='')
 		{
@@ -2594,6 +2613,235 @@
 		}
 	}
 	
+	function export_project()
+	{
+		
+		$element_id=$this->get_var('element_id', array('GET', 'POST'));
+				
+		$thetempdir=$GLOBALS['phpgw_info']['server']['temp_dir']."/Archive_temp";
+		exec("rm -R $thetempdir");
+		mkdir($thetempdir, 0700);
+		
+		$zip_file_name='archive.zip';
+		$zip_file_name_full_path=$GLOBALS['phpgw_info']['server']['temp_dir']."/Archive_temp/".$zip_file_name;
+
+		/*
+		 * remplissage du répertoire temporaire
+		 */
+		$file_to_zip=$this->ged_dm->export_project($element_id,$thetempdir);
+		
+		$zip_file_name=$file_to_zip.'.zip';
+		$zip_file_name_full_path=$GLOBALS['phpgw_info']['server']['temp_dir']."/Archive_temp/".$zip_file_name;
+
+		// zip creation
+		$retval=null;
+		exec ( "cd ".$thetempdir."; ".zip_bin." -r ". escapeshellarg($zip_file_name) . " " . escapeshellarg($file_to_zip) . "/", $retval);
+		
+
+		// FIXME the browser class handles (almost?) all of this for you
+		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);
+    }
+    
+   // exec("rm -R $thetempdir");
+    
+    unlink ($zip_file_name_full_path);
+
+		exit();
+
+	}
+	
+	function import_project()
+	{
+		
+		
+		
+		$parent_id=$this->get_var('parent_id', array('GET', 'POST'));
+		$errormessage='';
+		if(isset($GLOBALS['php_errormsg']))
+		{
+			if( strpos($GLOBALS['php_errormsg'], "exceeds the limit"))
+				$errormessage="<p><b>".lang("error")." : <br/>"." - ".lang("exceeds the limit of 8 MB")."</b></p>";
+			else
+				$errormessage ="<p><b>".lang("error")." : <br/> - ".$GLOBALS['php_errormsg']."<br/>".lang("return the error to your ISIS administrator")."</b></p>";
+		}
+		$link_data=null;
+		$link_data['menuaction']='ged.ged_ui.browse';
+		$link_data['focused_id']=$parent_id;
+
+		if ( ! $this->ged_dm->can_write($parent_id) )
+		{
+			$link_data=null;
+			$link_data['menuaction']='ged.ged_ui.browse';
+			$link_data['focused_id']=$parent_id;
+				
+			$GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
+		}
+		
+		$import=$this->get_var('import',array('GET','POST'));
+		$project_name=addslashes($this->get_var('name',array('GET','POST')));
+		$referenceq=addslashes($this->get_var('referenceq',array('GET','POST')));
+		$descriptionv=addslashes($this->get_var('descriptionv', array('GET', 'POST')));
+		$doc_type=addslashes($this->get_var('document_type', array('GET', 'POST')));
+		$validity_period=$this->get_var('validity_period', array('GET', 'POST'));
+
+		$this->set_template_defaults();
+		
+		
+		
+		if ($parent_id=="")
+			$parent_id=0;
+			
+		if ($import==lang('Import'))
+		{
+			
+			
+			$thetempdir=$GLOBALS['phpgw_info']['server']['temp_dir']."/Archive_temp";
+			exec("rm -R $thetempdir");
+			mkdir($thetempdir, 0700);
+			copy($_FILES['file']['tmp_name'], $thetempdir."/archive.zip");
+			$retval=null;
+			exec ( "cd ".$thetempdir."; unzip archive.zip", $retval);
+			$row = 0;
+			$Cpt = 0;
+			$verif=array();
+			$tmp=array();
+			$todo=array();
+			$fp = fopen($thetempdir."/import.csv", "r");
+			while (($data = fgetcsv($fp,1000,";")) !== FALSE) 
+			{
+		    for ($i=0; $i < count($data); $i++) 
+		    {
+		    	if($data[$i]!="")
+		    	{
+		    		if($this->ged_dm->is_file($data[$i]))
+		    		{
+		    			$todo[$i]['action']='mkver';
+		    			$info_file=$this->ged_dm->supp_tag($data[$i]);
+		    			$todo[$i]['element_id']=$tmp[$i-1]['id'];
+				    	$todo[$i]['file_name']=$file_info['file_name'];
+							$todo[$i]['file_size']=filesize($thetempdir."/".$data[$i]);
+							$todo[$i]['file_tmp_name']=$thetempdir."/".$data[$i];
+							$todo[$i]['file_mime_type']=mime_content_type($thetempdir."/".$data[$i]);
+				      $todo[$i]['relations']='';
+
+				      $todo[$i]['major']=$file_info['major'];
+							$todo[$i]['minor']=$file_info['minor'];
+							$todo[$i]['draft']=$file_info['draft'];
+				      	
+				      $todo[$i]['description']="";
+				      	
+				      $version_added=$this->ged_dm->copy_to_add_version($todo[$i]);
+		    			
+		    		}
+		    		else if(isset($data[$i]) && isset($data[$i+1]) && $this->ged_dm->is_file($data[$i+1]) )
+		    		{
+		    			$todo[$i]['action']='mkdoc';
+		    			$file_info=$this->ged_dm->supp_tag($data[$i+1]);
+		    			$todo[$i]['file_name']=$file_info['file_name'];
+							$todo[$i]['file_size']=filesize($thetempdir."/".$data[$i+1]);
+							$todo[$i]['file_tmp_name']=$thetempdir."/".$data[$i+1];
+							$todo[$i]['file_mime_type']=mime_content_type($thetempdir."/".$data[$i+1]);
+							$todo[$i]['parent_id']=$tmp[$i-1]['id'];
+							$todo[$i]['name']=$data[$i];
+							$todo[$i]['reference']="";
+							$todo[$i]['major']=$file_info['major'];
+							$todo[$i]['minor']=$file_info['minor'];
+							$todo[$i]['draft']=$file_info['draft'];
+							$todo[$i]['description']='';
+							$todo[$i]['descriptionv']='First version';
+							$todo[$i]['doc_type']='';
+							$todo[$i]['validity_period']=0;
+		    			$tmp[$i]['file_name']=$data[$i];
+		    			$tmp[$i]['id']=$this->ged_dm->add_file_copy($todo[$i]);
+		    			++$i;
+		    		}	
+		    		else
+		    		{
+		    			if($i==0)
+		    			{
+		    				
+		    				$todo[$i]['action']='mkdir';
+		    				$todo[$i]['parent_id']=$parent_id;
+								$todo[$i]['name']=$data[$i];
+								$todo[$i]['referenceq']='';
+								$todo[$i]['description']='';
+								$todo[$i]['project_name']=$project_name;
+								$tmp[$i]['file_name']=$data[$i];
+								
+								$tmp[$i]['id']=$this->ged_dm->add_folder($todo[$i]);
+		    			}
+		    			else
+		    			{
+		    				$todo[$i]['action']='mkdir';
+		    				$todo[$i]['parent_id']=$tmp[$i-1]['id'];
+								$todo[$i]['name']=addslashes($data[$i]);
+								$todo[$i]['referenceq']='';
+								$todo[$i]['description']='';
+								$todo[$i]['project_name']='';
+								$tmp[$i]['file_name']=$data[$i];
+				
+								$tmp[$i]['id']=$this->ged_dm->add_folder($todo[$i]);
+		    			}
+		    			
+		    		}
+		    	}
+		        
+    		}
+			}
+			fclose($fp);
+			
+			
+			
+		}
+			
+	
+		$this->t->set_var('errormessage',$errormessage);
+		$this->t->set_var('import_field', 'import');
+		$this->t->set_var('import_action', lang('Import'));	
+		$this->t->set_var('reset_import_field', 'reset_import');
+		$this->t->set_var('reset_import_action', lang('Undo'));
+		$this->t->set_var('go_back_field', 'go_back');
+		$this->t->set_var('go_back_action', lang('Go back'));
+		$this->t->set_var('parent_id_value', $parent_id);
+		$this->t->set_file(array('import_project_tpl'=>'import_project.tpl'));
+
+		$this->set_template_defaults();
+
+		$parent_element=$this->ged_dm->get_element_info($parent_id);
+
+
+		$add_link_data['menuaction']='ged.ged_ui.import_project';
+		$this->t->set_var('action_add', $GLOBALS['phpgw']->link('/index.php', $add_link_data));
+		
+		
+
+
+		$this->display_app_header();
+
+		$this->t->pfp('out', 'import_project_tpl');
+
+	}
+	
 	function dico()
 	{
 		$project_root=$this->get_var('project_root',array('GET'));

Modified: modules/ged/trunk/templates/base/browse.tpl
===================================================================
--- modules/ged/trunk/templates/base/browse.tpl	2010-01-05 21:40:00 UTC (rev 20936)
+++ modules/ged/trunk/templates/base/browse.tpl	2010-01-07 14:46:03 UTC (rev 20937)
@@ -1,4 +1,4 @@
-<div id="ged_top_menu">{top_link} {up_link} {update_folder} {add_folder} {move_folder} {delete_folder} {add_file} {edit_file} {update_file} {lock_file} <!-- BEGIN flow_actions_list --><a href="{flow_do_link}">{flow_do}</a>&nbsp;<!-- END flow_actions_list --> {move_file} {delete_file} {change_acl} {search} {stats} {chrono} {dico}</div>
+<div id="ged_top_menu">{import_project}{export_project} {top_link} {up_link} {update_folder} {add_folder} {move_folder} {delete_folder} {add_file} {edit_file} {update_file} {lock_file} <!-- BEGIN flow_actions_list --><a href="{flow_do_link}">{flow_do}</a>&nbsp;<!-- END flow_actions_list --> {move_file} {delete_file} {change_acl} {search} {stats} {chrono} {dico}</div>
 <br/>
 <div id="ged_info">
 {main_content}

Modified: modules/ged/trunk/templates/base/css/default.css
===================================================================
--- modules/ged/trunk/templates/base/css/default.css	2010-01-05 21:40:00 UTC (rev 20936)
+++ modules/ged/trunk/templates/base/css/default.css	2010-01-07 14:46:03 UTC (rev 20937)
@@ -142,6 +142,21 @@
 }
 
 
+#ged_search_file thead{
+color: #FF6666;
+font-size: 12pt;
+text-align: center;
+border: 1px solid #FF6666;
+}
+
+.max{
+width : 100%;
+height : 100%;
+}
+
+.center{
+text-align: center;
+}
 /* text colors */
 
 .current

Modified: modules/ged/trunk/templates/base/import_project.tpl
===================================================================
--- modules/ged/trunk/templates/base/import_project.tpl	2010-01-05 21:40:00 UTC (rev 20936)
+++ modules/ged/trunk/templates/base/import_project.tpl	2010-01-07 14:46:03 UTC (rev 20937)
@@ -0,0 +1,38 @@
+<div id="ged_add_file">
+<form name="FileList" enctype="multipart/form-data" action="{action_add}" method="post">
+{errormessage}
+<table cellpadding="5">
+<tr>
+<td colspan="2">
+<h2>Import</h2><input type="hidden" name="{parent_id_field}" value="{parent_id_value}">
+</td>
+</tr>
+<tr>
+<td>
+  {lang_project} : 
+</td>
+<td>  
+  <input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="name" value="{new_name}" size="70" maxlength="255"/><span>**</span>
+  <input type="hidden" name="{parent_id_field}" value="{parent_id_value}">
+</td>
+</tr>
+<tr>
+<td>
+{lang_zip} :  
+</td>
+<td>
+<input name="{file_field}" type="file" value="{file_value}""/><span>**</span>
+</td>
+</tr>
+<tr>
+<td style="vertical-align: top; text-align: center;" colspan="2">
+<input type="submit" name="{import_field}" value="{import_action}">
+<input type="reset" name="{reset_import_field}" value="{reset_import_action}">
+<input type="submit" name="{go_back_field}" value="{go_back_action}">
+</td>
+</tr>
+ </table>
+ </form>
+ <hr/>
+ <span>** {lang_Required}</span>
+ </div>

Modified: modules/ged/trunk/templates/base/search.tpl
===================================================================
--- modules/ged/trunk/templates/base/search.tpl	2010-01-05 21:40:00 UTC (rev 20936)
+++ modules/ged/trunk/templates/base/search.tpl	2010-01-07 14:46:03 UTC (rev 20937)
@@ -3,6 +3,9 @@
 <div align=center >
 <div id="ged_add_file" >{errormessage}</div>
 <form name="search" action="{action_search}" method="get" >
+<input name="menuaction" type="hidden" value="{menuaction}">
+<input name="sessionid" type="hidden" value="{sessionid}">
+<input name="click_history" type="hidden" value="{click_history}">
 <input name="{search_query_field}" type="text" size="50" value="{search_query_value}"> <input name="{do_search_command}" type="submit" value="{do_search_value}">
 
 <li><a href="#" onClick='document.getElementById("Avancee").style.visibility="visible";'>Advance</a></li>

Modified: modules/ged/trunk/templates/base/update_file.tpl
===================================================================
--- modules/ged/trunk/templates/base/update_file.tpl	2010-01-05 21:40:00 UTC (rev 20936)
+++ modules/ged/trunk/templates/base/update_file.tpl	2010-01-07 14:46:03 UTC (rev 20937)
@@ -1,162 +1,182 @@
 <div id="ged_add_file">
-{errormessage}
-<table border="0" cellpadding="5" width="100%">
-<tbody>
-<tr>
-<td colspan="2">
-<table>
-<tr>
-<td>
-<h2>File info</h2>
-<form enctype="multipart/form-data" action="{action_update}" method="post">
-<input type="hidden" name="{element_id_field}" value="{element_id_value}">
-</td>
-</tr>			
-<tr>
-<td style="vertical-align: top; width: 50px;">{lang_name} :<br>
-</td>
-<td style="vertical-align: top;"><input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="{file_name_field}" value="{file_name_value}" size="40" /><span>**</span>
-</td>
-</tr>
-<tr>
-<!-- BEGIN power_block -->
-<tr>
-<td style="vertical-align: top; width: 50px;">{lang_type} :<br>
-</td>
-<td style="vertical-align: top;">{select_type} (CARE : if you change this field with a chrono type, reference will be overriden)
-</td>
-</tr>
-<td>{lang_reference} :</td>
-<td>  
-  <input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="{referenceq_field}" value="{new_reference}" size="40" maxlength="255"/>
-</td>
-</tr>
-<!-- END power_block -->
-<tr>
-<td style="vertical-align: top; width: 50px;">{lang_description}<br>
-</td>
-<td style="vertical-align: top;"><textarea name="{file_description_field}" name="description" rows="10" cols="50" wrap="off" >{file_description_value}</textarea>
-</td>
-</tr>
-<tr>
-<td style="vertical-align: top; width: 50px;">{lang_period}<br>
-</td>
-<td style="vertical-align: top;">{select_period}
-</td>
-</tr>
-<tr>
-<td style="vertical-align: top; text-align: center;" colspan="2">
-<input type="submit" name="{update_file_field}" value="{update_file_action}">
-<input type="reset" name="{reset_file_field}" value="{reset_file_action}">
-<input type="submit" name="{go_back_field}" value="{go_back_action}">
-</form>
-</td>
-</tr>
-</table>
-</td>
-</tr>
-<tr>
-<td colspan="2">
-<hr/>
-<table>
-<tr>
-<td>
-<h2 id="versions">Version</h2>
-<form enctype="multipart/form-data" action="{action_update}#versions" method="post">
-<input type="hidden" name="{version_id_field}" value="{version_id_value}">
-<input type="hidden" name="{element_id_field}" value="{element_id_value}">
-</td>
-</tr>
-<tr>
-<td style="vertical-align: top; width: 50px;">File<br>
-</td>
-<td style="vertical-align: top;"><input name="{version_file_field}" type="file" value="{version_file_value}""/>
-</td>
-</tr>
-<tr>
-<td>
-  {lang_version} :
-</td>
-<td>  
-  <input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="{major_field}" value="{major_value}" size="2" maxlength="2"/> . <input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="{minor_field}" value="{minor_value}" size="2" maxlength="2"/> . <input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="{draft_field}" value="{draft_value}" size="2" maxlength="2"/>
-</td>
-</tr>
-<tr>
-<td style="vertical-align: top; width: 50px;">Description<br>
-</td>
-<td style="vertical-align: top;"><textarea name="{version_description_field}" name="description" rows="10" cols="50" wrap="off" >{version_description_value}</textarea>
-</td>
-</tr>
-</table>
-</td>
-</tr>
-<tr>
-<td style="border: 1px black solid;">
-
-<table width="100%" height="100%" >
-<tr>
-<td valign="top" height="100%" width="50%">
- <h3>Search</h3>
- <table width="70%">
- <tr>
- <td colspan="2">
- <input type="text" name="query" value="{search_query}"> <input type="submit" name="search"value="search" >
- </td>
- </tr>
-<!-- BEGIN search_list_block -->
- <tr>
- <td width="20" valign="bottom">
- <img src="{status_image}">
- </td>
- <td valign="top"><a href="{search_link}">{name} [{reference}] {version}</a></td>
- <td width="20" valign="bottom">
- <input type="image" src="{add-image}" name="do_add_relation" value="{version_id}">
- </td>
- </tr>
-<!-- END search_list_block -->
- </table>
-</td>
-<td valign="top">
-  <h3>Relations</h3>
-  <table width="100%">
-<!-- BEGIN relations_list_block -->
-  <tr>
-  <td><img src="{relations_element_status_image}" />
-  </td>
-  <td>{relations_element_name} [{relations_element_reference}] v{relations_element_major}.{relations_element_minor}.{relations_element_draft}
-  <input name="{relations_id_field}" type="hidden" value="{relations_id_value}"/>
-  </td>
-  <td>
-  {relations_type}
-  </td>
-  <td>
-  <input type="image" src="{remove-image}" name="do_remove_relation" value="{relations_id_value}">
-  </td>
-  </tr>
-<!-- END relations_list_block -->
-  </table>
- </td>
-</tr>
-</table>
-</td>
-</tr>	
-<tr>
-<td style="vertical-align: top; text-align: center;" colspan="2">
-<input type="submit" name="{update_version_field}" value="{update_version_action}">
-<input type="reset" name="{reset_version_field}" value="{reset_version_action}">
-<input type="submit" name="{go_back_field}" value="{go_back_action}">
-</form>
-</td>
-</tr>
-</tbody>
-</table>
-
- <hr/>
-<form name="search" enctype="multipart/form-data" action="{action_search}" method="post">
- <input type="text" name="query"> <input type="hidden" name="sess"  value="193a227a024bf5333a10175a94c1cb86">
- <input type="hidden" name="parent" value="2"> <input type="hidden" name="expand" value="1">
- <input type="hidden" name="order" value="name"> <input type="hidden" name="sortorder" value="sortname">
- <input type="hidden" name="sort"  value="ASC"> <input type="image" src="browse.php_files/btn_search.gif" border="0" alt="Search" title="Search" value="Search">
- </form>
-  <span>** {lang_Required}</span>
+	{errormessage}
+	<table border="0" cellpadding="5" width="100%">
+	<tbody>
+	<tr>
+	<td colspan="2">
+	<table border="2" cellpadding="5" width="100%" style="border: 1px black solid; border-collapse:collapse;">
+		<tr><td>
+		<table>
+		
+			<thead>
+			<tr>
+			<td class="center" colspan="2">
+			<h2>File info</h2>
+			<form enctype="multipart/form-data" action="{action_update}" method="post">
+			<input type="hidden" name="{element_id_field}" value="{element_id_value}">
+			</td>
+			</tr>		
+			</thead>	
+			
+			<tfoot>
+			<tr>
+			<td style="vertical-align: top; text-align: center;" colspan="2">
+			<input type="submit" name="{update_file_field}" value="{update_file_action}">
+			<input type="reset" name="{reset_file_field}" value="{reset_file_action}">
+			<input type="submit" name="{go_back_field}" value="{go_back_action}">
+			</form>
+			</td>
+			</tr>
+			</tfoot>
+			
+			<tr>
+			<td style="vertical-align: top; width: 50px;">{lang_name} :<br>
+			</td>
+			<td style="vertical-align: top;"><input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="{file_name_field}" value="{file_name_value}" size="40" /><span>**</span>
+			</td>
+			</tr>
+			<tr>
+			<!-- BEGIN power_block -->
+			<tr>
+			<td style="vertical-align: top; width: 50px;">{lang_type} :<br>
+			</td>
+			<td style="vertical-align: top;">{select_type} (CARE : if you change this field with a chrono type, reference will be overriden)
+			</td>
+			</tr>
+			<td>{lang_reference} :</td>
+			<td>  
+			  <input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="{referenceq_field}" value="{new_reference}" size="40" maxlength="255"/>
+			</td>
+			</tr>
+			<!-- END power_block -->
+			<tr>
+			<td style="vertical-align: top; width: 50px;">{lang_description}<br>
+			</td>
+			<td style="vertical-align: top;"><textarea name="{file_description_field}" name="description" rows="10" cols="50" wrap="off" >{file_description_value}</textarea>
+			</td>
+			</tr>
+			<tr>
+			<td style="vertical-align: top; width: 50px;">{lang_period}<br>
+			</td>
+			<td style="vertical-align: top;">{select_period}
+			</td>
+			</tr>
+			
+		</table>
+		<td class="max">
+		<table class="max">
+		
+			<thead valign="top">
+			<tr valign="top">
+			<td class="center" colspan="2">
+			<h2 id="versions">Version info</h2>
+			<form enctype="multipart/form-data" action="{action_update}#versions" method="post">
+			<input type="hidden" name="{version_id_field}" value="{version_id_value}">
+			<input type="hidden" name="{element_id_field}" value="{element_id_value}">
+			</td>
+			</tr>
+			</thead>
+			
+			<tfoot valign="bottom">
+			<tr style="height: 20px;">
+			<td style="vertical-align: bottom; text-align: center;" colspan="2">
+			<input type="submit" name="{update_version_field}" value="{update_version_action}">
+			<input type="reset" name="{reset_version_field}" value="{reset_version_action}">
+			<input type="submit" name="{go_back_field}" value="{go_back_action}">
+			</td>
+			</tr>
+			</tfoot>
+			<tbody>
+			<tr>
+			<td style="vertical-align: top; width: 50px;">File<br>
+			</td>
+			<td style="vertical-align: top;"><input name="{version_file_field}" type="file" value="{version_file_value}""/>
+			</td>
+			</tr>
+			<tr>
+			<td>
+			  {lang_version} :
+			</td>
+			<td>  
+			  <input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="{major_field}" value="{major_value}" size="2" maxlength="2"/> . <input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="{minor_field}" value="{minor_value}" size="2" maxlength="2"/> . <input type="text" default_class="{input_default_class}"  focused_class="{input_active_class}" name="{draft_field}" value="{draft_value}" size="2" maxlength="2"/>
+			</td>
+			</tr>
+			<tr>
+			<td style="vertical-align: top; width: 50px;">Description<br>
+			</td>
+			<td style="vertical-align: top;"><textarea name="{version_description_field}" name="description" rows="10" cols="50" wrap="off" >{version_description_value}</textarea>
+			</td>
+			</tr>
+			</tbody>
+		</table>
+		</td></tr>
+	</table>
+	</td>
+	</tr>
+	<tr>
+	<td style="border: 1px black solid;">
+	
+	<table width="100%" height="100%" >
+		<tr>
+		<td valign="top" height="100%" width="50%">
+		<h3>Search</h3>
+	 <table width="70%">
+		 <tr>
+		 <td colspan="2">
+		 <input type="text" name="query" value="{search_query}"> <input type="submit" name="search"value="search" >
+		 </td>
+		 </tr>
+		<!-- BEGIN search_list_block -->
+		 <tr>
+		 <td width="20" valign="bottom">
+		 <img src="{status_image}">
+		 </td>
+		 <td valign="top"><a href="{search_link}">{name} [{reference}] {version}</a></td>
+		 <td width="20" valign="bottom">
+		 <input type="image" src="{add-image}" name="do_add_relation[{version_id}]" >
+		 </td>
+		 </tr>
+		<!-- END search_list_block -->
+	 </table>
+	</td>
+	<td valign="top">
+	  <h3>Relations</h3>
+	  <table width="100%">
+	<!-- BEGIN relations_list_block -->
+	  <tr>
+	  <td><img src="{relations_element_status_image}" />
+	  </td>
+	  <td>{relations_element_name} [{relations_element_reference}] v{relations_element_major}.{relations_element_minor}.{relations_element_draft}
+	  <input name="{relations_id_field}" type="hidden" value="{relations_id_value}"/>
+	  </td>
+	  <td>
+	  {relations_type}
+	  </td>
+	  <td>
+	  <input type="image" src="{remove-image}" name="do_remove_relation[{relations_id_value}]" >
+	  </td>
+	  </tr>
+	<!-- END relations_list_block -->
+	  </table>
+	 </td>
+	</tr>
+	</table>
+	</td>
+	</tr>	
+	<tr>
+	<td style="vertical-align: top; text-align: center;" colspan="2">
+	</form>
+	</td>
+	</tr>
+	</tbody>
+	</table>
+	
+	 <hr/>
+	<form name="search" enctype="multipart/form-data" action="{action_search}" method="post">
+	 <input type="text" name="query"> <input type="hidden" name="sess"  value="193a227a024bf5333a10175a94c1cb86">
+	 <input type="hidden" name="parent" value="2"> <input type="hidden" name="expand" value="1">
+	 <input type="hidden" name="order" value="name"> <input type="hidden" name="sortorder" value="sortname">
+	 <input type="hidden" name="sort"  value="ASC"> <input type="image" src="browse.php_files/btn_search.gif" border="0" alt="Search" title="Search" value="Search">
+	 </form>
+	  <span>** {lang_Required}</span>
  </div>
\ No newline at end of file