Customize web interface - Adding tab functionality

Helge Blischke h.blischke at acm.org
Fri Sep 7 06:50:23 PDT 2012


Allan Wolfe wrote:

> 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>&#x25b2;</SMALL>
> Queue Name <SMALL>&#x25b2;</SMALL>:<SMALL>&#x25bc;</SMALL> Queue Name
> 
<SMALL>&#x25bc;</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.

Perhaps you should try to incorporate your problems stuff into the jobs 
template, as - as I understand how CUPS works here - the HREF attributes are 
evaluated by the corresponding cgi program (e.g. jobs.cgi). Or you need to 
compile your own problems.cgi .

Helge





More information about the cups mailing list