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