diff options
author | jlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2006-04-24 18:03:36 +0000 |
---|---|---|
committer | jlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2006-04-24 18:03:36 +0000 |
commit | 89d46774ee527faaaf27d1b696554f4508bf105b (patch) | |
tree | 27ae92ec2e5df36836fc505515ab45f9a06cebc1 /cgi-bin | |
parent | e53920b9224e07b7d5f3e5a3ffea1f64ded479d2 (diff) |
Load cups into easysw/current.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@136 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cgi-bin')
-rw-r--r-- | cgi-bin/admin.c | 75 | ||||
-rw-r--r-- | cgi-bin/ipp-var.c | 8 |
2 files changed, 52 insertions, 31 deletions
diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index a3d4d7f3b..aac69d973 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -1,5 +1,5 @@ /* - * "$Id: admin.c 5360 2006-03-30 17:02:17Z mike $" + * "$Id: admin.c 5425 2006-04-18 19:59:05Z mike $" * * Administration CGI for the Common UNIX Printing System (CUPS). * @@ -506,9 +506,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ int modify) /* I - Modify the printer? */ { int i; /* Looping var */ - int element; /* Element number */ - ipp_attribute_t *attr, /* Current attribute */ - *last; /* Last attribute */ + ipp_attribute_t *attr; /* Current attribute */ ipp_t *request, /* IPP request */ *response, /* IPP response */ *oldinfo; /* Old printer information */ @@ -855,27 +853,31 @@ do_am_printer(http_t *http, /* I - HTTP connection */ * Got the list of PPDs, see if the user has selected a make... */ - cgiSetIPPVars(response, NULL, NULL, NULL, 0); - - if (var == NULL) + if (cgiSetIPPVars(response, NULL, NULL, NULL, 0) == 0) { /* - * Let the user choose a make... + * No PPD files with this make, try again with all makes... */ - for (element = 0, attr = response->attrs, last = NULL; - attr != NULL; - attr = attr->next) - if (attr->name && strcmp(attr->name, "ppd-make") == 0) - if (last == NULL || - strcasecmp(last->values[0].string.text, - attr->values[0].string.text) != 0) - { - cgiSetArray("PPD_MAKE", element, attr->values[0].string.text); - element ++; - last = attr; - } + ippDelete(response); + + request = ippNewRequest(CUPS_GET_PPDS); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", + NULL, "ipp://localhost/printers/"); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, + "requested-attributes", NULL, "ppd-make"); + if ((response = cupsDoRequest(http, request, "/")) != NULL) + cgiSetIPPVars(response, NULL, NULL, NULL, 0); + + cgiStartHTML(title); + cgiCopyTemplateLang("choose-make.tmpl"); + cgiEndHTML(); + } + else if (!var) + { cgiStartHTML(title); cgiCopyTemplateLang("choose-make.tmpl"); cgiEndHTML(); @@ -931,7 +933,6 @@ do_am_printer(http_t *http, /* I - HTTP connection */ cgiEndHTML(); } - ippDelete(response); } else @@ -1182,7 +1183,7 @@ do_config_printer(http_t *http) /* I - HTTP connection */ ppdLocalize(ppd); - cgiStartHTML("Set Printer Options"); + cgiStartHTML(cgiText(_("Set Printer Options"))); cgiCopyTemplateLang("set-printer-options-header.tmpl"); if (ppdConflicts(ppd)) @@ -1451,7 +1452,7 @@ do_config_printer(http_t *http) /* I - HTTP connection */ if (!in || !out) { cgiSetVariable("ERROR", strerror(errno)); - cgiStartHTML("Set Printer Options"); + cgiStartHTML(cgiText(_("Set Printer Options"))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -1814,7 +1815,7 @@ do_config_server(http_t *http) /* I - HTTP connection */ * Show the current config file... */ - cgiStartHTML("Edit Configuration File"); + cgiStartHTML(cgiText(_("Edit Configuration File"))); printf("<!-- \"%s\" -->\n", filename); @@ -1837,10 +1838,13 @@ do_delete_class(http_t *http) /* I - HTTP connection */ const char *pclass; /* Printer class name */ - cgiStartHTML(cgiText(_("Delete Class"))); + /* + * Get form variables... + */ if (cgiGetVariable("CONFIRM") == NULL) { + cgiStartHTML(cgiText(_("Delete Class"))); cgiCopyTemplateLang("class-confirm.tmpl"); cgiEndHTML(); return; @@ -1851,6 +1855,7 @@ do_delete_class(http_t *http) /* I - HTTP connection */ "localhost", 0, "/classes/%s", pclass); else { + cgiStartHTML(cgiText(_("Delete Class"))); cgiSetVariable("ERROR", cgiText(_("Missing form variable!"))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -1877,6 +1882,12 @@ do_delete_class(http_t *http) /* I - HTTP connection */ ippDelete(cupsDoRequest(http, request, "/admin/")); + /* + * Show the results... + */ + + cgiStartHTML(cgiText(_("Delete Class"))); + if (cupsLastError() > IPP_OK_CONFLICT) cgiShowIPPError(_("Unable to delete class:")); else @@ -1898,10 +1909,13 @@ do_delete_printer(http_t *http) /* I - HTTP connection */ const char *printer; /* Printer printer name */ - cgiStartHTML(cgiText(_("Delete Printer"))); + /* + * Get form variables... + */ if (cgiGetVariable("CONFIRM") == NULL) { + cgiStartHTML(cgiText(_("Delete Printer"))); cgiCopyTemplateLang("printer-confirm.tmpl"); cgiEndHTML(); return; @@ -1912,6 +1926,7 @@ do_delete_printer(http_t *http) /* I - HTTP connection */ "localhost", 0, "/printers/%s", printer); else { + cgiStartHTML(cgiText(_("Delete Printer"))); cgiSetVariable("ERROR", cgiText(_("Missing form variable!"))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -1938,6 +1953,12 @@ do_delete_printer(http_t *http) /* I - HTTP connection */ ippDelete(cupsDoRequest(http, request, "/admin/")); + /* + * Show the results... + */ + + cgiStartHTML(cgiText(_("Delete Printer"))); + if (cupsLastError() > IPP_OK_CONFLICT) cgiShowIPPError(_("Unable to delete printer:")); else @@ -2867,5 +2888,5 @@ match_string(const char *a, /* I - First string */ /* - * End of "$Id: admin.c 5360 2006-03-30 17:02:17Z mike $". + * End of "$Id: admin.c 5425 2006-04-18 19:59:05Z mike $". */ diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c index 274c8e9b8..583a9f745 100644 --- a/cgi-bin/ipp-var.c +++ b/cgi-bin/ipp-var.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp-var.c 5235 2006-03-06 13:02:23Z mike $" + * "$Id: ipp-var.c 5425 2006-04-18 19:59:05Z mike $" * * CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS). * @@ -1035,9 +1035,9 @@ cgiSetIPPVars(ipp_t *response, /* I - Response data to be copied... */ attr = cgiSetIPPObjectVars(attr, prefix, element); } - fprintf(stderr, "DEBUG2: Returing %d from cgiSetIPPVars()...\n", element + 1); + fprintf(stderr, "DEBUG2: Returing %d from cgiSetIPPVars()...\n", element); - return (element + 1); + return (element); } @@ -1277,5 +1277,5 @@ cgiText(const char *message) /* I - Message */ /* - * End of "$Id: ipp-var.c 5235 2006-03-06 13:02:23Z mike $". + * End of "$Id: ipp-var.c 5425 2006-04-18 19:59:05Z mike $". */ |