]> git.ipfire.org Git - thirdparty/cups.git/blame - doc/help/translation.html
Load cups into easysw/current.
[thirdparty/cups.git] / doc / help / translation.html
CommitLineData
4744bd90 1<HTML>
2<!-- SECTION: Getting Started -->
3<HEAD>
d09495fa 4 <TITLE>Translating and Customizing CUPS</TITLE>
4744bd90 5</HEAD>
6<BODY>
7
8<P>Thanks to its extensive use of templates, images, and message
9catalogs, CUPS can be easily translated (or customized!) to suit
10your needs. This help file will guide you through the CUPS
11localization files so you can get the most out of it.</P>
12
13<H2 CLASS="title"><A NAME="INTRO">Getting Started</A></H2>
14
15<P>Start by downloading the CUPS source code from <A
16HREF="http://www.cups.org/software.php"
17TARGET="_blank">www.cups.org</A>. After you extract the files
18from the source archive, you will want to copy the following
19files and directories:</P>
20
21<UL>
22
d09495fa 23 <LI><VAR>desktop/cups.desktop</VAR> - the GNOME/KDE
24 desktop file pointing to the CUPS web interface</LI>
25
4744bd90 26 <LI><VAR>doc/images/button-*.gif</VAR> - the web
27 interface button images</LI>
28
29 <LI><VAR>doc/images/button-*.scm</VAR> - the Gimp scripts
30 we use to generate the web interface button images</LI>
31
32 <LI><VAR>doc/index.html</VAR> - the web interface home
33 page</LI>
34
35 <LI><VAR>locale/cups.pot</VAR> - the message catalog</LI>
36
37 <LI><VAR>templates/*.tmpl</VAR> - the web interface
38 template files</LI>
d09495fa 39
4744bd90 40</UL>
41
d09495fa 42<P>With the exception of the message catalogs and desktop file,
43localization files are placed in subdirectories under the
44<VAR>doc</VAR> and <VAR>templates</VAR> using the locale name.
45Locale names are either <VAR>ll</VAR> or <VAR>ll_CC</VAR>, where
46"ll" is the 2-letter language code and "CC" is the 2-letter
47country code.</P>
4744bd90 48
49<P>All non-image files must be encoded using the UTF-8 character
50set.</P>
51
52
53<H2 CLASS="title"><A NAME="SUBMIT">Submitting a Translation for CUPS</A></H2>
54
d09495fa 55<P>To submit a translation for inclusion in CUPS, translate the
56desktop file, all of the button images, template files, the
4744bd90 57<VAR>index.html.in</VAR> file, and the message catalog. Place
58these files in the correct subdirectory in the CUPS source code
59archive and run the following command to create an archive with
60your files:</P>
61
62<PRE CLASS="command">
d09495fa 63tar cvf <I>ll_CC</I>.tar.gz desktop/cups.desktop doc/<I>ll_CC</I> \
64 locale/cups_<I>ll_CC</I>.po templates/<I>ll_CC</I>
4744bd90 65</PRE>
66
67<P>Replace "ll_CC" with the locale name for your translation.
68Once you have created the archive, go to the <A
69HREF="http://www.cups.org/str.php" TARGET="_blank">CUPS Bugs
70&amp; Features</A> page and submit a bug report, attaching the
71translation to the report.</P>
72
73
d09495fa 74<H2 CLASS="title"><A NAME="DESKTOP">The Desktop File</A></H2>
75
76<P>The <VAR>desktop/cups.desktop</VAR> file provides a link to
77the CUPS web interface from desktop environments such as
78GNOME and KDE. To translate this file, add two lines to the
79bottom with the <tt>Name</tt> and <tt>Comment</tt> keys:</P>
80
81<PRE CLASS="command">
82Name[<I>ll_CC</I>]=<I>Translation of "Manage Printing"</I>
83Comment[<I>ll_CC</I>]=<I>Translation of "CUPS Web Interface"</I>
84</PRE>
85
86
4744bd90 87<H2 CLASS="title"><A NAME="IMAGES">Button Images</A></H2>
88
89<P>The web interface button images are used to activate functions
90on the CUPS web pages. Table 1 lists the button images and the
91English text labels for those buttons. Use the supplied Gimp
92scripts to create button images that match the CUPS web interface
93and save them in the <VAR>doc/ll_CC/images</VAR> subdirectory.
94The Gimp button scripts can be installed using the following
95command:</P>
96
97<PRE CLASS="command">
98cp doc/images/button*.scm ~/.gimp-2.2/scripts
99</PRE>
100
101<P>If you have already started the Gimp application, choose
102<VAR>Refresh Scripts</VAR> from the <VAR>Xtns->Script-Fu</VAR>
103sub-menu. The button scripts will be available under a new
104<VAR>Btns</VAR menu in the Gimp tool window.</P>
105
106<P>When you have created all of the button images, edit the
d09495fa 107<VAR>Makedefs</VAR> file and add the locale name to the
4744bd90 108<CODE>LANGUAGES</CODE> variable. You can then run "make
109install" in the <VAR>doc</VAR> subdirectory to test the
110translated buttons.</P>
111
112<DIV CLASS="table"><TABLE SUMMARY="Web Interface Buttons">
113<CAPTION>Table 1: Web Interface Buttons</CAPTION>
114<THEAD>
115<TR>
116 <TH>Filename</TH>
117 <TH>Text</TH>
118</TR>
119</THEAD>
120<TBODY>
121<TR>
122 <TD>button-accept-jobs.gif</TD>
123 <TD>Accept Jobs</TD>
124</TR>
125<TR>
126 <TD>button-add-class.gif</TD>
127 <TD>Add Class</TD>
128</TR>
129<TR>
130 <TD>button-add-printer.gif</TD>
131 <TD>Add Printer</TD>
132</TR>
133<TR>
134 <TD>button-add-this-printer.gif</TD>
135 <TD>Add This Printer</TD>
136</TR>
137<TR>
138 <TD>button-cancel-all-jobs.gif</TD>
139 <TD>Cancel All Jobs</TD>
140</TR>
141<TR>
142 <TD>button-cancel-job.gif</TD>
143 <TD>Cancel Job</TD>
144</TR>
145<TR>
146 <TD>button-change-settings.gif</TD>
147 <TD>Change Settings</TD>
148</TR>
149<TR>
150 <TD>button-clean-print-heads.gif</TD>
151 <TD>Clean Print Heads</TD>
152</TR>
153<TR>
154 <TD>button-clear.gif</TD>
155 <TD>Clear</TD>
156</TR>
157<TR>
158 <TD>button-continue.gif</TD>
159 <TD>Continue</TD>
160</TR>
161<TR>
162 <TD>button-delete-class.gif</TD>
163 <TD>Delete Class</TD>
164</TR>
165<TR>
166 <TD>button-delete-printer.gif</TD>
167 <TD>Delete Printer</TD>
168</TR>
169<TR>
170 <TD>button-edit-configuration-file.gif</TD>
171 <TD>Edit Configuration File</TD>
172</TR>
173<TR>
174 <TD>button-export-samba.gif</TD>
175 <TD>Export Printers to Samba</TD>
176</TR>
177<TR>
178 <TD>button-help.gif</TD>
179 <TD>Help</TD>
180</TR>
181<TR>
182 <TD>button-hold-job.gif</TD>
183 <TD>Hold Job</TD>
184</TR>
185<TR>
186 <TD>button-manage-classes.gif</TD>
187 <TD>Manage Classes</TD>
188</TR>
189<TR>
190 <TD>button-manage-jobs.gif</TD>
191 <TD>Manage Jobs</TD>
192</TR>
193<TR>
194 <TD>button-manage-printers.gif</TD>
195 <TD>Manage Printers</TD>
196</TR>
197<TR>
198 <TD>button-manage-server.gif</TD>
199 <TD>Manage Server</TD>
200</TR>
201<TR>
202 <TD>button-modify-class.gif</TD>
203 <TD>Modify Class</TD>
204</TR>
205<TR>
206 <TD>button-modify-printer.gif</TD>
207 <TD>Modify Printer</TD>
208</TR>
209<TR>
210 <TD>button-move-job.gif</TD>
211 <TD>Move Job</TD>
212</TR>
213<TR>
214 <TD>button-move-jobs.gif</TD>
215 <TD>Move All Jobs</TD>
216</TR>
217<TR>
218 <TD>button-print-self-test-page.gif</TD>
219 <TD>Print Self-Test Page</TD>
220</TR>
221<TR>
222 <TD>button-print-test-page.gif</TD>
223 <TD>Print Test Page</TD>
224</TR>
225<TR>
226 <TD>button-publish-printer.gif</TD>
227 <TD>Publish Printer</TD>
228</TR>
229<TR>
230 <TD>button-reject-jobs.gif</TD>
231 <TD>Reject Jobs</TD>
232</TR>
233<TR>
234 <TD>button-release-job.gif</TD>
235 <TD>Release Job</TD>
236</TR>
237<TR>
238 <TD>button-restart-job.gif</TD>
239 <TD>Reprint Job</TD>
240</TR>
241<TR>
242 <TD>button-save-changes.gif</TD>
243 <TD>Save Changes</TD>
244</TR>
245<TR>
246 <TD>button-search.gif</TD>
247 <TD>Search</TD>
248</TR>
249<TR>
250 <TD>button-set-allowed-users.gif</TD>
251 <TD>Set Allowed Users</TD>
252</TR>
253<TR>
254 <TD>button-set-as-default.gif</TD>
255 <TD>Set As Default</TD>
256</TR>
257<TR>
258 <TD>button-set-printer-options.gif</TD>
259 <TD>Set Printer Options</TD>
260</TR>
261<TR>
262 <TD>button-show-active.gif</TD>
263 <TD>Show Active Jobs</TD>
264</TR>
265<TR>
266 <TD>button-show-all.gif</TD>
267 <TD>Show All Jobs</TD>
268</TR>
269<TR>
270 <TD>button-show-completed.gif</TD>
271 <TD>Show Completed Jobs</TD>
272</TR>
273<TR>
274 <TD>button-show-next.gif</TD>
275 <TD>Show Next</TD>
276</TR>
277<TR>
278 <TD>button-show-previous.gif</TD>
279 <TD>Show Previous</TD>
280</TR>
281<TR>
282 <TD>button-sort-ascending.gif</TD>
283 <TD>Show Ascending</TD>
284</TR>
285<TR>
286 <TD>button-sort-descending.gif</TD>
287 <TD>Show Descending</TD>
288</TR>
289<TR>
290 <TD>button-start-class.gif</TD>
291 <TD>Start Class</TD>
292</TR>
293<TR>
294 <TD>button-start-printer.gif</TD>
295 <TD>Start Printer</TD>
296</TR>
297<TR>
298 <TD>button-stop-class.gif</TD>
299 <TD>Stop Class</TD>
300</TR>
301<TR>
302 <TD>button-stop-printer.gif</TD>
303 <TD>Stop Printer</TD>
304</TR>
305<TR>
306 <TD>button-unpublish-printer.gif</TD>
307 <TD>Unpublish Printer</TD>
308</TR>
309<TR>
310 <TD>button-use-default-config.gif</TD>
311 <TD>Use Default Configuration File</TD>
312</TR>
313<TR>
314 <TD>button-view-access-log.gif</TD>
315 <TD>View Access Log</TD>
316</TR>
317<TR>
318 <TD>button-view-error-log.gif</TD>
319 <TD>View Error Log</TD>
320</TR>
321<TR>
322 <TD>button-view-page-log.gif</TD>
323 <TD>View Page Log</TD>
324</TR>
325<TR>
326 <TD>button-view-printable-version.gif</TD>
327 <TD>View Printable Version</TD>
328</TR>
329</TBODY>
330</TABLE></DIV>
331
332
333<H2 CLASS="title"><A NAME="HOMEPAGE">The Home Page</A></H2>
334
335<P>The <VAR>index.html</VAR> file is a complete HTML file that is
336displayed when the user visits "http://localhost:631/". Edit the
337existing <VAR>doc/index.html</VAR> and save it in the
338<VAR>doc/ll_CC</VAR> subdirectory so that the makefile can
339install it. Run "make install" in the <VAR>doc</VAR> subdirectory
340to test the new home page.</P>
341
342
343<H2 CLASS="title"><A NAME="CATALOGS">Message Catalogs</A></H2>
344
345<P>CUPS message catalogs are GNU gettext ".po" text files that
346provide a list of localized message strings for the CUPS
347software. Message catalogs are named <VAR>cups_ll.po</VAR> or
348<VAR>cups_ll_CC.po</VAR>, where "ll" is the standard 2-letter
349abbreviation for the language and "CC" is the standard 2-letter
350abbreviation for the country.</P>
351
352<P>When translating a new message catalog, copy the
353<VAR>cups.pot</VAR> message catalog file in the <VAR>locale</VAR>
354subdirectory of the CUPS source code. For example, to start
355translating the message catalog to Canadian French, you would
356type the following commands:</P>
357
358<PRE CLASS="command">
359cd locale
d09495fa 360cp cups.pot cups_fr_CA.po
4744bd90 361</PRE>
362
d09495fa 363<P>Alternatively, you can copy the existing <VAR>cups_fr.po</VAR>
4744bd90 364message catalog and then make any necessary changes.</P>
365
366<P>Once you have make your copy of the file, edit it using your
367favorite text editor or translation program to translate the text
368to the desired language.</P>
369
370<P>Finally, add your locale to the <CODE>LANGUAGES</CODE>
d09495fa 371variable in the <VAR>Makedefs</VAR> file and run the "make
4744bd90 372install" command in the <VAR>locale</VAR> subdirectory to test
373the translation.</P>
374
375
376<H2 CLASS="title"><A NAME="TEMPLATES">Template Files</A></H2>
377
378<P>The CUPS scheduler provides a web interface that can be used
379to do many common printing and administration tasks. The built-in
380web server supports localization of web pages through the use of
381subdirectories for each locale, e.g. "fr" for French, "de" for
382German, "fr_ca" for French in Canada, and so forth.</P>
383
384<P>Template files are HTML files with special formatting
385characters in them that allow substition of variables and arrays.
386The CUPS CGI programs (<CODE>admin.cgi</CODE>,
387<CODE>classes.cgi</CODE>, <CODE>help.cgi</CODE>,
388<CODE>jobs.cgi</CODE>, and <CODE>printers.cgi</CODE>) use these
389template file to provide dynamic content for the web interface.
390Template files are installed in the
391<VAR>/usr/share/cups/templates</VAR> directory by default. Table
3922 lists the various template files and their purpose.</P>
393
394<P>Translated versions of the template files should be saved in
395the <VAR>templates/ll_CC</VAR> subdirectory. For example,
396Canadian French template files should be saved in the
397<VAR>templates/fr_CA</VAR> subdirectory. After you have
398translated all of the templates, add the locale to the
399<CODE>LANGUAGES</CODE> variable in the
d09495fa 400<VAR>Makedefs</VAR> file and run "make install" in the
4744bd90 401<VAR>templates</VAR> subdirectory to test the translation.</P>
402
403<DIV CLASS="table"><TABLE SUMMARY="Web Interface Template Files">
404<CAPTION>Table 2: Web Interface Template Files</CAPTION>
405<THEAD>
406<TR>
407 <TH>Filename</TH>
408 <TH>Purpose</TH>
409</TR>
410</THEAD>
411<TBODY>
412<TR>
413 <TD>add-class.tmpl</TD>
414 <TD>This is the initial form that is shown to add a new
415 printer class.</TD>
416</TR>
417<TR>
418 <TD>add-printer.tmpl</TD>
419 <TD>This is the initial form that is shown to add a new
420 printer.</TD>
421</TR>
422<TR>
423 <TD>admin.tmpl</TD>
424 <TD>This is the main administration page.</TD>
425</TR>
426<TR>
427 <TD>choose-device.tmpl</TD>
428 <TD>This is the form that shows the list of available
429 devices.</TD>
430</TR>
431<TR>
432 <TD>choose-make.tmpl</TD>
433 <TD>This is the form that shows the list of available
434 manufacturers.</TD>
435</TR>
436<TR>
437 <TD>choose-model.tmpl</TD>
438 <TD>This is the form that shows the list of available
439 printer models/drivers.</TD>
440</TR>
441<TR>
442 <TD>choose-serial.tmpl</TD>
443 <TD>This is the form that allows the user to choose
444 a serial port and any options.</TD>
445</TR>
446<TR>
447 <TD>choose-uri.tmpl</TD>
448 <TD>This is the form that allows the user to enter
449 a device URI for network printers.</TD>
450</TR>
451<TR>
452 <TD>class-added.tmpl</TD>
453 <TD>This template shows the "class added" message.</TD>
454</TR>
455<TR>
456 <TD>class-confirm.tmpl</TD>
457 <TD>This is the template used to confirm the
458 deletion of a class.</TD>
459</TR>
460<TR>
461 <TD>class-deleted.tmpl</TD>
462 <TD>This template shows the "class deleted" message.</TD>
463</TR>
464<TR>
465 <TD>class-jobs-header.tmpl</TD>
466 <TD>This template shows the "jobs" header for jobs in a
467 class.</TD>
468</TR>
469<TR>
470 <TD>class-modified.tmpl</TD>
471 <TD>This template shows the "class modified" message.</TD>
472</TR>
473<TR>
474 <TD>classes.tmpl</TD>
475 <TD>This template shows one or more printer classes.</TD>
476</TR>
477<TR>
478 <TD>classes-header.tmpl</TD>
479 <TD>This template shows the "showing N of M classes" header in
480 the class list.</TD>
481</TR>
482<TR>
483 <TD>edit-config.tmpl</TD>
484 <TD>This is the cupsd.conf editor page.</TD>
485</TR>
486<TR>
487 <TD>error.tmpl</TD>
488 <TD>This template displays a generic error message.</TD>
489</TR>
490<TR>
491 <TD>error-op.tmpl</TD>
492 <TD>This is the "unknown operation" error page.</TD>
493</TR>
494<TR>
495 <TD>header.tmpl</TD>
496 <TD>This template is used as the standard header on all dynamic
497 content.</TD>
498</TR>
499<TR>
500 <TD>help-header.tmpl</TD>
501 <TD>This is the top part of the help page.</TD>
502</TR>
503<TR>
504 <TD>help-printable.tmpl</TD>
505 <TD>This is the standard page header for the printable
506 version of help files.</TD>
507</TR>
508<TR>
509 <TD>job-cancel.tmpl</TD>
510 <TD>This template shows "job cancelled".</TD>
511</TR>
512<TR>
513 <TD>job-hold.tmpl</TD>
514 <TD>This template shows "job held".</TD>
515</TR>
516<TR>
517 <TD>job-move.tmpl</TD>
518 <TD>This template shows the move-job form.</TD>
519</TR>
520<TR>
521 <TD>job-moved.tmpl</TD>
522 <TD>This template shows "job moved".</TD>
523</TR>
524<TR>
525 <TD>job-release.tmpl</TD>
526 <TD>This template shows "job released".</TD>
527</TR>
528<TR>
529 <TD>job-restart.tmpl</TD>
530 <TD>This template shows "job reprinted".</TD>
531</TR>
532<TR>
533 <TD>jobs.tmpl</TD>
534 <TD>This template is used to list the print jobs on a server,
535 class, or printer.</TD>
536</TR>
537<TR>
538 <TD>jobs-header.tmpl</TD>
539 <TD>This template shows the "showing N or M jobs" header in the
540 jobs list.</TD>
541</TR>
542<TR>
543 <TD>maintenance.tmpl</TD>
544 <TD>This template shows "maintenance commands sent".</TD>
545</TR>
546<TR>
547 <TD>modify-class.tmpl</TD>
548 <TD>This template is used as the first form when modifying a
549 class.</TD>
550</TR>
551<TR>
552 <TD>modify-printer.tmpl</TD>
553 <TD>This template is used as the first form when modifying a
554 printer.</TD>
555</TR>
d09495fa 556<TR>
557 <TD>norestart.tmpl</TD>
558 <TD>This template shows "server not restarted because no
559 changes were made to the configuration".</TD>
560</TR>
4744bd90 561<TR>
562 <TD>option-boolean.tmpl</TD>
563 <TD>This template is used to select a boolean PPD option.</TD>
564</TR>
565<TR>
566 <TD>option-conflict.tmpl</TD>
567 <TD>This template shows the conflicting options.</TD>
568</TR>
569<TR>
570 <TD>option-header.tmpl</TD>
571 <TD>This template is used to start a PPD option group.</TD>
572</TR>
573<TR>
574 <TD>option-pickmany.tmpl</TD>
575 <TD>This template is used to select a multi-valued PPD option.</TD>
576</TR>
577<TR>
578 <TD>option-pickone.tmpl</TD>
579 <TD>This template is used to select a single-valued PPD option.</TD>
580</TR>
581<TR>
582 <TD>option-trailer.tmpl</TD>
583 <TD>This template is used to end a PPD option group.</TD>
584</TR>
585<TR>
586 <TD>pager.tmpl</TD>
587 <TD>This template shows the previous/next pager bar.</TD>
588</TR>
589<TR>
590 <TD>printer-accept.tmpl</TD>
591 <TD>This template shows "printer now accepting jobs".</TD>
592</TR>
593<TR>
594 <TD>printer-added.tmpl</TD>
595 <TD>This template shows "printer added".</TD>
596</TR>
597<TR>
598 <TD>printer-configured.tmpl</TD>
599 <TD>This template shows "printer configured".</TD>
600</TR>
601<TR>
602 <TD>printer-confirm.tmpl</TD>
603 <TD>This template asks the user to confirm the deletion
604 of a printer.</TD>
605</TR>
606<TR>
607 <TD>printer-default.tmpl</TD>
608 <TD>This template shows "default printer set".</TD>
609</TR>
610<TR>
611 <TD>printer-deleted.tmpl</TD>
612 <TD>This template shows "printer deleted".</TD>
613</TR>
614<TR>
615 <TD>printer-jobs-header.tmpl</TD>
616 <TD>This templates shows the "jobs" header for jobs on a
617 printer.</TD>
618</TR>
619<TR>
620 <TD>printer-modified.tmpl</TD>
621 <TD>This template shows "printer modified".</TD>
622</TR>
623<TR>
624 <TD>printer-purge.tmpl</TD>
625 <TD>This template shows "printer has been purged of all jobs".</TD>
626</TR>
627<TR>
628 <TD>printer-reject.tmpl</TD>
629 <TD>This template shows "printer now rejecting jobs".</TD>
630</TR>
631<TR>
632 <TD>printer-start.tmpl</TD>
633 <TD>This template shows "printer started".</TD>
634</TR>
635<TR>
636 <TD>printer-stop.tmpl</TD>
637 <TD>This template shows "printer stopped".</TD>
638</TR>
639<TR>
640 <TD>printers.tmpl</TD>
641 <TD>This template is used to list information on one or more
642 printers.</TD>
643</TR>
644<TR>
645 <TD>printers-header.tmpl</TD>
646 <TD>This template shows the "showing printer N of M" header in
647 the printers list.</TD>
648</TR>
649<TR>
650 <TD>restart.tmpl</TD>
651 <TD>This template shows "server restarting".</TD>
652</TR>
653<TR>
654 <TD>samba-export.tmpl</TD>
655 <TD>This template shows the export printers to Samba form.</TD>
656</TR>
657<TR>
658 <TD>samba-exported.tmpl</TD>
659 <TD>This template shows "printers exported to Samba".</TD>
660</TR>
661<TR>
662 <TD>search.tmpl</TD>
663 <TD>This template shows the search form.</TD>
664</TR>
665<TR>
666 <TD>set-printer-options-header.tmpl</TD>
667 <TD>This template shows the first part of the set printer options
668 form.</TD>
669</TR>
670<TR>
671 <TD>set-printer-options-trailer.tmpl</TD>
672 <TD>This template shows the last part of the set printer options
673 form.</TD>
674</TR>
675<TR>
676 <TD>test-page.tmpl</TD>
677 <TD>This template shows "test page printed".</TD>
678</TR>
679<TR>
680 <TD>trailer.tmpl</TD>
681 <TD>This template is used as the standard trailer on all dynamic
682 content.</TD>
683</TR>
684<TR>
685 <TD>users.tmpl</TD>
686 <TD>This template shows the set allowed users form.</TD>
687</TR>
688</TBODY>
689</TABLE></DIV>
690
691<H3><A NAME="VARIABLE">Inserting Attributes and Values</A></H3>
692
693<P>Template files consist of HTML with variable substitutions for
694named inside curley braces "{name}". Variable names are generally
695the IPP attribute names with the hyphen ("-") replaced by the
696underscore ("_") character. For example, the
697<TT>job-printer-uri</TT> attribute is renamed to
698<TT>job_printer_uri</TT>.</P>
699
700<P>Curley braces ("{" and "}") to indicate substitutions, and the
701backslash ("\") character for quoting. To insert any of these
702special characters as-is you need to use the HTML
703<CODE>&amp;name;</CODE> mechanism or prefix each special
704character with the backslash ("\".)</P>
705
706<P>You substitute the value of a variable using
707<CODE>{NAME}</CODE> in your template file. If the variable is
708undefined then the <CODE>{NAME}</CODE> string is output
709as-is.</P>
710
711<P>To substitute an empty string if the variable is undefined,
712use <CODE>{?NAME}</CODE> instead.</P>
713
714<H3>Array Substitutions</H3>
715
716<P>The number of array elements can be inserted using
717<CODE>{#NAME}</CODE>. If the array is undefined then 0 is output.
718The current array element (starting at 1) is inserted with
719<CODE>{#}</CODE>.</P>
720
721<P>Arrays are handled using <CODE>{[NAME]</CODE> at the beginning
722of a section and <CODE>}</CODE> at the end. The information
723between the closing bracket ("]") and closing brace ("}") is
724repeated for as many elements as are in the named array. For
725example, the following template will display a list of each job
726in the <CODE>job_id</CODE> array:</P>
727
728<PRE CLASS="command">
729&lt;TABLE&gt;
730&lt;TR&gt;
731 &lt;TH&gt;Job ID&lt;/TH&gt;
732 &lt;TH&gt;Destination&lt;/TH&gt;
733 &lt;TH&gt;Title&lt;/TH&gt;
734&lt;/TR&gt;
735
736{[job_id]
737&lt;TR&gt;
738 &lt;TD&gt;{?job_id}&lt;/TD&gt;
739 &lt;TD&gt;{?job_printer_name}&lt;/TD&gt;
740 &lt;TD&gt;{?job_name}&lt;/TD&gt;
741&lt;/TR&gt;
742}
743&lt;/TABLE&gt;
744</PRE>
745
746<P>Arrays can be nested, however all elements within the curley
747braces ("{" and "}") are indexed using the innermost array.</P>
748
749<H3>Conditional Tests</H3>
750
751<P>Templates can also test variables against specific values and
752conditionally include text in the template. The format is:</P>
753
754<PRE CLASS="command">
755{<I>variable</I>?<I>true</I>:<I>false</I>}
756{<I>variable</I>=<I>value</I>?<I>true</I>:<I>false</I>}
757{<I>variable</I>!<I>value</I>?<I>true</I>:<I>false</I>}
758{<I>variable</I>&lt;<I>value</I>?<I>true</I>:<I>false</I>}
759{<I>variable</I>><I>value</I>?<I>true</I>:<I>false</I>}
760</PRE>
761
762<P>where <VAR>true</VAR> is the text that is included if the
763condition is true and <VAR>false</VAR> is the text that is
764included if the condition is false. A value of <CODE>#</CODE> is
765replaced with the current element number (starting at 1.) The
766character after the variable name specifies the condition to
767test. Table 3 shows the available test conditions.</P>
768
769<DIV CLASS="table"><TABLE SUMMARY="Template Substitution Conditions">
770<CAPTION>Table 3: Template Substitution Conditions</CAPTION>
771<TR>
772 <TH>Char</TH>
773 <TH>Condition</TH>
774</TR>
775<TR>
776 <TD>?</TD>
777 <TD>True if <VAR>variable</VAR> exists.</TD>
778</TR>
779<TR>
780 <TD>=</TD>
781 <TD>True if <VAR>variable</VAR> is equal to <VAR>value</VAR>.</TD>
782</TR>
783<TR>
784 <TD>!</TD>
785 <TD>True if <VAR>variable</VAR> is not equal to <VAR>value</VAR>.</TD>
786</TR>
787<TR>
788 <TD>&lt;</TD>
789 <TD>True if <VAR>variable</VAR> is less than <VAR>value</VAR>.</TD>
790</TR>
791<TR>
792 <TD>></TD>
793 <TD>True if <VAR>variable</VAR> is greater than <VAR>value</VAR>.</TD>
794</TR>
795</TABLE></DIV>
796
797<H3><A NAME="CGI">CGI Programs</A></H3>
798
799<P>CUPS uses five CGI programs to manage the dynamic web
800interfaces:</P>
801
802<UL>
803
804 <LI><CODE>admin.cgi</CODE></LI>
805 <LI><CODE>classes.cgi</CODE></LI>
806 <LI><CODE>help.cgi</CODE></LI>
807 <LI><CODE>jobs.cgi</CODE></LI>
808 <LI><CODE>printers.cgi</CODE></LI>
809
810</UL>
811
812<P>Each CGI program accepts standard form variables such as
813<CODE>OP</CODE> for the operation to perform,
814<CODE>PRINTER_NAME</CODE> for the printer or class name to
815operate on, <CODE>QUERY</CODE> for any search words,
816<CODE>FIRST</CODE> for the first class, job, or printer to
817display, and <CODE>ORDER</CODE> to control the order that
818classes, jobs, or printers are displayed.</P>
819
820<P>In addition, the <CODE>classes.cgi</CODE>,
821<CODE>jobs.cgi</CODE>, and <CODE>printers.cgi</CODE> programs
822support a <CODE>WHICH_JOBS</CODE> variable to control which jobs
823are displayed. Table 4 lists the supported values.</P>
824
825<DIV CLASS="table"><TABLE SUMMARY="WHICH_JOBS Values">
826<CAPTION>Table 4: WHICH_JOBS Values</CAPTION>
827<THEAD>
828<TR>
829 <TH>OP Value</TH>
830 <TH>Description</TH>
831</TR>
832</THEAD>
833<TR>
834 <TD>all</TD>
835 <TD>Show all jobs</TD>
836</TR>
837<TR>
838 <TD>completed</TD>
839 <TD>Show completed jobs</TD>
840</TR>
841<TR>
842 <TD>not-completed</TD>
843 <TD>Show active jobs</TD>
844</TR>
845</TABLE></DIV>
846
847<H4><A NAME="admin.cgi">admin.cgi</A></H4>
848
849<P>The <CODE>admin.cgi</CODE> program handles all of the printer
850and class administration functions and is run for all direct
851accesses to the <VAR>/admin</VAR> resource. For most operations
852it uses the <CODE>PRINTER_NAME</CODE> and <CODE>OP</CODE> form
853variables to specify the action requested. Table 5 shows the
854supported <CODE>OP</CODE> values.</P>
855
856<DIV CLASS="table"><TABLE SUMMARY="admin.cgi OP Values">
857<CAPTION>Table 5: admin.cgi OP Values</CAPTION>
858<THEAD>
859<TR>
860 <TH>OP Value</TH>
861 <TH>Description</TH>
862</TR>
863</THEAD>
864<TBODY>
865<TR>
866 <TD>accept-jobs</TD>
867 <TD>Accepts jobs on the named destination.</TD>
868</TR>
869<TR>
870 <TD>add-class</TD>
871 <TD>Adds a new printer class.</TD>
872</TR>
873<TR>
874 <TD>add-printer</TD>
875 <TD>Adds a new printer.</TD>
876</TR>
877<TR>
878 <TD>config-server</TD>
879 <TD>Configures the server.</TD>
880</TR>
881<TR>
882 <TD>delete-class</TD>
883 <TD>Deletes a printer class. The form variable <CODE>CONFIRM</CODE>
884 may be set to any value to bypass the confirmation page.</TD>
885</TR>
886<TR>
887 <TD>delete-printer</TD>
888 <TD>Deletes a printer. The form variable <CODE>CONFIRM</CODE>
889 may be set to any value to bypass the confirmation page.</TD>
890</TR>
891<TR>
892 <TD>export-samba</TD>
893 <TD>Exports printers to Samba.</TD>
894</TR>
895<TR>
896 <TD>modify-class</TD>
897 <TD>Modifies a printer class.</TD>
898</TR>
899<TR>
900 <TD>modify-printer</TD>
901 <TD>Modifies a printer.</TD>
902</TR>
903<TR>
904 <TD>purge-jobs</TD>
905 <TD>Purges all jobs on the named destination.</TD>
906</TR>
907<TR>
908 <TD>redirect</TD>
909 <TD>Redirects the web browser to the location referenced by
910 the URL form variable.</TD>
911</TR>
912<TR>
913 <TD>reject-jobs</TD>
914 <TD>Rejects new jobs on the named destination.</TD>
915</TR>
916<TR>
917 <TD>set-allowed-users</TD>
918 <TD>Sets the allowed users for a destination.</TD>
919</TR>
920<TR>
921 <TD>set-as-default</TD>
922 <TD>Sets the default destination.</TD>
923</TR>
924<TR>
925 <TD>set-printer-options</TD>
926 <TD>Sets the default options for a printer.</TD>
927</TR>
928<TR>
929 <TD>set-sharing</TD>
930 <TD>Sets the printer-is-shared attribute for a destination.</TD>
931</TR>
932<TR>
933 <TD>start-class</TD>
934 <TD>Starts the named class.</TD>
935</TR>
936<TR>
937 <TD>start-printer</TD>
938 <TD>Starts the named printer.</TD>
939</TR>
940<TR>
941 <TD>stop-class</TD>
942 <TD>Stops the named class.</TD>
943</TR>
944<TR>
945 <TD>stop-printer</TD>
946 <TD>Stops the named printer.</TD>
947</TR>
948</TBODY>
949</TABLE></DIV>
950
951<H4><A NAME="classes.cgi">classes.cgi</A></H4>
952
953<P>The <CODE>classes.cgi</CODE> program is responsible for
954listing class information, including jobs destined for that
955class. It is for all direct accesses to the <VAR>/classes</VAR>
956resource and supports the optional form variables <CODE>OP</CODE>
957and <CODE>WHICH_JOBS</CODE>. If no form variables are supplied
958then the CGI lists all or a specific class and the active jobs on
959each class. Table 6 shows the supported <CODE>OP</CODE>
960values.</P>
961
962<DIV CLASS="table"><TABLE SUMMARY="classes.cgi OP Values">
963<CAPTION>Table 6: classes.cgi OP Values</CAPTION>
964<THEAD>
965<TR>
966 <TH>OP Value</TH>
967 <TH>Description</TH>
968</TR>
969</THEAD>
970<TBODY>
971<TR>
972 <TD>move-jobs</TD>
973 <TD>Moves the jobs on this class to another destination.</TD>
974</TR>
975<TR>
976 <TD>print-test-page</TD>
977 <TD>Prints the standard PostScript test page.</TD>
978</TR>
979</TBODY>
980</TABLE></DIV>
981
982
983<H4><A NAME="help.cgi">help.cgi</A></H4>
984
985<P>The <CODE>help.cgi</CODE> program handles all of the on-line
986help functions and is run for all direct accesses to the
987<VAR>/help</VAR> resource.</P>
988
989
990<H4><A NAME="jobs.cgi">jobs.cgi</A></H4>
991
992<P>The <CODE>jobs.cgi</CODE> program handles all of the job
993functions and is run for all direct accesses to the
994<VAR>/jobs</VAR> resource. For most operations it uses the
995<CODE>JOB_ID</CODE>, <CODE>OP</CODE>, and <CODE>WHICH_JOBS</CODE>
996form variables to specify the action requested. Table 7 shows the
997supported <CODE>OP</CODE> values.</P>
998
999<DIV CLASS="table"><TABLE SUMMARY="jobs.cgi OP Values">
1000<CAPTION>Table 7: jobs.cgi OP Values</CAPTION>
1001<THEAD>
1002<TR>
1003 <TH>OP Value</TH>
1004 <TH>Description</TH>
1005</TR>
1006</THEAD>
1007<TBODY>
1008<TR>
1009 <TD>cancel-job</TD>
1010 <TD>Cancels a job.</TD>
1011</TR>
1012<TR>
1013 <TD>hold-job</TD>
1014 <TD>Holds a job indefinitely.</TD>
1015</TR>
1016<TR>
1017 <TD>move-job</TD>
1018 <TD>Moves a job to another destination.</TD>
1019</TR>
1020<TR>
1021 <TD>release-job</TD>
1022 <TD>Releases a job for printing.</TD>
1023</TR>
1024<TR>
1025 <TD>restart-job</TD>
1026 <TD>Restarts/reprints a stopped, cancelled, completed, or aborted
1027 print job.</TD>
1028</TR>
1029</TBODY>
1030</TABLE></DIV>
1031
1032
1033<H4><A NAME="printers.cgi">printers.cgi</A></H4>
1034
1035<P>The <CODE>printers.cgi</CODE> program is responsible for
1036listing printer information, including jobs destined for that
1037printer. It is for all direct accesses to the
1038<VAR>/printers</VAR> resource and supports the optional form
1039variables <CODE>OP</CODE> and <CODE>WHICH_JOBS</CODE>. If no form
1040variables are supplied then the CGI lists all printers or a
1041specific printer and the active jobs on that printer. Table 8
1042shows the supported <CODE>OP</CODE> values.</P>
1043
1044<DIV CLASS="table"><TABLE SUMMARY="printers.cgi OP Values">
1045<CAPTION>Table 8: printers.cgi OP Values</CAPTION>
1046<THEAD>
1047<TR>
1048 <TH>OP Value</TH>
1049 <TH>Description</TH>
1050</TR>
1051</THEAD>
1052<TBODY>
1053<TR>
1054 <TD>clean-print-heads</TD>
1055 <TD>Clean the print heads.</TD>
1056</TR>
1057<TR>
1058 <TD>move-jobs</TD>
1059 <TD>Move all jobs to a different destination.</TD>
1060</TR>
1061<TR>
1062 <TD>print-self-test-page</TD>
1063 <TD>Print a printer self-test page.</TD>
1064</TR>
1065<TR>
1066 <TD>print-test-page</TD>
1067 <TD>Print a PostScript test page.</TD>
1068</TR>
1069</TBODY>
1070</TABLE></DIV>
1071
1072</BODY>
1073</HTML>