mirror of https://github.com/BOINC/boinc.git
Use CSS for date styling
Removed BOINC code dependency and added boincwork module function to set CSS classes for styling deadline datestamps
This commit is contained in:
parent
8f03fe28ac
commit
d2438e712b
|
@ -224,14 +224,16 @@ function work_and_host_stats_views_default_views() {
|
|||
'relationship' => 'none',
|
||||
),
|
||||
'phpcode' => array(
|
||||
'label' => 'Time reported or deadline [use CSS!]',
|
||||
'label' => 'Time reported or deadline',
|
||||
'alter' => array(
|
||||
'alter_text' => 0,
|
||||
'text' => '',
|
||||
'make_link' => 0,
|
||||
'path' => '',
|
||||
'absolute' => 0,
|
||||
'link_class' => '',
|
||||
'alt' => '',
|
||||
'rel' => '',
|
||||
'prefix' => '',
|
||||
'suffix' => '',
|
||||
'target' => '',
|
||||
|
@ -246,21 +248,8 @@ function work_and_host_stats_views_default_views() {
|
|||
'empty' => '',
|
||||
'hide_empty' => 0,
|
||||
'empty_zero' => 0,
|
||||
'value' => '<?php
|
||||
require_boinc(\'util\');
|
||||
if ($data->result_received_time) {
|
||||
$r = time_str($data->result_received_time);
|
||||
} else if ($data->result_report_deadline) {
|
||||
if ($data->result_report_deadline>time()) {
|
||||
$r = "<font color=\'#33cc33\'>" . time_str($data->result_report_deadline) . "</font>";
|
||||
} else {
|
||||
$r = "<font color=\'#ff3333\'>" . time_str($data->result_report_deadline) . "</font>";
|
||||
}
|
||||
} else {
|
||||
$r = "---";
|
||||
}
|
||||
return $r;
|
||||
?>',
|
||||
'hide_alter_empty' => 1,
|
||||
'value' => '<?php return boincwork_task_time_reported($data->result_received_time, $data->result_report_deadline); ?>',
|
||||
'exclude' => 0,
|
||||
'id' => 'phpcode',
|
||||
'table' => 'customfield',
|
||||
|
@ -5558,14 +5547,16 @@ else {
|
|||
'relationship' => 'none',
|
||||
),
|
||||
'phpcode' => array(
|
||||
'label' => 'Time reported or deadline [use CSS!]',
|
||||
'label' => 'Time reported or deadline',
|
||||
'alter' => array(
|
||||
'alter_text' => 0,
|
||||
'text' => '',
|
||||
'make_link' => 0,
|
||||
'path' => '',
|
||||
'absolute' => 0,
|
||||
'link_class' => '',
|
||||
'alt' => '',
|
||||
'rel' => '',
|
||||
'prefix' => '',
|
||||
'suffix' => '',
|
||||
'target' => '',
|
||||
|
@ -5580,21 +5571,8 @@ else {
|
|||
'empty' => '',
|
||||
'hide_empty' => 0,
|
||||
'empty_zero' => 0,
|
||||
'value' => '<?php
|
||||
require_boinc(\'util\');
|
||||
if ($data->result_received_time) {
|
||||
$r = time_str($data->result_received_time);
|
||||
} else if ($data->result_report_deadline) {
|
||||
if ($data->result_report_deadline>time()) {
|
||||
$r = "<font color=\'#33cc33\'>" . time_str($data->result_report_deadline) . "</font>";
|
||||
} else {
|
||||
$r = "<font color=\'#ff3333\'>" . time_str($data->result_report_deadline) . "</font>";
|
||||
}
|
||||
} else {
|
||||
$r = "---";
|
||||
}
|
||||
return $r;
|
||||
?>',
|
||||
'hide_alter_empty' => 1,
|
||||
'value' => '<?php return boincwork_task_time_reported($data->result_received_time, $data->result_report_deadline); ?>',
|
||||
'exclude' => 0,
|
||||
'id' => 'phpcode',
|
||||
'table' => 'customfield',
|
||||
|
@ -8799,14 +8777,16 @@ else {
|
|||
'relationship' => 'none',
|
||||
),
|
||||
'phpcode' => array(
|
||||
'label' => 'Time reported or deadline [use CSS!]',
|
||||
'label' => 'Time reported or deadline',
|
||||
'alter' => array(
|
||||
'alter_text' => 0,
|
||||
'text' => '',
|
||||
'make_link' => 0,
|
||||
'path' => '',
|
||||
'absolute' => 0,
|
||||
'link_class' => '',
|
||||
'alt' => '',
|
||||
'rel' => '',
|
||||
'prefix' => '',
|
||||
'suffix' => '',
|
||||
'target' => '',
|
||||
|
@ -8821,21 +8801,8 @@ else {
|
|||
'empty' => '',
|
||||
'hide_empty' => 0,
|
||||
'empty_zero' => 0,
|
||||
'value' => '<?php
|
||||
require_boinc(\'util\');
|
||||
if ($data->result_received_time) {
|
||||
$r = time_str($data->result_received_time);
|
||||
} else if ($data->result_report_deadline) {
|
||||
if ($data->result_report_deadline>time()) {
|
||||
$r = "<font color=\'#33cc33\'>" . time_str($data->result_report_deadline) . "</font>";
|
||||
} else {
|
||||
$r = "<font color=\'#ff3333\'>" . time_str($data->result_report_deadline) . "</font>";
|
||||
}
|
||||
} else {
|
||||
$r = "---";
|
||||
}
|
||||
return $r;
|
||||
?>',
|
||||
'hide_alter_empty' => 1,
|
||||
'value' => '<?php return boincwork_task_time_reported($data->result_received_time, $data->result_report_deadline); ?>',
|
||||
'exclude' => 0,
|
||||
'id' => 'phpcode',
|
||||
'table' => 'customfield',
|
||||
|
|
|
@ -1427,7 +1427,7 @@ function boincwork_validate_datatype($data, $datatype = NULL) {
|
|||
/**
|
||||
* Determine output for host list views when no hosts are found.
|
||||
*/
|
||||
function boincwork_views_host_list_empty_text($context = null) {
|
||||
function boincwork_views_host_list_empty_text($context = NULL) {
|
||||
|
||||
// Pull the BOINC user ID from the view arguments to get show_hosts
|
||||
// preference for that user
|
||||
|
@ -1470,7 +1470,7 @@ function boincwork_views_host_list_empty_text($context = null) {
|
|||
/**
|
||||
* Determine output for task list views when no tasks are found.
|
||||
*/
|
||||
function boincwork_views_task_list_empty_text($context = null) {
|
||||
function boincwork_views_task_list_empty_text($context = NULL) {
|
||||
|
||||
//
|
||||
$output = '';
|
||||
|
@ -1485,7 +1485,7 @@ function boincwork_views_task_list_empty_text($context = null) {
|
|||
/**
|
||||
* Determine output for host last contact time
|
||||
*/
|
||||
function boincwork_host_last_contact($timestamp, $context = null) {
|
||||
function boincwork_host_last_contact($timestamp, $context = NULL) {
|
||||
$output = '---';
|
||||
$log_name = 'NO_SUCH_LOG';
|
||||
if ($timestamp) {
|
||||
|
@ -1497,3 +1497,24 @@ function boincwork_host_last_contact($timestamp, $context = null) {
|
|||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine output for task reported time / deadline
|
||||
*/
|
||||
function boincwork_task_time_reported($received_time = NULL, $deadline = NULL, $context = NULL) {
|
||||
$output = '---';
|
||||
if ($received_time OR $deadline) {
|
||||
$timestamp = ($received_time) ? $received_time : $deadline;
|
||||
$output = gmdate('j M Y, G:i:s', $timestamp) . ' UTC';
|
||||
// Add a wrapper to deadline text
|
||||
if (!$received_time) {
|
||||
if (time() < $deadline) {
|
||||
$output = '<span class="on-time">' . $output . '</span>';
|
||||
}
|
||||
else {
|
||||
$output = '<span class="past-due">' . $output . '</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue