aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-09-24 18:19:33 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-09-24 18:19:33 -0700
commite558ddae3f0e9cae8800caf878a07f5530d2e31f (patch)
tree86e337c1e960c4047952ecf3babf5103dec4cbf2 /mod
parent2c665e5e4cbd5530bc979c99022a2513c67a5425 (diff)
downloadvolse-hubzilla-e558ddae3f0e9cae8800caf878a07f5530d2e31f.tar.gz
volse-hubzilla-e558ddae3f0e9cae8800caf878a07f5530d2e31f.tar.bz2
volse-hubzilla-e558ddae3f0e9cae8800caf878a07f5530d2e31f.zip
clean up the delivery reports to make them manageable, more approachable, and translateable
Diffstat (limited to 'mod')
-rw-r--r--mod/dreport.php52
1 files changed, 50 insertions, 2 deletions
diff --git a/mod/dreport.php b/mod/dreport.php
index a20e17372..31a6274c8 100644
--- a/mod/dreport.php
+++ b/mod/dreport.php
@@ -30,9 +30,48 @@ function dreport_content(&$a) {
$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'],' ')));
+
+ switch($r[$x]['dreport_result']) {
+ case 'channel sync processed':
+ $r[$x]['gravity'] = 0;
+ $r[$x]['dreport_result'] = t('channel sync processed');
+ break;
+ case 'queued':
+ $r[$x]['gravity'] = 2;
+ $r[$x]['dreport_result'] = t('queued');
+ break;
+ case 'posted':
+ $r[$x]['gravity'] = 3;
+ $r[$x]['dreport_result'] = t('posted');
+ break;
+ case 'accepted for delivery':
+ $r[$x]['gravity'] = 4;
+ $r[$x]['dreport_result'] = t('accepted for delivery');
+ break;
+ case 'updated':
+ $r[$x]['gravity'] = 5;
+ $r[$x]['dreport_result'] = t('updated');
+ case 'update ignored':
+ $r[$x]['gravity'] = 6;
+ $r[$x]['dreport_result'] = t('update ignored');
+ break;
+ case 'permission denied':
+ $r[$x]['dreport_result'] = t('permission denied');
+ $r[$x]['gravity'] = 6;
+ break;
+ default:
+ $r[$x]['gravity'] = 1;
+ break;
+ }
+ }
+
+ usort($r,'dreport_gravity_sort');
+
+
foreach($r as $rr) {
- $name = escape_tags(substr($rr['dreport_recip'],strpos($rr['dreport_recip'],' ')));
- $o .= '<tr><td>' . $name . '</td><td>' . escape_tags($rr['dreport_result']) . '</td><td>' . escape_tags($rr['dreport_time']) . '</td></tr>';
+ $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>';
@@ -40,4 +79,13 @@ function dreport_content(&$a) {
+}
+
+function dreport_gravity_sort($a,$b) {
+ if($a['gravity'] == $b['gravity']) {
+ if($a['name'] === $b['name'])
+ return strcmp($a['dreport_time'],$b['dreport_time']);
+ return strcmp($a['name'],$b['name']);
+ }
+ return (($a['gravity'] > $b['gravity']) ? 1 : (-1));
} \ No newline at end of file