Merge pull request #250 from Squidly271/6.4-wip

Add in Support & Project Links to Docker Context Menus
This commit is contained in:
tom mortensen
2018-01-29 21:53:33 -08:00
committed by GitHub
5 changed files with 89 additions and 8 deletions

View File

@@ -84,7 +84,10 @@ img.stopped{opacity:0.3;}
$updateStatus = ($updateStatus == "true" || $updateStatus == "undef") ? 'true' : 'false';
$running = ($ct['Running']) ? 'true' : 'false';
$webGuiUrl = $info[$name]['url'];
$contextMenus[] = sprintf("addDockerContainerContext('%s', '%s', '%s', %s, %s, %s, '%s', '%s');", addslashes($ct['Name']), addslashes($ct['ImageId']), addslashes($info[$name]['template']), $running, $updateStatus, $is_autostart, addslashes($webGuiUrl), $ct["Id"]);
$Support = $ct['Support'];
$Project = $ct['Project'];
$contextMenus[] = sprintf("addDockerContainerContext('%s', '%s', '%s', %s, %s, %s, '%s', '%s', '%s', '%s');", addslashes($ct['Name']), addslashes($ct['ImageId']), addslashes($info[$name]['template']), $running, $updateStatus, $is_autostart, addslashes($webGuiUrl), $ct["Id"], addslashes($info[$name]['Support']),addslashes($info[$name]['Project']));
$shape = ($ct["Running"]) ? "play" : "square";
$status = ($ct["Running"]) ? "started" : "stopped";
@@ -207,8 +210,8 @@ img.stopped{opacity:0.3;}
<input type="button" onclick="addContainer()" value="Add Container"/>
<input type="button" onclick="reloadUpdate()" value="Check for Updates"/>
<script src="/webGui/javascript/jquery.switchbutton.js"></script>
<script src="/plugins/dynamix.docker.manager/javascript/docker.js"></script>
<script src="<?autov('/webGui/javascript/jquery.switchbutton.js')?>"></script>
<script src="<?autov('/plugins/dynamix.docker.manager/javascript/docker.js')?>"></script>
<script>
<?if ($display['resize']):?>
function resize(bind) {

View File

@@ -198,6 +198,7 @@ function postToXML($post, $setOwnership = false) {
$xml->MyIP = xml_encode($post['contMyIP']);
$xml->Privileged = (strtolower($post["contPrivileged"]) == 'on') ? 'true' : 'false';
$xml->Support = xml_encode($post['contSupport']);
$xml->Project = xml_encode($post['contProject']);
$xml->Overview = xml_encode($post['contOverview']);
$xml->Category = xml_encode($post['contCategory']);
$xml->WebUI = xml_encode(trim($post['contWebUI']));
@@ -206,6 +207,10 @@ function postToXML($post, $setOwnership = false) {
$xml->ExtraParams = xml_encode($post['contExtraParams']);
$xml->PostArgs = xml_encode($post['contPostArgs']);
$xml->DateInstalled = xml_encode(time());
$xml->DonateText = xml_encode($post['contDonateText']);
$xml->DonateLink = xml_encode($post['contDonateLink']);
$xml->DonateImg = xml_encode($post['contDonateImg']);
$xml->MinVer = xml_encode($post['contMinVer']);
# V1 compatibility
$xml->Description = xml_encode($post['contOverview']);
@@ -262,6 +267,7 @@ function xmlToVar($xml) {
$out['MyIP'] = isset($xml->MyIP) ? xml_decode($xml->MyIP) : '';
$out['Privileged'] = xml_decode($xml->Privileged);
$out['Support'] = xml_decode($xml->Support);
$out['Project'] = xml_decode($xml->Project);
$out['Overview'] = stripslashes(xml_decode($xml->Overview));
$out['Category'] = xml_decode($xml->Category);
$out['WebUI'] = xml_decode($xml->WebUI);
@@ -269,6 +275,10 @@ function xmlToVar($xml) {
$out['Icon'] = xml_decode($xml->Icon);
$out['ExtraParams'] = xml_decode($xml->ExtraParams);
$out['PostArgs'] = xml_decode($xml->PostArgs);
$out['DonateText'] = xml_decode($xml->DonateText);
$out['DonateLink'] = xml_decode($xml->DonateLink);
$out['DonateImg'] = (xml_decode($xml->DonateImage)) ? xml_decode($xml->DonateImage) : xml_decode($xml->DonateImg); # Various authors use different tags. DonateImg is the official spec
$out['MinVer'] = xml_decode($xml->MinVer);
$out['Config'] = [];
if (isset($xml->Config)) {
@@ -1320,6 +1330,61 @@ optgroup.title{background-color:#625D5D;color:#FFFFFF;text-align:center;margin-t
</blockquote>
</td>
</tr>
<tr class="<?=$authoring;?>">
<td>Project Page:</td>
<td><input type="text" name="contProject"></td>
</tr>
<tr class="<?=$authoring;?>">
<td colspan="2">
<blockquote class="inline_help">
<p>Link to the project page (eg: www.plex.tv)</p>
</blockquote>
</td>
</tr>
<tr class="<?=$authoring;?>">
<td>Minimum unRAID version:</td>
<td><input type="text" name="contMinVer"></td>
</tr>
<tr class="<?=$authoring;?>">
<td colspan="2">
<blockquote class="inline_help">
<p>Minimum unRAID version required to run this container. Enforced by the Apps Tab on Installation. If there is no minimum version of unRaid required to run the container, leave blank. Note that any container using 32 bit binaries should have a minimum version set to 6.4.0</p>
</blockquote>
</td>
</tr>
<tr class="<?=$authoring;?>">
<td>Donation Text:</td>
<td><input type="text" name="contDonateText"></td>
</tr>
<tr class="<?=$authoring;?>">
<td colspan="2">
<blockquote class="inline_help">
<p>Text to appear on Donation Links Within The Apps Tab</p>
</blockquote>
</td>
</tr>
<tr class="<?=$authoring;?>">
<td>Donation Image:</td>
<td><input type="text" name="contDonateImg"></td>
</tr>
<tr class="<?=$authoring;?>">
<td colspan="2">
<blockquote class="inline_help">
<p>Link to the image used for Donation Links Within The Apps Tab</p>
</blockquote>
</td>
</tr>
<tr class="<?=$authoring;?>">
<td>Donation Link:</td>
<td><input type="text" name="contDonateLink"></td>
</tr>
<tr class="<?=$authoring;?>">
<td colspan="2">
<blockquote class="inline_help">
<p>Link to the donation page. If using donation's, both the image and link must be set</p>
</blockquote>
</td>
</tr>
<tr class="advanced">
<td>Docker Hub URL:</td>
<td><input type="text" name="contRegistry"></td>

View File

@@ -333,6 +333,12 @@ class DockerTemplates {
$Registry = $this->getTemplateValue($image, "Registry");
$tmp['registry'] = ($Registry) ? $Registry : null;
$Support = $this->getTemplateValue($image, "Support");
$tmp['Support'] = ($Support) ? $Support : null;
$Project = $this->getTemplateValue($image, "Project");
$tmp['Project'] = ($Project) ? $Project : null;
if (!$tmp['updated'] || $reload) {
if ($reload) $DockerUpdate->reloadUpdateStatus($image);

View File

@@ -1,6 +1,6 @@
var eventURL = "/plugins/dynamix.docker.manager/include/Events.php";
function addDockerContainerContext(container, image, template, started, update, autostart, webui, id) {
function addDockerContainerContext(container, image, template, started, update, autostart, webui, id, Support, Project) {
var opts = [{header: container, image: "/plugins/dynamix.docker.manager/images/dynamix.docker.manager.png"}];
if (started && (webui !== "" && webui != "#")) {
opts.push({text: 'WebUI', icon: 'fa-globe', href: webui, target: '_blank'});
@@ -25,6 +25,13 @@ function addDockerContainerContext(container, image, template, started, update,
}
opts.push({divider: true});
opts.push({text: 'Remove', icon: 'fa-trash', action: function(e){ e.preventDefault(); rmContainer(container, image, id); }});
if (Support) {
opts.push({divider: true});
opts.push({text: 'Support', icon: 'fa-question', href: Support, target: '_blank'});
}
if (Project) {
opts.push({text: 'Project Page', icon: 'fa-life-ring', href: Project, target: '_blank'});
}
context.attach('#context-'+container, opts);
}

View File

@@ -76,7 +76,7 @@ foreach ($allContainers as $ct) {
$updateStatus = ($updateStatus == "true" or $updateStatus == "undef" ) ? 'true' : 'false';
$running = ($ct['Running']) ? 'true' : 'false';
$webGuiUrl = $info['url'];
$contextMenus[] = sprintf("addDockerContainerContext('%s', '%s', '%s', %s, %s, %s, '%s', '%s');", addslashes($ct['Name']), addslashes($ct['ImageId']), addslashes($info['template']), $running, $updateStatus, $is_autostart, addslashes($webGuiUrl), $ct["Id"] );
$contextMenus[] = sprintf("addDockerContainerContext('%s', '%s', '%s', %s, %s, %s, '%s', '%s', '%s', '%s');", addslashes($ct['Name']), addslashes($ct['ImageId']), addslashes($info['template']), $running, $updateStatus, $is_autostart, addslashes($webGuiUrl), $ct["Id"], $info["Support"],$info["Project"] );
$shape = ($ct["Running"]) ? "play" : "square";
$status = ($ct["Running"]) ? "started" : "stopped";
@@ -132,9 +132,9 @@ foreach ($allVMs as $name) {
?>
<div id="noapps">No apps available to show</div>
</div>
<script src="/webGui/javascript/jquery.switchbutton.js"></script>
<script src="/plugins/dynamix.docker.manager/javascript/docker.js"></script>
<script src="/plugins/dynamix.vm.manager/javascript/vmmanager.js"></script>
<script src="<?autov('/webGui/javascript/jquery.switchbutton.js')?>"></script>
<script src="<?autov('/plugins/dynamix.docker.manager/javascript/docker.js')?>"></script>
<script src="<?autov('/plugins/dynamix.vm.manager/javascript/vmmanager.js')?>"></script>
<script>
$(function() {
if ($.cookie('dashapps_view_mode') == 'startedonly') {