saveing the links

This commit is contained in:
Ralf Becker 2005-11-13 18:22:43 +00:00
parent e665bbad9d
commit 2bd1de92a8

View File

@ -66,12 +66,31 @@ class uicontacts extends bocontacts
switch($button) switch($button)
{ {
case 'save': case 'save':
$this->save($content);
echo "<html><body><script>var referer = opener.location;opener.location.href = referer;window.close();</script></body></html>\n";
$GLOBALS['egw']->common->egw_exit();
case 'apply': case 'apply':
$links = false;
if (!$content['id'] && is_array($content['link_to']['to_id']))
{
$links = $content['link_to']['to_id'];
}
$content = $this->save($content); $content = $this->save($content);
// writing links for new entry, existing ones are handled by the widget itself
if ($links && $content['id'])
{
if (!is_object($this->link))
{
if (!is_object($GLOBALS['egw']->link))
{
$GLOBALS['egw']->link =& CreateObject('phpgwapi.bolink');
}
$this->link =& $GLOBALS['egw']->link;
}
$this->link->link('addressbook',$content['id'],$links);
}
if ($button == 'save')
{
echo "<html><body><script>var referer = opener.location;opener.location.href = referer;window.close();</script></body></html>\n";
$GLOBALS['egw']->common->egw_exit();
}
$GLOBALS['egw_info']['flags']['java_script'] .= "<script LANGUAGE=\"JavaScript\"> $GLOBALS['egw_info']['flags']['java_script'] .= "<script LANGUAGE=\"JavaScript\">
var referer = opener.location; var referer = opener.location;
opener.location.href = referer;</script>"; opener.location.href = referer;</script>";
@ -117,6 +136,11 @@ class uicontacts extends bocontacts
$sel_options['tz'] = $tz; $sel_options['tz'] = $tz;
$content['tz'] = $content['tz'] ? $content['tz'] : 0; $content['tz'] = $content['tz'] ? $content['tz'] : 0;
$content['link'] = $content['link_to'] = array(
'to_app' => 'addressbook',
'to_id' => (int) $content['id'],
);
$this->tmpl->read('addressbook.edit'); $this->tmpl->read('addressbook.edit');
return $this->tmpl->exec('addressbook.uicontacts.edit',$content,$sel_options,$readonlys,$preserv, 2); return $this->tmpl->exec('addressbook.uicontacts.edit',$content,$sel_options,$readonlys,$preserv, 2);
} }