Should be only fixes to make the portal box movement possible (up/down).

This commit is contained in:
skeeter 2001-10-21 10:49:29 +00:00
parent 2562a6b49d
commit dab358dfa5
8 changed files with 185 additions and 40 deletions

View File

@ -35,12 +35,44 @@
$bdays = $c->read(0,15,$qfields,$today,'tid=n','','',$GLOBALS['phpgw_info']['user']['account_id']);
$title = '<center><font color="#FFFFFF">'.lang('Birthdays').'</font></center>';
$portalbox = CreateObject('phpgwapi.listbox',
Array(
'title' => $title,
'primary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'secondary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'tertiary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'width' => '100%',
'outerborderwidth' => '0',
'header_background_image' => $GLOBALS['phpgw']->common->image('phpgwapi/templates/phpgw_website','bg_filler.gif')
)
);
$app_id = $GLOBALS['phpgw']->applications->name2id('addressbook');
$GLOBALS['portal_order'][] = $app_id;
$var = Array(
'up' => Array('url' => '/set_box.php', 'app' => $app_id),
'down' => Array('url' => '/set_box.php', 'app' => $app_id),
'close' => Array('url' => '/set_box.php', 'app' => $app_id),
'question' => Array('url' => '/set_box.php', 'app' => $app_id),
'edit' => Array('url' => '/set_box.php', 'app' => $app_id)
);
while(list($key,$value) = each($var))
{
$portalbox->set_controls($key,$value);
}
$portalbox->data = Array();
while(list($key,$val) = @each($bdays))
{
$tmp = '<a href="'
. $GLOBALS['phpgw']->link('/addressbook/view.php','ab_id=' . $val['id']) . '">'
. $val['n_given'] . ' ' . $val['n_family'] . '</a>';
echo '<tr><td align="left">' . lang("Today is x's birthday!", $tmp) . '</td></tr>' . "\n";
$portalbox->data[] = array('text'=>lang("Today is x's birthday!", $val['n_given'] . ' ' . $val['n_family']),'link'=>$GLOBALS['phpgw']->link('/addressbook/view.php','ab_id=' . $val['id']));
// $tmp = '<a href="'
// . $GLOBALS['phpgw']->link('/addressbook/view.php','ab_id=' . $val['id']) . '">'
// . $val['n_given'] . ' ' . $val['n_family'] . '</a>';
// echo '<tr><td align="left">' . lang("Today is x's birthday!", $tmp) . '</td></tr>' . "\n";
}
$tomorrow = $GLOBALS['phpgw']->common->show_date($now + 86400,'n/d/');
@ -49,11 +81,17 @@
while(list($key,$val) = @each($bdays))
{
$tmp = '<a href="'
. $GLOBALS['phpgw']->link('/addressbook/view.php','ab_id=' . $val['id']) . '">'
. $val['n_given'] . ' ' . $val["n_family"] . '</a>';
echo '<tr><td align="left">' . lang("Tomorrow is x's birthday.", $tmp) . '</td></tr>' . "\n";
$portalbox->data[] = array('text'=>lang("Tommorow is x's birthday!",$val['n_given'].' '.$val['n_family']),'link'=>$GLOBALS['phpgw']->link('/addressbook/view.php','ab_id='.$val['id']));
// $tmp = '<a href="'
// . $GLOBALS['phpgw']->link('/addressbook/view.php','ab_id=' . $val['id']) . '">'
// . $val['n_given'] . ' ' . $val["n_family"] . '</a>';
// echo '<tr><td align="left">' . lang("Tomorrow is x's birthday.", $tmp) . '</td></tr>' . "\n";
}
// if(count($portalbox->data))
// {
echo $portalbox->draw();
// }
unset($portalbox);
echo "\n<!-- Birthday info -->\n";
}
?>

View File

