3 # Edit or create a burn profile
5 require './burner-lib.pl';
9 $access{'create'} || &error($text{'edit_ecannot'});
10 &ui_print_header(undef, $text{'create_title'}, "");
11 $profile = { 'type' => $in{'type'} };
14 $profile = &get_profile($in{'id'});
15 &can_use_profile($profile) || &error($text{'edit_ecannot'});
16 &ui_print_header(undef, $text{'edit_title'}, "");
19 if ($profile->{'type'} == 2 && !&has_command($config{'mkisofs'})) {
20 print "<p>",&text('edit_emkisofs', "<tt>$config{'mkisofs'}</tt>",
21 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
22 &ui_print_footer("", $text{"index_return"});
25 if ($profile->{'type'} == 3 && !&has_command($config{'mpg123'})) {
26 print "<p>",&text('edit_empg123', "<tt>$config{'mpg123'}</tt>",
27 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
28 &ui_print_footer("", $text{"index_return"});
31 if ($profile->{'type'} == 4 && !&has_command($config{'cdrdao'})) {
32 print "<p>",&text('edit_ecdrdao', "<tt>$config{'cdrdao'}</tt>",
33 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
34 &ui_print_footer("", $text{"index_return"});
38 print "<form action=save_profile.cgi>\n";
39 print "<input type=hidden name=id value='$in{'id'}'>\n";
40 print "<input type=hidden name=type value='$in{'type'}'>\n";
42 print "<table border width=100%>\n";
43 print "<tr $tb> <td><b>$text{'edit_header'}</b></td> </tr>\n";
44 print "<tr $cb> <td><table width=100%>\n";
46 print "<tr> <td><b>$text{'edit_name'}</b></td>\n";
47 print "<td><input name=name size=25 value='$profile->{'name'}'></td>\n";
48 print "<td colspan=2></td> </tr>\n";
50 if ($profile->{'type'} == 1) {
52 print "<tr> <td><b>$text{'edit_iso'}</b></td>\n";
53 printf "<td colspan=3><input name=iso size=45 value='%s'> %s</td>\n",
54 $profile->{'iso'}, &file_chooser_button("iso");
57 print "<tr> <td><b>$text{'edit_isosize'}</b></td>\n";
58 printf "<td><input type=radio name=isosize value=1 %s> %s\n",
59 $profile->{'isosize'} ? 'checked' : '', $text{'yes'};
60 printf "<input type=radio name=isosize value=0 %s> %s</td> </tr>\n",
61 $profile->{'isosize'} ? '' : 'checked', $text{'no'};
63 elsif ($profile->{'type'} == 2) {
64 # Multi-directory options
65 print "<tr> <td valign=top><b>$text{'edit_dirs'}</b></td>\n";
66 print "<td colspan=3><table width=100% border=1>\n";
67 print "<tr $tb> <td><b>$text{'edit_source'}</b></td> ",
68 "<td><b>$text{'edit_dest'}</b></td> </tr>\n";
69 for($i=0; $profile->{"source_".($i-4)} || $i < 4; $i++) {
71 printf "<td><input name=source_%d size=35 value='%s'>%s</td>\n",
72 $i, $profile->{"source_$i"},
73 &file_chooser_button("source_$i");
74 printf "<td><input name=dest_%d size=25 value='%s'></td>\n",
75 $i, $profile->{"dest_$i"} ? $profile->{"dest_$i"} : "/";
80 print "<tr> <td><b>$text{'edit_rock'}</b></td>\n";
81 printf "<td colspan=3><input type=radio name=rock value=2 %s> %s\n",
82 $profile->{'rock'} == 2 ? 'checked' : '', $text{'edit_rock2'};
83 printf "<input type=radio name=rock value=1 %s> %s\n",
84 $profile->{'rock'} == 1 ? 'checked' : '', $text{'yes'};
85 printf "<input type=radio name=rock value=0 %s> %s</td> </tr>\n",
86 $profile->{'rock'} == 0 ? 'checked' : '', $text{'no'};
88 print "<tr> <td><b>$text{'edit_joliet'}</b></td>\n";
89 printf "<td><input type=radio name=joliet value=1 %s> %s\n",
90 $profile->{'joliet'} ? 'checked' : '', $text{'yes'};
91 printf "<input type=radio name=joliet value=0 %s> %s</td>\n",
92 $profile->{'joliet'} ? '' : 'checked', $text{'no'};
94 print "<td><b>$text{'edit_long'}</b></td>\n";
95 printf "<td><input type=radio name=long value=1 %s> %s\n",
96 $profile->{'long'} ? 'checked' : '', $text{'yes'};
97 printf "<input type=radio name=long value=0 %s> %s</td> </tr>\n",
98 $profile->{'long'} ? '' : 'checked', $text{'no'};
100 print "<tr> <td><b>$text{'edit_netatalk'}</b></td>\n";
101 printf "<td><input type=radio name=netatalk value=1 %s> %s\n",
102 $profile->{'netatalk'} ? 'checked' : '', $text{'yes'};
103 printf "<input type=radio name=netatalk value=0 %s> %s</td>\n",
104 $profile->{'netatalk'} ? '' : 'checked', $text{'no'};
106 print "<td><b>$text{'edit_cap'}</b></td>\n";
107 printf "<td><input type=radio name=cap value=1 %s> %s\n",
108 $profile->{'cap'} ? 'checked' : '', $text{'yes'};
109 printf "<input type=radio name=cap value=0 %s> %s</td> </tr>\n",
110 $profile->{'cap'} ? '' : 'checked', $text{'no'};
112 print "<tr> <td><b>$text{'edit_trans'}</b></td>\n";
113 printf "<td><input type=radio name=trans value=1 %s> %s\n",
114 $profile->{'trans'} ? 'checked' : '', $text{'yes'};
115 printf "<input type=radio name=trans value=0 %s> %s</td>\n",
116 $profile->{'trans'} ? '' : 'checked', $text{'no'};
118 print "<td><b>$text{'edit_volid'}</b></td>\n";
119 printf "<td><input name=volid size=15 value='%s'></td> </tr>\n",
122 elsif ($profile->{'type'} == 3) {
123 # MP3 files or directories of them
124 print "<tr> <td valign=top><b>$text{'edit_mp3s'}</b></td>\n";
125 print "<td colspan=3>\n";
126 for($i=0; $profile->{"source_".($i-4)} || $i < 4; $i++) {
127 printf "<input name=source_%d size=50 value='%s'> %s<br>\n",
128 $i, $profile->{"source_$i"},
129 &file_chooser_button("source_$i");
131 print "</td> </tr>\n";
133 elsif ($profile->{'type'} == 4) {
135 print "<tr> <td><b>$text{'edit_sdev'}</b></td>\n";
136 print "<td colspan=3><select name=sdev>\n";
137 foreach $d (&list_cdrecord_devices()) {
138 printf "<option value=%s %s>%s (%s)\n",
140 $d->{'dev'} eq $profile->{'sdev'} ? 'selected' : '',
141 $d->{'name'}, $d->{'type'};
142 $found++ if ($d->{'dev'} eq $profile->{'sdev'});
144 printf "<option value='' %s>%s\n",
145 !$found && $profile->{'sdev'} ? "selected" : "",
148 printf "<input name=other size=30 value='%s'></td> </tr>\n",
149 $found ? "" : $profile->{'sdev'};
151 print "<tr> <td><b>$text{'edit_srcdrv'}</b></td>\n";
152 print "<td><select name=srcdrv>\n";
153 printf "<option value='' %s> %s\n",
154 $profile->{'srcdrv'} ? "" : "selected", $text{'default'};
155 foreach $d (@cdr_drivers) {
156 printf "<option %s>%s\n",
157 $profile->{'srcdrv'} eq $d ? "selected" : "", $d;
159 print "</select></td> </tr>\n";
161 print "<tr> <td><b>$text{'edit_dstdrv'}</b></td>\n";
162 print "<td><select name=dstdrv>\n";
163 printf "<option value='' %s> %s\n",
164 $profile->{'dstdrv'} ? "" : "selected", $text{'default'};
165 foreach $d (@cdr_drivers) {
166 printf "<option %s>%s\n",
167 $profile->{'dstdrv'} eq $d ? "selected" : "", $d;
169 print "</select></td> </tr>\n";
171 print "<tr> <td><b>$text{'edit_fly'}</b></td>\n";
172 printf "<td><input type=radio name=fly value=1 %s> %s\n",
173 $profile->{'fly'} ? "checked" : "", $text{'edit_fly1'};
174 printf "<input type=radio name=fly value=0 %s> %s</td> </tr>\n",
175 $profile->{'fly'} ? "" : "checked", $text{'edit_fly0'};
178 print "</table></td></tr></table>\n";
179 print "<table width=100%><tr>\n";
181 if ($access{'edit'}) {
182 # Show save, burn, test and delete buttons
183 print "<td width=25%><input type=submit value='$text{'save'}'></td>\n";
184 if ($profile->{'type'} == 4) {
185 print "<td width=50% colspan=2 align=center>",
186 "<input type=submit name=burn ",
187 "value='$text{'edit_burn'}'></td>\n";
190 print "<td width=25% align=center>",
191 "<input type=submit name=burn ",
192 "value='$text{'edit_burn'}'></td>\n";
193 print "<td width=25% align=center>",
194 "<input type=submit name=test ",
195 "value='$text{'edit_test'}'></td>\n";
197 if ($profile->{'id'}) {
198 print "<td width=25% align=right>",
199 "<input type=submit name=delete ",
200 "value='$text{'delete'}'></td>\n";
203 print "<td width=25%></td>\n";
206 print "<tr> <td></td> <td width=50% align=center colspan=2>\n";
207 print "<input type=checkbox name=ask value=1 checked> ",
208 "$text{'edit_ask'}\n";
209 print "</td> <td></td>\n";
212 # Show only burn and test burn buttons
213 if ($profile->{'type'} == 4) {
214 print "<td width=50% colspan=2 align=left>",
215 "<input type=submit name=burn ",
216 "value='$text{'edit_burn2'}'></td>\n";
219 print "<td width=50% align=left>",
220 "<input type=submit name=burn ",
221 "value='$text{'edit_burn2'}'></td>\n";
222 print "<td width=50% align=right>",
223 "<input type=submit name=test ",
224 "value='$text{'edit_test2'}'></td>\n";
226 print "<input type=hidden name=ask value=1>\n";
228 print "</tr></table></form>\n";
230 if (!$access{'edit'}) {
231 # Add some javascript to disable form
233 print "l = document.forms[0].elements;\n";
234 print "for(i=0; i<l.length; i++) {\n";
235 print " if (l[i].name != \"burn\" && l[i].name != \"test\" &&\n";
236 print " l[i].type != \"hidden\") {\n";
237 print " l[i].disabled = true;\n";
243 &ui_print_footer("", $text{'index_return'});