From 1cf404177dc3824096e724308f4e26716b6e2c8d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 17 Sep 2015 19:25:13 +0200 Subject: quickfix for private messages - needs a lot more work --- mod/mail.php | 5 +---- mod/message.php | 50 ++++++++++++++++++++++++----------------------- view/tpl/mail_display.tpl | 22 ++++++++++++--------- view/tpl/mail_head.tpl | 13 +++++++++--- view/tpl/mail_list.tpl | 14 ++++++------- 5 files changed, 56 insertions(+), 48 deletions(-) diff --git a/mod/mail.php b/mod/mail.php index 152db3231..80d7f477d 100644 --- a/mod/mail.php +++ b/mod/mail.php @@ -125,8 +125,7 @@ function mail_content(&$a) { $tpl = get_markup_template('mail_head.tpl'); $header = replace_macros($tpl, array( - '$messages' => t('Messages'), - '$tab_content' => $tab_content + '$header' => t('Messages'), )); if((argc() == 3) && (argv(1) === 'drop')) { @@ -160,8 +159,6 @@ function mail_content(&$a) { if((argc() > 1) && (argv(1) === 'new')) { - $o .= $header; - $plaintext = true; $tpl = get_markup_template('msg-header.tpl'); diff --git a/mod/message.php b/mod/message.php index 9cf4b6987..9f62f6b61 100644 --- a/mod/message.php +++ b/mod/message.php @@ -25,11 +25,7 @@ function message_content(&$a) { $cipher = 'aes256'; - $tpl = get_markup_template('mail_head.tpl'); - $header = replace_macros($tpl, array( - '$messages' => t('Messages'), - '$tab_content' => $tab_content - )); + if((argc() == 3) && (argv(1) === 'dropconv')) { if(! intval(argv(2))) @@ -42,9 +38,6 @@ function message_content(&$a) { } if(argc() == 1) { - // list messages - - $o .= $header; // private_messages_list() can do other more complicated stuff, for now keep it simple @@ -55,24 +48,33 @@ function message_content(&$a) { return $o; } - $tpl = get_markup_template('mail_list.tpl'); + $messages = array(); + foreach($r as $rr) { - - $o .= replace_macros($tpl, 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'] : '' . $rr['title'] . ''), - '$delete' => t('Delete conversation'), - '$body' => smilies(bbcode($rr['body'])), - '$date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], t('D, d M Y - g:i A')), - '$seen' => $rr['seen'] - )); + $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'] : '' . $rr['title'] . ''), + 'delete' => t('Delete conversation'), + 'body' => smilies(bbcode($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' => t('Messages'), + '$messages' => $messages + )); + + $o .= alt_pager($a,count($r)); return $o; } diff --git a/view/tpl/mail_display.tpl b/view/tpl/mail_display.tpl index 523a9160a..062710f1d 100755 --- a/view/tpl/mail_display.tpl +++ b/view/tpl/mail_display.tpl @@ -1,12 +1,16 @@ -

{{$prvmsg_header}}

-{{foreach $mails as $mail}} - {{include file="mail_conv.tpl"}} -{{/foreach}} +
+

{{$prvmsg_header}}

+
+
+ {{foreach $mails as $mail}} + {{include file="mail_conv.tpl"}} + {{/foreach}} -{{if $canreply}} -{{include file="prv_message.tpl"}} -{{else}} -{{$unknown_text}} -{{/if}} + {{if $canreply}} + {{include file="prv_message.tpl"}} + {{else}} + {{$unknown_text}} + {{/if}} +
diff --git a/view/tpl/mail_head.tpl b/view/tpl/mail_head.tpl index 1cd7145e7..7bc854fff 100755 --- a/view/tpl/mail_head.tpl +++ b/view/tpl/mail_head.tpl @@ -1,3 +1,10 @@ -

{{$messages}}

- -{{$tab_content}} +
+
+

{{$header}}

+
+
+ {{foreach $messages as $message}} + {{include file="mail_list.tpl"}} + {{/foreach}} +
+
diff --git a/view/tpl/mail_list.tpl b/view/tpl/mail_list.tpl index 1d499e12f..e75fae15c 100755 --- a/view/tpl/mail_list.tpl +++ b/view/tpl/mail_list.tpl @@ -1,8 +1,6 @@ -
- {{$from_name}} - {{$from_name}} - {{$subject}} - {{$date}} - -
 
-
+{{$message.from_name}} +{{$message.from_name}} +{{$message.subject}} +{{$message.date}} + +
-- cgit v1.2.3