From 6e17b96dd9b01ef35b08db5721139a7073d4d54f Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 18 Oct 2002 20:20:35 +0000 Subject: [PATCH] some fixes to get the links working in case the entry is not yet created --- etemplate/inc/class.link_widget.inc.php | 4 +-- etemplate/inc/class.uietemplate.inc.php | 12 ++++++--- infolog/inc/class.boinfolog.inc.php | 33 ++++++++++++++----------- infolog/inc/class.solink.inc.php | 10 +++++++- infolog/inc/class.uiinfolog.inc.php | 23 +++++++++++------ 5 files changed, 52 insertions(+), 30 deletions(-) diff --git a/etemplate/inc/class.link_widget.inc.php b/etemplate/inc/class.link_widget.inc.php index 7a7441a199..92ba56180e 100644 --- a/etemplate/inc/class.link_widget.inc.php +++ b/etemplate/inc/class.link_widget.inc.php @@ -140,11 +140,11 @@ case 'create': if ($value['to_app']) // make the link { - $this->link->link($value['to_app'],$value['to_id'],$value['app'],$value['id'],$value['remark']); + $link_id = $this->link->link($value['to_app'],$value['to_id'],$value['app'],$value['id'],$value['remark']); //echo "

link($value[to_app],$value[to_id],$value[app],$value[id],'$value[remark]')

\n"; if (isset($value['primary']) && !$value['anz_links'] ) { - $value['primary'] = $value['app'].'/'.$value['id']; + $value['primary'] = $link_id; } } // fall-trough diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index bf3b1816d8..5080cb3ae8 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -208,7 +208,7 @@ } else { - ExecMethod($session_data['method'],$this->complete_array_merge($content,$session_data['preserv'])); + ExecMethod($session_data['method'],$this->complete_array_merge($session_data['preserv'],$content)); } } @@ -358,10 +358,14 @@ each($cols); // skip next cell(s) } } - elseif ($opts[$col]) // width only once for a non colspan cell + else { - $row_data[".$col"] .= ' WIDTH='.$opts[$col]; - $opts[$col] = 0; + list($width,$disable) = explode(',',$opts[$col]); + if ($width) // width only once for a non colspan cell + { + $row_data[".$col"] .= " WIDTH=\"$width\""; + $opts[$col] = "0,$disable"; + } } $row_data[".$col"] .= $this->html->formatOptions($cell['align'],'ALIGN'); list(,$cl) = explode(',',$cell['span']); diff --git a/infolog/inc/class.boinfolog.inc.php b/infolog/inc/class.boinfolog.inc.php index 08232ee47b..fe246461fd 100644 --- a/infolog/inc/class.boinfolog.inc.php +++ b/infolog/inc/class.boinfolog.inc.php @@ -179,7 +179,7 @@ $this->so->delete($info_id); } - function write($values) + function write($values,$check_defaults=True) { while (list($key,$val) = each($values)) { @@ -189,21 +189,24 @@ unset($values[$key]); } } - if ($values['info_responsible'] && $values['info_status'] == 'offer') + if ($check_defaults) { - $values['info_status'] = 'ongoing'; // have to match if not finished - } - if (!$values['info_id'] && !$values['info_owner']) - { - $values['info_owner'] = $this->so->user; - } - if (!$values['info_subject']) - { - $values['info_subject'] = substr($values['info_des'],0,60).' ...'; - } - if ($values['info_link_id'] && $values['info_from'] == '') - { - $values['info_from'] = $this->link_id2title($values); + if ($values['info_responsible'] && $values['info_status'] == 'offer') + { + $values['info_status'] = 'ongoing'; // have to match if not finished + } + if (!$values['info_id'] && !$values['info_owner']) + { + $values['info_owner'] = $this->so->user; + } + if (!$values['info_subject']) + { + $values['info_subject'] = substr($values['info_des'],0,60).' ...'; + } + if ($values['info_link_id'] && $values['info_from'] == '') + { + $values['info_from'] = $this->link_id2title($values); + } } $values['info_datemodified'] = time(); $values['info_modifier'] = $this->so->user; diff --git a/infolog/inc/class.solink.inc.php b/infolog/inc/class.solink.inc.php index 700edbacfa..baef505ff4 100644 --- a/infolog/inc/class.solink.inc.php +++ b/infolog/inc/class.solink.inc.php @@ -61,7 +61,7 @@ */ function link( $app1,$id1,$app2,$id2,$remark='',$owner=0,$lastmod=0 ) { - if ($this->debug) + //if ($this->debug) { echo "

solink.link('$app1',$id1,'$app2',$id2,'$remark',$owner)

\n"; } @@ -167,6 +167,10 @@ */ function get_link($app_link_id,$id='',$app2='',$id2='') { + if ($this->debug) + { + echo "

solink.get_link('$app_link_id',$id,'$app2','$id2')

\n"; + } $sql = "SELECT * FROM $this->db_name WHERE "; if (intval($app_link_id) > 0) { @@ -185,6 +189,10 @@ if ($this->db->next_record()) { + if ($this->debug) + { + _debug_array($this->db->Record); + } return $this->db->Record; } return False; diff --git a/infolog/inc/class.uiinfolog.inc.php b/infolog/inc/class.uiinfolog.inc.php index 4e8be17d9d..2e9a410caa 100644 --- a/infolog/inc/class.uiinfolog.inc.php +++ b/infolog/inc/class.uiinfolog.inc.php @@ -143,7 +143,6 @@ { $referer = is_array($values) ? $values['referer'] : $referer; //echo "

uiinfolog::index(action='$action/$action_id',referer='$referer/$values[referer]')

\n"; - if (!is_array($values)) { $values = array('nm' => $GLOBALS['phpgw']->session->appsession('session_data','infolog')); @@ -262,6 +261,7 @@ { if (is_array($content)) { + //echo "uiinfolog::edit: content="; _debug_array($content); $info_id = $content['info_id']; $action = $content['action']; $action_id = $content['action_id']; @@ -271,7 +271,7 @@ { $content['info_link_id'] = $content['link_to']['primary']; } - if (!$this->link->get_link($content['info_link_id'])) + if (intval($content['info_link_id']) > 0 && !$this->link->get_link($content['info_link_id'])) { $content['info_link_id'] = 0; // link has been deleted } @@ -288,16 +288,23 @@ if (!$info_id && is_array($content['link_to']['to_id'])) // writing link for new entry { - $info_id = $this->bo->so->data['info_id']; - $this->link->link('infolog',$info_id,$content['link_to']['to_id']); + $content['info_id'] = $this->bo->so->data['info_id']; + $this->link->link('infolog',$content['info_id'],$content['link_to']['to_id']); if (strstr($content['info_link_id'],':') !== False) { list($app,$id) = explode(':',$content['info_link_id']); - $content['info_link_id'] = $this->link->get_link('info_log',$info_id,$app,$id); + $link = $this->link->get_link('infolog',$content['info_id'],$app,$id); + $content['info_link_id'] = $link['link_id']; + + if ($content['info_from'] == '') + { + $content['info_from'] = $this->bo->link_id2title($content); + } $this->bo->write(array( - 'info_id' => $info_id, - 'info_link_id' => $content['info_link_id'] - )); + 'info_id' => $content['info_id'], + 'info_link_id' => $content['info_link_id'], + 'info_from' => $content['info_from'] + ),False); } } }