diff --git a/addressbook/inc/hook_home.inc.php b/addressbook/inc/hook_home.inc.php
index a1dddee497..22973869cd 100644
--- a/addressbook/inc/hook_home.inc.php
+++ b/addressbook/inc/hook_home.inc.php
@@ -35,12 +35,44 @@
$bdays = $c->read(0,15,$qfields,$today,'tid=n','','',$GLOBALS['phpgw_info']['user']['account_id']);
+ $title = '
'.lang('Birthdays').'';
+
+ $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 = ''
- . $val['n_given'] . ' ' . $val['n_family'] . '';
- echo '' . lang("Today is x's birthday!", $tmp) . ' |
' . "\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 = ''
+// . $val['n_given'] . ' ' . $val['n_family'] . '';
+// echo '' . lang("Today is x's birthday!", $tmp) . ' |
' . "\n";
}
$tomorrow = $GLOBALS['phpgw']->common->show_date($now + 86400,'n/d/');
@@ -49,11 +81,17 @@
while(list($key,$val) = @each($bdays))
{
- $tmp = ''
- . $val['n_given'] . ' ' . $val["n_family"] . '';
- echo '' . lang("Tomorrow is x's birthday.", $tmp) . ' |
' . "\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 = ''
+// . $val['n_given'] . ' ' . $val["n_family"] . '';
+// echo '' . lang("Tomorrow is x's birthday.", $tmp) . ' |
' . "\n";
}
+// if(count($portalbox->data))
+// {
+ echo $portalbox->draw();
+// }
+ unset($portalbox);
echo "\n\n";
}
?>
diff --git a/calendar/inc/hook_home.inc.php b/calendar/inc/hook_home.inc.php
index 534fe6f29d..6dd3870ae3 100755
--- a/calendar/inc/hook_home.inc.php
+++ b/calendar/inc/hook_home.inc.php
@@ -18,15 +18,14 @@
if($d1 == 'htt' || $d1 == 'ftp' )
{
echo 'Failed attempt to break in via an old Security Hole!
'."\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".''."\n".''
. $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))
diff --git a/home.php b/home.php
index ef22cb6d3a..eb65e369f9 100755
--- a/home.php
+++ b/home.php
@@ -199,8 +199,58 @@
' . lang('Open notify window') . '';
}
- $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();
diff --git a/phpgwapi/inc/class.applications.inc.php b/phpgwapi/inc/class.applications.inc.php
index 9e365428f7..84257c09e6 100755
--- a/phpgwapi/inc/class.applications.inc.php
+++ b/phpgwapi/inc/class.applications.inc.php
@@ -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;
+ }
+ }
}
?>
diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php
index 425be2385e..ee88f2f5fa 100644
--- a/phpgwapi/inc/class.common.inc.php
+++ b/phpgwapi/inc/class.common.inc.php
@@ -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
diff --git a/phpgwapi/inc/class.portalbox.inc.php b/phpgwapi/inc/class.portalbox.inc.php
index 7f94b4eeb3..b5fae989c9 100755
--- a/phpgwapi/inc/class.portalbox.inc.php
+++ b/phpgwapi/inc/class.portalbox.inc.php
@@ -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 = ' | | ';
+ }
$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','');
+ $this->p->set_var('link_field_data','');
$this->p->parse('control_link','link_field',True);
}
}
diff --git a/phpgwapi/inc/class.preferences.inc.php b/phpgwapi/inc/class.preferences.inc.php
index 755e409e2c..88fb1d57f2 100644
--- a/phpgwapi/inc/class.preferences.inc.php
+++ b/phpgwapi/inc/class.preferences.inc.php
@@ -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
{
diff --git a/phpgwapi/templates/default/portal.tpl b/phpgwapi/templates/default/portal.tpl
index 12fffe3e3f..0422316e9d 100755
--- a/phpgwapi/templates/default/portal.tpl
+++ b/phpgwapi/templates/default/portal.tpl
@@ -1,11 +1,11 @@
-
+
{title} | {portal_controls}
-
+ |
|
|