visualfail: UNIX line endings

Change-Id: I5d26ec25d070e98b977ff3130c597a388a4c2c96
This commit is contained in:
Horst Schirmeier
2014-11-20 10:27:53 +01:00
parent ea4c350bcc
commit 1d66db3625
5 changed files with 842 additions and 842 deletions

View File

@ -1,10 +1,10 @@
<?php <?php
//Datenbank //Datenbank
$host = "localhost"; $host = "localhost";
$username = ""; $username = "";
$password = ""; $password = "";
$database = ""; $database = "";
// Name der result-Tabelle // Name der result-Tabelle
$result_table = "result"; $result_table = "result";
?> ?>

View File

@ -1,475 +1,475 @@
<?php <?php
require('CONFIGURATION.php'); require('CONFIGURATION.php');
//Datenbankverbindung aufbauen //Datenbankverbindung aufbauen
$verbindung = mysql_connect ($host,$username, $password) $verbindung = mysql_connect ($host,$username, $password)
or die ("keine Verbindung möglich. Benutzername oder Passwort sind falsch"); or die ("keine Verbindung möglich. Benutzername oder Passwort sind falsch");
mysql_select_db($database) or die ("Die Datenbank existiert nicht."); mysql_select_db($database) or die ("Die Datenbank existiert nicht.");
//Kommande lesen //Kommande lesen
switch ($_GET['kommando']) switch ($_GET['kommando'])
{ {
case "dbTest" : dbTest();break; case "dbTest" : dbTest();break;
case "getAsmCode" : getAsmCode();break; case "getAsmCode" : getAsmCode();break;
case "asmToSourceFile" : asmToSourceFile();break; case "asmToSourceFile" : asmToSourceFile();break;
case "getBinarys" : getBinarys();break; case "getBinarys" : getBinarys();break;
case "getVariants" : getVariants();break; case "getVariants" : getVariants();break;
case "getSourceFiles" : getSourceFiles();break; case "getSourceFiles" : getSourceFiles();break;
case "getResultTypes" : getResulttypesOUT();break; case "getResultTypes" : getResulttypesOUT();break;
case "getHighlevelCode" : getHighlevelCode();break; case "getHighlevelCode" : getHighlevelCode();break;
case "resultsDB" : resultsDB();break; case "resultsDB" : resultsDB();break;
case "dechex" : echo json_encode(dechex($_GET['dec']));break; case "dechex" : echo json_encode(dechex($_GET['dec']));break;
} }
function dbTest() function dbTest()
{ {
$check = true; $check = true;
$abfrage = "SELECT 1 FROM objdump;"; $abfrage = "SELECT 1 FROM objdump;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
if(!$ergebnis) { if(!$ergebnis) {
echo json_encode('Tabelle objdump nicht gefunden <br>'); echo json_encode('Tabelle objdump nicht gefunden <br>');
return; return;
} }
$abfrage = "SELECT 1 FROM fulltrace;"; $abfrage = "SELECT 1 FROM fulltrace;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
if(!$ergebnis) { if(!$ergebnis) {
echo json_encode('Tabelle fulltrace nicht gefunden <br>'); echo json_encode('Tabelle fulltrace nicht gefunden <br>');
return; return;
} }
$abfrage = "SELECT 1 FROM dbg_filename;"; $abfrage = "SELECT 1 FROM dbg_filename;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
if(!$ergebnis) { if(!$ergebnis) {
echo json_encode('Tabelle dbg_filename nicht gefunden <br>'); echo json_encode('Tabelle dbg_filename nicht gefunden <br>');
return; return;
} }
$abfrage = "SELECT 1 FROM dbg_mapping;"; $abfrage = "SELECT 1 FROM dbg_mapping;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
if(!$ergebnis) { if(!$ergebnis) {
echo json_encode('Tabelle dbg_mapping nicht gefunden <br>'); echo json_encode('Tabelle dbg_mapping nicht gefunden <br>');
return; return;
} }
$abfrage = "SELECT 1 FROM dbg_methods;"; $abfrage = "SELECT 1 FROM dbg_methods;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
if(!$ergebnis) { if(!$ergebnis) {
echo json_encode('Tabelle dbg_methods nicht gefunden <br>'); echo json_encode('Tabelle dbg_methods nicht gefunden <br>');
return; return;
} }
$abfrage = "SELECT 1 FROM dbg_source;"; $abfrage = "SELECT 1 FROM dbg_source;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
if(!$ergebnis) { if(!$ergebnis) {
echo json_encode('Tabelle dbg_source nicht gefunden <br>'); echo json_encode('Tabelle dbg_source nicht gefunden <br>');
return; return;
} }
$abfrage = "SELECT 1 FROM dbg_stacktrace;"; $abfrage = "SELECT 1 FROM dbg_stacktrace;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
if(!$ergebnis) { if(!$ergebnis) {
echo json_encode('Tabelle dbg_stacktrace nicht gefunden <br>'); echo json_encode('Tabelle dbg_stacktrace nicht gefunden <br>');
return; return;
} }
$abfrage = "SELECT 1 FROM dbg_variables;"; $abfrage = "SELECT 1 FROM dbg_variables;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
if(!$ergebnis) { if(!$ergebnis) {
echo json_encode('Tabelle dbg_variables nicht gefunden <br>'); echo json_encode('Tabelle dbg_variables nicht gefunden <br>');
return; return;
} }
} }
function getBinarys() function getBinarys()
{ {
$binarys = array(); $binarys = array();
$abfrage = "SELECT benchmark FROM variant;"; $abfrage = "SELECT benchmark FROM variant;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
mysql_close($verbindung); mysql_close($verbindung);
while($row = mysql_fetch_object($ergebnis)) while($row = mysql_fetch_object($ergebnis))
{ {
array_push($binarys, $row->benchmark); array_push($binarys, $row->benchmark);
} }
$result = array_unique($binarys); $result = array_unique($binarys);
echo json_encode($result); echo json_encode($result);
} }
function getVariants() function getVariants()
{ {
$variants = array(); $variants = array();
$abfrage = "SELECT id, variant FROM variant WHERE benchmark = '" . $_GET['datei'] ."';"; $abfrage = "SELECT id, variant FROM variant WHERE benchmark = '" . $_GET['datei'] ."';";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
mysql_close($verbindung); mysql_close($verbindung);
while($row = mysql_fetch_object($ergebnis)) while($row = mysql_fetch_object($ergebnis))
{ {
$variants[$row->id] = $row->variant; $variants[$row->id] = $row->variant;
} }
echo json_encode($variants); echo json_encode($variants);
} }
function getSourceFiles() function getSourceFiles()
{ {
$sourceFiles = array(); $sourceFiles = array();
$abfrage = "SELECT file_id, path FROM dbg_filename WHERE variant_id = '" . $_GET['variant']. "';"; $abfrage = "SELECT file_id, path FROM dbg_filename WHERE variant_id = '" . $_GET['variant']. "';";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
mysql_close($verbindung); mysql_close($verbindung);
while($row = mysql_fetch_object($ergebnis)) while($row = mysql_fetch_object($ergebnis))
{ {
$sourceFiles[$row->file_id] = $row->path; $sourceFiles[$row->file_id] = $row->path;
} }
echo json_encode($sourceFiles); echo json_encode($sourceFiles);
} }
function asmCode() function asmCode()
{ {
$content = ""; $content = "";
$abfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id'] ."' ORDER BY instr_address;"; $abfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id'] ."' ORDER BY instr_address;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
mysql_close($verbindung); mysql_close($verbindung);
$content = $content; $content = $content;
while($row = mysql_fetch_object($ergebnis)) while($row = mysql_fetch_object($ergebnis))
{ {
$content = $content . '<span id="' . dechex($row->instr_address) . '">' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '</span><br>'; $content = $content . '<span id="' . dechex($row->instr_address) . '">' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '</span><br>';
} }
echo json_encode($content); echo json_encode($content);
} }
function getAsmCode() function getAsmCode()
{ {
$content = ""; $content = "";
$resulttypes = array(); $resulttypes = array();
$asmAbfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id'] ."' ORDER BY instr_address;"; $asmAbfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id'] ."' ORDER BY instr_address;";
$asmcode = mysql_query($asmAbfrage); $asmcode = mysql_query($asmAbfrage);
getResulttypes($resulttypes); getResulttypes($resulttypes);
$fehlerdaten = resultsDB($_GET['variant_id'], $_GET['version'], $resulttypes); $fehlerdaten = resultsDB($_GET['variant_id'], $_GET['version'], $resulttypes);
//$fehlerdaten = askDBFehler($_GET['variant_id'], $resulttypes, $_GET['version']); //$fehlerdaten = askDBFehler($_GET['variant_id'], $resulttypes, $_GET['version']);
//print_r($fehlerdaten); //print_r($fehlerdaten);
$content = '<div id="maxFehler" '; $content = '<div id="maxFehler" ';
foreach ($resulttypes as $value) { foreach ($resulttypes as $value) {
$temp = $value . '="' . $fehlerdaten[max][$value] . '" '; $temp = $value . '="' . $fehlerdaten[max][$value] . '" ';
$content = $content . $temp; $content = $content . $temp;
} }
$content = $content .' >'; $content = $content .' >';
while($row = mysql_fetch_object($asmcode)) while($row = mysql_fetch_object($asmcode))
{ {
if (array_key_exists($row->instr_address,$fehlerdaten[Daten])) { if (array_key_exists($row->instr_address,$fehlerdaten[Daten])) {
$content = $content . '<span id="' . dechex($row->instr_address) . '" class="hasFehler" '; $content = $content . '<span id="' . dechex($row->instr_address) . '" class="hasFehler" ';
foreach ($resulttypes as $value) { foreach ($resulttypes as $value) {
$temp = $value . '="' . $fehlerdaten[Daten][$row->instr_address][$value] . '" '; $temp = $value . '="' . $fehlerdaten[Daten][$row->instr_address][$value] . '" ';
$content = $content . $temp; $content = $content . $temp;
} }
$content = $content . ' cursor: pointer;>' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '</span><br>'; $content = $content . ' cursor: pointer;>' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '</span><br>';
} else { } else {
$content = $content . '<span id="' . dechex($row->instr_address) . '">' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '</span><br>'; $content = $content . '<span id="' . dechex($row->instr_address) . '">' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '</span><br>';
} }
} }
$content = $content . ' </div>'; $content = $content . ' </div>';
echo json_encode($content); echo json_encode($content);
} }
function getHighlevelCode() function getHighlevelCode()
{ {
$content = ""; $content = "";
$resulttypes = array(); $resulttypes = array();
getResulttypes($resulttypes); getResulttypes($resulttypes);
$kleinsteAdresseAbfrage = "SELECT instr_address FROM objdump WHERE variant_id = '" . $_GET['variant_id']. "' ORDER BY instr_address LIMIT 1;"; $kleinsteAdresseAbfrage = "SELECT instr_address FROM objdump WHERE variant_id = '" . $_GET['variant_id']. "' ORDER BY instr_address LIMIT 1;";
$kleinsteAdresseErgebnis = mysql_query($kleinsteAdresseAbfrage); $kleinsteAdresseErgebnis = mysql_query($kleinsteAdresseAbfrage);
$kleinsteAdresse = mysql_fetch_object($kleinsteAdresseErgebnis); $kleinsteAdresse = mysql_fetch_object($kleinsteAdresseErgebnis);
$highlevelCodeAbfrage = "SELECT linenumber, line FROM dbg_source WHERE variant_id = '" . $_GET['variant_id']. "' AND file_id = '" . $_GET['file_id']. "' ORDER BY linenumber;"; $highlevelCodeAbfrage = "SELECT linenumber, line FROM dbg_source WHERE variant_id = '" . $_GET['variant_id']. "' AND file_id = '" . $_GET['file_id']. "' ORDER BY linenumber;";
$mappingAbfrage = "SELECT instr_absolute, linenumber FROM dbg_mapping WHERE variant_id = '" . $_GET['variant_id']. "' AND file_id = '" . $_GET['file_id'] . "' AND instr_absolute >= '" . $kleinsteAdresse->instr_address . "' ORDER BY instr_absolute;"; $mappingAbfrage = "SELECT instr_absolute, linenumber FROM dbg_mapping WHERE variant_id = '" . $_GET['variant_id']. "' AND file_id = '" . $_GET['file_id'] . "' AND instr_absolute >= '" . $kleinsteAdresse->instr_address . "' ORDER BY instr_absolute;";
$highlevelCode = mysql_query($highlevelCodeAbfrage); $highlevelCode = mysql_query($highlevelCodeAbfrage);
$mappingInfo = mysql_query($mappingAbfrage); $mappingInfo = mysql_query($mappingAbfrage);
$fehlerdaten = resultsDB($_GET['variant_id'], $_GET['version'], $resulttypes); $fehlerdaten = resultsDB($_GET['variant_id'], $_GET['version'], $resulttypes);
$mappingRanges = array(); $mappingRanges = array();
$numEntrysMapping = mysql_num_rows($mappingInfo); $numEntrysMapping = mysql_num_rows($mappingInfo);
$row = mysql_fetch_object($mappingInfo); $row = mysql_fetch_object($mappingInfo);
for ($i = 0; $i < $numEntrysMapping-1; $i++) for ($i = 0; $i < $numEntrysMapping-1; $i++)
{ {
if(!is_array($mappingRanges[$row->linenumber])) { if(!is_array($mappingRanges[$row->linenumber])) {
$mappingRanges[$row->linenumber] = array(); $mappingRanges[$row->linenumber] = array();
} }
$oldLineNumber = $row->linenumber; $oldLineNumber = $row->linenumber;
$firstAddr = $row->instr_absolute; $firstAddr = $row->instr_absolute;
$row = mysql_fetch_object($mappingInfo); $row = mysql_fetch_object($mappingInfo);
array_push($mappingRanges[$oldLineNumber], array($firstAddr, $row->instr_absolute)); array_push($mappingRanges[$oldLineNumber], array($firstAddr, $row->instr_absolute));
} }
$mapping = array(); $mapping = array();
$maxFehlerMapping = array(); $maxFehlerMapping = array();
foreach ($mappingRanges as $lineNumber => $value) { foreach ($mappingRanges as $lineNumber => $value) {
$maxFehler = array(); $maxFehler = array();
foreach ($resulttypes as $val) { foreach ($resulttypes as $val) {
$maxFehler[$val] = 0; $maxFehler[$val] = 0;
} }
foreach ($value as $index => $ranges) { foreach ($value as $index => $ranges) {
$InstrMappingAbfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id']. "' AND instr_address > '" . $ranges[0] . "' AND instr_address < '" . $ranges[1] . "' ORDER BY instr_address;"; $InstrMappingAbfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id']. "' AND instr_address > '" . $ranges[0] . "' AND instr_address < '" . $ranges[1] . "' ORDER BY instr_address;";
$mappingErgebnis = mysql_query($InstrMappingAbfrage); $mappingErgebnis = mysql_query($InstrMappingAbfrage);
//Leerzeile //Leerzeile
$mapping[$lineNumber] [] = '<br>'; $mapping[$lineNumber] [] = '<br>';
while($row = mysql_fetch_object($mappingErgebnis)) { while($row = mysql_fetch_object($mappingErgebnis)) {
if (array_key_exists($row->instr_address,$fehlerdaten[Daten])) { if (array_key_exists($row->instr_address,$fehlerdaten[Daten])) {
$newline = $newline . '<span id="' . dechex($row->instr_address) . '" class="hasFehler" '; $newline = $newline . '<span id="' . dechex($row->instr_address) . '" class="hasFehler" ';
foreach ($resulttypes as $value) { foreach ($resulttypes as $value) {
$temp = $value . '="' . $fehlerdaten[Daten][$row->instr_address][$value] . '" '; $temp = $value . '="' . $fehlerdaten[Daten][$row->instr_address][$value] . '" ';
$newline = $newline . $temp; $newline = $newline . $temp;
$maxFehler[$value] = $maxFehler[$value] + $fehlerdaten[Daten][$row->instr_address][$value]; $maxFehler[$value] = $maxFehler[$value] + $fehlerdaten[Daten][$row->instr_address][$value];
} }
$newline = $newline . ' cursor: pointer;>' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '</span><br>'; $newline = $newline . ' cursor: pointer;>' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '</span><br>';
} else { } else {
$newline = '<span id="' . dechex($row->instr_address) . '">' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '</span><br>'; $newline = '<span id="' . dechex($row->instr_address) . '">' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '</span><br>';
} }
$mapping[$lineNumber] [] = $newline; $mapping[$lineNumber] [] = $newline;
} }
//Leerzeile //Leerzeile
$mapping[$lineNumber] [] = '<br>'; $mapping[$lineNumber] [] = '<br>';
} }
foreach ($resulttypes as $value) { foreach ($resulttypes as $value) {
$maxFehlerMapping[$lineNumber][$value] = $maxFehler[$value]; $maxFehlerMapping[$lineNumber][$value] = $maxFehler[$value];
} }
} }
while($row = mysql_fetch_object($highlevelCode)) while($row = mysql_fetch_object($highlevelCode))
{ {
$content = $content . '<span id="' . $row->linenumber . '">' . $row->linenumber . ' : ' . $row->line . '</span><br>'; $content = $content . '<span id="' . $row->linenumber . '">' . $row->linenumber . ' : ' . $row->line . '</span><br>';
if(array_key_exists($row->linenumber, $mapping)) { if(array_key_exists($row->linenumber, $mapping)) {
$content = $content . '<div id="mapping">'; $content = $content . '<div id="mapping">';
foreach ($mapping[$row->linenumber] as $index => $span) { foreach ($mapping[$row->linenumber] as $index => $span) {
$content = $content . $span; $content = $content . $span;
} }
$content = $content . '</div>'; $content = $content . '</div>';
$content = $content .'<div class="maxFehlerMapping"'; $content = $content .'<div class="maxFehlerMapping"';
foreach ($resulttypes as $value) { foreach ($resulttypes as $value) {
$content = $content . $value . '="' . $maxFehlerMapping[$row->linenumber][$value] . '" '; $content = $content . $value . '="' . $maxFehlerMapping[$row->linenumber][$value] . '" ';
} }
$content = $content .'> </div>'; $content = $content .'> </div>';
} }
} }
mysql_close($verbindung); mysql_close($verbindung);
echo json_encode($content); echo json_encode($content);
} }
function getResulttypes(&$resulttypes) function getResulttypes(&$resulttypes)
{ {
$abfrage = "SELECT resulttype FROM " . $GLOBALS['result_table'] . " GROUP BY resulttype;"; $abfrage = "SELECT resulttype FROM " . $GLOBALS['result_table'] . " GROUP BY resulttype;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
mysql_close($verbindung); mysql_close($verbindung);
while ($row = mysql_fetch_object($ergebnis)) { while ($row = mysql_fetch_object($ergebnis)) {
//echo $row->resulttype; //echo $row->resulttype;
array_push($resulttypes, $row->resulttype); array_push($resulttypes, $row->resulttype);
} }
} }
function getResulttypesOUT() function getResulttypesOUT()
{ {
$resulttypes = array(); $resulttypes = array();
$abfrage = "SELECT resulttype FROM " . $GLOBALS['result_table'] . " GROUP BY resulttype;"; $abfrage = "SELECT resulttype FROM " . $GLOBALS['result_table'] . " GROUP BY resulttype;";
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
mysql_close($verbindung); mysql_close($verbindung);
while ($row = mysql_fetch_object($ergebnis)) { while ($row = mysql_fetch_object($ergebnis)) {
//echo $row->resulttype; //echo $row->resulttype;
array_push($resulttypes, $row->resulttype); array_push($resulttypes, $row->resulttype);
} }
echo json_encode($resulttypes); echo json_encode($resulttypes);
} }
function askDBFehler($variant_id, $resulttypes, $version) function askDBFehler($variant_id, $resulttypes, $version)
{ {
if($version == 'onlyRightEdge') { if($version == 'onlyRightEdge') {
$abfrage = "SELECT ft.instr, ft.instr_absolute "; $abfrage = "SELECT ft.instr, ft.instr_absolute ";
foreach ( $resulttypes as $value) { foreach ( $resulttypes as $value) {
$temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value; $temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value;
$abfrage = $abfrage . $temp; $abfrage = $abfrage . $temp;
} }
$abfrage = $abfrage . " FROM fulltrace ft $abfrage = $abfrage . " FROM fulltrace ft
LEFT JOIN trace t LEFT JOIN trace t
ON ft.variant_id = '" . $variant_id . "' ON ft.variant_id = '" . $variant_id . "'
AND t.variant_id = '" . $variant_id . "' AND t.variant_id = '" . $variant_id . "'
AND ft.instr = t.instr2 AND ft.instr = t.instr2
AND t.accesstype = 'R' AND t.accesstype = 'R'
JOIN fsppilot p JOIN fsppilot p
ON t.variant_id = '" . $variant_id . "' ON t.variant_id = '" . $variant_id . "'
AND p.variant_id = '" . $variant_id . "' AND p.variant_id = '" . $variant_id . "'
AND t.data_address = p.data_address AND t.data_address = p.data_address
AND p.instr2 = t.instr2 AND p.instr2 = t.instr2
JOIN " . $GLOBALS['result_table'] . " r JOIN " . $GLOBALS['result_table'] . " r
ON p.id = r.pilot_id ON p.id = r.pilot_id
GROUP BY ft.instr_absolute;"; GROUP BY ft.instr_absolute;";
} else if ($version == 'latestip') { } else if ($version == 'latestip') {
$abfrage = "SELECT r.latest_ip "; $abfrage = "SELECT r.latest_ip ";
foreach ( $resulttypes as $value) { foreach ( $resulttypes as $value) {
$temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value; $temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value;
$abfrage = $abfrage . $temp; $abfrage = $abfrage . $temp;
} }
$abfrage = $abfrage . " FROM trace t $abfrage = $abfrage . " FROM trace t
JOIN fsppilot p JOIN fsppilot p
ON t.variant_id = p.variant_id ON t.variant_id = p.variant_id
AND t.data_address = p.data_address AND t.data_address = p.data_address
AND p.instr2 = t.instr2 AND p.instr2 = t.instr2
JOIN " . $GLOBALS['result_table'] . " r JOIN " . $GLOBALS['result_table'] . " r
ON p.id = r.pilot_id ON p.id = r.pilot_id
WHERE t.variant_id = '" . $variant_id . "' AND t.accesstype = 'R' WHERE t.variant_id = '" . $variant_id . "' AND t.accesstype = 'R'
GROUP BY r.latest_ip;"; GROUP BY r.latest_ip;";
} else { } else {
$abfrage = "SELECT ft.instr, ft.instr_absolute "; $abfrage = "SELECT ft.instr, ft.instr_absolute ";
foreach ( $resulttypes as $value) { foreach ( $resulttypes as $value) {
$temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value; $temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value;
$abfrage = $abfrage . $temp; $abfrage = $abfrage . $temp;
} }
$abfrage = $abfrage . " FROM fulltrace ft $abfrage = $abfrage . " FROM fulltrace ft
LEFT JOIN trace t LEFT JOIN trace t
ON ft.variant_id = '" . $variant_id . "' ON ft.variant_id = '" . $variant_id . "'
AND t.variant_id = '" . $variant_id . "' AND t.variant_id = '" . $variant_id . "'
AND ft.instr BETWEEN t.instr1 AND t.instr2 AND ft.instr BETWEEN t.instr1 AND t.instr2
AND t.accesstype = 'R' AND t.accesstype = 'R'
JOIN fsppilot p JOIN fsppilot p
ON t.variant_id = '" . $variant_id . "' ON t.variant_id = '" . $variant_id . "'
AND p.variant_id = '" . $variant_id . "' AND p.variant_id = '" . $variant_id . "'
AND t.data_address = p.data_address AND t.data_address = p.data_address
AND p.instr2 = t.instr2 AND p.instr2 = t.instr2
JOIN " . $GLOBALS['result_table'] . " r JOIN " . $GLOBALS['result_table'] . " r
ON p.id = r.pilot_id ON p.id = r.pilot_id
GROUP BY ft.instr_absolute;"; GROUP BY ft.instr_absolute;";
} }
//echo $abfrage; //echo $abfrage;
$ergebnis = mysql_query($abfrage); $ergebnis = mysql_query($abfrage);
mysql_close($verbindung); mysql_close($verbindung);
return $ergebnis; return $ergebnis;
} }
function resultsDB($variant_id, $version, $resulttypes) function resultsDB($variant_id, $version, $resulttypes)
{ {
getResulttypes($resulttypes); getResulttypes($resulttypes);
//print_r($resulttypes); //print_r($resulttypes);
$ergebnis = askDBFehler($variant_id, $resulttypes, $version); $ergebnis = askDBFehler($variant_id, $resulttypes, $version);
//print_r($ergebnis); //print_r($ergebnis);
$results = array(); $results = array();
// We find the fields number // We find the fields number
$numfields=mysql_num_fields($ergebnis); $numfields=mysql_num_fields($ergebnis);
for($i=0;$i<$numfields;$i++){ for($i=0;$i<$numfields;$i++){
$fieldname[$i]=mysql_field_name($ergebnis, $i); $fieldname[$i]=mysql_field_name($ergebnis, $i);
} }
for($i=2;$i<$numfields;$i++){ for($i=2;$i<$numfields;$i++){
$results["max"][$fieldname[$i]] = 0; $results["max"][$fieldname[$i]] = 0;
} }
$maxFehler = 0; $maxFehler = 0;
while($row = mysql_fetch_object($ergebnis)) while($row = mysql_fetch_object($ergebnis))
{ {
if($version != 'latestip'){ if($version != 'latestip'){
if($row->instr_absolute != NULL) if($row->instr_absolute != NULL)
{ {
$results["Daten"][$row->instr_absolute] = array(); $results["Daten"][$row->instr_absolute] = array();
for ($i = 1 ; $i < $numfields ; $i++) for ($i = 1 ; $i < $numfields ; $i++)
{ {
$results["Daten"][$row->instr_absolute][$fieldname[$i]] = $row->$fieldname[$i]; $results["Daten"][$row->instr_absolute][$fieldname[$i]] = $row->$fieldname[$i];
if($row->$fieldname[$i] > $results["max"][$fieldname[$i]]) if($row->$fieldname[$i] > $results["max"][$fieldname[$i]])
{ {
$results["max"][$fieldname[$i]] = $row->$fieldname[$i]; $results["max"][$fieldname[$i]] = $row->$fieldname[$i];
} }
} }
} }
} else { } else {
if($row->latest_ip != NULL) if($row->latest_ip != NULL)
{ {
$results["Daten"][$row->latest_ip] = array(); $results["Daten"][$row->latest_ip] = array();
for ($i = 0 ; $i < $numfields ; $i++) for ($i = 0 ; $i < $numfields ; $i++)
{ {
$results["Daten"][$row->latest_ip][$fieldname[$i]] = $row->$fieldname[$i]; $results["Daten"][$row->latest_ip][$fieldname[$i]] = $row->$fieldname[$i];
if($row->$fieldname[$i] > $results["max"][$fieldname[$i]]) if($row->$fieldname[$i] > $results["max"][$fieldname[$i]])
{ {
$results["max"][$fieldname[$i]] = $row->$fieldname[$i]; $results["max"][$fieldname[$i]] = $row->$fieldname[$i];
} }
} }
} }
} }
} }
return $results; return $results;
} }
?> ?>