@ -18,15 +18,14 @@
if($d1 == 'htt' || $d1 == 'ftp' )
{
echo 'Failed attempt to break in via an old Security Hole!<br>'."\n";
$phpgw->common->phpgw_exit();
$GLOBALS['phpgw']->common->phpgw_exit();
}
unset($d1);
if ($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])
{
global $date;
$time = time() - ((60*60) * intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
$date = $GLOBALS['phpgw']->common->show_date($time,'Ymd');
$GLOBALS['date'] = $GLOBALS['phpgw']->common->show_date($time,'Ymd');
$cal = CreateObject('calendar.uicalendar');
$extra_data = "\n".'<td>'."\n".'<table border="0" cols="3"><tr><td align="center" width="35%" valign="top">'
. $cal->mini_calendar(
@ -55,19 +54,20 @@
'primary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'secondary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'tertiary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'width' => '90%',
'width' => '100%',
'outerborderwidth' => '0',
'header_background_image' => $GLOBALS['phpgw']->common->image('phpgwapi/templates/phpgw_website','bg_filler.gif')
)
);
$app_id = $GLOBALS['phpgw']->applications->name2id('calendar');
$GLOBALS['portal_order'][] = $app_id;
$var = Array(
'up' => Array('url' => '/set_box.php', 'app' => $app_id, 'order' => $GLOBALS['order_seq']),
'down' => Array('url' => '/set_box.php', 'app' => $app_id, 'order' => $GLOBALS['order_seq']),
'close' => Array('url' => '/set_box.php', 'app' => $app_id, 'order' => $GLOBALS['order_seq']),
'question' => Array('url' => '/set_box.php', 'app' => $app_id, 'order' => $GLOBALS['order_seq']),
'edit' => Array('url' => '/set_box.php', 'app' => $app_id, 'order' => $GLOBALS['order_seq'])
'up' => Array('url' => '/set_box.php', 'app' => $app_id),
'down' => Array('url' => '/set_box.php', 'app' => $app_id),
'close' => Array('url' => '/set_box.php', 'app' => $app_id),
'question' => Array('url' => '/set_box.php', 'app' => $app_id),
'edit' => Array('url' => '/set_box.php', 'app' => $app_id)
);
while(list($key,$value) = each($var))

View File

@ -199,8 +199,58 @@
<?php
echo '<a href="javascript:opennotifywindow()">' . lang('Open notify window') . '</a>';
}
$GLOBALS['phpgw']->common->hook('home',array('email','calendar','news','addressbook','squirrelmail'));
/* This initializes the users portal_order preference if it does not exist. */
if(!is_array($GLOBALS['phpgw_info']['user']['preferences']['portal_order']))
{
$GLOBALS['phpgw']->preferences->delete('portal_order');
@reset($GLOBALS['phpgw_info']['apps']);
$order = 0;
while (list(,$p) = each($GLOBALS['phpgw_info']['apps']))
{
if($GLOBALS['phpgw_info']['user']['apps'][$p['name']])
{
$GLOBALS['phpgw']->preferences->add('portal_order',$order++,$p['id']);
}
}
$GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->save_repository();
}
if(is_array($GLOBALS['phpgw_info']['user']['preferences']['portal_order']))
{
$app_check = Array();
@ksort($GLOBALS['phpgw_info']['user']['preferences']['portal_order']);
while(list($order,$app) = each($GLOBALS['phpgw_info']['user']['preferences']['portal_order']))
{
if(!isset($app_check[intval($app)]) || !$app_check[intval($app)])
{
$app_check[intval($app)] = True;
$sorted_apps[] = $GLOBALS['phpgw']->applications->id2name(intval($app));
}
}
}
else
{
$sorted_apps = Array(
'email',
'calendar',
'news',
'addressbook',
'squirrelmail'
);
}
@reset($sorted_apps);
$GLOBALS['phpgw']->common->hook('home',$sorted_apps);
$GLOBALS['phpgw']->preferences->delete('portal_order');
@reset($GLOBALS['portal_order']);
while(list($app_order,$app_id) = each($GLOBALS['portal_order']))
{
$GLOBALS['phpgw']->preferences->add('portal_order',$app_order,$app_id);
}
$GLOBALS['phpgw']->preferences->save_repository();
//$phpgw->common->debug_phpgw_info();
//$phpgw->common->debug_list_core_functions();
$GLOBALS['phpgw']->common->phpgw_footer();

View File

@ -78,7 +78,8 @@
'title' => $GLOBALS['phpgw_info']['apps'][$app[0]]['title'],
'name' => $app[0],
'enabled' => True,
'status' => $GLOBALS['phpgw_info']['apps'][$app[0]]['status']
'status' => $GLOBALS['phpgw_info']['apps'][$app[0]]['status'],
'id' => $GLOBALS['phpgw_info']['apps'][$app[0]]['id']
);
}
}
@ -113,7 +114,8 @@
'title' => $GLOBALS['phpgw_info']['apps'][$app[1]]['title'],
'name' => $app[1],
'enabled' => True,
'status' => $GLOBALS['phpgw_info']['apps'][$app[1]]['status']
'status' => $GLOBALS['phpgw_info']['apps'][$app[1]]['status'],
'id' => $GLOBALS['phpgw_info']['apps'][$app[1]]['id']
);
}
}
@ -123,7 +125,8 @@
'title' => $GLOBALS['phpgw_info']['apps'][$apps]['title'],
'name' => $apps,
'enabled' => True,
'status' => $GLOBALS['phpgw_info']['apps'][$apps]['status']
'status' => $GLOBALS['phpgw_info']['apps'][$apps]['status'],
'id' => $GLOBALS['phpgw_info']['apps'][$app[1]]['id']
);
}
reset($this->data);
@ -215,7 +218,8 @@
'title' => $GLOBALS['phpgw_info']['apps'][$app[1]]['title'],
'name' => $app[1],
'enabled' => True,
'status' => $GLOBALS['phpgw_info']['apps'][$app[1]]['status']
'status' => $GLOBALS['phpgw_info']['apps'][$app[1]]['status'],
'id' => $GLOBALS['phpgw_info']['apps'][$app[1]]['id']
);
}
}
@ -238,14 +242,13 @@
{
while ($this->db->next_record())
{
$name = $this->db->f('app_name');
$title = $this->db->f('app_title');
$status = $this->db->f('app_enabled');
$GLOBALS['phpgw_info']['apps'][$name] = Array(
'title' => $title,
'name' => $name,
$GLOBALS['phpgw_info']['apps'][$this->db->f('app_name')] = Array(
'title' => $this->db->f('app_title'),
'name' => $this->db->f('app_name'),
'enabled' => True,
'status' => $status
'status' => $this->db->f('app_enabled'),
'id' => intval($this->db->f('app_id')),
'order' => intval($this->db->f('app_order'))
);
}
}
@ -270,5 +273,31 @@
return False;
}
}
function id2name($id)
{
@reset($GLOBALS['phpgw_info']['apps']);
while (list($appname,$app) = each($GLOBALS['phpgw_info']['apps']))
{
if(intval($app['id']) == intval($id))
{
@reset($GLOBALS['phpgw_info']['apps']);
return $appname;
}
}
@reset($GLOBALS['phpgw_info']['apps']);
return '';
}
function name2id($appname)
{
if(is_array($GLOBALS['phpgw_info']['apps'][$appname]))
{
return $GLOBALS['phpgw_info']['apps'][$appname]['id'];
}
else
{
return 0;
}
}
}
?>

