Skip to content

Commit

Permalink
[574646] Installer Auto Launch button template for GitHub
Browse files Browse the repository at this point in the history
https://bugs.eclipse.org/bugs/show_bug.cgi?id=574646

Also update the installer page to show configuration documentation by
extracting it from the setups.zip.
  • Loading branch information
merks committed Jul 5, 2021
1 parent c61e85c commit ff66f6c
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 6 deletions.
25 changes: 21 additions & 4 deletions releng/org.eclipse.oomph.releng/www/installer/fetch.php
Expand Up @@ -2,10 +2,27 @@
header( 'Cache-control: no cache' );
header('Content-type: application/xml');
$url = $_GET["url"];
$contents = @file_get_contents($url);
if ($contents === FALSE) {
http_response_code(404);
if (preg_match("@^https?://[^/]+eclipse.org/@i", $url) == FALSE) {
$path = str_replace("://", "/", $url);
$zip = new ZipArchive;
$res = $zip->open('../setups.zip');
if ($res === TRUE) {
$contents = $zip->getFromName($path);
if ($contents == "") {
$path = str_replace("http://", "https/", $url);
$contents = $zip->getFromName($path);
}
$zip->close();
echo $contents;
} else {
http_response_code(404);
}
} else {
echo $contents;
$contents = @file_get_contents($url);
if ($contents === FALSE) {
http_response_code(404);
} else {
echo $contents;
}
}
?>
51 changes: 49 additions & 2 deletions releng/org.eclipse.oomph.releng/www/installer/index.html
Expand Up @@ -268,6 +268,8 @@
updateHref('link-drag-and-drop', url, 'Drag and drop the following link on the installer\'s title area:\n' + url);
updateHref('link-copy-and-apply', url, 'Click to copy the following link to the system clipboard and apply it to the installer:\n' + url);
updateHref('link-launch', scheme + ':' + url, 'Click to launch the installer for the following link:\n' + url);
updateProjectURL('button-sample-link', 'href', url);
updateProjectURLText('button-sample', url);
}

var os = getOS();
Expand All @@ -292,6 +294,24 @@
}
}

function updateProjectURL(id, attribute, url) {
var e = document.getElementById(id);
e.setAttribute(attribute, e.getAttribute(attribute).replace(/PROJECT_URL/g, url));
}

function updateProjectURLText(id, url) {
var e = document.getElementById(id);
e.innerHTML = e.innerHTML.replace(/PROJECT_URL/g, url);
}

function updateProjectLabel(label) {
var name = label.replace(/ *Development */, '').replace(/ *Environment */, '').replace(/ *Configuration */, '')
var e = document.getElementById('button-sample');
e.innerHTML = e.innerHTML.replace(/PROJECT/g, name);
var e = document.getElementById('button-sample-link');
e.innerHTML = e.innerHTML.replace(/PROJECT/g, name);
}

function updateHref(id, url, tooltip) {
var e = document.getElementById(id);
e.href = url;
Expand Down Expand Up @@ -389,6 +409,7 @@

var title= xmlDoc.documentElement.getAttribute('label');
var body = xmlBody[xmlBody.length - 1].textContent;
updateProjectLabel(title)
updateMarketplace(imageURI, title, body, ' and provision the <b>' + title + '</b>');
}
}
Expand Down Expand Up @@ -671,7 +692,8 @@ <h3 class="url-required section-header">
<button id="drag-and-drop-installer_arrow" class="orange bb" onclick="expand_collapse('drag-and-drop-installer');">&#x25B7;</button>
Install Using Drag and Drop
</h3>
<p id="drag-and-drop-installer" style="display: none;">
<div id="drag-and-drop-installer" style="display: none;">
<p>
If you don't wish to register the Eclipse Installer,
you can drag the following link button and drop it onto installer's title area:
<br/>
Expand All @@ -693,8 +715,33 @@ <h3 class="url-required section-header">
<br/>
Alternatively, you can
<span class="help-link" onclick="expand_collapse('copy-and-apply-installer', true);">copy and apply<img class="help" src="Help.png"/></span>the link.
<hr class="clearer"/>
<br/>
<br/>
<button id="drag-and-drop-installer-button_arrow" class="orange bb" onclick="expand_collapse('drag-and-drop-installer-button');">&#x25B7;</button>
You can even drag and drop the link for this page directly and the author could provide a styled button for that purpose.
</p>
<div id="drag-and-drop-installer-button" style="display:none;">
<a id="button-sample-link"
title="Click to open the Eclipse Installer Auto Launch documentation or drag into your running installer"
href="https://www.eclipse.org/setups/installer/?url=PROJECT_URL&show=true">
<img
src="https://img.shields.io/static/v1?logo=eclipseide&amp;label=Create%20Development%20Environment&amp;message=PROJECT&amp;style=for-the-badge&amp;logoColor=white&amp;labelColor=darkorange&amp;color=gray"
alt="Create Eclipse Development Environment for PROJECT"/>
</a>
<br/>
<br/>
<pre id="button-sample" style="font-size: 60%;">
&lt;a
title="Click to open the Eclipse Installer Auto Launch documentation or drag into your running installer"
href="https://www.eclipse.org/setups/installer/?url=PROJECT_URL&amp;show=true">
&lt;img
src="https://img.shields.io/static/v1?logo=eclipseide&amp;label=Create%20Development%20Environment&amp;message=PROJECT&amp;style=for-the-badge&amp;logoColor=white&amp;labelColor=darkorange&amp;color=gray"
alt="Create Eclipse Development Environment for PROJECT"/>
&lt;/a>
</pre>
</div>
</div>
<hr class="clearer"/>

<h3 class="url-required section-header">
<button id="copy-and-apply-installer_arrow" class="orange bb" onclick="expand_collapse('copy-and-apply-installer');">&#x25B7;</button>
Expand Down

0 comments on commit ff66f6c

Please sign in to comment.