3 # Displays a list of all PAP secrets
5 require './pap-lib.pl';
6 $access{'secrets'} || &error($text{'secrets_ecannot'});
7 &ui_print_header(undef, $text{'secrets_title'}, "");
9 if (!-r $config{'pap_file'}) {
10 print "<b>", &text('index_enopfile', $config{'pap_file'}), "</b>.<p>\n";
11 &ui_print_footer("/", $text{'index_return'});
15 @links = ( &select_all_link("d"),
16 &select_invert_link("d"),
17 "<a href=edit_secret.cgi>$text{'index_create'}</a>" );
20 @sec = &list_secrets();
21 @links = ( &select_all_link("d"),
22 &select_invert_link("d"),
23 "<a href=edit_secret.cgi>$text{'index_create'}</a>" );
25 print &ui_form_start("delete_secrets.cgi", "post");
27 print &ui_links_row(\@links);
28 print &ui_columns_start(
29 [ "", $text{'index_user'}, $text{'index_server'} ],
31 for($i=0; $i<@sec; $i++) {
34 push(@cols, "<a href=\"edit_secret.cgi?$i\">".
35 ($s->{'client'} ? &html_escape($s->{'client'})
36 : $text{'index_uany'})."</a>");
37 push(@cols, $s->{'server'} eq "*" ? $text{'index_sany'}
38 : &html_escape($s->{'server'}));
39 print &ui_checked_columns_row(\@cols, \@tds, "d", $i);
41 print &ui_columns_end();
42 print &ui_links_row(\@links);
43 print &ui_form_end([ [ "delete", $text{'index_delete'} ] ]);
46 print "<b>$text{'secrets_none'}</b><p>\n";
47 print &ui_links_row([ $links[2] ]);
50 if ($access{'sync'}) {
51 print &ui_hr(), $text{'index_info'}, " <p>\n";
53 print "<form action=save_sync.cgi>\n";
54 printf "<input type=checkbox name=add value=1 %s>\n",
55 $config{'sync_add'} ? "checked" : "";
56 print $text{'index_onadd'}, "\n";
57 print "<input name=server size=20 value='$config{'sync_server'}'><p>\n";
59 printf "<input type=checkbox name=change value=1 %s>\n",
60 $config{'sync_change'} ? "checked" : "";
61 print $text{'index_onchange'}, "<p>\n";
63 printf "<input type=checkbox name=delete value=1 %s>\n",
64 $config{'sync_delete'} ? "checked" : "";
65 print $text{'index_ondelete'}, "<p>\n";
66 print "<input type=submit value=", $text{'save'}, "></form>\n";
69 &ui_print_footer("", $text{'index_return'});