[20903] improvement : nicer error messages for users

Pascal Vilarem <[email protected]>
Newsgroups gmane.comp.web.phpgroupware.cvs
Message-ID <[email protected]>
Revision: 20903
          http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20903
Author:   maat
Date:     2010-01-04 15:50:20 +0000 (Mon, 04 Jan 2010)
Log Message:
-----------
improvement : nicer error messages for users

Modified Paths:
--------------
    modules/ged/trunk/inc/class.flow_client.inc.php
    modules/ged/trunk/templates/base/search.tpl

Modified: modules/ged/trunk/inc/class.flow_client.inc.php
===================================================================
--- modules/ged/trunk/inc/class.flow_client.inc.php	2010-01-04 15:37:43 UTC (rev 20902)
+++ modules/ged/trunk/inc/class.flow_client.inc.php	2010-01-04 15:50:20 UTC (rev 20903)
@@ -304,6 +304,29 @@
 		// needed for relations action
 		$new_relations=$this->get_var('relations', array('POST', 'GET'));
 
+		if ($context['custom_fields']['update_mode'] == 'new'  && $update_version==lang('New') && $_FILES['version_file']['name']=='')
+		{
+			$errormessage.="<br/> - ".lang("no file");
+    		$update_version = null;
+    		$function_result=Array('status' => 'error');
+		}
+		elseif ($context['custom_fields']['update_mode'] == 'update'  && $update_version==lang('Update')  && $_FILES['version_file']['name']=='')
+		{
+			$errormessage.="<br/> - ".lang("no file");
+    		$update_version = null;
+    		$function_result=Array('status' => 'error');
+		}
+		if($update_file==lang('Update') )
+		{
+			if($new_file_name =='')
+			{
+				$errormessage.="<br/> - ".lang("no name");
+				$update_file='';
+			}
+			
+		}
+		
+		
 		// TODO : real update
 		if ($update_file==lang('Update'))
 		{
@@ -340,7 +363,8 @@
 
 			if ($version_added=='OK')
 			{
-				$function_result=Array('status' => 'ok', 'mute_history' => 'mute');
+					$function_result=Array('status' => 'ok');
+					$function_result['comment']=$new_version_description;	
 			}
 			else
 			{
@@ -388,7 +412,7 @@
 		}
 		elseif ( $go_back == lang('Go back'))
 		{
-			$function_result=Array('status' => 'ok');
+			$function_result=Array('status' => 'ok', 'mute_history' => 'mute');
 		}
 		else
 		{

Modified: modules/ged/trunk/templates/base/search.tpl
===================================================================
--- modules/ged/trunk/templates/base/search.tpl	2010-01-04 15:37:43 UTC (rev 20902)
+++ modules/ged/trunk/templates/base/search.tpl	2010-01-04 15:50:20 UTC (rev 20903)
@@ -1,6 +1,7 @@
 <div id="ged_top_menu">{top_link} {up_link} {update_folder} {add_folder} {delete_folder} {add_file} {edit_file} {update_file} {refuse_file} {accept_file} {submit_file} {deliver_file} {reject_file} {approve_file} {delete_file} {change_acl} {search} {stats}</div>
 <br/>
 <div align=center>
+<div id="ged_add_file" >{errormessage}</div>
 <form name="search" action="{action_search}" method="get">
 <input name="{search_query_field}" type="text" size="50" value="{search_query_value}"> <input name="{do_search_command}" type="submit" value="{do_search_value}">
 </form>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.