aboutsummaryrefslogtreecommitdiffstats
path: root/include/widgets.php
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2015-09-29 08:01:51 +0200
committermrjive <mrjive@mrjive.it>2015-09-29 08:01:51 +0200
commit11c1573b55f278a664a90a2872d06a40b3ac3026 (patch)
tree4061879d490fec39ab01d3feeb575b86586fb7f8 /include/widgets.php
parent006ca4421a7027ccee4612beb99a1f9976146070 (diff)
parentb3525b865784ff5d2d5a76b913b8c86d139cc0f3 (diff)
downloadvolse-hubzilla-11c1573b55f278a664a90a2872d06a40b3ac3026.tar.gz
volse-hubzilla-11c1573b55f278a664a90a2872d06a40b3ac3026.tar.bz2
volse-hubzilla-11c1573b55f278a664a90a2872d06a40b3ac3026.zip
Merge pull request #5 from redmatrix/master
updating from original codebase
Diffstat (limited to 'include/widgets.php')
-rw-r--r--include/widgets.php99
1 files changed, 95 insertions, 4 deletions
diff --git a/include/widgets.php b/include/widgets.php
index 5e40bf54a..9c8596a66 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,80 @@ 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(
+ 'mailbox' => $mailbox,
+ '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'],
+ 'selected' => ((argv(2)) ? (argv(2) == $rr['id']) : ($r[0]['id'] == $rr['id']))
+ );
+ }
+
+ $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 +684,7 @@ function widget_design_tools($arr) {
return design_tools();
}
+
function widget_findpeople($arr) {
return findpeople_widget();
}
@@ -1135,4 +1226,4 @@ function widget_admin($arr) {
return $o;
-} \ No newline at end of file
+}