deleting of attached files

This commit is contained in:
Ralf Becker 2001-10-04 23:34:30 +00:00
parent 4a8a26b367
commit 3f71a7727d
4 changed files with 50 additions and 21 deletions

View File

@ -975,7 +975,7 @@
function delete( )
{
global $info_id,$confirm;
global $info_id,$confirm,$to_del;
$t = $this->template; $html = $this->html;
@ -989,20 +989,25 @@
}
if ($confirm)
{
$this->bo->delete($info_id);
$file = $this->basedir.'/'.$info_id; // whole dir
Header('Location: ' . $html->link($referer,array( 'cd' => 16 )));
/*
** Also remove the attached files for that entry
*/
$dir=$this->basedir.'/'.$info_id;
if ($this->vfs->file_exists($dir,array(RELATIVE_ROOT)))
if (!isset($to_del) || $to_del == '.')
{
$this->vfs->override_acl = 1;
$this->vfs->delete($dir,array(RELATIVE_ROOT));
$this->vfs->override_acl = 0;
$this->bo->delete($info_id);
$file = $this->basedir.'/'.$info_id; // whole dir
}
else
{
$file .= '/'.$to_del;
}
if ($this->vfs->file_exists($file,array(RELATIVE_ROOT)))
{
$this->vfs->override_acl = 1;
$this->vfs->delete($file,array(RELATIVE_ROOT));
$this->vfs->override_acl = 0;
}
Header('Location: ' . $html->link($referer,array( 'cd' => 16 )));
}
else
{
@ -1010,18 +1015,38 @@
echo parse_navbar();
$t->set_file(array( 'info_delete' => 'delete.tpl' ));
// add the links to the files which corrospond to this entry
$attachments = $this->vfs->ls($this->basedir.'/'.$info_id.'/',array(REALTIVE_NONE));
if (count($attachments) && $attachments[0]['name'])
{
$to_del = array('.' => lang('entry and all files'));
while (list($keys,$fileinfo) = each($attachments))
{
$to_del[$fileinfo['name']] = $fileinfo['name'] .
($fileinfo['comment'] ? ' ('.$fileinfo['comment'].')' : '');
}
$sbox2 = CreateObject('phpgwapi.sbox2');
$t->set_var('to_del',$sbox2->getArrayItem('to_del','.',$to_del,True));
}
else
{
$t->set_var('to_del','');
}
$t->set_var( $this->setStyleSheet( ));
$t->set_var( $this->infoHeaders( ));
$t->set_var( $this->formatInfo( $info_id ));
$t->set_var('lang_info_action',lang('InfoLog - Delete'));
$t->set_var('deleteheader',
lang('Are you sure you want to delete this entry'));
$t->set_var('deleteheader',lang('Are you sure you want to delete this entry'));
$t->set_var('no_button',$html->form_1button('no_button',
'No - Cancel','',$referer));
$t->set_var('yes_button',$html->form_1button('yes_button',
'Yes - Delete',array('referer' => $referer),'/index.php',$this->menuaction('delete')+
array('info_id' => $info_id,'confirm' => 'True')));
$t->set_var('yes_form',$html->form('',array('referer' => $referer),'/index.php',
$this->menuaction('delete') + array('info_id' => $info_id,'confirm' => 'True')));
$t->set_var('yes_button',$html->submit_button('yes_button','Yes - Delete'));
$t->pfp('out','info_delete');
}
}

View File

@ -30,6 +30,7 @@ download infolog de Datei laden
duration infolog de Dauer
enddate infolog de Enddatum
enddate can not be before startdate infolog de Das Enddatum kann nicht vor dem Startdatum liegen
entry and all files infolog de Eintrag und alle Dateien
fax infolog de Fax
fieldseparator infolog de Feldbegrenzer
finish infolog de wenn erledigt

View File

@ -30,6 +30,7 @@ download infolog en Download
duration infolog en Duration
enddate infolog en Enddate
enddate can not be before startdate infolog en Enddate can not be before startdate
entry and all files infolog en Entry and all files
fax infolog en Fax
fieldseparator infolog en Fieldseparator
finish infolog en finish

View File

@ -22,16 +22,18 @@
<td class=list">{responsible}</td>
</tr>
</table><p>
{yes_form}
<table border=0 with=65%>
<tr>
<td align=center colspan=2>
<b>{deleteheader}</b>
<b>{deleteheader}</b><p>
{to_del}
</td>
</tr>
<tr>
<td align=center>{yes_button}</td>
<td align=center>{no_button}</td>
<td height=50 valign=bottom align=center>{yes_button}</td>
<td valign=bottom align=center>{no_button}</td>
</tr>
</table>
</form>
</center>