View File

@ -1,19 +1,19 @@
body { body {
min-height: 2000px; min-height: 2000px;
padding-top: 70px; padding-top: 70px;
} }
/* Custom container */ /* Custom container */
.container-full { .container-full {
margin: 0 auto; margin: 0 auto;
padding: 0 15px; padding: 0 15px;
width: 100%; width: 100%;
} }
.logo { .logo {
padding: 0 0 0 30px; padding: 0 0 0 30px;
} }
#analyse { #analyse {
margin: 20px 0 0 0; margin: 20px 0 0 0;
} }

View File

@ -1,129 +1,129 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content=""> <meta name="author" content="">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<title>Visual FAIL*</title> <title>Visual FAIL*</title>
<!-- Bootstrap core CSS --> <!-- Bootstrap core CSS -->
<link href="css/bootstrap.css" rel="stylesheet"> <link href="css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template --> <!-- Custom styles for this template -->
<link href="css/myStyle.css" rel="stylesheet"> <link href="css/myStyle.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! --> <!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]--> <!--[if lt IE 9]><script src="../../docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]--> <![endif]-->
</head> </head>
<body> <body>
<!-- Fixed navbar --> <!-- Fixed navbar -->
<div class="container-full"> <div class="container-full">
<div class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<!--<div class="container"> --> <!--<div class="container"> -->
<!--<a class="navbar-brand" href="#">Visual FAIL*</a>--> <!--<a class="navbar-brand" href="#">Visual FAIL*</a>-->
<img class="navbar-brand logo" src="images/logos/visualfaillogo_klein.png" alt="Visual Fail* logo" /> <img class="navbar-brand logo" src="images/logos/visualfaillogo_klein.png" alt="Visual Fail* logo" />
<!--</div>--> <!--</div>-->
</div> </div>
<div class="container"> <div class="container">
<div class="navbar-collapse collapse"> <div class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="active"><a href="#">Rückabbildung</a></li> <li class="active"><a href="#">Rückabbildung</a></li>
<li><a href="#about">Aggregation</a></li> <li><a href="#about">Aggregation</a></li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tools <b class="caret"></b></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Tools <b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="adminer-3.7.1.php" target="_blank">Adminer</a></li> <li><a href="adminer-3.7.1.php" target="_blank">Adminer</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2">
<!-- Main component for a primary marketing message or call to action --> <!-- Main component for a primary marketing message or call to action -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">Färbung</div> <div class="panel-heading">Färbung</div>
<div class="panel-body"> <div class="panel-body">
<select class="form-control" id="faerbung"> <select class="form-control" id="faerbung">
<option value="onlyRightEdge">Rechter Rand(trace.instr2)</option> <option value="onlyRightEdge">Rechter Rand(trace.instr2)</option>
<option value="latestip">Letzte Instruktion(result.latest_ip)</option> <option value="latestip">Letzte Instruktion(result.latest_ip)</option>
<option value="normal">Äquivalenzklassen</option> <option value="normal">Äquivalenzklassen</option>
</select> </select>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">Benchmark</div> <div class="panel-heading">Benchmark</div>
<div class="panel-body"> <div class="panel-body">
<select class="form-control" id="binary"> <select class="form-control" id="binary">
<option></option> <option></option>
</select> </select>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">Variante</div> <div class="panel-heading">Variante</div>
<div class="panel-body"> <div class="panel-body">
<select class="form-control" id="variant"> <select class="form-control" id="variant">
<option></option> <option></option>
</select> </select>
<div class="text-center"> <div class="text-center">
<button type="button" class="btn btn-default btn-lg" id="analyse">Analyse</button> <button type="button" class="btn btn-default btn-lg" id="analyse">Analyse</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-10"> <div class="col-md-10">
<div class="panel-body"> <div class="panel-body">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<div class="btn-group" id="fehlertypenset" data-toggle="buttons"> <div class="btn-group" id="fehlertypenset" data-toggle="buttons">
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<select class="form-control" id="sourceFiles"> <select class="form-control" id="sourceFiles">
<option></option> <option></option>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<pre class="container col-md-6" id="asm"> <pre class="container col-md-6" id="asm">
</pre> </pre>
<pre class="container col-md-6" id="hcode"> <pre class="container col-md-6" id="hcode">
</pre> </pre>
</div> </div>
</div> </div>
</div> </div>
</div> <!-- /container-full --> </div> <!-- /container-full -->
<!-- Bootstrap core JavaScript <!-- Bootstrap core JavaScript
================================================== --> ================================================== -->
<!-- Placed at the end of the document so the pages load faster --> <!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script> <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script> <script src="js/bootstrap.min.js"></script>
<script src="js/myscript.js"></script> <script src="js/myscript.js"></script>
</body> </body>
</html> </html>

