mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-16 14:31:29 +01:00
Fix: file add and delte in email forms was broken with firefox 5
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/admin/mails.php
|
||||
* \brief Page to setup emails sending
|
||||
* \version $Id: mails.php,v 1.72 2011/07/09 06:10:06 hregis Exp $
|
||||
* \version $Id: mails.php,v 1.73 2011/07/10 20:03:39 eldy Exp $
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
@@ -80,7 +80,7 @@ if ($_POST['addfile'] || $_POST['addfilehtml'])
|
||||
|
||||
// Set tmp user directory
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir = $vardir.'/temp/';
|
||||
$upload_dir = $vardir.'/temp';
|
||||
|
||||
if (create_exdir($upload_dir) >= 0)
|
||||
{
|
||||
@@ -127,7 +127,7 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
|
||||
{
|
||||
// Set tmp user directory
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir = $vardir.'/temp/';
|
||||
$upload_dir = $vardir.'/temp';
|
||||
|
||||
$keytodelete=isset($_POST['removedfile'])?$_POST['removedfile']:$_POST['removedfilehtml'];
|
||||
$keytodelete--;
|
||||
@@ -737,5 +737,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/07/09 06:10:06 $ - $Revision: 1.72 $');
|
||||
llxFooter('$Date: 2011/07/10 20:03:39 $ - $Revision: 1.73 $');
|
||||
?>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* \file htdocs/core/class/html.formmail.class.php
|
||||
* \ingroup core
|
||||
* \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire
|
||||
* \version $Id: html.formmail.class.php,v 1.30 2011/07/09 10:26:19 hregis Exp $
|
||||
* \version $Id: html.formmail.class.php,v 1.31 2011/07/10 20:03:41 eldy Exp $
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php");
|
||||
|
||||
@@ -124,9 +124,9 @@ class FormMail
|
||||
/**
|
||||
* Add a file into the list of attached files (stored in SECTION array)
|
||||
*
|
||||
* @param $path
|
||||
* @param $file
|
||||
* @param $type
|
||||
* @param string $path Full absolute path on filesystem of file, including file name
|
||||
* @param string $file Only filename
|
||||
* @param string $type Mime type
|
||||
*/
|
||||
function add_attached_files($path,$file,$type)
|
||||
{
|
||||
@@ -505,14 +505,26 @@ class FormMail
|
||||
$out.= '<tr>';
|
||||
$out.= '<td width="180">'.$langs->trans("MailFile").'</td>';
|
||||
$out.= '<td>';
|
||||
//print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
// FIXME Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
|
||||
$out.= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
|
||||
$out.= '<script type="text/javascript" language="javascript">';
|
||||
$out.= 'jQuery(document).ready(function () {';
|
||||
$out.= ' jQuery(".removedfile").click(function() {';
|
||||
$out.= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
|
||||
$out.= ' });';
|
||||
$out.= '})';
|
||||
$out.= '</script>'."\n";
|
||||
if (sizeof($listofpaths))
|
||||
{
|
||||
foreach($listofpaths as $key => $val)
|
||||
{
|
||||
$out.= '<div id="attachfile_'.$key.'">';
|
||||
$out.= img_mime($listofnames[$key]).' '.$listofnames[$key];
|
||||
if (! $this->withfilereadonly) $out.= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key+1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
|
||||
if (! $this->withfilereadonly)
|
||||
{
|
||||
$out.= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key+1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
|
||||
//$out.= ' <a href="'.$_SERVER["PHP_SELF"].'?removedfile='.($key+1).' id="removedfile_'.$key.'">'.img_delete($langs->trans("Delete").'</a>';
|
||||
}
|
||||
$out.= '<br /></div>';
|
||||
}
|
||||
}
|
||||
@@ -522,11 +534,9 @@ class FormMail
|
||||
}
|
||||
if ($this->withfile == 2) // Can add other files
|
||||
{
|
||||
//print '<td><td align="right">';
|
||||
$out.= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
|
||||
$out.= ' ';
|
||||
$out.= '<input type="submit" class="button" id="'.$addfileaction.'" name="'.$addfileaction.'" value="'.$langs->trans("MailingAddFile").'" />';
|
||||
//print '</td></tr></table>';
|
||||
}
|
||||
$out.= "</td></tr>\n";
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/lib/files.lib.php
|
||||
* \brief Library for file managing functions
|
||||
* \version $Id: files.lib.php,v 1.68 2011/07/11 06:23:22 hregis Exp $
|
||||
* \version $Id: files.lib.php,v 1.67 2011/07/10 20:03:41 eldy Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -561,8 +561,9 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
||||
if (! empty($conf->global->MAIN_UMASK)) @chmod($file_name_osencoded, octdec($conf->global->MAIN_UMASK));
|
||||
dol_syslog("Functions.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG);
|
||||
|
||||
if (! $notrigger && is_object($object))
|
||||
if (! $notrigger)
|
||||
{
|
||||
if (! is_object($object)) $object=(object) 'dummy';
|
||||
$object->src_file=$dest_file;
|
||||
|
||||
// Appel des triggers
|
||||
|
||||
Reference in New Issue
Block a user