Skip to content

Commit

Permalink
Merge pull request BOINC#2559 from BOINC/dpa_autoattach2
Browse files Browse the repository at this point in the history
Updated registration flow
  • Loading branch information
tristanolive authored Jun 27, 2018
2 parents 902921e + 9dbc768 commit 5bedd6b
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 76 deletions.
8 changes: 4 additions & 4 deletions html/project.sample/project.inc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function make_php_mailer() {
//
function project_banner($title, $prefix, $is_main) {
if ($is_main) {
echo '<img class="img-responsive" src="img/water.jpg">';
echo '<img class="img-responsive" style="width:100%" src="img/water.jpg">';
}
sample_navbar(secure_url_base(), get_logged_in_user(false), false);
if ($title) {
Expand All @@ -130,9 +130,9 @@ function project_banner($title, $prefix, $is_main) {
function project_footer($show_return, $show_date, $prefix) {
// If you include any links, prepend URL with $prefix
//
echo '<p></p>
<a class="brand boinc-logo" href="https://boinc.berkeley.edu/"><img align="middle" border="0" src="'.secure_url_base().'img/pb_boinc.gif" alt="Powered by BOINC"></a>
<br>
echo '<br>
<a class="brand boinc-logo" href="http://boinc.berkeley.edu/"><img class="img-responsive center-block" src="'.secure_url_base().'img/pb_boinc.gif" alt="Powered by BOINC"></a>
<div class="form-group"></div>
<p class="text-center"> &copy;'.gmdate("Y ").COPYRIGHT_HOLDER.'</p>
';
if ($show_date) {
Expand Down
59 changes: 51 additions & 8 deletions html/user/download.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.

// Show a page with download links and instructions.
// There's a logged-in user.
//
// If no project ID, redirect to BOINC web site
// otherwise...
//
// - get platform from user agent string
// - find latest version for that platform (regular and vbox)
Expand Down Expand Up @@ -76,15 +80,18 @@ function get_version($dev) {
$v = simplexml_load_file("versions.xml");
$client_info = $_SERVER['HTTP_USER_AGENT'];
$p = client_info_to_platform($client_info);
$string = $dev?"Development":"Recommended";
foreach ($v->version as $i=>$v) {
if ((string)$v->dbplatform != $p) {
continue;
}
if (!strstr((string)$v->description, $string)) {
continue;
if (strstr((string)$v->description, "Recommended")) {
return $v;
}
if ($dev) {
if (strstr((string)$v->description, "Development")) {
return $v;
}
}
return $v;
}
return null;
}
Expand Down Expand Up @@ -140,21 +147,50 @@ function download_button_vbox($v, $project_id, $token, $user) {
);
}

// We can't use auto-attach; direct them to the BOINC download page
//
function direct_to_boinc() {
global $master_url;
page_head(tra("Download BOINC"));
text_start();
echo sprintf(
'<p>%s
<p><p>
%s
<p>
<a href=https://boinc.berkeley.edu/download.php>%s</a>
',
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
),
tra("Go the BOINC download page.")
);
text_end();
page_tail();
}

function show_download_page($user, $dev) {
global $config;
$need_vbox = parse_bool($config, "need_vbox");
$project_id = parse_config($config, "<project_id>");
if (!$project_id) {
error_page("must specify project ID in config.xml");
direct_to_boinc();
return;
}
$v = get_version($dev);

// if we can't figure out the user's platform,
// take them to the download_all page on the BOINC site
// take them to the download page on the BOINC site
//
if (!$v) {
Header("Location: https://boinc.berkeley.edu/download_all.php");
exit;
direct_to_boinc();
return;
}

page_head("Download software");
Expand Down Expand Up @@ -197,6 +233,8 @@ function show_download_page($user, $dev) {
echo "</table></center>\n";
echo "<p><p>";
echo tra("When the download is finished, open the downloaded file to install %1.", $dl);
echo "<p><p>";
echo tra("All done? %1Click here to finish%2.", "<a href=welcome.php>", "</a>");
page_tail();
}

Expand Down Expand Up @@ -238,6 +276,11 @@ function installed() {
tra("Enter your %1 email address and password.", PROJECT)
);
}
echo "<p><p>";
echo sprintf('<a href=home.php class="btn btn-success">%s</a>
',
tra('Continue to your home page')
);
page_tail();
}

Expand Down
20 changes: 12 additions & 8 deletions html/user/forum_forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,18 @@ function show_forum($forum, $start, $sort_style, $user) {
);
echo $page_nav;
start_table('table-striped');
row_heading_array(array(
"",
tra("Threads"),
tra("Posts"),
tra("Author"),
tra("Views"),
"<nobr>".tra("Last post")."</nobr>"
));
row_heading_array(
array(
"",
tra("Threads"),
tra("Posts"),
tra("Author"),
tra("Views"),
"<nobr>".tra("Last post")."</nobr>"
),
array("", "width=35%", "", "", "", "")

);

$sticky_first = !$user || !$user->prefs->ignore_sticky_posts;

Expand Down
15 changes: 9 additions & 6 deletions html/user/forum_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ function show_forum_summary($forum) {
echo "<p>";
show_mark_as_read_button($user);
start_table('table-striped');
row_heading_array(array(
tra("Topic"),
tra("Threads"),
tra("Posts"),
tra("Last post")
));
row_heading_array(
array(
tra("Topic"),
tra("Threads"),
tra("Posts"),
tra("Last post")
),
array("width=30%", "", "", "")
);
}
if (strlen($category->name)) {
echo '
Expand Down
51 changes: 27 additions & 24 deletions html/user/join.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,33 @@
// from the BOINC web site,
// and creates an account using the Manager.
//
// signup.php is the newer version, with web signup and autoattach
// Link to here (e.g. from front-page Join button
// if you're not a vetted project.
// If you are, link to signup.php instead
//
// This page routes people to the right place depending on whether
// they already have BOINC installed on this device.

require_once("../inc/util.inc");

// "old" (misnomer) means BOINC is already installed on this device

function show_choose($is_old) {
panel(null,
function() use($is_old) {
echo tra("Is BOINC installed on this device?");
$y = tra("Yes");
$n = tra("No");
if ($is_old) {
echo ' <a href="join.php">'.tra('I\'m new').'</a> &nbsp; |&nbsp; '.tra('I\'m a BOINC user').'
';
echo sprintf(
' <b>%s</b> &nbsp; |&nbsp; <a href="join.php">%s</a>',
$y, $n
);
} else {
echo tra('I\'m new')
.' &nbsp; |&nbsp; <a href="join.php?old=1">'
.tra('I\'m a BOINC user')
.'</a>
';
echo sprintf(
' <a href="join.php?old=1">%s</a> &nbsp; |&nbsp; <b>%s</b>',
$y, $n
);
}
}
);
Expand All @@ -51,14 +62,14 @@ function() use ($master_url) {
<li> '
.tra('Read our %1 Rules and Policies %2.', '<a href="info.php">', '</a>')
.'<li> <p>'
.tra('Download the BOINC desktop software.')
.tra('Download and install BOINC.')
.'</p><p>
<a href="http://boinc.berkeley.edu/download.php" class="btn btn-success">'.tra('Download').'</a>
</p><p>'
.tra('For Android devices, download BOINC from the Google Play Store or Amazon App Store.')
.'</p>
<li> '
.tra('Run the installer.').'
.tra('Run BOINC.').'
<li> '.tra("Choose %1 from the list, or enter %2", "<strong>".PROJECT."</strong>", "<strong>$master_url</strong>").'
</ol>
';
Expand All @@ -73,20 +84,12 @@ function() use($master_url) {
echo '
<ul>
<li> '
.tra('Install BOINC on this device if not already present.')
.'<p>
<li> '
.tra('Select Tools / Add Project. Choose %1 from the list, or enter %2', "<strong>".PROJECT."</strong>", "<strong>$master_url</strong>")
.' <p>
<li> '
.tra('If you\'re running a command-line version of BOINC on this computer, %1 create an account %2, then use %3 boinccmd --project_attach %4 to add the project.',
'<a href="create_account_form.php">',
'</a>',
'<strong><a href="http://boinc.berkeley.edu/wiki/Boinccmd_tool">',
'</a></strong>'
)
.'
</ul>
.tra('Read our %1 Rules and Policies %2.', '<a href="info.php">', '</a>')
.'<p><li> '
.tra('In the BOINC Manager, select Tools / Add Project.')
.'<p><li> '
.tra('Choose %1 from the list, or enter %2', "<strong>".PROJECT."</strong>", "<strong>$master_url</strong>")
.'</ul>
';
}
);
Expand Down
5 changes: 4 additions & 1 deletion html/user/prefs.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@

$user = get_logged_in_user();

$subset = get_str("subset");
$subset = get_str("subset", true);
if (!$subset) {
$subset = "global";
}
$columns = get_int("cols", true);
$updated = get_int("updated", true);
$defaults = get_int("defaults", true);
Expand Down
71 changes: 46 additions & 25 deletions html/user/sample_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

$config = get_config();
$no_web_account_creation = parse_bool($config, "no_web_account_creation");
$project_id = parse_config($config, "<project_id>");

$stopped = web_stopped();
$user = get_logged_in_user(false);
Expand All @@ -58,57 +59,77 @@ function top() {
}

function left(){
global $user, $no_web_account_creation, $master_url;
global $user, $no_web_account_creation, $master_url, $project_id;
panel(
$user?tra("Welcome, %1", $user->name):tra("What is %1?", PROJECT),
function() use($user) {
global $no_web_account_creation, $master_url;
global $no_web_account_creation, $master_url, $project_id;
if ($user) {
$dt = time() - $user->create_time;
if ($dt < 86400) {
echo tra("Thanks for joining %1", PROJECT);
} else if ($user->total_credit == 0) {
echo "Your computer hasn't completed any tasks yet. If you need help, <a href=https://boinc.berkeley.edu/help.php>go here</a>";
echo tra("Your computer hasn't completed any tasks yet. If you need help, %1go here%2.",
"<a href=https://boinc.berkeley.edu/help.php>",
"</a>"
);
} else {
$x = format_credit($user->expavg_credit);
$y = number_format($user->expavg_credit/200, 3);
echo tra("You've contributed about %1 credits per day (%2 GFLOPS) to %3 recently.", $x, $y, PROJECT);
echo tra("You've contributed about %1 credits per day to %2 recently.", $x, PROJECT);
if ($user->expavg_credit > 1) {
echo "Thanks!";
echo " ";
echo tra("Thanks!");
} else {
echo "<p><p>";
echo "Please make sure BOINC is installed and enabled on your computer.";
echo tra("Please make sure BOINC is installed and enabled on your computer.");
}
echo "<p>";
}
echo "<p><p>";
echo sprintf('<center><a href=home.php class="btn btn-success">%s</a></center>
',
tra('Continue to your home page')
);
} else {
echo "
<p>
XXX is a research project, based at <a href=#>YYY</a>,
that uses Internet-connected
computers to do research in XXX.
You can contribute to our research
by running a free program on your computer.
</p>
";
echo "
echo "<p><p>";
echo sprintf('%s
<ul>
<li> <a href=#>Our research</a>
<li> <a href=#>Our team</a>
</ul>
";
<li> %s
<li> %s
<li> %s
',
tra("Want to help more?"),
tra("If BOINC is not installed on this computer, %1download it%2.",
"<a href=download.php>", "</a>"
),
tra("Install BOINC on your other computers, tablets, and phones."),
tra("Tell your friends about BOINC, and show them how to join %1.", PROJECT)
);
if (function_exists('project_help_more')) {
project_help_more();
}
echo "</ul>\n";
} else {
echo "<p>";
$pd = "../project/project_description.php";
if (file_exists($pd)) {
include($pd);
} else {
echo "No project description yet. Create a file html/project/project_description.php
that prints a short description of your project.
";
}
echo "</p>\n";
if (NO_COMPUTING) {
echo "
<a href=\"create_account_form.php\">Create an account</a>
";
} else {
// use auto-attach if possible
//
echo '<center><a href="signup.php" class="btn btn-success"><font size=+2>'.tra('Join %1', PROJECT).'</font></a></center>
';

echo "<p><p>".tra("Already joined? %1Log in%2.",
"<a href=login_form.php>", "</a>"
);
}
}
}
Expand All @@ -117,7 +138,7 @@ function() use($user) {
if (!$stopped) {
$profile = get_current_uotd();
if ($profile) {
panel('User of the Day',
panel(tra('User of the Day'),
function() use ($profile) {
show_uotd($profile);
}
Expand Down
Loading

0 comments on commit 5bedd6b

Please sign in to comment.