quickfix for private messages - needs a lot more work

This commit is contained in:
Mario Vavti 2015-09-17 19:25:13 +02:00
parent 6cd5826d21
commit 1cf404177d
5 changed files with 56 additions and 48 deletions

View File

@ -125,8 +125,7 @@ function mail_content(&$a) {
$tpl = get_markup_template('mail_head.tpl'); $tpl = get_markup_template('mail_head.tpl');
$header = replace_macros($tpl, array( $header = replace_macros($tpl, array(
'$messages' => t('Messages'), '$header' => t('Messages'),
'$tab_content' => $tab_content
)); ));
if((argc() == 3) && (argv(1) === 'drop')) { if((argc() == 3) && (argv(1) === 'drop')) {
@ -160,8 +159,6 @@ function mail_content(&$a) {
if((argc() > 1) && (argv(1) === 'new')) { if((argc() > 1) && (argv(1) === 'new')) {
$o .= $header;
$plaintext = true; $plaintext = true;
$tpl = get_markup_template('msg-header.tpl'); $tpl = get_markup_template('msg-header.tpl');

View File

@ -25,11 +25,7 @@ function message_content(&$a) {
$cipher = 'aes256'; $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((argc() == 3) && (argv(1) === 'dropconv')) {
if(! intval(argv(2))) if(! intval(argv(2)))
@ -42,9 +38,6 @@ function message_content(&$a) {
} }
if(argc() == 1) { if(argc() == 1) {
// list messages
$o .= $header;
// private_messages_list() can do other more complicated stuff, for now keep it simple // private_messages_list() can do other more complicated stuff, for now keep it simple
@ -55,24 +48,33 @@ function message_content(&$a) {
return $o; return $o;
} }
$tpl = get_markup_template('mail_list.tpl'); $messages = array();
foreach($r as $rr) {
$o .= replace_macros($tpl, array( foreach($r as $rr) {
'$id' => $rr['id'], $messages[] = array(
'$from_name' => $rr['from']['xchan_name'], 'id' => $rr['id'],
'$from_url' => chanlink_hash($rr['from_xchan']), 'from_name' => $rr['from']['xchan_name'],
'$from_photo' => $rr['from']['xchan_photo_s'], 'from_url' => chanlink_hash($rr['from_xchan']),
'$to_name' => $rr['to']['xchan_name'], 'from_photo' => $rr['from']['xchan_photo_s'],
'$to_url' => chanlink_hash($rr['to_xchan']), 'to_name' => $rr['to']['xchan_name'],
'$to_photo' => $rr['to']['xchan_photo_s'], 'to_url' => chanlink_hash($rr['to_xchan']),
'$subject' => (($rr['seen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>'), 'to_photo' => $rr['to']['xchan_photo_s'],
'$delete' => t('Delete conversation'), 'subject' => (($rr['seen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>'),
'$body' => smilies(bbcode($rr['body'])), 'delete' => t('Delete conversation'),
'$date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], t('D, d M Y - g:i A')), 'body' => smilies(bbcode($rr['body'])),
'$seen' => $rr['seen'] '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)); $o .= alt_pager($a,count($r));
return $o; return $o;
} }

View File

@ -1,12 +1,16 @@
<h3>{{$prvmsg_header}}</h3>
<div class="generic-content-wrapper"> <div class="generic-content-wrapper">
{{foreach $mails as $mail}} <div class="section-title-wrapper">
<h2>{{$prvmsg_header}}</h2>
</div>
<div class="section-content-wrapper">
{{foreach $mails as $mail}}
{{include file="mail_conv.tpl"}} {{include file="mail_conv.tpl"}}
{{/foreach}} {{/foreach}}
{{if $canreply}} {{if $canreply}}
{{include file="prv_message.tpl"}} {{include file="prv_message.tpl"}}
{{else}} {{else}}
{{$unknown_text}} {{$unknown_text}}
{{/if}} {{/if}}
</div>
</div> </div>

View File

@ -1,3 +1,10 @@
<h3>{{$messages}}</h3> <div class="generic-content-wrapper">
<div class="section-title-wrapper">
{{$tab_content}} <h2>{{$header}}</h2>
</div>
<div class="section-content-wrapper">
{{foreach $messages as $message}}
{{include file="mail_list.tpl"}}
{{/foreach}}
</div>
</div>

View File

@ -1,8 +1,6 @@
<div class="generic-content-wrapper" id="mail-list-wrapper"> <a href="{{$message.from_url}}" class ="mail-list" ><img class="mail-list-sender-photo" src="{{$message.from_photo}}" alt="{{$message.from_name}}" /></a>
<a href="{{$from_url}}" class ="mail-list" ><img class="mail-list-sender-photo" src="{{$from_photo}}" alt="{{$from_name}}" /></a> <span class="mail-list">{{$message.from_name}}</span>
<span class="mail-list">{{$from_name}}</span> <span class="mail-list {{if $message.seen}}seen{{else}}unseen{{/if}}"><a href="mail/{{$message.id}}" class="mail-link">{{$message.subject}}</a></span>
<span class="mail-list {{if $seen}}seen{{else}}unseen{{/if}}"><a href="mail/{{$id}}" class="mail-link">{{$subject}}</a></span> <span class="mail-list" title="{{$message.date}}">{{$message.date}}</span>
<span class="mail-list" title="{{$date}}">{{$date}}</span> <span class="mail-list mail-list-remove" class="btn btn-default btn-sm"><a href="message/dropconv/{{$id}}" onclick="return confirmDelete();" title="{{$message.delete}}" class="btn btn-default btn-sm" ><i class="icon-trash mail-icons drop-icons"></i></a></span>
<span class="mail-list mail-list-remove" class="btn btn-default btn-sm"><a href="message/dropconv/{{$id}}" onclick="return confirmDelete();" title="{{$delete}}" class="btn btn-default btn-sm" ><i class="icon-trash mail-icons drop-icons"></i></a></span> <div class="clear"></div>
<div class="clear">&nbsp;</div>
</div>