improve /locs page with some field notes and the ability to do a forced sync

This commit is contained in:
redmatrix 2015-11-01 15:51:45 -08:00
parent a8cdbd44e8
commit b62614bbd4
4 changed files with 25 additions and 2 deletions

View File

@ -675,7 +675,7 @@ function notifier_run($argv, $argc){
dbesc(json_encode($encoded_item)) dbesc(json_encode($encoded_item))
); );
// only create delivery reports for normal undeleted items // only create delivery reports for normal undeleted items
if(array_key_exists('postopts',$target_item) && (! $target_item['item_deleted'])) { if(is_array($target_item) && array_key_exists('postopts',$target_item) && (! $target_item['item_deleted'])) {
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_result, dreport_time, dreport_xchan, dreport_queue ) values ( '%s','%s','%s','%s','%s','%s','%s' ) ", q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_result, dreport_time, dreport_xchan, dreport_queue ) values ( '%s','%s','%s','%s','%s','%s','%s' ) ",
dbesc($target_item['mid']), dbesc($target_item['mid']),
dbesc($hub['hubloc_host']), dbesc($hub['hubloc_host']),

View File

@ -35,6 +35,7 @@ function locs_post(&$a) {
} }
} }
if($_REQUEST['drop']) { if($_REQUEST['drop']) {
$hubloc_id = intval($_REQUEST['drop']); $hubloc_id = intval($_REQUEST['drop']);
@ -85,6 +86,13 @@ function locs_content(&$a) {
$channel = $a->get_channel(); $channel = $a->get_channel();
if($_REQUEST['sync']) {
proc_run('php','include/notifier.php','location',$channel['channel_id']);
info( t('Syncing locations') . EOL);
goaway(z_root() . '/locs');
}
$r = q("select * from hubloc where hubloc_hash = '%s'", $r = q("select * from hubloc where hubloc_hash = '%s'",
dbesc($channel['channel_hash']) dbesc($channel['channel_hash'])
); );
@ -106,6 +114,10 @@ function locs_content(&$a) {
'$mkprm' => t('Primary Location'), '$mkprm' => t('Primary Location'),
'$drop' => t('Drop location'), '$drop' => t('Drop location'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$sync' => t('Sync now'),
'$sync_text' => t('Please wait several minutes between consecutive operations.'),
'$drop_text' => t('When possible, drop a location by logging into that website/hub and removing your channel.'),
'$last_resort' => t('Use this form to drop the location if the hub is no longer operating.'),
'$hubs' => $r '$hubs' => $r
)); ));

View File

@ -1 +1 @@
2015-10-31.1202 2015-11-01.1203

View File

@ -10,6 +10,15 @@ function drophub(id) {
} }
</script> </script>
<div class="descriptive-text">{{$sync_text}}</div>
<br />
<div class="descriptive-text">{{$drop_text}}</div>
<div class="descriptive-text">{{$last_resort}}</div>
<br />
<table> <table>
<tr><td>{{$loc}}</td><td>{{$mkprm}}</td><td>{{$drop}}</td></tr> <tr><td>{{$loc}}</td><td>{{$mkprm}}</td><td>{{$drop}}</td></tr>
{{foreach $hubs as $hub}} {{foreach $hubs as $hub}}
@ -25,3 +34,5 @@ function drophub(id) {
{{/foreach}} {{/foreach}}
</table> </table>
</div> </div>
<div class="clear"></div>
<button class="btn btn-std" onclick="window.location.href='/locs/f=&sync=1'; return false;">{{$sync}}</button>