infolog now explicitly asks to deleted sub-entries and allows not to delete them

This commit is contained in:
Ralf Becker 2003-12-19 02:26:17 +00:00
parent 2e6114f9ce
commit d4952f1a2b
6 changed files with 31 additions and 11 deletions

View File

@ -191,11 +191,11 @@
return $err ? False : $data; return $err ? False : $data;
} }
function delete($info_id) function delete($info_id,$delete_children,$new_parent)
{ {
$this->link->unlink(0,'infolog',$info_id); $this->link->unlink(0,'infolog',$info_id);
$this->so->delete($info_id); $this->so->delete($info_id,$delete_children,$new_parent);
} }
function write($values,$check_defaults=True,$touch_modified=True) function write($values,$check_defaults=True,$touch_modified=True)

View File

@ -1,7 +1,7 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - InfoLog * * eGroupWare - InfoLog *
* http://www.phpgroupware.org * * http://www.eGroupWare.org *
* Written by Ralf Becker <RalfBecker@outdoor-training.de> * * Written by Ralf Becker <RalfBecker@outdoor-training.de> *
* originaly based on todo written by Joseph Engo <jengo@phpgroupware.org> * * originaly based on todo written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- * * -------------------------------------------- *
@ -284,11 +284,13 @@
@function delete @function delete
@abstract delete InfoLog entry $info_id AND the links to it @abstract delete InfoLog entry $info_id AND the links to it
@syntax delete( $info_id ) @syntax delete( $info_id )
@param $info_id id of log-entry @param int $info_id id of log-entry
@param int $delete_children delete the children, if not set there parent-id to 0 @param bool $delete_children delete the children, if not set there parent-id to $new_parent
@param int new_parent new parent-id to set for subs
*/ */
function delete($info_id,$delete_children=True) // did _not_ ensure ACL function delete($info_id,$delete_children=True,$new_parent=0) // did _not_ ensure ACL
{ {
//echo "<p>soinfolog::delete($info_id,'$delete_children',$new_parent)</p>\n";
if (($info_id = intval($info_id)) <= 0) if (($info_id = intval($info_id)) <= 0)
{ {
return; return;
@ -311,8 +313,9 @@
$this->delete($db2->f(0),$delete_children); $this->delete($db2->f(0),$delete_children);
} }
} }
// set parent_id to 0 for all not deleted children // set parent_id to $new_parent for all not deleted children
$this->db->query("UPDATE phpgw_infolog SET info_id_parent=0 WHERE info_id_parent=$info_id",__LINE__,__FILE__); $new_parent = intval($new_parent);
$this->db->query("UPDATE phpgw_infolog SET info_id_parent=$new_parent WHERE info_id_parent=$info_id",__LINE__,__FILE__);
} }
/*! /*!

View File

@ -274,7 +274,7 @@
{ {
if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,PHPGW_ACL_DELETE)) if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,PHPGW_ACL_DELETE))
{ {
$this->bo->delete($info_id); $this->bo->delete($info_id,$values['remove_subs'],$values['info_id_parent']);
} }
return $referer ? $this->tmpl->location($referer) : $this->index(); return $referer ? $this->tmpl->location($referer) : $this->index();
} }
@ -284,8 +284,10 @@
$this->tmpl->read('infolog.delete'); $this->tmpl->read('infolog.delete');
$values['main']['no_actions'] = True; $values['main']['no_actions'] = True;
$values['remove_subs'] = $this->bo->anzSubs($info_id) > 0;
$persist['info_id'] = $info_id; $persist['info_id'] = $info_id;
$persist['referer'] = $referer; $persist['referer'] = $referer;
$persist['info_id_parent'] = $values['main'][1]['info_id_parent'];
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete'); $GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete');

File diff suppressed because one or more lines are too long

View File

@ -73,6 +73,7 @@ default filter for infolog infolog de Standard-Filter f
default status for a new log entry infolog de Vorgabe für den Status eines neuen Eintrags default status for a new log entry infolog de Vorgabe für den Status eines neuen Eintrags
delegation infolog de Delegation delegation infolog de Delegation
delete infolog de Löschen delete infolog de Löschen
delete all subs (if not subs will be subs of this enties parent or have no parent) infolog de Alle Untereinträge löschen (wenn nicht werden diese Untereinträge des übergeordneten Eintrags oder sind keine Untereinträge mehr)
delete the entry infolog de Eintrag löschen delete the entry infolog de Eintrag löschen
delete this entry infolog de diesen Eintrag löschen delete this entry infolog de diesen Eintrag löschen
deletes the selected typ infolog de löscht den ausgewählten Typ deletes the selected typ infolog de löscht den ausgewählten Typ

View File

@ -73,6 +73,7 @@ default filter for infolog infolog en Default Filter for InfoLog
default status for a new log entry infolog en default status for a new log entry default status for a new log entry infolog en default status for a new log entry
delegation infolog en Delegation delegation infolog en Delegation
delete infolog en Delete delete infolog en Delete
delete all subs (if not subs will be subs of this enties parent or have no parent) infolog en Delete all subs (if not subs will be subs of this enties parent or have no parent)
delete the entry infolog en Delete the entry delete the entry infolog en Delete the entry
delete this entry infolog en delete this entry delete this entry infolog en delete this entry
deletes the selected typ infolog en deletes the selected type deletes the selected typ infolog en deletes the selected type