| 287 | */ |
| 288 | |
| 289 | static void |
| 290 | show_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 |
no test coverage detected