-if ($keys) foreach ($keys as $key) {
- $key_id=$key['key_id'];
- plc_table_row_start($key_id);
- plc_table_cell ($key['key_type']);
- plc_table_cell(wordwrap( $key['key'], 60, "<br />\n", 1 ));
- if ($can_manage_keys)
- plc_table_cell (plc_form_checkbox_text('key_ids[]',$key_id));
- plc_table_row_end();
-}
-plc_table_end("person_keys");
-plc_form_end();
-
-// sites
-echo "<hr />\n";
-plc_table_title('Sites');
+ if ($keys) foreach ($keys as $key) {
+ $key_id=$key['key_id'];
+ $table->row_start();
+ $table->cell ($key['key_type']);
+ $table->cell(wordwrap( $key['key'], 60, "<br />\n", 1 ));
+ if ($can_manage_keys)
+ $table->cell ($form->checkbox_html('key_ids[]',$key_id));
+ $table->row_end();
+ }
+ // the footer area is used for displaying key-management buttons
+ // add the 'remove keys' button and key upload areas as the table footer
+ if ($can_manage_keys) {
+ $table->tfoot_start();
+ // no need to remove if there's no key
+ if ($keys) {
+ $table->row_start();
+ $table->cell($form->submit_html ("delete-keys","Remove keys"),
+ array('hfill'=>true,'align'=>'right'));
+ $table->row_end();
+ }
+ $table->row_start();
+ $table->cell($form->label_html("key","Upload new key")
+ . $form->file_html("key","upload",array('size'=>60))
+ . $form->submit_html("upload-key","Upload key"),
+ array('hfill'=>true,'align'=>'right'));
+ $table->row_end();
+ }
+
+ $table->end();
+ $toggle->end();
+ }
+
+//////////////////// sites
+if ($local_peer) {
+ $sites_title = count_english_warning($sites,'site');
+ $toggle=new PlekitToggle('sites',$sites_title,
+ array('visible'=>get_arg('show_sites')));
+ $toggle->start();