View File

@ -988,6 +988,32 @@
}
return $e_password;
}
/*!
@function find_portal_order
@abstract find the current position of the app is the users portal_order preference
@param $app application id to find current position - required
@discussion No discussion
*/
function find_portal_order($app)
{
if(!is_array($GLOBALS['phpgw_info']['user']['preferences']['portal_order']))
{
return -1;
}
@reset($GLOBALS['phpgw_info']['user']['preferences']['portal_order']);
while(list($seq,$appid) = each($GLOBALS['phpgw_info']['user']['preferences']['portal_order']))
{
if($appid == $app)
{
@reset($GLOBALS['phpgw_info']['user']['preferences']['portal_order']);
return $seq;
}
}
@reset($GLOBALS['phpgw_info']['user']['preferences']['portal_order']);
return -1;
}
/*!
@function hook
@abstract hooking function which allows applications to 'hook' into each other
@ -1003,8 +1029,6 @@
$order[] = $GLOBALS['phpgw_info']['flags']['currentapp'];
}
$GLOBALS['order_seq'] = -1;
/* First include the ordered apps hook file */
reset ($order);
while (list(,$appname) = each($order))
@ -1013,7 +1037,6 @@
if (file_exists($f) &&
( $GLOBALS['phpgw_info']['user']['apps'][$appname] || (($no_permission_check || $appname == 'preferences') && $appname)) )
{
$GLOBALS['order_seq']++;
include($f);
}
@ -1033,7 +1056,6 @@
$f = PHPGW_SERVER_ROOT . '/' . $appname . '/inc/hook_' . $location . '.inc.php';
if (file_exists($f))
{
$GLOBALS['order_seq']++;
include($f);
}
} // if
@ -1050,7 +1072,6 @@
$f = PHPGW_SERVER_ROOT . '/' . $appname . '/inc/hook_' . $location . '.inc.php';
if (file_exists($f))
{
$GLOBALS['order_seq']++;
include($f);
}
} // if

View File

@ -42,6 +42,8 @@
var $close;
var $question;
var $edit;
var $data = Array();
// Textual variables
var $title;
@ -129,8 +131,12 @@
}
}
function set_internal($data)
function set_internal($data='')
{
if($data=='' && !count($this->data))
{
$data = '<td>&nbsp;</td>';
}
$this->p->set_var('output',$data);
$this->p->parse('row','portal_row',true);
}
@ -157,7 +163,7 @@
{
$image_width = 30;
}
$this->p->set_var('link_field_data','<a href="'.$this->$param.'"><img src="'.$GLOBALS['phpgw']->common->image('phpgwapi',$param.'.button.gif').'" border="0" width="'.$image_width.'" height="15" alt="'.$param.'"></a>');
$this->p->set_var('link_field_data','<a href="'.$this->$param.'"><img src="'.$GLOBALS['phpgw']->common->image('phpgwapi',$param.'.button.gif').'" border="0" width="'.$image_width.'" height="15" alt="'.lang($param).'"></a>');
$this->p->parse('control_link','link_field',True);
}
}

View File

@ -146,9 +146,10 @@
*/
function delete($app_name, $var = '')
{
if ($var == '')
if (is_string($var) && $var == '')
{
$this->data[$app_name] = array();
// $this->data[$app_name] = array();
unset($this->data[$app_name]);
}
else
{

View File

@ -1,11 +1,11 @@
<!-- BEGIN portal_box -->
<p>
<table border="{outer_border}" cellpadding="0" cellspacing="0" width="{outer_width}" bordercolor="{outer_bordercolor}" bgcolor="{outer_bgcolor}">
<tr nowrap>
<tr nowrap align="center">
<td align="center" background="{header_background_image}">{title}</td>{portal_controls}
</tr>
<tr>
<td>
<td colspan="2">
<table border="1" cellpadding="0" cellspacing="0" width="{inner_width}" bgcolor="{inner_bgcolor}">
{row}
</table>