View File

@ -1,210 +1,210 @@
$.ajaxSetup({ $.ajaxSetup({
async: false async: false
}); });
//Umwandlung von dezimal zu hexadezimal //Umwandlung von dezimal zu hexadezimal
function dec2hex(dec) { function dec2hex(dec) {
var hex = ""; var hex = "";
if (dec < 0) { if (dec < 0) {
dec = 0xFFFFFFFF + dec + 1; dec = 0xFFFFFFFF + dec + 1;
} }
hex = parseInt(dec, 10).toString(16); hex = parseInt(dec, 10).toString(16);
return hex; return hex;
} }
//Berechne den Farbwert (z.B.: #FFFFFF) fuer gegebene Fehlerwerte //Berechne den Farbwert (z.B.: #FFFFFF) fuer gegebene Fehlerwerte
function calcColor(fehler, maxFehler) { function calcColor(fehler, maxFehler) {
//console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler); //console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler);
var part = 0; var part = 0;
if (fehler != 0) { if (fehler != 0) {
var x = 255/Math.log(maxFehler); var x = 255/Math.log(maxFehler);
part = x*Math.log(fehler); part = x*Math.log(fehler);
} }
//console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler + " Part: " + part); //console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler + " Part: " + part);
var hex = dec2hex(255-part); var hex = dec2hex(255-part);
//console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler + " Part: " + part + " Farbcode: " + ("#FF" + hex + hex)); //console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler + " Part: " + part + " Farbcode: " + ("#FF" + hex + hex));
if (hex >= 0 && hex <= 9 ) { if (hex >= 0 && hex <= 9 ) {
return "#FF" + hex + hex + hex + hex; return "#FF" + hex + hex + hex + hex;
} else { } else {
return "#FF" + hex + hex; return "#FF" + hex + hex;
} }
} }
//Tooltip für Instruktionszeilen mit Fehler //Tooltip für Instruktionszeilen mit Fehler
$('body').popover({ $('body').popover({
selector: ".hasFehler", selector: ".hasFehler",
html: true, html: true,
title: function() { return $(this).attr("id"); }, title: function() { return $(this).attr("id"); },
content: function() { content: function() {
var ausgabe = ''; var ausgabe = '';
var caller = $(this); var caller = $(this);
$.getJSON("core.php", {kommando: 'getResultTypes'}, function(data) { $.getJSON("core.php", {kommando: 'getResultTypes'}, function(data) {
$.each(data, function(key, val) { $.each(data, function(key, val) {
ausgabe = ausgabe + val +': ' + caller.attr(val) + '<br>'; ausgabe = ausgabe + val +': ' + caller.attr(val) + '<br>';
}); });
}); });
return ausgabe; return ausgabe;
} }
}); });
//Einblenden des Modal "Loading" fuer Ajax Requests //Einblenden des Modal "Loading" fuer Ajax Requests
/*$(document).ajaxStart(function(){ /*$(document).ajaxStart(function(){
//console.log("ajaxstart"); //console.log("ajaxstart");
$("body").addClass("loading"); $("body").addClass("loading");
}).ajaxStop(function(){ }).ajaxStop(function(){
//console.log("ajaxstop"); //console.log("ajaxstop");
$("body").removeClass("loading"); $("body").removeClass("loading");
});*/ });*/
//User-Interaktionen nachdem das DOM geladen ist //User-Interaktionen nachdem das DOM geladen ist
$(document).ready(function() { $(document).ready(function() {
//DB check //DB check
$.getJSON("core.php", {kommando: 'dbTest'}, function(data) { $.getJSON("core.php", {kommando: 'dbTest'}, function(data) {
if(data != "ok") { if(data != "ok") {
$('html').html(data); $('html').html(data);
} }
}); });
//Holen der Binarys, die in der DB in der Tabelle Variant vorkommen //Holen der Binarys, die in der DB in der Tabelle Variant vorkommen
$.getJSON("core.php", {kommando: 'getBinarys'}, function(data) { $.getJSON("core.php", {kommando: 'getBinarys'}, function(data) {
$.each(data, function(key, val) { $.each(data, function(key, val) {
$('#binary').append('<option value="' + val + '">' + val + '</option>'); $('#binary').append('<option value="' + val + '">' + val + '</option>');
}); });
}); });
//Auswahl eines Eintrages aus den Source-Files für die Darstellung des Hochsprachencode //Auswahl eines Eintrages aus den Source-Files für die Darstellung des Hochsprachencode
$('#sourceFiles').change(function() { $('#sourceFiles').change(function() {
if($(this).val() != 'none') { if($(this).val() != 'none') {
$.getJSON("core.php", {kommando: 'getHighlevelCode', variant_id: $('#variant').val(), file_id: $(this).val(), version: $('#faerbung').val()}, function(data) { $.getJSON("core.php", {kommando: 'getHighlevelCode', variant_id: $('#variant').val(), file_id: $(this).val(), version: $('#faerbung').val()}, function(data) {
$('#hcode').html(data); $('#hcode').html(data);
$('.maxFehlerMapping').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) { $('.maxFehlerMapping').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) {
var newFehler = 0; var newFehler = 0;
var actualRow = $(this); var actualRow = $(this);
$.each(activeFehlertypes, function(key, val) { $.each(activeFehlertypes, function(key, val) {
newFehler = newFehler + parseInt(actualRow.attr(val)); newFehler = newFehler + parseInt(actualRow.attr(val));
}); });
console.log("jepp" + newMaxFehler + " " + newFehler); console.log("jepp" + newMaxFehler + " " + newFehler);
$(this).prev().prev().prev().css("background-color", calcColor(newFehler, newMaxFehler)) $(this).prev().prev().prev().css("background-color", calcColor(newFehler, newMaxFehler))
.css('cursor', 'pointer'); .css('cursor', 'pointer');
}); });
$('.hasFehler').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) { $('.hasFehler').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) {
var newFehler = 0; var newFehler = 0;
var actualRow = $(this); var actualRow = $(this);
$.each(activeFehlertypes, function(key, val) { $.each(activeFehlertypes, function(key, val) {
newFehler = newFehler + parseInt(actualRow.attr(val)); newFehler = newFehler + parseInt(actualRow.attr(val));
}); });
$(this).css("background-color", calcColor(newFehler, newMaxFehler)) $(this).css("background-color", calcColor(newFehler, newMaxFehler))
.css('cursor', 'pointer'); .css('cursor', 'pointer');
}); });
}); });
setTimeout(function(){ setTimeout(function(){
var activeFehlertypes = new Array(); var activeFehlertypes = new Array();
var newMaxFehler = 0; var newMaxFehler = 0;
$('#fehlertypenset > .active').each(function(){ $('#fehlertypenset > .active').each(function(){
activeFehlertypes.push($(this).attr("id")); activeFehlertypes.push($(this).attr("id"));
//console.log("Hinzugefuegt: " + $(this).attr("id")); //console.log("Hinzugefuegt: " + $(this).attr("id"));
}); });
$.each(activeFehlertypes,function(key, name){ $.each(activeFehlertypes,function(key, name){
//Neuen MaxFehler berechnen //Neuen MaxFehler berechnen
newMaxFehler = newMaxFehler + parseInt($('#maxFehler').attr(name)); newMaxFehler = newMaxFehler + parseInt($('#maxFehler').attr(name));
}); });
$('.hasFehler').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); $('.hasFehler').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]);
$('.maxFehlerMapping').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); $('.maxFehlerMapping').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]);
},100); },100);
} }
}); });
//Auswahl eines Eintrages aus den Binarys für die Darstellung des Assembler-Code //Auswahl eines Eintrages aus den Binarys für die Darstellung des Assembler-Code
$('#binary').change(function() { $('#binary').change(function() {
if($(this).val() != 'none') { if($(this).val() != 'none') {
$('#variant').html('<option value="none" selected="selected"></option>'); $('#variant').html('<option value="none" selected="selected"></option>');
$.getJSON("core.php", {kommando: 'getVariants', datei: $(this).val()}, function(data) { $.getJSON("core.php", {kommando: 'getVariants', datei: $(this).val()}, function(data) {
$.each(data, function(key, val) { $.each(data, function(key, val) {
$('#variant').append('<option value="' + key + '">' + val + '</option>'); $('#variant').append('<option value="' + key + '">' + val + '</option>');
}); });
}); });
} }
}); });
//Analyse Button wird gedrueckt //Analyse Button wird gedrueckt
$('#analyse').button().click( function () { $('#analyse').button().click( function () {
$.getJSON("core.php", {kommando: 'getAsmCode', variant_id: $('#variant').val(), version: $('#faerbung').val()}, function(data) { $.getJSON("core.php", {kommando: 'getAsmCode', variant_id: $('#variant').val(), version: $('#faerbung').val()}, function(data) {
$('#asm').html(data); $('#asm').html(data);
}); });
$.getJSON("core.php", {kommando: 'getSourceFiles', variant: $('#variant').val()}, function(data) { $.getJSON("core.php", {kommando: 'getSourceFiles', variant: $('#variant').val()}, function(data) {
$.each(data, function(key, val) { $.each(data, function(key, val) {
$('#sourceFiles').append('<option value="' + key + '">' + val + '</option>'); $('#sourceFiles').append('<option value="' + key + '">' + val + '</option>');
}); });
}); });
$.getJSON("core.php", {kommando: 'getResultTypes'}, function(data) { $.getJSON("core.php", {kommando: 'getResultTypes'}, function(data) {
$('#fehlertypenset').html(''); $('#fehlertypenset').html('');
$.each(data, function(key, val) { $.each(data, function(key, val) {
$('#fehlertypenset').append('<label class="btn btn-default" id="' + val + '"><input type="checkbox" id="' + val + '">' + val + '</label>'); $('#fehlertypenset').append('<label class="btn btn-default" id="' + val + '"><input type="checkbox" id="' + val + '">' + val + '</label>');
//$('#'+ val +'.btn').button('toggle'); //$('#'+ val +'.btn').button('toggle');
}); });
$('.hasFehler').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) { $('.hasFehler').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) {
var newFehler = 0; var newFehler = 0;
var actualRow = $(this); var actualRow = $(this);
$.each(activeFehlertypes, function(key, val) { $.each(activeFehlertypes, function(key, val) {
newFehler = newFehler + parseInt(actualRow.attr(val)); newFehler = newFehler + parseInt(actualRow.attr(val));
}); });
$(this).css("background-color", calcColor(newFehler, newMaxFehler)) $(this).css("background-color", calcColor(newFehler, newMaxFehler))
.css('cursor', 'pointer'); .css('cursor', 'pointer');
}); });
//Auf Änderungen bzgl. des Fehler-Buttonset horchen //Auf Änderungen bzgl. des Fehler-Buttonset horchen
$('#fehlertypenset input[type=checkbox]').change(function() {setTimeout(function(){ $('#fehlertypenset input[type=checkbox]').change(function() {setTimeout(function(){
//console.log("aenderung!"); //console.log("aenderung!");
var activeFehlertypes = new Array(); var activeFehlertypes = new Array();
var newMaxFehler = 0; var newMaxFehler = 0;
$('#fehlertypenset > .active').each(function(){ $('#fehlertypenset > .active').each(function(){
activeFehlertypes.push($(this).attr("id")); activeFehlertypes.push($(this).attr("id"));
}); });
$.each(activeFehlertypes,function(key, name){ $.each(activeFehlertypes,function(key, name){
//Neuen MaxFehler berechnen //Neuen MaxFehler berechnen
newMaxFehler = newMaxFehler + parseInt($('#maxFehler').attr(name)); newMaxFehler = newMaxFehler + parseInt($('#maxFehler').attr(name));
}); });
$('.hasFehler').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); $('.hasFehler').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]);
$('.maxFehlerMapping').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); $('.maxFehlerMapping').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]);
},100)}); },100)});
}); });
}); });
}); });