/*
* "$Id$"
*
- * Job status CGI for the Common UNIX Printing System (CUPS).
+ * Job status CGI for CUPS.
*
+ * Copyright 2007-2012 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*
* Contents:
*
*/
cgiSetVariable("SECTION", "jobs");
+ cgiSetVariable("REFRESH_PAGE", "");
/*
* Connect to the HTTP server...
* Do the operation...
*/
- if ((op = cgiGetVariable("OP")) != NULL && job_id > 0)
+ if ((op = cgiGetVariable("OP")) != NULL && job_id > 0 && cgiIsPOST())
{
/*
* Do the operation...
ippDelete(cupsDoRequest(http, request, "/jobs"));
+ if (cupsLastError() <= IPP_OK_CONFLICT && getenv("HTTP_REFERER"))
+ {
+ /*
+ * Redirect successful updates back to the parent page...
+ */
+
+ char url[1024]; /* Encoded URL */
+
+
+ strlcpy(url, "5;URL=", sizeof(url));
+ cgiFormEncode(url + 6, getenv("HTTP_REFERER"), sizeof(url) - 6);
+ cgiSetVariable("refresh_page", url);
+ }
+ else if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
+
cgiStartHTML(cgiText(_("Jobs")));
if (cupsLastError() > IPP_OK_CONFLICT)
- cgiShowIPPError(_("Job operation failed:"));
+ cgiShowIPPError(_("Job operation failed"));
else if (op == IPP_CANCEL_JOB)
cgiCopyTemplateLang("job-cancel.tmpl");
else if (op == IPP_HOLD_JOB)