2 # Show details of one package and available updates
4 require './package-updates-lib.pl';
5 &ui_print_header(undef, $text{'view_title'}, "");
9 @avail = &list_for_mode($in{'mode'}, 0);
10 ($a) = grep { $_->{'name'} eq $in{'name'} &&
11 $_->{'system'} eq $in{'system'} } @avail;
12 @current = &list_current(0);
13 ($c) = grep { $_->{'name'} eq $in{'name'} &&
14 $_->{'system'} eq $in{'system'} } @current;
17 print &ui_form_start("save_view.cgi");
18 print &ui_hidden("name", $p->{'name'});
19 print &ui_hidden("system", $p->{'system'});
20 print &ui_hidden("version", $p->{'version'});
21 print &ui_hidden("mode", $in{'mode'});
22 print &ui_table_start($text{'view_header'}, undef, 2);
24 # Package name and type
25 print &ui_table_row($text{'view_name'}, $p->{'name'});
26 print &ui_table_row($text{'view_system'}, $text{'system_'.$p->{'system'}} ||
28 print &ui_table_row($text{'view_desc'}, $c->{'desc'});
31 print &ui_table_row($text{'view_state'},
32 $a && !$c ? "<font color=#00aa00>$text{'index_caninstall'}</font>" :
33 !$a && $c ? "<font color=#ffaa00>".
34 &text('index_noupdate', $c->{'version'})."</font>" :
35 &compare_versions($a, $c) > 0 ?
36 "<font color=#00aa00>".
37 &text('index_new', $a->{'version'})."</font>" :
38 &text('index_ok', $c->{'version'}));
40 # Version(s) available
42 print &ui_table_row($text{'view_cversion'},
43 ($c->{'epoch'} ? $c->{'epoch'}.":" : "").$c->{'version'});
46 print &ui_table_row($text{'view_aversion'},
47 ($a->{'epoch'} ? $a->{'epoch'}.":" : "").$a->{'version'});
50 # Source, if available
52 print &ui_table_row($text{'view_source'}, ucfirst($a->{'source'}));
55 # Change log, if possible
57 $cl = &get_changelog($a);
59 print &ui_table_row($text{'view_changelog'},
60 "<pre>".&html_escape($cl)."</pre>");
64 print &ui_table_end();
66 # Buttons to update / manage
68 if ($c && &foreign_available("software") && $c->{'software'}) {
69 push(@buts, [ "software", $text{'view_software'} ]);
71 if ($a && $c && &compare_versions($a, $c) > 0) {
72 push(@buts, [ "update", $text{'view_update'} ]);
75 push(@buts, [ "update", $text{'view_install'} ]);
77 print &ui_form_end(\@buts);
79 &ui_print_footer("index.cgi?mode=$in{'mode'}&search=".
80 &urlize($in{'search'}),
81 $text{'index_return'});