MCPcopy Create free account
hub / github.com/OpenPrinting/cups / show_all_classes

Function show_all_classes

cgi-bin/classes.c:289–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287 */
288
289static void
290show_all_classes(http_t *http, /* I - Connection to server */
291 const char *user) /* I - Username */
292{
293 int i; /* Looping var */
294 ipp_t *request, /* IPP request */
295 *response; /* IPP response */
296 cups_array_t *classes; /* Array of class objects */
297 ipp_attribute_t *pclass; /* Class object */
298 int first, /* First class to show */
299 count; /* Number of classes */
300 const char *var; /* Form variable */
301 void *search; /* Search data */
302 char val[1024]; /* Form variable */
303
304
305 /*
306 * Show the standard header...
307 */
308
309 cgiStartHTML(cgiText(_("Classes")));
310
311 /*
312 * Build a CUPS_GET_CLASSES request, which requires the following
313 * attributes:
314 *
315 * attributes-charset
316 * attributes-natural-language
317 * requesting-user-name
318 */
319
320 request = ippNewRequest(CUPS_GET_CLASSES);
321
322 if (user)
323 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
324 "requesting-user-name", NULL, user);
325
326 cgiGetAttributes(request, "classes.tmpl");
327
328 /*
329 * Do the request and get back a response...
330 */
331
332 if ((response = cupsDoRequest(http, request, "/")) != NULL)
333 {
334 /*
335 * Get a list of matching job objects.
336 */
337
338 if ((var = cgiGetTextfield("QUERY")) != NULL &&
339 !cgiGetVariable("CLEAR"))
340 search = cgiCompileSearch(var);
341 else
342 search = NULL;
343
344 classes = cgiGetIPPObjects(response, search);
345 count = cupsArrayCount(classes);
346

Callers 1

mainFunction · 0.85

Calls 15

cgiStartHTMLFunction · 0.85
cgiTextFunction · 0.85
ippNewRequestFunction · 0.85
ippAddStringFunction · 0.85
cgiGetAttributesFunction · 0.85
cupsDoRequestFunction · 0.85
cgiGetTextfieldFunction · 0.85
cgiGetVariableFunction · 0.85
cgiCompileSearchFunction · 0.85
cgiGetIPPObjectsFunction · 0.85
cupsArrayCountFunction · 0.85
cgiFreeSearchFunction · 0.85

Tested by

no test coverage detected