Fix: delete file from ecm module

This commit is contained in:
Laurent Destailleur 2012-10-27 00:23:16 +02:00
parent aee92ad3dc
commit 7a48351909
5 changed files with 23 additions and 19 deletions

View File

@ -654,7 +654,7 @@ class Form
* @param int $showempty Add an empty field
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box
* @param array $event Event options
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return string HTML string with
*/
function select_company($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array())
@ -2315,8 +2315,8 @@ class Form
$autoOpen=false;
$dialogconfirm.='-'.$button;
}
$pageyes=$page.'&action='.$action.'&confirm=yes';
$pageno=($useajax == 2?$page.'&confirm=no':'');
$pageyes=(preg_match('/\?/',$page)?'&':'?').'action='.$action.'&confirm=yes';
$pageno=($useajax == 2 ? (preg_match('/\?/',$page)?'&':'?').'confirm=no':'');
// Add input fields into list of fields to read during submit (inputok and inputko)
if (is_array($formquestion))
{
@ -2823,17 +2823,17 @@ class Form
}
/**
* Output html select to select thirdparty
* Output html select to select thirdparty
*
* @param string $page Page
* @param string $selected Id preselected
* @param string $htmlname Name of HTML select
* @param string $page Page
* @param string $selected Id preselected
* @param string $htmlname Name of HTML select
* @param string $filter Optionnal filters criteras
* @param int $showempty Add an empty field
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box
* @param array $event Event options
* @return void
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return void
*/
function form_thirdparty($page, $selected='', $htmlname='socid', $filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array())
{

View File

@ -576,7 +576,7 @@ class FormFile
* @param array $filearray Array of files loaded by dol_dir_list('files') function before calling this
* @param Object $object Object on which document is linked to
* @param string $modulepart Value for modulepart used by download or viewimage wrapper
* @param string $param Parameters on sort links
* @param string $param Parameters on sort links (param must start with &, example &aaa=bbb&ccc=ddd)
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file
* @param string $relativepath Relative path of docs (autodefined if not provided)
* @param int $permtodelete Permission to delete
@ -678,9 +678,10 @@ class FormFile
print '</td>';
}
// Delete or view link
// ($param must start with &)
print '<td align="right">';
if ($useinecm) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view().'</a> &nbsp; ';
if ($permtodelete) print '<a href="'.(($useinecm && ! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':$url.'?action=delete&urlfile='.urlencode($file['name']).$param).'" class="deletefilelink" rel="'.urlencode($file['name']).'">'.img_delete().'</a>';
if ($useinecm) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).$param.'">'.img_view().'</a> &nbsp; ';
if ($permtodelete) print '<a href="'.(($useinecm && ! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':$url.'?action=delete&urlfile='.urlencode($file['name']).$param).'" class="deletefilelink" rel="'.urlencode($file['name']).$param.'">'.img_delete().'</a>';
else print '&nbsp;';
print "</td>";
print "</tr>\n";

View File

@ -757,8 +757,11 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
});
}
/* This is to allow to transform all select box into ajax autocomplete box
* with just one line: $(function() { $( "#listmotifcons" ).combobox(); });
/*
* =================================================================
* This is to allow to transform all select box into ajax autocomplete box
* with just one line: $(function() { $( "#idofmylist" ).combobox(); });
* =================================================================
*/
(function( $ ) {
$.widget( "ui.combobox", {

View File

@ -290,10 +290,10 @@ function ajax_dialog($title,$message,$w=350,$h=150)
}
/**
* Convert a select html field into an ajax combobox
* Convert a html select field into an ajax combobox
*
* @param string $htmlname Name of html field
* @param array $event Event options
* @param string $htmlname Name of html select field
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return string Return html string to convert a select field into a combo
*/
function ajax_combobox($htmlname, $event=array())

View File

@ -168,7 +168,7 @@ if ($action == 'confirm_deletefile')
{
$langs->load("other");
$result=$ecmdir->fetch($section);
if (! $result > 0)
if (! ($result > 0))
{
dol_print_error($db,$ecmdir->error);
exit;
@ -396,7 +396,7 @@ print $langs->trans("ECMAreaDesc")."<br>";
print $langs->trans("ECMAreaDesc2")."<br>";
print "<br>\n";
// Confirm remove file
// Confirm remove file (for non javascript users)
if ($action == 'delete' && empty($conf->use_javascript_ajax))
{
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile','','',1);