Sat, 26 Jul 2014 13:18:00 +0200
Profiles now have a busy state
--- a/thermferm/rdconfig.c Fri Jul 25 23:28:44 2014 +0200 +++ b/thermferm/rdconfig.c Sat Jul 26 13:18:00 2014 +0200 @@ -444,6 +444,10 @@ syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); return 1; } + if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BUSY", "%d", tmp4->busy)) < 0) { + syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); + return 1; + } if (tmp4->steps) { if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "STEPS")) < 0) { syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); @@ -928,11 +932,13 @@ { xmlChar *key; profiles_list *profile, *tmp; + int ival; profile = (profiles_list *)malloc(sizeof(profiles_list)); profile->next = NULL; profile->version = 1; profile->uuid = profile->name = NULL; + profile->busy = 0; profile->steps = NULL; cur = cur->xmlChildrenNode; @@ -952,6 +958,12 @@ if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { profile->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BUSY"))) { + key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + if (sscanf((const char *)key, "%d", &ival) == 1) + profile->busy = ival; + xmlFree(key); + } if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEPS"))) { parseSteps(doc, cur, &(profile)->steps); }
--- a/thermferm/server.c Fri Jul 25 23:28:44 2014 +0200 +++ b/thermferm/server.c Sat Jul 26 13:18:00 2014 +0200 @@ -332,7 +332,7 @@ j = 0; for (step = profile->steps; step; step = step->next) j++; - srv_send((char *)"%s,%s,%d", profile->uuid, profile->name, j); + srv_send((char *)"%s,%s,%d,%d", profile->uuid, profile->name, j, profile->busy); } srv_send((char *)"."); return 0;
--- a/thermferm/thermferm.h Fri Jul 25 23:28:44 2014 +0200 +++ b/thermferm/thermferm.h Sat Jul 26 13:18:00 2014 +0200 @@ -125,6 +125,7 @@ int version; /* Version 1 */ char *uuid; /* Profile uuid */ char *name; /* Profile name */ + int busy; /* Profile busy == 1, free == 0 */ prof_step *steps; /* Profile steps */ } profiles_list;
--- a/www-thermferm/profiles.php Fri Jul 25 23:28:44 2014 +0200 +++ b/www-thermferm/profiles.php Sat Jul 26 13:18:00 2014 +0200 @@ -86,6 +86,10 @@ +/* + * @link Edit profile + * @link Add profile + */ function profile_list() { $sock = open_socket(); @@ -112,7 +116,12 @@ $outstr .= ' <div id="etable">'.PHP_EOL; $outstr .= ' <table class="setup">'.PHP_EOL; - $outstr .= ' <tr style="background-color: #FFCC01;"><td class="setup">UUID</td><td class="setup">Name</td><td class="setup">Steps</td><td class="setup">spare</td></tr>'.PHP_EOL; + $outstr .= ' <tr style="background-color: #FFCC01;">'.PHP_EOL; + $outstr .= ' <td class="setup">UUID</td>'.PHP_EOL; + $outstr .= ' <td class="setup">Name</td>'.PHP_EOL; + $outstr .= ' <td class="setup">Steps</td>'.PHP_EOL; + $outstr .= ' <td class="setup">Edit</td>'.PHP_EOL; + $outstr .= ' </tr>'.PHP_EOL; if (startsWith($arr[0], "212")) { $j = 1; @@ -120,7 +129,16 @@ if (strcmp($arr[$j], ".") == 0) break; $f = explode(",", $arr[$j]); - $outstr .= ' <tr class="setup"><td class="setup">'.$f[0].'</td><td class="setup">'.$f[1].'</td><td class="setup">'.$f[2].'</td><td class="setup">bla</td></tr>'.PHP_EOL; + $busy = 0; + $outstr .= ' <tr class="setup">'.PHP_EOL; + $outstr .= ' <td class="setup">'.$f[0].'</td>'.PHP_EOL; + $outstr .= ' <td class="setup">'.$f[1].'</td>'.PHP_EOL; + $outstr .= ' <td class="setup">'.$f[2].'</td>'.PHP_EOL; + if ($busy == 1) + $outstr .= ' <td class="setup">Busy</td>'.PHP_EOL; + else + $outstr .= ' <td class="setup"><a href="profiles.php?action=edit&UUID='.$f[0].'">Edit</a></td>'.PHP_EOL; + $outstr .= ' </tr>'.PHP_EOL; $j++; } }