]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Move list of new printers to a separate page.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 3 Apr 2007 23:17:17 +0000 (23:17 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 3 Apr 2007 23:17:17 +0000 (23:17 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@6440 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
cgi-bin/admin.c
templates/Makefile
templates/admin.tmpl
templates/list-available-printers.tmpl [new file with mode: 0644]
tools/buttons.txt

index 6ed291ec62f0fdde4610d5633589a3e5b634f75f..dc564ca56e0b380478178bf83dbd6bfcf9916ccc 100644 (file)
@@ -4,6 +4,10 @@ CHANGES.txt - 2007-04-03
 CHANGES IN CUPS V1.3
 
        - Documentation updates (STR #1775, STR #2130, STR #2131)
+       - The web interface no longer lists new printers on the
+         main administration page.  Instead, a new "List Available
+         Printers" button is provided that shows a separate page
+         with the list of printers.
        - The web interface now supports setting the banner and
          policy options on raw printers and classes (STR #2238)
        - The socket backend now reads any pending back-channel
index 8068e44008a5d1ca5a4c2fb0d114de1db67f2cc3..d0b78f176b380bdac63514c283e856aee1b581a8 100644 (file)
@@ -32,6 +32,7 @@
  *   do_delete_class()         - Delete a class...
  *   do_delete_printer()       - Delete a printer...
  *   do_export()               - Export printers to Samba...
+ *   do_list_printers()        - List available printers...
  *   do_menu()                 - Show the main menu...
  *   do_printer_op()           - Do a printer operation.
  *   do_set_allowed_users()    - Set the allowed/denied users for a queue.
@@ -66,6 +67,7 @@ static void   do_config_server(http_t *http);
 static void    do_delete_class(http_t *http);
 static void    do_delete_printer(http_t *http);
 static void    do_export(http_t *http);
+static void    do_list_printers(http_t *http);
 static void    do_menu(http_t *http);
 static void    do_printer_op(http_t *http,
                              ipp_op_t op, const char *title);
@@ -172,6 +174,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
       do_printer_op(http, CUPS_SET_DEFAULT, cgiText(_("Set As Default")));
     else if (!strcmp(op, "set-sharing"))
       do_set_sharing(http);
+    else if (!strcmp(op, "list-available-printers"))
+      do_list_printers(http);
     else if (!strcmp(op, "add-class"))
       do_am_class(http, 0);
     else if (!strcmp(op, "add-printer"))
@@ -1923,66 +1927,19 @@ do_export(http_t *http)                 /* I - HTTP connection */
 
 
 /*
- * 'do_menu()' - Show the main menu...
+ * 'do_list_printers()' - List available printers...
  */
 
 static void
-do_menu(http_t *http)                  /* I - HTTP connection */
+do_list_printers(http_t *http)         /* I - HTTP connection */
 {
-  int          num_settings;           /* Number of server settings */
-  cups_option_t        *settings;              /* Server settings */
-  const char   *val;                   /* Setting value */
-  char         filename[1024];         /* Temporary filename */
-  const char   *datadir;               /* Location of data files */
   ipp_t                *request,               /* IPP request */
                *response;              /* IPP response */
   ipp_attribute_t *attr;               /* IPP attribute */
 
 
- /*
-  * Get the current server settings...
-  */
-
-  if (!cupsAdminGetServerSettings(http, &num_settings, &settings))
-  {
-    cgiSetVariable("SETTINGS_MESSAGE",
-                   cgiText(_("Unable to open cupsd.conf file:")));
-    cgiSetVariable("SETTINGS_ERROR", cupsLastErrorString());
-  }
-
-  if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, num_settings,
-                           settings)) != NULL && atoi(val))
-    cgiSetVariable("DEBUG_LOGGING", "CHECKED");
-
-  if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, num_settings,
-                           settings)) != NULL && atoi(val))
-    cgiSetVariable("REMOTE_ADMIN", "CHECKED");
-
-  if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, num_settings,
-                           settings)) != NULL && atoi(val))
-    cgiSetVariable("REMOTE_ANY", "CHECKED");
-
-  if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, num_settings,
-                           settings)) != NULL && atoi(val))
-    cgiSetVariable("REMOTE_PRINTERS", "CHECKED");
-
-  if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, num_settings,
-                           settings)) != NULL && atoi(val))
-    cgiSetVariable("SHARE_PRINTERS", "CHECKED");
-
-  if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, num_settings,
-                           settings)) != NULL && atoi(val))
-    cgiSetVariable("USER_CANCEL_ANY", "CHECKED");
-
-#ifdef HAVE_GSSAPI
-  cgiSetVariable("HAVE_GSSAPI", "1");
-
-  if ((val = cupsGetOption("DefaultAuthType", num_settings,
-                           settings)) != NULL && !strcasecmp(val, "Negotiate"))
-    cgiSetVariable("KERBEROS", "CHECKED");
-#endif /* HAVE_GSSAPI */
-
-  cupsFreeOptions(num_settings, settings);
+  cgiStartHTML(cgiText(_("List Available Printers")));
+  fflush(stdout);
 
  /*
   * Get the list of printers and their devices...
@@ -2195,6 +2152,77 @@ do_menu(http_t *http)                    /* I - HTTP connection */
     }
   }
 
