4 Commits

Author SHA1 Message Date
Andrew
9aa8378599 Merge pull request #2 from EZSCALE/Prophet731-patch-1
Update hooks.php
2024-01-16 12:13:15 -05:00
Andrew
f0c28a4961 Update hooks.php
Hide the SSH key field if the user isn't logged in to see them or is a new user.
2024-01-16 12:11:26 -05:00
Prophet731
a46223e5ac Update issue templates 2023-09-11 00:31:03 -04:00
98250f2f4c Ahh typos 2023-09-10 23:58:17 -04:00
4 changed files with 73 additions and 11 deletions

38
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -5,7 +5,8 @@
![GitHub issues](https://img.shields.io/github/issues/EZSCALE/virtfusion-whmcs-module)
![GitHub pull requests](https://img.shields.io/github/issues-pr/EZSCALE/virtfusion-whmcs-module)
This module requires VirtFusion v1.7.3 or higher as this is what it's based on. Please refer to the official [documenataion](https://docs.virtfusion.com/integrations/whmcs).
This module requires VirtFusion v1.7.3 or higher as this is what it's based on. Please refer to the
official [documentation](https://docs.virtfusion.com/integrations/whmcs).
## Installation

View File

@@ -27,7 +27,7 @@ add_hook('ClientAreaFooterOutput', 1, function ($vars) {
foreach ($templates_data['data'] as $osCategory) {
foreach ($osCategory['templates'] as $template) {
$optionValue = $template['id'];
$optionLabel = $template['name'] . " " . $template['version'] . " " . $template['variant'];
$optionLabel = $template['name']." ".$template['version']." ".$template['variant'];
$dropdownOptions[] = ['id' => $optionValue, 'name' => $optionLabel];
}
}
@@ -65,18 +65,20 @@ add_hook('ClientAreaFooterOutput', 1, function ($vars) {
return "
<script>
document.addEventListener('DOMContentLoaded', function() {
var osTemplates = " . json_encode($dropdownOptions) . ";
var sshKeys = " . json_encode($sshKeysOptions) . ";
let osTemplates = ".json_encode($dropdownOptions, JSON_THROW_ON_ERROR).";
let sshKeys = ".json_encode($sshKeysOptions, JSON_THROW_ON_ERROR).";
var osInputField = document.querySelector('[name=\"customfield[" . ($osID[0] ?? null) . "]\"]');
var sshInputField = document.querySelector('[name=\"customfield[" . ($sshID[0] ?? null) . "]\"]');
const osInputField = document.querySelector('[name=\"customfield[".($osID[0] ?? null)."]\"]');
const osInputLabel = document.querySelector('[for=\"customfield".($osID[0] ?? null)."\"]');
const sshInputField = document.querySelector('[name=\"customfield[".($sshID[0] ?? null)."]\"]');
const sshInputLabel = document.querySelector('[for=\"customfield".($sshID[0] ?? null)."\"]');
// Create dropdown options menu, then add it to the DOM then on change, update the regular input.
var osSelect = document.createElement('select');
let osSelect = document.createElement('select');
osSelect.className = 'form-control';
osTemplates.forEach(function(template) {
var option = document.createElement('option');
let option = document.createElement('option');
option.value = template.id;
option.text = template.name;
osSelect.appendChild(option);
@@ -95,11 +97,11 @@ add_hook('ClientAreaFooterOutput', 1, function ($vars) {
if (sshKeys.length > 0) {
// Create dropdown options menu, then add it to the DOM then on change, update the regular input.
var sshSelect = document.createElement('select');
let sshSelect = document.createElement('select');
sshSelect.className = 'form-control';
sshKeys.forEach(function(sshkey) {
var option = document.createElement('option');
let option = document.createElement('option');
option.value = sshkey.id;
option.text = sshkey.name;
sshSelect.appendChild(option);
@@ -116,6 +118,7 @@ add_hook('ClientAreaFooterOutput', 1, function ($vars) {
sshInputField.style.display = 'none';
} else {
sshInputField.style.display = 'none';
sshInputLabel.style.display = 'none';
}
});
</script>