aboutsummaryrefslogtreecommitdiffstats
path: root/include/widgets.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-09-24 16:58:32 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-09-24 16:58:32 -0700
commit2fe3d16bbed892b2c1287ba876ae54ff502edbad (patch)
tree2732d7fd9e57760665815c770a9bf5e4d4812726 /include/widgets.php
parent2844f276b9af6154e36706b7fe53438352493d58 (diff)
parentc42dcd5ac9c63cd42c7af1b2765dd33e7e9f5d6d (diff)
downloadvolse-hubzilla-2fe3d16bbed892b2c1287ba876ae54ff502edbad.tar.gz
volse-hubzilla-2fe3d16bbed892b2c1287ba876ae54ff502edbad.tar.bz2
volse-hubzilla-2fe3d16bbed892b2c1287ba876ae54ff502edbad.zip
Merge https://github.com/redmatrix/hubzilla into pending_merge
Diffstat (limited to 'include/widgets.php')
-rw-r--r--include/widgets.php97
1 files changed, 93 insertions, 4 deletions
diff --git a/include/widgets.php b/include/widgets.php
index 5e40bf54a..9f8b88d54 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -562,14 +562,30 @@ function widget_mailmenu($arr) {
return;
$a = get_app();
+
return replace_macros(get_markup_template('message_side.tpl'), array(
- '$title' => t('Messages'),
- '$tabs'=> array(),
+ '$title' => t('Private Mail Menu'),
'$check'=>array(
'label' => t('Check Mail'),
- 'url' => $a->get_baseurl(true) . '/message',
+ 'url' => $a->get_baseurl(true) . '/mail/combined',
'sel' => (argv(1) == ''),
),
+
+ '$combined'=>array(
+ 'label' => t('Combined View'),
+ 'url' => $a->get_baseurl(true) . '/mail/combined',
+ 'sel' => (argv(1) == 'combined'),
+ ),
+ '$inbox'=>array(
+ 'label' => t('Inbox'),
+ 'url' => $a->get_baseurl(true) . '/mail/inbox',
+ 'sel' => (argv(1) == 'inbox'),
+ ),
+ '$outbox'=>array(
+ 'label' => t('Outbox'),
+ 'url' => $a->get_baseurl(true) . '/mail/outbox',
+ 'sel' => (argv(1) == 'outbox'),
+ ),
'$new'=>array(
'label' => t('New Message'),
'url' => $a->get_baseurl(true) . '/mail/new',
@@ -578,6 +594,78 @@ function widget_mailmenu($arr) {
));
}
+
+function widget_conversations($arr) {
+ if (! local_channel())
+ return;
+
+ $a = get_app();
+
+ if(argc() > 1) {
+
+ switch(argv(1)) {
+ case 'combined':
+ $mailbox = 'combined';
+ $header = t('Conversations');
+ break;
+ case 'inbox':
+ $mailbox = 'inbox';
+ $header = t('Received Messages');
+ break;
+ case 'outbox':
+ $mailbox = 'outbox';
+ $header = t('Sent Messages');
+ break;
+ default:
+ $mailbox = 'combined';
+ $header = t('Conversations');
+ break;
+ }
+
+ require_once('include/message.php');
+
+ // private_messages_list() can do other more complicated stuff, for now keep it simple
+ $r = private_messages_list(local_channel(), $mailbox, $a->pager['start'], $a->pager['itemspage']);
+
+ if(! $r) {
+ info( t('No messages.') . EOL);
+ return $o;
+ }
+
+ $messages = array();
+
+ foreach($r as $rr) {
+
+ $messages[] = array(
+ 'id' => $rr['id'],
+ 'from_name' => $rr['from']['xchan_name'],
+ 'from_url' => chanlink_hash($rr['from_xchan']),
+ 'from_photo' => $rr['from']['xchan_photo_s'],
+ 'to_name' => $rr['to']['xchan_name'],
+ 'to_url' => chanlink_hash($rr['to_xchan']),
+ 'to_photo' => $rr['to']['xchan_photo_s'],
+ 'subject' => (($rr['seen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>'),
+ 'delete' => t('Delete conversation'),
+ 'body' => $rr['body'],
+ 'date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], t('D, d M Y - g:i A')),
+ 'seen' => $rr['seen']
+ );
+ }
+
+ $tpl = get_markup_template('mail_head.tpl');
+ $o .= replace_macros($tpl, array(
+ '$header' => $header,
+ '$messages' => $messages
+ ));
+
+ $o .= alt_pager($a,count($r));
+
+ }
+
+ return $o;
+}
+
+
function widget_design_tools($arr) {
$a = get_app();
@@ -594,6 +682,7 @@ function widget_design_tools($arr) {
return design_tools();
}
+
function widget_findpeople($arr) {
return findpeople_widget();
}
@@ -1135,4 +1224,4 @@ function widget_admin($arr) {
return $o;
-} \ No newline at end of file
+}