[pLog-svn] r5911 - in plog/trunk: class/action/admin locale/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Thu Sep 6 17:36:02 EDT 2007


Author: oscar
Date: 2007-09-06 17:36:02 -0400 (Thu, 06 Sep 2007)
New Revision: 5911

Modified:
   plog/trunk/class/action/admin/adminuploadtemplatefileaction.class.php
   plog/trunk/locale/admin/locale_en_UK.php
Log:
Improved error messages when uploading files


Modified: plog/trunk/class/action/admin/adminuploadtemplatefileaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminuploadtemplatefileaction.class.php	2007-09-06 21:28:47 UTC (rev 5910)
+++ plog/trunk/class/action/admin/adminuploadtemplatefileaction.class.php	2007-09-06 21:36:02 UTC (rev 5911)
@@ -36,11 +36,18 @@
 			$v = new UploadValidator();
 			foreach( $uploads as $upload ) {
 				if( $v->validate( $upload ) < 0) {
-					$this->_view->setErrorMessage( $this->_locale->tr("error_uploading_template_file" ));
+					$this->_view->setErrorMessage( $this->_locale->tr("error_file_cannot_be_uploaded" ));
 					$this->setCommonData();
 					return( false );
 				}				
 			}
+			
+			// check that the destination folder is writable, or else show a different error message
+			if( !File::isWritable( $folder )) {
+				$this->_view->setErrorMessage( $this->_locale->tr("error_cannot_write_to_folder" ));
+				$this->setCommonData();
+				return( false );				
+			}			
 
 			// we can now move the uploaded file to the destination folder
 			$folder = TemplateSetStorage::getTemplateFolder( $this->_templateId) . "/" . $this->_path . "/";			

Modified: plog/trunk/locale/admin/locale_en_UK.php
===================================================================
--- plog/trunk/locale/admin/locale_en_UK.php	2007-09-06 21:28:47 UTC (rev 5910)
+++ plog/trunk/locale/admin/locale_en_UK.php	2007-09-06 21:36:02 UTC (rev 5911)
@@ -1300,8 +1300,7 @@
 $messages["templateeditor_backupfile"] = "Please select the date that you want to recover, template editor will load it to editor automatically. Each template file can have 5 backup files in total.";
 $messages["templateeditor_choose_backupfile"] = "Select backup file to recover";
 
-$messages['error_loading_template_set'] = 'error_loading_template_set';
-$messages['error_loading_template_file'] = 'error_loading_template_file';
+$messages['error_loading_template_file'] = 'There was an error loading the template file';
 $messages['edit_template_file'] = 'edit_template_file';
 $messages['template_file_updated_ok'] = ' template_file_updated_ok';
 $messages['error_updating_template_file'] = 'error_updating_template_file';
@@ -1332,6 +1331,11 @@
 $messages['new_template_file_help'] = 'Please select a file to upload';
 $messages['template_file_uploaded_ok'] = 'Template file successfully uploaded';
 $messages['error_updating_template_file'] = 'There was an error upading the template file';
+$messages['error_cannot_copy_to_noneditable_file'] = 'Cannnot copy the selected file to a file that is not one of the allowed types';
+$messages['newTemplateFile'] = 'Upload File';
+$messages['new_template_file_help'] = 'Select the file that you would like to upload';
+$messages['error_cannot_write_to_folder'] = 'Sorry, could not upload the file because the destination folder is not writable';
+$messages['error_file_cannot_be_uploaded'] = 'Sorry, the settings in this site do not allow files of this type';
 
 $messages['ok'] = 'Ok';
 $messages['cancel'] = 'Cancel';



More information about the pLog-svn mailing list