+ /*
+  * Finally, show the printer list...
+  */
+
+  cgiCopyTemplateLang("list-available-printers.tmpl");
+
+  cgiEndHTML();
+}
+
+
+/*
+ * 'do_menu()' - Show the main menu...
+ */
+
+static void
+do_menu(http_t *http)                  /* I - HTTP connection */
+{
+  int          num_settings;           /* Number of server settings */
+  cups_option_t        *settings;              /* Server settings */
+  const char   *val;                   /* Setting value */
+  char         filename[1024];         /* Temporary filename */
+  const char   *datadir;               /* Location of data files */
+  ipp_t                *request,               /* IPP request */
+               *response;              /* IPP response */
+
+
+ /*
+  * Get the current server settings...
+  */
+
+  if (!cupsAdminGetServerSettings(http, &num_settings, &settings))
+  {
+    cgiSetVariable("SETTINGS_MESSAGE",
+                   cgiText(_("Unable to open cupsd.conf file:")));
+    cgiSetVariable("SETTINGS_ERROR", cupsLastErrorString());
+  }
+
+  if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("DEBUG_LOGGING", "CHECKED");
+
+  if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("REMOTE_ADMIN", "CHECKED");
+
+  if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("REMOTE_ANY", "CHECKED");
+
+  if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("REMOTE_PRINTERS", "CHECKED");
+
+  if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("SHARE_PRINTERS", "CHECKED");
+
+  if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("USER_CANCEL_ANY", "CHECKED");
+
+#ifdef HAVE_GSSAPI
+  cgiSetVariable("HAVE_GSSAPI", "1");
+
+  if ((val = cupsGetOption("DefaultAuthType", num_settings,
+                           settings)) != NULL && !strcasecmp(val, "Negotiate"))
+    cgiSetVariable("KERBEROS", "CHECKED");
+#endif /* HAVE_GSSAPI */
+
+  cupsFreeOptions(num_settings, settings);
+
  /*
   * See if Samba and the Windows drivers are installed...
   */
index 3d65f26ed2aa0961b7d998fd40ed409198e1648f..bf505a902bad9cb4e7f79855e68d5cd2123fb547 100644 (file)
@@ -3,7 +3,7 @@
 #
 #   Template makefile for the Common UNIX Printing System (CUPS).
 #
-#   Copyright 1993-2006 by Easy Software Products.
+#   Copyright 1993-2007 by Easy Software Products.
 #
 #   These coded instructions, statements, and computer programs are the
 #   property of Easy Software Products and are protected by Federal
@@ -58,6 +58,7 @@ FILES =       \
                job-restart.tmpl \
                jobs.tmpl \
                jobs-header.tmpl \
+               list-available-printers.tmpl \
                maintenance.tmpl \
                modify-class.tmpl \
                modify-printer.tmpl \
index 137e26475b80fa5af93f5ecd66654596e06fae7d..91aafc4691fa72dd348c4988fa4981c97f9d31e4 100644 (file)
@@ -6,6 +6,9 @@
 <P>
 <A HREF="/admin?op=add-printer"><IMG
 SRC="/images/button-add-printer.gif" ALT="Add Printer" CLASS="button"></A>
+<A HREF="/admin?op=list-available-printers"><IMG
+SRC="/images/button-list-available-printers.gif"
+ALT="List Available Printers" CLASS="button"></A>
 <A HREF="/printers/"><IMG SRC="/images/button-manage-printers.gif"
 ALT="Manage Printers" CLASS="button"></A>
 {have_samba?<A HREF="/admin/?op=export-samba"><IMG
@@ -13,13 +16,6 @@ SRC="/images/button-export-samba.gif" ALT="Export Printers to Samba"
 CLASS="button"></A>:}
 </P>
 
-{#device_uri=0?:<P><B>New Printers Found:</B></P><UL>{[device_uri]
-<LI><A HREF="/admin?op=add-printer&amp;{device_options}"><IMG
-SRC="/images/button-add-this-printer.gif" ALT="Add This Printer" CLASS="button"
-ALIGN="MIDDLE"></A>
-{device_make_and_model} ({device_info})</LI>
-}</UL>}
-
 <H2 CLASS="title">Classes</H2>
 
 <P>
diff --git a/templates/list-available-printers.tmpl b/templates/list-available-printers.tmpl
new file mode 100644 (file)
index 0000000..bd7ff88
--- /dev/null
@@ -0,0 +1,10 @@
+<H2 CLASS="title">Available Printers</H2>
+
+{#device_uri=0?<P>No printers found.</P>
+:<UL>{[device_uri]
+<LI><A HREF="/admin?op=add-printer&amp;{device_options}"><IMG
+SRC="/images/button-add-this-printer.gif" ALT="Add This Printer" CLASS="button"
+ALIGN="MIDDLE"></A>
+{device_make_and_model} ({device_info})</LI>
+}</UL>}
+
index 51cc4e40974b297a5312589662a3a2c35fb44626..de5defd2938271b2430cbfffcf0d5bc45557d65c 100644 (file)
@@ -22,6 +22,7 @@ button-manage-printers.gif        standard  Manage Printers
 button-manage-server.gif           standard  Manage Server
 button-modify-class.gif            standard  Modify Class
 button-modify-printer.gif          standard  Modify Printer
+button-list-available-printers.gif  standard  List Available Printers
 button-move-job.gif                standard  Move Job
 button-move-jobs.gif               standard  Move All Jobs
 button-print-self-test-page.gif     standard  Print Self-Test Page