3 # Display a form for upgrading all of webmin from a tarfile
5 require './webmin-lib.pl';
7 &ui_print_header(undef, $text{'upgrade_title'}, "");
9 if (&shared_root_directory()) {
10 &ui_print_endpage($text{'upgrade_eroot'});
13 # what kind of install was this?
14 $mode = &get_install_type();
16 # was the install to a target directory?
17 if (open(DIR, "$config_directory/install-dir")) {
21 if ($mode eq "solaris-pkg") {
22 $skip_upgrade = $text{'upgrade_esolaris'};
24 elsif ($mode eq "zip") {
25 $skip_upgrade = $text{'upgrade_ezip'};
29 @tabs = map { [ $_, $text{'upgrade_tab'.$_}, "edit_upgrade.cgi?mode=$_" ] }
30 ( $skip_upgrade ? ( ) : ( "upgrade" ),
31 "grants", "update", "sched" );
32 print ui_tabs_start(\@tabs, "mode", $in{'mode'} || $tabs[0]->[0], 1);
35 # Display upgrade form
36 print ui_tabs_start_tab("mode", "upgrade");
37 print $text{"upgrade_desc$mode"},"<p>";
39 print ui_form_start("upgrade.cgi", "form-data");
40 print ui_hidden("mode", $mode);
41 print ui_hidden("dir", $dir);
42 print ui_table_start($text{'upgrade_title'}, undef, 1);
43 print "<tr $cb> <td nowrap>\n";
44 print "<input type=radio name=source value=0> $text{'upgrade_local'}\n";
45 print "<input name=file size=40>\n";
46 print file_chooser_button("file", 0),"<br>\n";
47 print "<input type=radio name=source value=1> $text{'upgrade_uploaded'}\n";
48 print "<input name=upload type=file size=30><br>\n";
49 print "<input type=radio name=source value=5> $text{'upgrade_url'}\n";
50 print "<input name=url size=40><br>\n";
51 if ($mode eq 'caldera') {
52 print "<input type=radio name=source value=3 checked> $text{'upgrade_cup'}\n";
54 elsif ($mode eq "gentoo") {
55 print "<input type=radio name=source value=4 checked> $text{'upgrade_emerge'}\n";
57 elsif ($mode ne "sun-pkg") {
58 print "<input type=radio name=source value=2 checked> $text{'upgrade_ftp'}\n";
61 if (!$mode && !$dir) {
62 # Checkbox to delete original directory
63 print "<input type=checkbox name=delete value=1> ",
64 "$text{'upgrade_delete'}<br>\n";
66 if ((!$mode || $mode eq "rpm") && &foreign_check("proc")) {
67 # Checkbox to check signature
68 ($ec, $emsg) = &gnupg_setup();
69 printf "<input type=checkbox name=sig value=1 %s> %s<br>\n",
70 $ec ? "" : "checked", $text{'upgrade_sig'};
73 # Checkbox to not install missing modules
74 printf "<input type=checkbox name=only value=1 %s> %s<br>\n",
75 -r "$root_directory/minimal-install" ? "checked" : "",
76 $text{'upgrade_only'};
78 printf "<input type=checkbox name=force value=1> %s<br>\n",
79 $text{'upgrade_force'};
80 if ($main::session_id) {
81 # Checkbox to disconnect other sessions
82 printf "<input type=checkbox name=disc value=1> %s<br>\n",
83 $text{'upgrade_disc'};
86 print "<input type=submit value=\"$text{'upgrade_ok'}\">\n";
88 print ui_tabs_end_tab();
91 # Display new module grants form
92 print ui_tabs_start_tab("mode", "grants");
93 print "$text{'newmod_desc'}<p>\n";
94 print ui_form_start("save_newmod.cgi", "post");
95 print ui_table_start($text{'newmod_header'});
97 $newmod = &get_newmodule_users();
98 printf "<input type=radio name=newmod_def value=1 %s> %s<br>\n",
99 $newmod ? "" : "checked", $text{'newmod_def'};
100 printf "<input type=radio name=newmod_def value=0 %s> %s\n",
101 $newmod ? "checked" : "", $text{'newmod_users'};
102 printf "<input name=newmod size=30 value='%s'><br>\n",
105 print ui_table_end();
106 print "<input type=submit value='$text{'save'}'></form>\n";
107 print ui_tabs_end_tab();
109 # Display module update form
110 print ui_tabs_start_tab("mode", "update");
111 print "$text{'update_desc1'}<p>\n";
112 print ui_form_start("update.cgi", "post");
113 print ui_table_start($text{'update_header1'});
114 print "<tr $cb> <td nowrap>\n";
116 printf "<input type=radio name=source value=0 %s> %s<br>\n",
117 $config{'upsource'} ? "" : "checked", $text{'update_webmin'};
118 printf "<input type=radio name=source value=1 %s> %s<br>\n",
119 $config{'upsource'} ? "checked" : "", $text{'update_other'};
121 print &ui_textarea("other", join("\n", split(/\t+/, $config{'upsource'})),
124 printf "<input type=checkbox name=show value=1 %s> %s<br>\n",
125 $config{'upshow'} ? "checked" : "", $text{'update_show'};
126 printf "<input type=checkbox name=missing value=1 %s> %s<br>\n",
127 $config{'upmissing'} ? "checked" : "", $text{'update_missing'};
128 printf "<input type=checkbox name=third value=1 %s> %s<br>\n",
129 $config{'upthird'} ? "checked" : "", $text{'update_third'};
130 printf "<input type=checkbox name=checksig value=1 %s> %s<br>\n",
131 $config{'upchecksig'} ? 'checked' : '', $text{'update_checksig'};
134 print "<tr> <td>$text{'update_user'}</td>\n";
135 print "<td>",&ui_textbox("upuser", $config{'upuser'}, 30),"</td> </tr>\n";
136 print "<tr> <td>$text{'update_pass'}</td>\n";
137 print "<td>",&ui_password("uppass", $config{'uppass'}, 30),"</td> </tr>\n";
140 print ui_table_end();
141 print "<input type=submit value=\"$text{'update_ok'}\">\n";
143 print ui_tabs_end_tab();
145 # Display scheduled update form
146 print ui_tabs_start_tab("mode", "sched");
147 print "$text{'update_desc2'}<p>\n";
148 print ui_form_start("update_sched.cgi", "post");
149 print ui_table_start($text{'update_header2'});
150 print "<tr $cb> <td nowrap>\n";
151 printf "<input type=checkbox name=enabled value=1 %s> %s<p>\n",
152 $config{'update'} ? 'checked' : '', $text{'update_enabled'};
154 printf "<input type=radio name=source value=0 %s> %s<br>\n",
155 $config{'upsource'} ? "" : "checked", $text{'update_webmin'};
156 printf "<input type=radio name=source value=1 %s> %s<br>\n",
157 $config{'upsource'} ? "checked" : "", $text{'update_other'};
159 print &ui_textarea("other", join("\n", split(/\t+/, $config{'upsource'})),
162 if ($config{'cron_mode'} == 0) {
163 $upmins = sprintf "%2.2d", $config{'upmins'};
164 print &text('update_sched2',
165 "<input name=hour size=2 value='$config{'uphour'}'>",
166 "<input name=mins size=2 value='$upmins'>",
167 "<input name=days size=3 value='$config{'updays'}'>"),"<br>\n";
170 &foreign_require("cron", "cron-lib.pl");
171 @jobs = &cron::list_cron_jobs();
172 $job = &find_cron_job(\@jobs);
173 $job ||= { 'mins' => 0,
174 'hours' => $config{'uphour'},
175 'days' => "*/$config{'updays'}",
178 print "<br><table border=1>\n";
179 &cron::show_times_input($job, 1);
180 print "</table><br>\n";
183 printf "<input type=checkbox name=show value=1 %s> %s<br>\n",
184 $config{'upshow'} ? 'checked' : '', $text{'update_show'};
185 printf "<input type=checkbox name=missing value=1 %s> %s<br>\n",
186 $config{'upmissing'} ? 'checked' : '', $text{'update_missing'};
187 printf "<input type=checkbox name=third value=1 %s> %s<br>\n",
188 $config{'upthird'} ? "checked" : "", $text{'update_third'};
189 printf "<input type=checkbox name=quiet value=1 %s> %s<br>\n",
190 $config{'upquiet'} ? 'checked' : '', $text{'update_quiet'};
191 printf "<input type=checkbox name=checksig value=1 %s> %s<br>\n",
192 $config{'upchecksig'} ? 'checked' : '', $text{'update_checksig'};
195 print "<tr> <td>$text{'update_email'}</td>\n";
196 print "<td>",&ui_textbox("email", $config{'upemail'}, 30),"</td> </tr>\n";
197 print "<tr> <td>$text{'update_user'}</td>\n";
198 print "<td>",&ui_textbox("upuser", $config{'upuser'}, 30),"</td> </tr>\n";
199 print "<tr> <td>$text{'update_pass'}</td>\n";
200 print "<td>",&ui_password("uppass", $config{'uppass'}, 30),"</td> </tr>\n";
203 print ui_table_end();
204 print "<input type=submit value=\"$text{'update_apply'}\">\n";
206 print ui_tabs_end_tab();
208 print &ui_tabs_end(1);
210 &ui_print_footer("", $text{'index_return'});