mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-25 14:41:50 +01:00
got infolog working:
- referers are handled now correct - hooks are working again (only addressbook::view ported so far)
This commit is contained in:
parent
d1b7fc8035
commit
0df9d71782
@ -25,7 +25,7 @@
|
|||||||
'readProj' => True,
|
'readProj' => True,
|
||||||
'readAddr' => True,
|
'readAddr' => True,
|
||||||
'anzSubs' => True,
|
'anzSubs' => True,
|
||||||
'readIdArray' => True,
|
'search' => True,
|
||||||
'get_rows' => True,
|
'get_rows' => True,
|
||||||
'accountInfo' => True, // in class boinfolog (this class)
|
'accountInfo' => True, // in class boinfolog (this class)
|
||||||
'addr2name' => True,
|
'addr2name' => True,
|
||||||
@ -288,10 +288,10 @@
|
|||||||
return $this->so->anzSubs( $info_id );
|
return $this->so->anzSubs( $info_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
function readIdArray($order,$sort,$filter,$cat_id,$query,$action,$action_id,
|
function search($order,$sort,$filter,$cat_id,$query,$action,$action_id,
|
||||||
$ordermethod,&$start,&$total)
|
$ordermethod,&$start,&$total)
|
||||||
{
|
{
|
||||||
return $this->so->readIdArray($order,$sort,$filter,$cat_id,$query,
|
return $this->so->search($order,$sort,$filter,$cat_id,$query,
|
||||||
$action,$action_id,$ordermethod,$start,$total);
|
$action,$action_id,$ordermethod,$start,$total);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,9 +478,9 @@
|
|||||||
function link_query( $pattern )
|
function link_query( $pattern )
|
||||||
{
|
{
|
||||||
$start = $total = 0;
|
$start = $total = 0;
|
||||||
$ids = $this->readIdArray('','','','',$pattern,'','','',&$start,&$total);
|
$ids = $this->search('','','','',$pattern,'','','',&$start,&$total);
|
||||||
$content = array();
|
$content = array();
|
||||||
while (is_array($ids) && list( $id,$parent ) = each( $ids ))
|
while (is_array($ids) && list( $id,$info ) = each( $ids ))
|
||||||
{
|
{
|
||||||
$content[$id] = $this->link_title($id);
|
$content[$id] = $this->link_title($id);
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,28 @@
|
|||||||
'info_pri' => 'normal' );
|
'info_pri' => 'normal' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function db2data(&$data)
|
||||||
|
{
|
||||||
|
$data = $this->db->Record;
|
||||||
|
reset($this->maybe_slashes);
|
||||||
|
while (list($key) = each($this->maybe_slashes))
|
||||||
|
{
|
||||||
|
$data[$key] = stripslashes($data[$key]);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
$links = $this->links->get_links('infolog',$this->data['info_id']);
|
||||||
|
while (list($nul,$link) = each($links))
|
||||||
|
{
|
||||||
|
if ($link['app'] == 'addressbook')
|
||||||
|
$data['info_addr_id'] = $link['id'];
|
||||||
|
if ($link['app'] == 'projects')
|
||||||
|
$data['info_proj_id'] = $link['id'];
|
||||||
|
if ($link['app'] == 'calendar')
|
||||||
|
$data['info_event_id'] = $link['id'];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
function read($info_id) // did _not_ ensure ACL
|
function read($info_id) // did _not_ ensure ACL
|
||||||
{
|
{
|
||||||
if ($info_id <= 0 || $info_id != $this->data['info_id'] &&
|
if ($info_id <= 0 || $info_id != $this->data['info_id'] &&
|
||||||
@ -169,22 +191,7 @@
|
|||||||
}
|
}
|
||||||
if ($info_id != $this->data['info_id']) // data yet read in
|
if ($info_id != $this->data['info_id']) // data yet read in
|
||||||
{
|
{
|
||||||
$this->data = $this->db->Record;
|
$this->db2data($this->data);
|
||||||
reset($this->maybe_slashes);
|
|
||||||
while (list($key) = each($this->maybe_slashes))
|
|
||||||
{
|
|
||||||
$this->data[$key] = stripslashes($this->data[$key]);
|
|
||||||
}
|
|
||||||
$links = $this->links->get_links('infolog',$this->data['info_id']);
|
|
||||||
while (list($nul,$link) = each($links))
|
|
||||||
{
|
|
||||||
if ($link['app'] == 'addressbook')
|
|
||||||
$this->data['info_addr_id'] = $link['id'];
|
|
||||||
if ($link['app'] == 'projects')
|
|
||||||
$this->data['info_proj_id'] = $link['id'];
|
|
||||||
if ($link['app'] == 'calendar')
|
|
||||||
$this->data['info_event_id'] = $link['id'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
@ -252,6 +259,10 @@
|
|||||||
|
|
||||||
function anzSubs( $info_id )
|
function anzSubs( $info_id )
|
||||||
{
|
{
|
||||||
|
if ($info_id <= 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
$this->db->query('select count(*) FROM phpgw_infolog where '.
|
$this->db->query('select count(*) FROM phpgw_infolog where '.
|
||||||
"info_id_parent=$info_id",__LINE__,__FILE__);
|
"info_id_parent=$info_id",__LINE__,__FILE__);
|
||||||
|
|
||||||
@ -260,38 +271,28 @@
|
|||||||
return $this->db->f(0);
|
return $this->db->f(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function readIdArray($order,$sort,$filter,$cat_id,$query,$action,$action_id,
|
function search($order,$sort,$filter,$cat_id,$query,$action,$action_id,
|
||||||
$ordermethod,&$start,&$total)
|
$ordermethod,&$start,&$total)
|
||||||
{
|
{
|
||||||
//echo "<p>soinfolog.readIdArray(action='$action',action_id='$action_id')</p>\n";
|
//echo "<p>soinfolog.search(action='$action/$action_id')</p>\n";
|
||||||
$action2app = array(
|
$action2app = array(
|
||||||
'addr' => 'addressbook',
|
'addr' => 'addressbook',
|
||||||
'addressbook' => 'addressbook',
|
|
||||||
'proj' => 'projects',
|
'proj' => 'projects',
|
||||||
'projects' => 'projects',
|
'event' => 'calendar'
|
||||||
'event' => 'calendar',
|
|
||||||
'calendar' => 'calendar'
|
|
||||||
);
|
);
|
||||||
if ($action != '' && isset($action2app[$action]))
|
if (isset($action2app[$action]))
|
||||||
{
|
{
|
||||||
$links = $this->links->get_links($action2app[$action],$action_id);
|
$action = $action2app[$action];
|
||||||
$total = count($links);
|
|
||||||
if ($start > $total)
|
|
||||||
{
|
|
||||||
$start = 0;
|
|
||||||
}
|
}
|
||||||
$ids = array();
|
if ($action != '')
|
||||||
while (list($n,$link) = each($links) &&
|
|
||||||
$n < $start+$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'])
|
|
||||||
{
|
{
|
||||||
if ($n >= $start)
|
$links = $this->links->get_links($action=='sp'?'infolog':$action,$action_id,'infolog');
|
||||||
|
|
||||||
|
if (count($links))
|
||||||
{
|
{
|
||||||
$ids[''.$link['id']] = 0;
|
$link_extra = ($action == 'sp' ? 'OR' : 'AND').' info_id IN ('.implode(',',$links).')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//echo "<p>soinfolog.readIdArray($action,$action_id) ids ="; _debug_array($ids);
|
|
||||||
return $ids;
|
|
||||||
}
|
|
||||||
if ($order)
|
if ($order)
|
||||||
{
|
{
|
||||||
$ordermethod = 'ORDER BY ' . $order . ' ' . $sort;
|
$ordermethod = 'ORDER BY ' . $order . ' ' . $sort;
|
||||||
@ -309,17 +310,6 @@
|
|||||||
{
|
{
|
||||||
$filtermethod .= " AND info_cat='$cat_id' ";
|
$filtermethod .= " AND info_cat='$cat_id' ";
|
||||||
}
|
}
|
||||||
/* not longer used
|
|
||||||
switch ($action)
|
|
||||||
{
|
|
||||||
case 'addr': $filtermethod .= " AND info_addr_id=$action_id ";
|
|
||||||
break;
|
|
||||||
case 'proj': $filtermethod .= " AND info_proj_id=$action_id ";
|
|
||||||
break;
|
|
||||||
case 'event': $filtermethod .= " AND info_event_id=$action_id ";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if ($query) // we search in _from, _subject and _des for $query
|
if ($query) // we search in _from, _subject and _des for $query
|
||||||
{
|
{
|
||||||
$sql_query = "AND (info_from like '%$query%' OR info_subject ".
|
$sql_query = "AND (info_from like '%$query%' OR info_subject ".
|
||||||
@ -332,7 +322,10 @@
|
|||||||
{
|
{
|
||||||
$pid = '';
|
$pid = '';
|
||||||
}
|
}
|
||||||
$this->db->query("SELECT COUNT(*) FROM phpgw_infolog WHERE $filtermethod $pid $sql_query",__LINE__,__FILE__);
|
$ids = array( );
|
||||||
|
if ($action == '' || $action == 'sp' || count($links))
|
||||||
|
{
|
||||||
|
$this->db->query($sql="SELECT COUNT(*) FROM phpgw_infolog i WHERE ($filtermethod $pid $sql_query) $link_extra",__LINE__,__FILE__);
|
||||||
|
|
||||||
$this->db->next_record();
|
$this->db->next_record();
|
||||||
$total = $this->db->f(0);
|
$total = $this->db->f(0);
|
||||||
@ -341,12 +334,17 @@
|
|||||||
{
|
{
|
||||||
$start = 0;
|
$start = 0;
|
||||||
}
|
}
|
||||||
$this->db->limit_query($sql="SELECT info_id,info_id_parent FROM phpgw_infolog WHERE $filtermethod $pid $sql_query $ordermethod",$start,__LINE__,__FILE__);
|
$this->db->limit_query($sql="SELECT * FROM phpgw_infolog WHERE ($filtermethod $pid $sql_query) $link_extra $ordermethod",$start,__LINE__,__FILE__);
|
||||||
|
|
||||||
$ids = array( );
|
|
||||||
while ($this->db->next_record())
|
while ($this->db->next_record())
|
||||||
{
|
{
|
||||||
$ids[$this->db->f('info_id')] = $this->db->f('info_id_parent');
|
$this->db2data(&$info);
|
||||||
|
$ids[$info['info_id']] = $info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$start = $total = 0;
|
||||||
}
|
}
|
||||||
return $ids;
|
return $ids;
|
||||||
}
|
}
|
||||||
|
@ -85,17 +85,21 @@
|
|||||||
$this->html = &$this->tmpl->html;
|
$this->html = &$this->tmpl->html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_info($id,&$readonlys,$action='',$action_id='')
|
function get_info($info,&$readonlys,$action='',$action_id='')
|
||||||
{
|
{
|
||||||
$info = $this->bo->read($id);
|
if (!is_array($info))
|
||||||
$info['anzSubs'] = $this->bo->anzSubs($id);
|
{
|
||||||
|
$info = $this->bo->read($info);
|
||||||
|
}
|
||||||
|
$id = $info['info_id'];
|
||||||
$info += $this->formatInfo($info,$action,$action_id);
|
$info += $this->formatInfo($info,$action,$action_id);
|
||||||
$info['info_des'] = nl2br($info['info_des']);
|
$info['info_des'] = nl2br($info['info_des']);
|
||||||
|
$info['info_anz_subs'] = $this->bo->anzSubs($id);
|
||||||
|
|
||||||
$readonlys["edit[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_EDIT);
|
$readonlys["edit[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_EDIT);
|
||||||
$readonlys["delete[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_DELETE);
|
$readonlys["delete[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_DELETE);
|
||||||
$readonlys["sp[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_ADD);
|
$readonlys["sp[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_ADD);
|
||||||
$readonlys["view[$id]"] = $info['anzSubs'] < 1;
|
$readonlys["view[$id]"] = $info['info_anz_subs'] < 1;
|
||||||
$readonlys['view[0]'] = True; // no parent
|
$readonlys['view[0]'] = True; // no parent
|
||||||
|
|
||||||
return $info;
|
return $info;
|
||||||
@ -105,7 +109,7 @@
|
|||||||
{
|
{
|
||||||
//echo "<p>uiinfolog.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]')</p>\n";
|
//echo "<p>uiinfolog.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]')</p>\n";
|
||||||
|
|
||||||
$ids = $this->bo->readIdArray($query['order'],$query['sort'],$query['filter'],$query['cat_id'],
|
$ids = $this->bo->search($query['order'],$query['sort'],$query['filter'],$query['cat_id'],
|
||||||
$query['search'],$query['action'],$query['action_id'],$query['ordermethod'],
|
$query['search'],$query['action'],$query['action_id'],$query['ordermethod'],
|
||||||
$query['start'],$total);
|
$query['start'],$total);
|
||||||
|
|
||||||
@ -115,9 +119,9 @@
|
|||||||
}
|
}
|
||||||
$rows = array( $total );
|
$rows = array( $total );
|
||||||
$readonlys = array();
|
$readonlys = array();
|
||||||
while (list($id,$parent) = each($ids))
|
while (list($id,$info) = each($ids))
|
||||||
{
|
{
|
||||||
$rows[] = $this->get_info($id,$readonlys,$query['action'],$query['action_id']);
|
$rows[] = $this->get_info($info,$readonlys,$query['action'],$query['action_id']);
|
||||||
}
|
}
|
||||||
//echo "<p>readonlys = "; _debug_array($readonlys);
|
//echo "<p>readonlys = "; _debug_array($readonlys);
|
||||||
reset($rows);
|
reset($rows);
|
||||||
@ -125,68 +129,49 @@
|
|||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete($values=0,$referer='')
|
|
||||||
{
|
|
||||||
$info_id = is_array($values) ? $values['info_id'] : $values;
|
|
||||||
$referer = is_array($values) ? $values['referer'] : $referer;
|
|
||||||
|
|
||||||
if (is_array($values) || $info_id <= 0)
|
|
||||||
{
|
|
||||||
if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,PHPGW_ACL_DELETE))
|
|
||||||
{
|
|
||||||
$this->bo->delete($info_id);
|
|
||||||
}
|
|
||||||
return $referer ? $this->tmpl->header($referer) : $this->index();
|
|
||||||
}
|
|
||||||
$readonlys = $values = array();
|
|
||||||
$values['main'][1] = $this->get_info($info_id,&$readonlys['main']);
|
|
||||||
|
|
||||||
$this->tmpl->read('infolog.delete');
|
|
||||||
|
|
||||||
$values['main']['no_actions'] = True;
|
|
||||||
$persist['info_id'] = $info_id;
|
|
||||||
$persist['referer'] = $referer;
|
|
||||||
|
|
||||||
$this->tmpl->exec('infolog.uiinfolog.delete',$values,'',$readonlys,$persist);
|
|
||||||
}
|
|
||||||
|
|
||||||
function index($values = 0,$action='',$action_id='',$referer=0)
|
function index($values = 0,$action='',$action_id='',$referer=0)
|
||||||
{
|
{
|
||||||
$referer = is_array($values) ? $values['referer'] : $referer;
|
$referer = is_array($values) ? $values['referer'] : $referer;
|
||||||
|
//echo "<p>uiinfolog::index(action='$action/$action_id',referer='$referer/$values[referer]')</p>\n";
|
||||||
|
|
||||||
if (!is_array($values))
|
if (!is_array($values))
|
||||||
{
|
{
|
||||||
$values = array('nm' => $GLOBALS['phpgw']->session->appsession('session_data','infolog'));
|
$values = array('nm' => $GLOBALS['phpgw']->session->appsession('session_data','infolog'));
|
||||||
}
|
}
|
||||||
$action = $action ? $action : $values['nm']['action'];
|
else
|
||||||
$action_id = $action_id ? $action_id : $values['nm']['action_id'];
|
|
||||||
|
|
||||||
if ($values['add'] || $values['cancel'] || isset($values['nm']['rows']) || isset($values['main']))
|
|
||||||
{
|
{
|
||||||
$data = $values['nm'];
|
$data = $values['nm'];
|
||||||
unset($data['rows']);
|
unset($data['rows']);
|
||||||
$GLOBALS['phpgw']->session->appsession('session_data','infolog',$data);
|
$GLOBALS['phpgw']->session->appsession('session_data','infolog',$data);
|
||||||
|
}
|
||||||
|
$action = $action ? $action : $values['action'];
|
||||||
|
$action_id = $action_id ? $action_id : $values['action_id'];
|
||||||
|
|
||||||
|
if ($values['add'] || $values['cancel'] || isset($values['nm']['rows']) || isset($values['main']))
|
||||||
|
{
|
||||||
|
|
||||||
if ($values['add'])
|
if ($values['add'])
|
||||||
{
|
{
|
||||||
list($type) = each($values['add']);
|
list($type) = each($values['add']);
|
||||||
return $this->edit(0,$values['nm']['action'],$values['nm']['action_id'],$type,$referer);
|
return $this->edit(0,$action,$action_id,$type,$referer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
list($action,$action_id) = isset($values['main']) ? each($values['main']) : @each($values['nm']['rows']);
|
list($do,$do_id) = isset($values['main']) ? each($values['main']) : @each($values['nm']['rows']);
|
||||||
list($action_id) = @each($action_id);
|
list($do_id) = @each($do_id);
|
||||||
//echo "<p>infolog::index: action='$action', id='$action_id'</p>\n";
|
//echo "<p>infolog::index: do='$do/$do_id', referer="; _debug_array($referer);
|
||||||
switch($action)
|
switch($do)
|
||||||
{
|
{
|
||||||
case 'edit':
|
case 'edit':
|
||||||
return $this->edit($action_id,'','','',$referer);
|
return $this->edit($do_id,$action,$action_id,'',$referer);
|
||||||
case 'delete':
|
case 'delete':
|
||||||
return $this->delete($action_id,$referer);
|
return $this->delete($do_id,$referer);
|
||||||
case 'sp':
|
case 'sp':
|
||||||
return $this->edit(0,$action,$action_id,'',$referer);
|
return $this->edit(0,'sp',$do_id,'',$referer);
|
||||||
case 'view':
|
case 'view':
|
||||||
$value = array();
|
$value = array();
|
||||||
$action = 'sp';
|
$action = 'sp';
|
||||||
|
$action_id = $do_id;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$value = array();
|
$value = array();
|
||||||
@ -216,15 +201,38 @@
|
|||||||
$values['nm']['options-filter'] = $this->filters;
|
$values['nm']['options-filter'] = $this->filters;
|
||||||
$values['nm']['get_rows'] = 'infolog.uiinfolog.get_rows';
|
$values['nm']['get_rows'] = 'infolog.uiinfolog.get_rows';
|
||||||
$values['nm']['no_filter2'] = True;
|
$values['nm']['no_filter2'] = True;
|
||||||
$persist['nm']['action'] = $values['nm']['action'] = $action;
|
$persist['action'] = $values['nm']['action'] = $action;
|
||||||
$persist['nm']['action_id'] = $values['nm']['action_id'] = $action_id;
|
$persist['action_id'] = $values['nm']['action_id'] = $action_id;
|
||||||
$persist['referer'] = $referer;
|
$persist['referer'] = $referer;
|
||||||
|
|
||||||
$GLOBALS['phpgw']->session->appsession('session_data','infolog',$values['nm']);
|
|
||||||
|
|
||||||
$this->tmpl->exec('infolog.uiinfolog.index',$values,'',$readonlys,$persist);
|
$this->tmpl->exec('infolog.uiinfolog.index',$values,'',$readonlys,$persist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function delete($values=0,$referer='')
|
||||||
|
{
|
||||||
|
$info_id = is_array($values) ? $values['info_id'] : $values;
|
||||||
|
$referer = is_array($values) ? $values['referer'] : $referer;
|
||||||
|
|
||||||
|
if (is_array($values) || $info_id <= 0)
|
||||||
|
{
|
||||||
|
if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,PHPGW_ACL_DELETE))
|
||||||
|
{
|
||||||
|
$this->bo->delete($info_id);
|
||||||
|
}
|
||||||
|
return $referer ? $this->tmpl->location($referer) : $this->index();
|
||||||
|
}
|
||||||
|
$readonlys = $values = array();
|
||||||
|
$values['main'][1] = $this->get_info($info_id,&$readonlys['main']);
|
||||||
|
|
||||||
|
$this->tmpl->read('infolog.delete');
|
||||||
|
|
||||||
|
$values['main']['no_actions'] = True;
|
||||||
|
$persist['info_id'] = $info_id;
|
||||||
|
$persist['referer'] = $referer;
|
||||||
|
|
||||||
|
$this->tmpl->exec('infolog.uiinfolog.delete',$values,'',$readonlys,$persist);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function edit
|
@function edit
|
||||||
@syntax edit( $content=0,$action='',$action_id=0,$type='' )
|
@syntax edit( $content=0,$action='',$action_id=0,$type='' )
|
||||||
@ -237,21 +245,12 @@
|
|||||||
*/
|
*/
|
||||||
function edit($content = 0,$action = '',$action_id=0,$type='',$referer='')
|
function edit($content = 0,$action = '',$action_id=0,$type='',$referer='')
|
||||||
{
|
{
|
||||||
$referer = is_array($content) ? $content['referer'] : $referer;
|
|
||||||
|
|
||||||
if (is_array($values) || $info_id < 0)
|
|
||||||
{
|
|
||||||
if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,PHPGW_ACL_DELETE))
|
|
||||||
{
|
|
||||||
$this->bo->delete($info_id);
|
|
||||||
}
|
|
||||||
return $referer ? $this->tmpl->header($referer) : $this->index();
|
|
||||||
}
|
|
||||||
if (is_array($content))
|
if (is_array($content))
|
||||||
{
|
{
|
||||||
$info_id = $content['info_id'];
|
$info_id = $content['info_id'];
|
||||||
$action = $content['action'];
|
$action = $content['action'];
|
||||||
$action_id = $content['action_id'];
|
$action_id = $content['action_id'];
|
||||||
|
$referer = $content['referer'];
|
||||||
|
|
||||||
if ($content['save'] || $content['delete'] || $content['cancel'])
|
if ($content['save'] || $content['delete'] || $content['cancel'])
|
||||||
{
|
{
|
||||||
@ -266,9 +265,14 @@
|
|||||||
}
|
}
|
||||||
elseif ($content['delete'] && $info_id > 0)
|
elseif ($content['delete'] && $info_id > 0)
|
||||||
{
|
{
|
||||||
|
if (!$referer && $action) $referer = array(
|
||||||
|
'menuaction' => 'infolog.uiinfolog.index',
|
||||||
|
'action' => $action,
|
||||||
|
'action_id' => $action_id
|
||||||
|
);
|
||||||
return $this->delete($info_id,$referer); // checks ACL first
|
return $this->delete($info_id,$referer); // checks ACL first
|
||||||
}
|
}
|
||||||
return $referer ? $this->tmpl->header($referer) : $this->index();
|
return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -278,21 +282,23 @@
|
|||||||
$action_id = $action_id ? $action_id : get_var('action_id',array('POST','GET'));
|
$action_id = $action_id ? $action_id : get_var('action_id',array('POST','GET'));
|
||||||
$info_id = $content ? $content : get_var('info_id', array('POST','GET'));
|
$info_id = $content ? $content : get_var('info_id', array('POST','GET'));
|
||||||
$type = $type ? $type : get_var('type', array('POST','GET'));
|
$type = $type ? $type : get_var('type', array('POST','GET'));
|
||||||
$referer = ''.$referer != '' ? $referer : get_var('HTTP_REFERER','SERVER');
|
$referer = $referer !== '' ? $referer :
|
||||||
|
ereg_replace('^.*'.$GLOBALS['phpgw_info']['server']['webserver_url'],'',
|
||||||
|
get_var('HTTP_REFERER',Array('GLOBAL')));
|
||||||
//echo "<p>uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
|
//echo "<p>uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
|
||||||
|
|
||||||
if (!isset($this->bo->enums['type'][$type]))
|
if (!isset($this->bo->enums['type'][$type]))
|
||||||
{
|
{
|
||||||
$type = 'note';
|
$type = 'note';
|
||||||
}
|
}
|
||||||
$this->bo->read( $action == 'sp' && $action_id > 0 ? $action_id : $info_id );
|
$this->bo->read( $info_id || $action != 'sp' ? $info_id : $action_id );
|
||||||
$content = $this->bo->so->data;
|
$content = $this->bo->so->data;
|
||||||
|
|
||||||
if ($action_id && $action == 'sp') // new SubProject
|
if (!$info_id && $action_id && $action == 'sp') // new SubProject
|
||||||
{
|
{
|
||||||
if (!$this->bo->check_access($action_id,PHPGW_ACL_ADD))
|
if (!$this->bo->check_access($action_id,PHPGW_ACL_ADD))
|
||||||
{
|
{
|
||||||
return $referer ? $this->tmpl->header($referer) : $this->index();
|
return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id);
|
||||||
}
|
}
|
||||||
$parent = $this->bo->so->data;
|
$parent = $this->bo->so->data;
|
||||||
$content['info_id'] = $info_id = 0;
|
$content['info_id'] = $info_id = 0;
|
||||||
@ -315,7 +321,7 @@
|
|||||||
{
|
{
|
||||||
if ($info_id && !$this->bo->check_access($info_id,PHPGW_ACL_EDIT))
|
if ($info_id && !$this->bo->check_access($info_id,PHPGW_ACL_EDIT))
|
||||||
{
|
{
|
||||||
return $referer ? $this->tmpl->header($referer) : $this->index();
|
return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$content['links'] = $content['link_to'] = array(
|
$content['links'] = $content['link_to'] = array(
|
||||||
@ -343,7 +349,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$readonlys['delete'] = $action != '';
|
$readonlys['delete'] = $action != '';
|
||||||
$content['appheader'] = $this->messages[$action ? ($action == 'sp' ? 'add_sub' : 'add') : 'edit'];
|
$content['appheader'] = $this->messages[$info_id ? 'edit' : ($action == 'sp' ? 'add_sub' : 'add')];
|
||||||
|
|
||||||
//echo "<p>uiinfolog.edit(info_id=$info_id,mode=$mode) content = "; _debug_array($content);
|
//echo "<p>uiinfolog.edit(info_id=$info_id,mode=$mode) content = "; _debug_array($content);
|
||||||
$this->tmpl->read('infolog.edit');
|
$this->tmpl->read('infolog.edit');
|
||||||
@ -357,7 +363,8 @@
|
|||||||
'info_id_parent' => $content['info_id_parent'],
|
'info_id_parent' => $content['info_id_parent'],
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'action_id' => $action_id,
|
'action_id' => $action_id,
|
||||||
'referer' => $referer
|
'referer' => $referer,
|
||||||
|
'link_to' => array('to_id' => $content['link_to']['to_id']) // in case tab gets not viewed
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -727,7 +734,7 @@
|
|||||||
$GLOBALS['phpgw']->template->parse('info_headers','info_headers');
|
$GLOBALS['phpgw']->template->parse('info_headers','info_headers');
|
||||||
// -------------- end header declaration -----------------
|
// -------------- end header declaration -----------------
|
||||||
|
|
||||||
$ids = $this->bo->readIdArray($order,$sort,$filter,$cat_id,$query,
|
$ids = $this->bo->search($order,$sort,$filter,$cat_id,$query,
|
||||||
$action,$action_id,$ordermethod,$start,$total);
|
$action,$action_id,$ordermethod,$start,$total);
|
||||||
|
|
||||||
$maxmatchs = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
|
$maxmatchs = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
|
||||||
@ -797,13 +804,13 @@
|
|||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->template->set_var('info_headers','');
|
$GLOBALS['phpgw']->template->set_var('info_headers','');
|
||||||
}
|
}
|
||||||
while (list($id,$parent) = each($ids))
|
while (list($id,$info) = each($ids))
|
||||||
{
|
{
|
||||||
$subproact = $this->bo->anzSubs($id);
|
$subproact = $this->bo->anzSubs($id);
|
||||||
|
|
||||||
$this->nextmatchs->template_alternate_row_color($GLOBALS['phpgw']->template);
|
$this->nextmatchs->template_alternate_row_color($GLOBALS['phpgw']->template);
|
||||||
|
|
||||||
$GLOBALS['phpgw']->template->set_var( $this->formatInfo( $id,$action,$action_id ));
|
$GLOBALS['phpgw']->template->set_var( $this->formatInfo( $info,$action,$action_id ));
|
||||||
|
|
||||||
if ($this->bo->check_access($id,PHPGW_ACL_EDIT))
|
if ($this->bo->check_access($id,PHPGW_ACL_EDIT))
|
||||||
{
|
{
|
||||||
|
@ -16,16 +16,18 @@
|
|||||||
|
|
||||||
$GLOBALS['phpgw']->translation->add_app('infolog');
|
$GLOBALS['phpgw']->translation->add_app('infolog');
|
||||||
|
|
||||||
/* echo "<p>hook_addressbook_view(ab_id=$ab_id)</p>"; */
|
//echo "<p>hook_addressbook_view(ab_id=$GLOBALS[ab_id])</p>\n";
|
||||||
|
/*
|
||||||
$link = CreateObject('infolog.uilink');
|
$link = CreateObject('infolog.uilink');
|
||||||
$out = '<table>'.$link->getEntry('entry','addressbook',$GLOBALS['ab_id'])."\n".
|
$out = '<table>'.$link->getEntry('entry','addressbook',$GLOBALS['ab_id'])."\n".
|
||||||
$link->showLinks('links','addressbook',$GLOBALS['ab_id'],'!infolog')."</table>\n";
|
$link->showLinks('links','addressbook',$GLOBALS['ab_id'],'!infolog')."</table>\n";
|
||||||
$html = CreateObject('etemplate.html');
|
$html = CreateObject('etemplate.html');
|
||||||
$out = $html->form($out,'','/index.php',array('menuaction'=>'addressbook.uiaddressbook.view','ab_id'=>$GLOBALS['ab_id']));
|
$out = $html->form($out,'','/index.php',array('menuaction'=>'addressbook.uiaddressbook.view','ab_id'=>$GLOBALS['ab_id']));
|
||||||
$GLOBALS['phpgw']->template->set_var('phpgw_body',$out,True);
|
$GLOBALS['phpgw']->template->set_var('phpgw_body',$out,True);
|
||||||
|
*/
|
||||||
$infolog = CreateObject('infolog.uiinfolog');
|
$infolog = CreateObject('infolog.uiinfolog');
|
||||||
$infolog->get_list(True,'addr',$GLOBALS['ab_id']);
|
$infolog->index(0,'addressbook',$GLOBALS['ab_id'],array(
|
||||||
|
'menuaction' => 'addressbook.uiaddressbook.view',
|
||||||
|
'ab_id' => $GLOBALS['ab_id']
|
||||||
|
));
|
||||||
$GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app;
|
$GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app;
|
||||||
|
Loading…
Reference in New Issue
Block a user