aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Dreport.php52
-rw-r--r--view/tpl/dreport.tpl21
2 files changed, 64 insertions, 9 deletions
diff --git a/Zotlabs/Module/Dreport.php b/Zotlabs/Module/Dreport.php
index e8709c952..904646d5d 100644
--- a/Zotlabs/Module/Dreport.php
+++ b/Zotlabs/Module/Dreport.php
@@ -16,7 +16,24 @@ class Dreport extends \Zotlabs\Web\Controller {
$channel = \App::get_channel();
$mid = ((argc() > 1) ? argv(1) : '');
-
+
+ if($mid === 'push') {
+ $table = 'push';
+ $mid = ((argc() > 2) ? argv(2) : '');
+ if($mid) {
+ $i = q("select id from item where mid = '%s' and author_xchan = '%s' and uid = %d",
+ dbesc($mid),
+ dbesc($channel['channel_hash']),
+ intval($channel['channel_id'])
+ );
+ if($i) {
+ \Zotlabs\Daemon\Master::Summon([ 'Notifier', 'edit_post', $i[0]['id'] ]);
+ }
+ }
+ sleep(3);
+ goaway(z_root() . '/dreport/' . urlencode($mid));
+ }
+
if($mid === 'mail') {
$table = 'mail';
$mid = ((argc() > 2) ? argv(2) : '');
@@ -60,9 +77,10 @@ class Dreport extends \Zotlabs\Web\Controller {
return;
}
- $o .= '<div class="generic-content-wrapper-styled">';
- $o .= '<h2>' . sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...' . '</h2>';
- $o .= '<table>';
+// $o .= '<div class="generic-content-wrapper-styled">';
+// $o .= '<h2>' . sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...' . '</h2>';
+
+// $o .= '<table>';
for($x = 0; $x < count($r); $x++ ) {
$r[$x]['name'] = escape_tags(substr($r[$x]['dreport_recip'],strpos($r[$x]['dreport_recip'],' ')));
@@ -119,13 +137,29 @@ class Dreport extends \Zotlabs\Web\Controller {
}
usort($r,'self::dreport_gravity_sort');
-
-
+
+ $entries = array();
foreach($r as $rr) {
- $o .= '<tr><td width="40%">' . $rr['name'] . '</td><td width="20%">' . escape_tags($rr['dreport_result']) . '</td><td width="20%">' . escape_tags($rr['dreport_time']) . '</td></tr>';
+ $entries[] = [
+ 'name' => $rr['name'],
+ 'result' => escape_tags($rr['dreport_result']),
+ 'time' => escape_tags($rr['dreport_time'])
+ ];
}
- $o .= '</table>';
- $o .= '</div>';
+
+ $o = replace_macros(get_markup_template('dreport.tpl'), array(
+ '$title' => sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...',
+ '$table' => $table,
+ '$mid' => urlencode($mid),
+ '$push' => t('Redeliver'),
+ '$entries' => $entries
+ ));
+
+// foreach($r as $rr) {
+// $o .= '<tr><td width="40%">' . $rr['name'] . '</td><td width="20%">' . escape_tags($rr['dreport_result']) . '</td><td width="20%">' . escape_tags($rr['dreport_time']) . '</td></tr>';
+// }
+// $o .= '</table>';
+// $o .= '</div>';
return $o;
diff --git a/view/tpl/dreport.tpl b/view/tpl/dreport.tpl
new file mode 100644
index 000000000..7d5524a6a
--- /dev/null
+++ b/view/tpl/dreport.tpl
@@ -0,0 +1,21 @@
+<div class="generic-content-wrapper">
+ <div class="section-title-wrapper">
+ {{if $table == 'item'}}
+ <a href="dreport/push/{{$mid}}"><button class="btn btn-default btn-xs pull-right">{{$push}}</button></a>
+ {{/if}}
+ <h2>{{$title}}</h2>
+ </div>
+
+ <div>
+ <table>
+ {{if $entries}}
+ {{foreach $entries as $e}}
+ <tr>
+ <td width="40%">{{$e.name}}</td>
+ <td width="20%">{{$e.result}}</td>
+ <td width="20%">{{$e.time}}</td>
+ </tr>
+ {{/foreach}}
+ {{/if}}
+ </table>
+</div>