Customize web interface - Adding tab functionality
Allan Wolfe
allan.wolfe at anadarko.com
Thu Sep 6 13:53:44 PDT 2012
The problem I'm working with here is that we have some 200+ printers on the network. With that many printers it is onerous for an operator to parse through all the printer listing via the "Printers" tab/view. I'm working to add a "Problems" tab/view and filter for anything "printer_state!3" (i.e. "Idle").
Reading the manuals I'm seeing the basics for structuring a filter and understand a bit of the methods readily available. The problem I'm having is getting the template reference tied back into the html.
I've added a templates/problems.tmpl and modified the www/index.html and templates/header.tmpl to add this (respectively):
index.html
[clipped]
<TD CLASS="unsel"><A HREF="/printers/"> Printers </A></TD>
<TD CLASS="unsel"><A HREF="/problems/"> Problems </A></TD>
[clipped]
header.tmpl
[clipped]
<TD CLASS="{SECTION=printers?:un}sel"><A HREF="/printers/"> Printers </A></TD>
<TD CLASS="{SECTION=problems?:un}sel"><A HREF="/problems/"> Problems </A></TD>
[clipped]
problems.tmpl
{#printer_name=0?:
<TABLE CLASS="list" SUMMARY="Printer List">
<THEAD>
<TR><TH><A HREF="{THISURL}?QUERY={?QUERY}&WHICH_JOBS={?WHICH_JOBS}&FIRST={FIRST}&ORDER={ORDER=dec?asc:dec}">{ORDER=dec?<SMALL>▲</SMALL> Queue Name <SMALL>▲</SMALL>:<SMALL>▼</SMALL> Queue Name <SMALL>▼</SMALL>}</A></TH><TH>Description</TH><TH>Location</TH><TH>Make and Model</TH><TH>Status</TH></TR>
</THEAD>
<TBODY>
{{printer_state!3?true:false}
{[printer_name]
<TR><TD><A HREF="{printer_uri_supported}">{printer_name}</A></TD><TD>{printer_info}</TD><TD>{printer_location}</TD><TD>{printer_make_and_model}</TD><TD>{printer_state=3?Idle:{printer_state=4?Processing:Paused}}{printer_state_message? - "{printer_state_message}":}</TD></TR>
}
}
</TBODY>
</TABLE></DIV>}
I see the tab appear on the webpage but get a 404 when invoking the tab. What am I missing (or worse doing wrong)? Thanks in advance.
More information about the cups
mailing list