From 1317104aa965dde8426f289b0ceb0e7a19e4ee27 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 12 Jul 2001 23:39:02 +0000 Subject: [PATCH] show infolog via hook in addressbook/view --- infolog/inc/class.uiinfolog.inc.php | 67 +++++++++++------------ infolog/inc/hook_addressbook_view.inc.php | 16 +++++- infolog/templates/default/list.tpl | 16 +++--- 3 files changed, 54 insertions(+), 45 deletions(-) diff --git a/infolog/inc/class.uiinfolog.inc.php b/infolog/inc/class.uiinfolog.inc.php index 0772d0313c..498a812dc7 100644 --- a/infolog/inc/class.uiinfolog.inc.php +++ b/infolog/inc/class.uiinfolog.inc.php @@ -57,7 +57,8 @@ ); $this->html = CreateObject('infolog.html'); - $this->template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); + $this->template = CreateObject('phpgwapi.Template', + $phpgw->common->get_tpl_dir('infolog')); $this->categories = CreateObject('phpgwapi.categories'); $this->nextmatchs = CreateObject('phpgwapi.nextmatchs'); } @@ -96,10 +97,6 @@ str_replace( '/images','',$phpgw->common->get_image_path()).'/info.css">' ); } - function loadStyleSheet( ) { - list( $style ) = $this->setStyleSheet(); echo $style; - } - /* * $info: info_id or array with one row form info-db * no Proj.Info if proj_id == p_id / no Addr.Info if addr_id == a_id @@ -192,11 +189,7 @@ 'enddate','owner','datecreated','responsible' ); for ( ;$f = $h = current($fields); $f = next($fields)) { $lang = lang(ucfirst( $f )); - if ($do_sort_header) { - $headers['sort_'.$f] = $this->nextmatchs->show_sort_order($sort,'info_'.$f,$order,'/index.php',$lang,'&'.$this->menuaction()); - } else { - $headers['lang_'.$f] = $lang; - } + $headers['lang_'.$f] = $do_sort_header ? $this->nextmatchs->show_sort_order($sort,'info_'.$f,$order,'/index.php',$lang,'&menuaction=infolog.uiinfolog.get_list') : $lang; } return $headers; } @@ -206,7 +199,6 @@ global $cat_filter,$cat_id,$sort,$order,$query,$start,$filter; global $action,$addr_id,$proj_id,$info_id,$for_include; - echo "

for_include: $for_include, action: $action, addr_id: $addr_id

"; if (!$for_include) { $phpgw->common->phpgw_header(); echo parse_navbar(); @@ -235,13 +227,13 @@ $t->set_var(lang_info_action,lang('Info Log - Subprojects from')); break; case 'proj': - $common_hidden_vars .= $html->input_hidden('proj_id',$proj_id); + $common_hidden_vars .= $html->input_hidden('id_project',$proj_id); $proj = $this->bo->readProj($proj_id); $t->set_var(lang_info_action,lang('Info Log').' - '. $proj['title']); break; case 'addr': - $common_hidden_vars .= $html->input_hidden('addr_id',$addr_id); + $common_hidden_vars .= $html->input_hidden('id_addr',$addr_id); $addr = $this->bo->readAddr($addr_id); $t->set_var(lang_info_action,lang('Info Log').' - '. $this->bo->addr2name($addr)); @@ -251,10 +243,10 @@ break; } $t->set_var($this->setStyleSheet( )); - $t->set_var(actionurl,$phpgw->link('/index.php', - 'menuaction=infolog.uiinfolog.edit&action=new')); - $t->set_var('cat_form',$phpgw->link('/index.php', - 'menuaction=infolog.uiinfolog.get_list')); + global $REQUEST_URI; + $t->set_var(actionurl,$html->link('/index.php', + $this->menuaction('edit')+array( 'action' => 'new'))); + $t->set_var('cat_form',$html->link('/index.php',$this->menuaction())); $t->set_var('lang_category',lang('Category')); $t->set_var('lang_all',lang('All')); $t->set_var('lang_select',lang('Select')); @@ -264,7 +256,7 @@ // =========================================== // list header variable template-declarations // =========================================== - $t->set_var( $this->infoHeaders( 1,$sort,$order )); + $t->set_var( $this->infoHeaders( !$for_include,$sort,$order )); $t->set_var(h_lang_sub,lang('Sub')); $t->set_var(h_lang_action,lang('Action')); // -------------- end header declaration ----------------- @@ -331,19 +323,30 @@ break; } + // catergory selection + $t->set_block('info_list_t','cat_selection','cat_selectionhandle'); + if (!$for_include) + $t->parse('cat_selectionhandle','cat_selection',True); + // =========================================== // nextmatch variable template-declarations // =========================================== - $next_matchs = $this->nextmatchs->show_tpl('/index.php',$start,$total, - "menuaction=infolog.uiinfolog.get_list&order=$order&filter=$filter&sort=$sort&query=$query&action=$action&info_id=$info_id&cat_id=$cat_id", + if (!$for_include) { + $next_matchs = $this->nextmatchs->show_tpl('/index.php',$start, + $total,"menuaction=infolog.uiinfolog.get_list&order=$order&filter=$filter&sort=$sort&query=$query&action=$action&info_id=$info_id&cat_id=$cat_id", '95%',$phpgw_info['theme']['th_bg']); - $t->set_var('next_matchs',$next_matchs); - if ($total > $maxmatchs) - $t->set_var('next_matchs_end',$next_matchs); + $t->set_var('next_matchs',$next_matchs); + if ($total > $maxmatchs) + $t->set_var('next_matchs_end',$next_matchs); + } // ---------- end nextmatch template -------------------- - $db->limit_query($q="SELECT * FROM phpgw_infolog WHERE $filtermethod $pid $sql_query $ordermethod",$start,__LINE__,__FILE__); + $sql="SELECT * FROM phpgw_infolog WHERE $filtermethod $pid $sql_query $ordermethod"; + if ($for_include) + $db->query($sql); + else + $db->limit_query($sql,$start,__LINE__,__FILE__); while ($db->next_record()) { // ======================================== @@ -413,7 +416,7 @@ // back2project list href declaration for subproject list // ========================================================= - if ($action) { + if ($action && !$for_include) { $t->set_var('lang_back2projects', '
'. $html->a_href(lang('Back to Projectlist'),'/index.php', $this->menuaction()+array('filter' => $filter))); @@ -442,9 +445,6 @@ global $type,$from,$addr,$id_addr,$id_project,$subject,$des,$access; global $pri,$status,$confirm,$info_cat,$id_parent,$responsible; - //$phpgw->common->phpgw_header(); - // echo parse_navbar(); - $t = &$this->template; $html = &$this->html; $hidden_vars = array('sort' => $sort,'order' => $order, @@ -535,8 +535,7 @@ )); if (!$query_addr && !$query_project) { - Header('Location: ' . $html->link('/index.php', $hidden_vars + - array( 'cd' => 15 ) + $this->menuaction())); + Header('Location: ' . $html->link('/index.php', $hidden_vars + array( 'cd' => 15 ) + $this->menuaction())); } } } @@ -590,7 +589,7 @@ switch ($action) { case 'sp': $info_action = 'Info Log - New Subproject'; break; - case 'new': + case 'new': case 'addr': case 'proj': $info_action = 'Info Log - New'; if ($info_type && isset($this->enums['type'][$info_type])) $this->data['info_type'] = $info_type; @@ -686,9 +685,6 @@ $t->set_var('subprohandle',''); $t->pfp('out','info_edit'); $t->pfp('edithandle','edit'); - - // $phpgw->common->phpgw_footer(); - // echo parse_navbar_end(); } function delete( ) { @@ -710,8 +706,7 @@ if ($confirm) { $this->bo->delete($info_id); - Header('Location: ' . $html->link('/index.php',$hidden_vars + - array( 'cd' => 16 )+$this->menuaction())); + Header('Location: ' . $html->link('/index.php',$hidden_vars + array( 'cd' => 16 )+$this->menuaction())); } else { $phpgw->common->phpgw_header(); echo parse_navbar(); diff --git a/infolog/inc/hook_addressbook_view.inc.php b/infolog/inc/hook_addressbook_view.inc.php index 8ab1241a09..5186da5b27 100644 --- a/infolog/inc/hook_addressbook_view.inc.php +++ b/infolog/inc/hook_addressbook_view.inc.php @@ -11,6 +11,18 @@ /* $Id$ */ - echo 'Hello World
'; + global $phpgw_info,$phpgw; + $save_app = $phpgw_info['flags']['currentapp']; + $phpgw_info['flags']['currentapp'] = 'infolog'; + + $phpgw->translation->add_app('infolog'); + global $ab_id; - echo lang('Infolog') . ': ' . $ab_id; + //echo "

hook_addressbook_view(ab_id=$ab_id)

"; + + global $addr_id,$action,$for_include; + $addr_id = $ab_id; $action='addr'; $for_include = True; + $infolog = CreateObject('infolog.uiinfolog'); + $infolog->get_list(); + + $phpgw_info['flags']['currentapp'] = $save_app; diff --git a/infolog/templates/default/list.tpl b/infolog/templates/default/list.tpl index cd3a0dae32..717aadb06f 100644 --- a/infolog/templates/default/list.tpl +++ b/infolog/templates/default/list.tpl @@ -24,6 +24,7 @@

+
{lang_category} @@ -36,20 +37,21 @@
{total_matchs}
+ + {next_matchs} - - - - - - + + + + + + -
{sort_type}{sort_status}{sort_subject}{sort_startdate}
{sort_enddate}
{sort_owner}
{sort_datecreated}
{sort_responsible}{lang_type}{lang_status}{lang_subject}{lang_startdate}
{lang_enddate}
{lang_owner}
{lang_datecreated}
{lang_responsible} {h_lang_sub} {h_lang_action}