private mail: bring additional inbox/outbox views and ajaxify single message drop
This commit is contained in:
parent
ed876a9c52
commit
b97102da01
@ -637,6 +637,7 @@ function widget_conversations($arr) {
|
|||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
|
|
||||||
$messages[] = array(
|
$messages[] = array(
|
||||||
|
'mailbox' => $mailbox,
|
||||||
'id' => $rr['id'],
|
'id' => $rr['id'],
|
||||||
'from_name' => $rr['from']['xchan_name'],
|
'from_name' => $rr['from']['xchan_name'],
|
||||||
'from_url' => chanlink_hash($rr['from_xchan']),
|
'from_url' => chanlink_hash($rr['from_xchan']),
|
||||||
@ -648,7 +649,8 @@ function widget_conversations($arr) {
|
|||||||
'delete' => t('Delete conversation'),
|
'delete' => t('Delete conversation'),
|
||||||
'body' => $rr['body'],
|
'body' => $rr['body'],
|
||||||
'date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], t('D, d M Y - g:i A')),
|
'date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], t('D, d M Y - g:i A')),
|
||||||
'seen' => $rr['seen']
|
'seen' => $rr['seen'],
|
||||||
|
'selected' => ((argv(2)) ? (argv(2) == $rr['id']) : ($r[0]['id'] == $rr['id']))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
44
mod/mail.php
44
mod/mail.php
@ -128,35 +128,47 @@ function mail_content(&$a) {
|
|||||||
'$header' => t('Messages'),
|
'$header' => t('Messages'),
|
||||||
));
|
));
|
||||||
|
|
||||||
if((argc() == 3) && (argv(1) === 'drop')) {
|
if((argc() == 4) && (argv(2) === 'drop')) {
|
||||||
if(! intval(argv(2)))
|
if(! intval(argv(3)))
|
||||||
return;
|
return;
|
||||||
$cmd = argv(1);
|
$cmd = argv(2);
|
||||||
|
$mailbox = argv(1);
|
||||||
$r = private_messages_drop(local_channel(), argv(2));
|
$r = private_messages_drop(local_channel(), argv(3));
|
||||||
if($r) {
|
if($r) {
|
||||||
info( t('Message deleted.') . EOL );
|
//info( t('Message deleted.') . EOL );
|
||||||
}
|
}
|
||||||
goaway($a->get_baseurl(true) . '/mail/combined' );
|
goaway($a->get_baseurl(true) . '/mail/' . $mailbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((argc() == 3) && (argv(1) === 'recall')) {
|
if((argc() == 4) && (argv(2) === 'recall')) {
|
||||||
if(! intval(argv(2)))
|
if(! intval(argv(3)))
|
||||||
return;
|
return;
|
||||||
$cmd = argv(1);
|
$cmd = argv(2);
|
||||||
|
$mailbox = argv(1);
|
||||||
$r = q("update mail set mail_recalled = 1 where id = %d and channel_id = %d",
|
$r = q("update mail set mail_recalled = 1 where id = %d and channel_id = %d",
|
||||||
intval(argv(2)),
|
intval(argv(3)),
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
proc_run('php','include/notifier.php','mail',intval(argv(2)));
|
proc_run('php','include/notifier.php','mail',intval(argv(3)));
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
info( t('Message recalled.') . EOL );
|
info( t('Message recalled.') . EOL );
|
||||||
}
|
}
|
||||||
goaway($a->get_baseurl(true) . '/mail/combined' );
|
goaway($a->get_baseurl(true) . '/mail/' . $mailbox . '/' . argv(3));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((argc() == 4) && (argv(2) === 'dropconv')) {
|
||||||
|
if(! intval(argv(3)))
|
||||||
|
return;
|
||||||
|
$cmd = argv(2);
|
||||||
|
$mailbox = argv(1);
|
||||||
|
$r = private_messages_drop(local_channel(), argv(3), true);
|
||||||
|
if($r)
|
||||||
|
info( t('Conversation removed.') . EOL );
|
||||||
|
goaway($a->get_baseurl(true) . '/mail/' . $mailbox);
|
||||||
|
}
|
||||||
|
|
||||||
if((argc() > 1) && (argv(1) === 'new')) {
|
if((argc() > 1) && (argv(1) === 'new')) {
|
||||||
|
|
||||||
$plaintext = true;
|
$plaintext = true;
|
||||||
@ -266,7 +278,7 @@ function mail_content(&$a) {
|
|||||||
|
|
||||||
$last_message = private_messages_list(local_channel(), $mailbox, 0, 1);
|
$last_message = private_messages_list(local_channel(), $mailbox, 0, 1);
|
||||||
|
|
||||||
$mid = ((argc() > 1) && (intval(argv(1)))) ? argv(1) : $last_message[0]['id'];
|
$mid = ((argc() > 2) && (intval(argv(2)))) ? argv(2) : $last_message[0]['id'];
|
||||||
|
|
||||||
$plaintext = true;
|
$plaintext = true;
|
||||||
|
|
||||||
@ -310,6 +322,7 @@ function mail_content(&$a) {
|
|||||||
$s = theme_attachments($message);
|
$s = theme_attachments($message);
|
||||||
|
|
||||||
$mails[] = array(
|
$mails[] = array(
|
||||||
|
'mailbox' => $mailbox,
|
||||||
'id' => $message['id'],
|
'id' => $message['id'],
|
||||||
'from_name' => $message['from']['xchan_name'],
|
'from_name' => $message['from']['xchan_name'],
|
||||||
'from_url' => chanlink_hash($message['from_xchan']),
|
'from_url' => chanlink_hash($message['from_xchan']),
|
||||||
@ -338,7 +351,8 @@ function mail_content(&$a) {
|
|||||||
$parent = '<input type="hidden" name="replyto" value="' . $message['parent_mid'] . '" />';
|
$parent = '<input type="hidden" name="replyto" value="' . $message['parent_mid'] . '" />';
|
||||||
$tpl = get_markup_template('mail_display.tpl');
|
$tpl = get_markup_template('mail_display.tpl');
|
||||||
$o = replace_macros($tpl, array(
|
$o = replace_macros($tpl, array(
|
||||||
'$prvmsg_header' => t('Subject:') . ' ' . $message['title'],
|
'$mailbox' => $mailbox,
|
||||||
|
'$prvmsg_header' => $message['title'],
|
||||||
'$thread_id' => $mid,
|
'$thread_id' => $mid,
|
||||||
'$thread_subject' => $message['title'],
|
'$thread_subject' => $message['title'],
|
||||||
'$thread_seen' => $seen,
|
'$thread_seen' => $seen,
|
||||||
|
@ -24,7 +24,7 @@ function message_content(&$a) {
|
|||||||
if(! $cipher)
|
if(! $cipher)
|
||||||
$cipher = 'aes256';
|
$cipher = 'aes256';
|
||||||
|
|
||||||
|
/*
|
||||||
if((argc() == 3) && (argv(1) === 'dropconv')) {
|
if((argc() == 3) && (argv(1) === 'dropconv')) {
|
||||||
if(! intval(argv(2)))
|
if(! intval(argv(2)))
|
||||||
return;
|
return;
|
||||||
@ -34,7 +34,7 @@ function message_content(&$a) {
|
|||||||
info( t('Conversation removed.') . EOL );
|
info( t('Conversation removed.') . EOL );
|
||||||
goaway($a->get_baseurl(true) . '/mail/combined' );
|
goaway($a->get_baseurl(true) . '/mail/combined' );
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if(argc() == 2) {
|
if(argc() == 2) {
|
||||||
|
|
||||||
switch(argv(1)) {
|
switch(argv(1)) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="mail-conv-outside-wrapper">
|
<div id="mail-{{$mail.id}}" class="mail-conv-outside-wrapper">
|
||||||
<div class="mail-conv-sender" >
|
<div class="mail-conv-sender" >
|
||||||
<a href="{{$mail.from_url}}"><img class="mail-conv-sender-photo" src="{{$mail.from_photo}}" alt="{{$mail.from_name}}" /></a>
|
<a href="{{$mail.from_url}}"><img class="mail-conv-sender-photo" src="{{$mail.from_photo}}" alt="{{$mail.from_name}}" /></a>
|
||||||
</div>
|
</div>
|
||||||
@ -9,9 +9,9 @@
|
|||||||
<div class="mail-conv-body">{{$mail.body}}</div>
|
<div class="mail-conv-body">{{$mail.body}}</div>
|
||||||
<div class="btn-group pull-right" id="mail-conv-delete-wrapper-{{$mail.id}}" >
|
<div class="btn-group pull-right" id="mail-conv-delete-wrapper-{{$mail.id}}" >
|
||||||
{{if $mail.can_recall}}
|
{{if $mail.can_recall}}
|
||||||
<a href="mail/recall/{{$mail.id}}" title="{{$mail.recall}}" id="mail-conv-recall-icon-{{$mail.id}}" class="btn btn-default" ><i class="icon-undo mail-icons"></i></a>
|
<a href="mail/{{$mail.mailbox}}/recall/{{$mail.id}}" title="{{$mail.recall}}" id="mail-conv-recall-icon-{{$mail.id}}" class="btn btn-default" ><i class="icon-undo mail-icons"></i></a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<a href="mail/drop/{{$mail.id}}" onclick="return confirmDelete();" title="{{$mail.delete}}" id="mail-conv-delete-icon-{{$mail.id}}" class="btn btn-default" ><i class="icon-trash mail-icons"></i></a>
|
<a href="#" onclick="dropItem('mail/{{$mail.mailbox}}/drop/{{$mail.id}}', '#mail-{{$mail.id}}'); return false;" title="{{$mail.delete}}" id="mail-conv-delete-icon-{{$mail.id}}" class="btn btn-default" ><i class="icon-trash mail-icons"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="generic-content-wrapper">
|
<div class="generic-content-wrapper">
|
||||||
<div class="section-title-wrapper">
|
<div class="section-title-wrapper">
|
||||||
<a class="btn btn-xs btn-danger pull-right" href="message/dropconv/{{$thread_id}}" onclick="return confirmDelete();"><i class="icon-trash"></i> {{$delete}}</a>
|
<a class="btn btn-xs btn-danger pull-right" href="mail/{{$mailbox}}/dropconv/{{$thread_id}}" onclick="return confirmDelete();"><i class="icon-trash"></i> {{$delete}}</a>
|
||||||
<h2>{{$prvmsg_header}}</h2>
|
<h2>{{$prvmsg_header}}</h2>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="mail/{{$message.id}}" class="mail-link">
|
<a href="mail/{{$message.mailbox}}/{{$message.id}}" class="{{if $message.selected}}active{{/if}}">
|
||||||
<span class="{{if $message.seen}}seen{{else}}unseen{{/if}}">{{$message.subject}}</span><br>
|
<span class="{{if $message.seen}}seen{{else}}unseen{{/if}}">{{$message.subject}}</span><br>
|
||||||
<span class="conv-participants">{{$message.from_name}} > {{$message.to_name}}</span><br>
|
<span class="conv-participants">{{$message.from_name}} > {{$message.to_name}}</span><br>
|
||||||
<span class="wall-item-ago autotime" title="{{$message.date}}">{{$message.date}}</span>
|
<span class="wall-item-ago autotime" title="{{$message.date}}">{{$message.date}}</span>
|
||||||
|
@ -2,18 +2,9 @@
|
|||||||
<h3>{{$title}}</h3>
|
<h3>{{$title}}</h3>
|
||||||
<ul class="nav nav-pills nav-stacked">
|
<ul class="nav nav-pills nav-stacked">
|
||||||
<li><a href="{{$check.url}}"{{if $check.sel}} class="active"{{/if}}>{{$check.label}}</a></li>
|
<li><a href="{{$check.url}}"{{if $check.sel}} class="active"{{/if}}>{{$check.label}}</a></li>
|
||||||
{{*
|
|
||||||
<li><a href="{{$combined.url}}"{{if $combined.sel}} class="active"{{/if}}>{{$combined.label}}</a></li>
|
<li><a href="{{$combined.url}}"{{if $combined.sel}} class="active"{{/if}}>{{$combined.label}}</a></li>
|
||||||
<li><a href="{{$inbox.url}}"{{if $inbox.sel}} class="active"{{/if}}>{{$inbox.label}}</a></li>
|
<li><a href="{{$inbox.url}}"{{if $inbox.sel}} class="active"{{/if}}>{{$inbox.label}}</a></li>
|
||||||
<li><a href="{{$outbox.url}}"{{if $outbox.sel}} class="active"{{/if}}>{{$outbox.label}}</a></li>
|
<li><a href="{{$outbox.url}}"{{if $outbox.sel}} class="active"{{/if}}>{{$outbox.label}}</a></li>
|
||||||
*}}
|
|
||||||
<li><a href="{{$new.url}}"{{if $new.sel}} class="active"{{/if}}>{{$new.label}}</a></li>
|
<li><a href="{{$new.url}}"{{if $new.sel}} class="active"{{/if}}>{{$new.label}}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{if $tabs}}
|
|
||||||
<ul class="nav nav-pills nav-stacked">
|
|
||||||
{{foreach $tabs as $t}}
|
|
||||||
<li><a href="{{$t.url}}"{{if $t.sel}} class="active"{{/if}}>{{$t.label}}</a></li>
|
|
||||||
{{/foreach}}
|
|
||||||
</ul>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user