Skip to content

Commit

Permalink
Add Issues/warning button
Browse files Browse the repository at this point in the history
Added an orange/issues warning button in addition to the
infections/danger button and move clean/success green button to the
right so the colours appear similar to other widgets.
  • Loading branch information
precursorca committed Mar 14, 2018
1 parent c9de288 commit c21668c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/modules/detectx/detectx_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function get_stats()
$queryobj = new Detectx_model();
$sql = "SELECT COUNT(1) as total,
COUNT(CASE WHEN `status` = 'Clean' THEN 1 END) AS Clean,
COUNT(CASE WHEN `status` = 'Issues' THEN 1 END) AS Issues,
COUNT(CASE WHEN `status` = 'Infected' THEN 1 END) AS Infected
FROM detectx";
$obj->view('json', array('msg' => current($queryobj->query($sql))));
Expand Down
15 changes: 14 additions & 1 deletion app/modules/detectx/detectx_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function process($json)
$this->spotlightindexing = $data['spotlightindexing'];
$this->registered = $data['registered'];
$len = count($data['infections']);
$lis = count($data['issues']);
if ($len > 0)
{
$this->status = "Infected";
Expand All @@ -65,7 +66,19 @@ function process($json)
$this->infections .= ($infectionname . ";");
}
}
else {
else if ($lis > 0)
{
$this->status = "Issues";
foreach($data['issues'] as $issue){
$this->issues .= ($issue . ";");
}
foreach($data['issues'] as $issuesname){
$this->numberofissues += 1;
$this->issues .= ($issuesname . ";");
}
}
else
{
$this->status = "Clean";
$this->issues = 'No Issues Detected';
$this->numberofissues = 0;
Expand Down
3 changes: 3 additions & 0 deletions app/modules/detectx/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
"false": "False",
"scantime": "Scandauer",
"spotlightindexing": "Spotlight Index"
"infections": "Infections",
"registered": "Registered"
},
"widget": {
"title": "DetectX status",
"clean": "Sauber",
"issues": "Issues",
"infected": "Infiziert"
},
"title": "DetectX"
Expand Down
1 change: 1 addition & 0 deletions app/modules/detectx/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"widget": {
"title": "DetectX Status",
"clean": "Clean",
"issues": "Issues",
"infected": "Infected"
},
"title": "DetectX"
Expand Down
4 changes: 2 additions & 2 deletions app/modules/detectx/views/detectx_widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
baseUrl = appUrl + '/show/listing/detectx/detectx/#';
panel.empty();
// Set statuses
panel.append(' <a href="'+baseUrl+'infected" class="btn btn-danger"><span class="bigger-150">'+data.Infected+'</span><br>'+i18n.t('detectx.widget.infected')+'</a>');
panel.append(' <a href="'+baseUrl+'issues" class="btn btn-warning"><span class="bigger-150">'+data.Issues+'</span><br>'+i18n.t('detectx.widget.issues')+'</a>');
panel.append(' <a href="'+baseUrl+'clean" class="btn btn-success"><span class="bigger-150">'+data.Clean+'</span><br>'+i18n.t('detectx.widget.clean')+'</a>');
panel.append(' <a href="'+baseUrl+'infected" class="btn btn-danger"><span class="bigger-150">'+data.Infected+'</span><br>'+i18n.t('detectx.widget.infected')+'</a>');
});
});
Expand Down

0 comments on commit c21668c

Please sign in to comment.