more work on aqhome-cgi.
This commit is contained in:
@@ -36,6 +36,8 @@
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void _addLinkForDevice(const char *page, const char *sDevice, const char *action, const char *imgName, GWEN_BUFFER *dbuf);
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@@ -67,6 +69,7 @@ void AQH_ModDevices_RunIndex(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *sess
|
||||
"<th>Room</th>"
|
||||
"<th>Location</th>"
|
||||
"<th>Description</th>"
|
||||
"<th>Actions</th>"
|
||||
"</tr>\n"
|
||||
"</thead>\n"
|
||||
"<tbody>\n");
|
||||
@@ -74,17 +77,12 @@ void AQH_ModDevices_RunIndex(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *sess
|
||||
device=AQH_Device_List_First(deviceList);
|
||||
while(device) {
|
||||
const char *s;
|
||||
const char *sDevice;
|
||||
|
||||
GBAA(dbuf, "<tr>");
|
||||
/* name for system */
|
||||
s=AQH_Device_GetNameForSystem(device);
|
||||
if (perms & AQH_MODDEVICES_PERMS_VALUEREAD) {
|
||||
GBAS(dbuf,"<td><a href=\"values.html?device=");
|
||||
GWEN_Text_EscapeToBufferTolerant(s, dbuf);
|
||||
GBAA(dbuf,"\">%s</a></td>", s?s:"");
|
||||
}
|
||||
else
|
||||
GBAA(dbuf,"<td>%s</td>", s?s:"");
|
||||
sDevice=AQH_Device_GetNameForSystem(device);
|
||||
GBAA(dbuf,"<td>%s</td>", sDevice?sDevice:"");
|
||||
/* room */
|
||||
s=AQH_Device_GetRoomName(device);
|
||||
GBAA(dbuf, "<td>%s</td>", s?s:"");
|
||||
@@ -95,6 +93,14 @@ void AQH_ModDevices_RunIndex(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *sess
|
||||
s=AQH_Device_GetDescription(device);
|
||||
GBAA(dbuf, "<td>%s</td>", s?s:"");
|
||||
|
||||
GBAS(dbuf, "<td>");
|
||||
if (perms & AQH_MODDEVICES_PERMS_VALUEREAD) {
|
||||
_addLinkForDevice("vtable.html", sDevice, "table view", "/pics/document-table.png", dbuf);
|
||||
_addLinkForDevice("vgraph.html", sDevice, "graph view", "/pics/graph.png", dbuf);
|
||||
// TODO: add edit link
|
||||
}
|
||||
GBAS(dbuf, "</td>");
|
||||
|
||||
GBAA(dbuf, "</tr>");
|
||||
device=AQH_Device_List_Next(device);
|
||||
}
|
||||
@@ -107,4 +113,15 @@ void AQH_ModDevices_RunIndex(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *sess
|
||||
|
||||
|
||||
|
||||
void _addLinkForDevice(const char *page, const char *sDevice, const char *action, const char *imgName, GWEN_BUFFER *dbuf)
|
||||
{
|
||||
GBAA(dbuf,"<a href=\"%s?device=", page);
|
||||
GWEN_Text_EscapeToBufferTolerant(sDevice, dbuf);
|
||||
GBAS(dbuf,"\">");
|
||||
GBAA(dbuf,"<img src=\"%s\" alt=\"action\" />", imgName);
|
||||
GBAS(dbuf,"</a>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user