diff --git a/html/inc/util.inc b/html/inc/util.inc index bc07a9ff8f..000586bc66 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -900,19 +900,23 @@ function current_url() { // @param text The text to display on the button // @param desc The title of the destination - typically used as a popup // @param class The optional CSS class of the button. Defaults to a standard button +// @params extra Additional text in href tag // -function button_text($url, $text, $desc=null, $class="btn-success btn-sm") { +function button_text($url, $text, $desc=null, $class=null, $extra='') { if (!$desc) { $desc = $text; } - return sprintf(' %s', - $url, $desc, $class, $text + if (!$class) { + $class = "btn-success btn-sm"; + } + return sprintf(' %s', + $url, $desc, $class, $extra, $text ); } -function show_button($url, $text, $desc=null, $class="btn-success btn-sm") { - echo button_text($url, $text, $desc, $class); +function show_button($url, $text, $desc=null, $class=null, $extra=null) { + echo button_text($url, $text, $desc, $class, $extra); } // for places with a bunch of buttons, like forum posts diff --git a/html/user/download_software.php b/html/user/download_software.php index 2cf953c84f..eaf48e8f36 100644 --- a/html/user/download_software.php +++ b/html/user/download_software.php @@ -16,20 +16,26 @@ // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see . -// Show a page with download links and instructions. +// Page for downloading the BOINC client, with support for autoattach: +// https://boinc.berkeley.edu/trac/wiki/SimpleAttach +// Note: to use autoattach: +// 1) You need to have the client versions file +// run html/ops/get_versions.php +// 2) Put your project ID (ask DPA if you don't have one) +// in config.xml as x +// // There's a logged-in user. // -// If no project ID, direct user to BOINC web site -// otherwise... -// -// - get platform from user agent string -// - find latest version for that platform (regular and vbox) -// - Create a login token. -// - Show download button(s) -// The download will be via concierge, using the login token. -// -// VirtualBox +// Autoattach case: if project has an ID and client is Win or Mac: +// - find latest version for that platform (regular and vbox) +// - Create a login token. +// - Show download button(s) +// The download will be via concierge, using the login token. +// Otherwise: +// - show link to download page on BOINC web site, +// and instructions for what to do after that. // +// VirtualBox: // config.xml entries: // This project requires VBox // This project can use VBox @@ -38,11 +44,6 @@ // For other platforms, direct user to VBox download page // before installing BOINC // -// Notes: -// 1) You need to have the client versions file -// run html/ops/get_versions.php -// 2) Put your project ID in a constant PROJECT_ID -// (this all works only for listed projects) // Can also be called as a web RPC; // see https://boinc.berkeley.edu/trac/wiki/WebRpc#download @@ -100,6 +101,13 @@ function is_windows() { return false; } +function is_windows_or_mac() { + global $user_agent; + if (strstr($user_agent, 'Windows')) return true; + if (strstr($user_agent, 'Mac')) return true; + return false; +} + // find release version for user's platform // function get_version($user_agent, $dev) { @@ -180,8 +188,7 @@ function show_vbox_info($where) { echo "

"; if ($need_vbox) { echo tra("This project requires VirtualBox."); - } - if ($recommend_vbox) { + } else if ($recommend_vbox) { echo tra("This project recommends VirtualBox."); } echo " "; @@ -215,27 +222,41 @@ function direct_to_boinc() { global $master_url; page_head(tra("Download BOINC")); text_start(); - show_vbox_info("direct"); - echo sprintf( - '

%s -

- %s -

- ', - tra("To download and install BOINC, + echo "

"; + echo tra("To download and install BOINC, click on the link below and follow the instructions. - "), - tra("When BOINC first runs it will ask you to select a project. - Select %1 from the list, - or enter this project's URL: %2", - PROJECT, - $master_url - ) - ); + "); + echo "

"; show_button( "https://boinc.berkeley.edu/download.php", - tra("Go to the BOINC download page.") + tra("Go to the BOINC download page."), + null, null, 'target=_new' ); + show_vbox_info("direct"); + + if (parse_bool(get_config(), 'account_manager')) { + echo sprintf( + "

%s

", + tra("When BOINC first runs it will ask you to select a project. + Cancel out of this dialog, + then select Tools / Use Account Manager + to connect BOINC to your %1 account. + See detailed instructions.", + PROJECT, + 'https://boinc.berkeley.edu/wiki/Account_managers' + ) + ); + } else { + echo sprintf( + "

%s

", + tra("When BOINC first runs it will ask you to select a project. + Select '%1' from the list, + or enter this project's URL:

%2", + PROJECT, + $master_url + ) + ); + } text_end(); page_tail(); } @@ -245,7 +266,7 @@ function show_download_page($user, $user_agent, $dev) { // If no project ID, we can't use simplified install // - if (!$project_id) { + if (!$project_id || !is_windows_or_mac()) { direct_to_boinc(); return; }