show infolog via hook in addressbook/view

This commit is contained in:
Ralf Becker 2001-07-12 23:39:02 +00:00
parent 5ec7e29c20
commit 1317104aa9
3 changed files with 54 additions and 45 deletions

View File

@ -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 "<p>for_include: $for_include, action: $action, addr_id: $addr_id</p>";
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', '<br>'.
$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();

View File

@ -11,6 +11,18 @@
/* $Id$ */
echo 'Hello World<br>';
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 "<p>hook_addressbook_view(ab_id=$ab_id)</p>";
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;

View File

@ -24,6 +24,7 @@
</table><p>
<!-- END projdetails -->
<!-- BEGIN cat_selection -->
<TABLE><tr valign="middle"><td>
<form method="POST" name="cat" action="{cat_form}">
{lang_category}
@ -36,20 +37,21 @@
</td><td>
{total_matchs}
</td></tr></table>
<!-- END cat_selection -->
{next_matchs}
<table width=95% border=0 cellspacing=1 cellpadding=3>
<tr bgcolor="{th_bg}">
<td width="2%" class=list>{sort_type}</td>
<td width="4%" class=list>{sort_status}</td>
<td class=list>{sort_subject}</td>
<td width="5%" class=list>{sort_startdate}<br>{sort_enddate}</td>
<td width="5%" class=list>{sort_owner}<br>{sort_datecreated}</td>
<td width="7%" class=list>{sort_responsible}</td>
<td width="2%" class=list>{lang_type}</td>
<td width="4%" class=list>{lang_status}</td>
<td class=list>{lang_subject}</td>
<td width="8%" class=list>{lang_startdate}<br>{lang_enddate}</td>
<td width="8%" class=list>{lang_owner}<br>{lang_datecreated}</td>
<td width="8%" class=list>{lang_responsible}</td>
<td width="3%" class=list>{h_lang_sub}</td>
<td width="3%" class=list>{h_lang_action}</td>
</tr>
</form>
<!-- BEGIN info_list -->
<tr bgcolor="{tr_color}" valign="top">