1<?php 2// This file is part of BOINC. 3// http://boinc.berkeley.edu 4// Copyright (C) 2008 University of California 5// 6// BOINC is free software; you can redistribute it and/or modify it 7// under the terms of the GNU Lesser General Public License 8// as published by the Free Software Foundation, 9// either version 3 of the License, or (at your option) any later version. 10// 11// BOINC is distributed in the hope that it will be useful, 12// but WITHOUT ANY WARRANTY; without even the implied warranty of 13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14// See the GNU Lesser General Public License for more details. 15// 16// You should have received a copy of the GNU Lesser General Public License 17// along with BOINC. If not, see <http://www.gnu.org/licenses/>. 18 19require_once("../inc/boinc_db.inc"); 20require_once("../inc/util.inc"); 21require_once("../inc/host.inc"); 22 23check_get_args(array("hostid", "detail")); 24 25$user = get_logged_in_user(); 26 27$hostid = get_int("hostid"); 28$host = BoincHost::lookup_id($hostid); 29if (!$host || $host->userid != $user->id) { 30 error_page("We have no record of that computer"); 31} 32 33$detail = get_int('detail', true); 34 35page_head(tra("Merge computers")); 36 37$t = time_str($host->create_time); 38echo tra("Sometimes BOINC assigns separate identities to the same computer by mistake. You can correct this by merging old identities with the newest one.")." 39 <form name=host_list action=host_edit_action.php> 40 <input type=hidden name=id_0 value=$hostid> 41 <p> 42"; 43 44$all_hosts = BoincHost::enum("userid=$user->id"); 45 46$nhosts = 1; 47$hosts = array(); 48foreach ($all_hosts as $host2) { 49 if ($host->id == $host2->id) continue; 50 if (!hosts_compatible($host, $host2, $detail)) continue; 51 $hosts[] = $host2; 52 $nhosts++; 53 if ($nhosts==500) break; 54} 55if ($nhosts == 1) { 56 echo "<br>".tra("No hosts are eligible for merging with this one."); 57 if (!$detail) { 58 echo "<p><a href=host_edit_form.php?hostid=$hostid&detail=1>".tra("Show details")."</a> 59 "; 60 } 61 page_tail(); 62 exit(); 63} 64echo " 65 <p>" 66 .tra("Check the computers that are the same as %1 (created %2, computer ID %3):", $host->domain_name, $t, $host->id)." 67 <p> 68"; 69start_table(); 70row_heading_array(array("", tra("name"), tra("created"), tra("computer ID"))); 71 72$i = 1; 73foreach ($hosts as $host2) { 74 $t = time_str($host2->create_time); 75 $x = $host2->domain_name; 76 if ($x == "") { 77 $x = "[".tra("no hostname")."]"; 78 } 79 row_array(array( 80 "<input type=checkbox name=id_$i value=$host2->id>", 81 $x, 82 "$t", 83 "$host2->id" 84 )); 85 $i++; 86} 87end_table(); 88echo " 89 <br> 90 <script> 91 function set_all() { 92"; 93for ($i=1; $i<$nhosts; $i++) { 94 echo "document.host_list.id_$i.checked=1;\n"; 95} 96echo " 97 } 98 function clear_all() { 99"; 100for ($i=1; $i<$nhosts; $i++) { 101 echo "document.host_list.id_$i.checked=0;\n"; 102} 103echo " 104 } 105 </script> 106 <p><a href=javascript:set_all()>Select all</a> 107 <p><a href=javascript:clear_all()>Unselect all</a> 108 <input type=hidden name=nhosts value=$nhosts> 109 <p><input class=\"btn btn-default\" type=submit value='".tra("Merge hosts")."'> 110 </form> 111"; 112 113if (!$detail) { 114 echo "<p><a href=host_edit_form.php?hostid=$hostid&detail=1>".tra("Show details")."</a> 115 "; 116} 117 118page_tail(); 119 120?> 121