]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cgi-bin/jobs.c
Update svn:keyword properties.
[thirdparty/cups.git] / cgi-bin / jobs.c
index 3a14cc0836e069de6a561fbb5cd653046c479ba6..e57b0218d0b5a9008ca329baa4c84683b0e3c97e 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: jobs.c 177 2006-06-21 00:20:03Z jlovell $"
+ * "$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:
  *
@@ -66,6 +57,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
   */
 
   cgiSetVariable("SECTION", "jobs");
+  cgiSetVariable("REFRESH_PAGE", "");
 
  /*
   * Connect to the HTTP server...
@@ -86,7 +78,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
   * Do the operation...
   */
 
-  if ((op = cgiGetVariable("OP")) != NULL && job_id > 0)
+  if ((op = cgiGetVariable("OP")) != NULL && job_id > 0 && cgiIsPOST())
   {
    /*
     * Do the operation...
@@ -181,10 +173,29 @@ do_job_op(http_t      *http,              /* I - HTTP connection */
 
   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)
@@ -199,5 +210,5 @@ do_job_op(http_t      *http,                /* I - HTTP connection */
 
 
 /*
- * End of "$Id: jobs.c 177 2006-06-21 00:20:03Z jlovell $".
+ * End of "$Id$".
  */