Skip to content

Commit

Permalink
Merge pull request #27 from lukesUbuntu/dns
Browse files Browse the repository at this point in the history
Added DNS tab and listing of DNS entries issue #14
  • Loading branch information
lukesUbuntu authored Jun 21, 2020
2 parents 4ec32ef + 20cf7eb commit 9479c83
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 10 deletions.
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
Please check [Todo Status](https://github.com/lukesUbuntu/virtualmin_blesta/issues/11) or [Current Project Status](https://github.com/lukesUbuntu/virtualmin_blesta/projects/2) before installing.
![GitHub last commit](https://img.shields.io/github/last-commit/lukesubuntu/virtualmin_blesta)
![GitHub issues](https://img.shields.io/github/issues/lukesubuntu/virtualmin_blesta)
![GitHub issues by-label](https://img.shields.io/github/issues/lukesubuntu/virtualmin_blesta/bug?color=orange)
![GitHub closed issues](https://img.shields.io/github/issues-closed/lukesubuntu/virtualmin_blesta?color=red)

# 01/06/2020 Virtualmin Module for Blesta v4.0+ (currently working off blesta 4.9)
Orginally did this plugin 4 years ago but client stopped webhosting... so i stopped development...

Plugin in BETA so please check [Todo Status](https://github.com/lukesUbuntu/virtualmin_blesta/issues/11) or [Current Project Status](https://github.com/lukesUbuntu/virtualmin_blesta/projects/2) before installing.

# Virtualmin Module for Blesta v4.0+


I myself have now got into webhosting with Virtualmin and updating this plugin for my own needs as i want all my clients hosting automated, from billing to the client controlling everything within blesta.

Expand All @@ -11,14 +17,17 @@ I myself have now got into webhosting with Virtualmin and updating this plugin f

Module currently works with blesta 3.5+ (php 5.6 & 7.0+) project is still in beta i wouldn't install till [Todo Status](https://github.com/lukesUbuntu/virtualmin_blesta/issues/11) or [Current Project Status](https://github.com/lukesUbuntu/virtualmin_blesta/projects/2) has been completed. But if you want to have a play and provide issues or feedback feel free to install & help make this module.

Support Blesta 3.5+
Ahh yeah so When will it be ready?
Once completed above and redone a few security issues i have found that, i am hoping for August 2020 for first release

##

**Virtualmin Blesta Module version 0.1.3**

### This virtualmin for blesta module ## is not finished, and only clients menus available are
### Current available client options for VirtualMin
- server status
- mail accounts
- install script
- databases


Expand All @@ -45,19 +54,19 @@ please note not all tabs are active in this repo module version
![Databases](http://i.imgur.com/7i5DLMa.png)

####### NOTES #######
This is first initial release so please use at your *own risk*, I have done a ton of *sandbox* testing, and only several **live** testing, please [submit](https://github.com/lukesUbuntu/gogetsslv2/issues) any issues, and check [todo list](#-todo)
Plugin in BETA so please check [Todo Status](https://github.com/lukesUbuntu/virtualmin_blesta/issues/11) or [Current Project Status](https://github.com/lukesUbuntu/virtualmin_blesta/projects/2) before installing.

## Installation instructions
### Via Git
1. CD into blesta root folder */components/modules* directory
1. clone repo into your blesta modules folder eg `cd /home/blesta_install/public_html/components/modules`
2. run `$ git clone https://github.com/lukesUbuntu/virtualmin_blesta.git`
3. Go to Blesta Admin, and click on Setings->Modules and it will list the Virtualmin module, Click on "INSTALL"
3. Go to Blesta Admin, and click on Settings->Modules and it will list the Virtualmin module, Click on "INSTALL"
4. Go to Virtualmin module and add your Virtualmin Server Details.

#### Via FTP
1. [Download](https://github.com/lukesUbuntu/virtualmin_blesta/archive/master.zip) this module
2. Uncompress file,and rename folder to *virtualmin_blesta*
3. Upload *virtualmin_blesta* folder to your blesta root dir to */componets/modules/* directory.
3. Go to Blesta Admin, and click on Setings->Modules and it will list the Virtualmin module, Click on "INSTALL"
3. Upload *virtualmin_blesta* folder to your blesta root dir to */components/modules/* directory.
3. Go to Blesta Admin, and click on Settings->Modules and it will list the Virtualmin module, Click on "INSTALL"
4. Go to Virtualmin module and add your Virtualmin Server Details.

2 changes: 2 additions & 0 deletions language/en_us/virtualmin_blesta.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@
//client tabs - Client Tab Scripts (client_tab_scripts.pdt)
$lang['virtualmin.client.tabs.scripts.menu'] = "Install Scripts";

$lang['virtualmin.client.tabs.dns.menu'] = "DNS Editor";

//client tabs - Client Tab Scripts (client_tab_scripts.pdt)
$lang['virtualmin.client.tabs.filemin.menu'] = "Filemin Manager";

Expand Down
71 changes: 71 additions & 0 deletions views/default/client_tab_dns.pdt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<style>
.type{
width : 100px;
}
.value {
width : 100%;
}
</style>
<h4>DNS Records</h4>
<div class="table-responsive" style="">

<table id= "dns_records_table" class="table table-curved table-striped">
<thead>

<tr>
<th>Type</th>
<th>Value</th>
<th>Actions</th>
</tr>

</thead>
<tbody>
<tr class="dns_row" style="display:none;">
<td class="type"></td>
<td class="value"></td>
<td class="action" >
<div class="dropdown pull-right">
<button class="btn btn-warning" data-toggle="modal" data-target="#editDnsRecord" role="presentation"> Edit </button>
</div>
</td>
</tr>




</tbody>
</table>
</div>

<div class="modal fade" id="editDnsRecord" tabindex="-1" role="dialog" aria-labelledby="confirmation"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">

<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
<h4 class="modal-title" id="confirmation">Edit Record</h4>
</div>

<div class="modal-body">
<p>Sorry still in development</p>
</div>

<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<a id="confirmed" href="#" class="btn btn-success success">Save</a>
</div>
</div>
</div>
</div>

<script type="text/javascript">
//declared for our external js pagehelper.js
var $action_url = '<?php echo $action_url; ?>';
var $CsrfToken = '<?php echo $this->Form->getCsrfToken();?>';
var $CurrentPage = $("#statusPage");
var dnsRecords = <?php echo json_encode($dns_records); ?>
</script>
<!--Include our javascript file !-->
<script type='text/javascript' src='<?php echo $this->Html->safe($this->view_dir . 'js/pagehelper.js'); ?>'></script>
<script type='text/javascript' src='<?php echo $this->Html->safe($this->view_dir . 'js/client_tab_dns.js'); ?>'></script>
27 changes: 27 additions & 0 deletions views/default/js/client_tab_dns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

$(document).ready(function () {
renderDnsRecords();
})

function renderDnsRecords(){
var dns_records_table = $("#dns_records_table > tbody:last-child");
var row_template = $('.dns_row').html()
for(var dns_index in dnsRecords){
var record = dnsRecords[dns_index];
var row = row_template;
if (record.type.toLowerCase() == "soa"){
continue;
}
row = $('<tr>' + row + '</tr>');
$('.type', row).text(record.type)
var value = record.value.toString();
if (value.length > 50){
value = value.substr(0,80) + '...'
}
$('.value', row).text(value)


$(dns_records_table).append(row)
// > tbody:last-child
}
}
37 changes: 37 additions & 0 deletions virtualmin_blesta.php
Original file line number Diff line number Diff line change
Expand Up @@ -1567,13 +1567,18 @@ public function getClientTabs($package)
'clientTabDatabase' => array('name' => Language::_("virtualmin.client.tabs.database.menu", true), 'icon' => "fa fa-bars"),
//'clientTabFileMin' => array('name' => Language::_("virtualmin.client.tabs.filemin.menu", true), 'icon' => "fa fa-file"), //still working on this may have to write custom perl module to enable
'clientTabScripts' => array('name' => Language::_("virtualmin.client.tabs.scripts.menu", true), 'icon' => "fa fa-chevron-right"),
'clientTabDns' => array('name' => Language::_("virtualmin.client.tabs.dns.menu", true), 'icon' => "fa fa-pencil"),

'clientTabBackups' => array('name' => Language::_("virtualmin.client.tabs.backup.menu", true), 'icon' => "fa fa-download"),

);

if (!isset($package->meta->enable_database)) unset($tabs['clientTabDatabase']);
if (!isset($package->meta->enable_mail)) unset($tabs['clientTabMail']);
if (!isset($package->meta->enable_scripts)) unset($tabs['clientTabScripts']);
if (!isset($package->meta->enable_backups)) unset($tabs['clientTabBackups']);
if (!isset($package->meta->enable_dns)) unset($tabs['clientTabDNS']);

return $tabs;
}

Expand Down Expand Up @@ -1752,7 +1757,39 @@ public function clientTabScripts($package, $service, array $getRequest = null, a
return $this->renderTemplate("client_tab_scripts", $buildVars);

}
public function clientTabDns($package, $service, array $getRequest = null, array $postRequest = null, array $files = null)
{

//check service is active
if (($service_active = $this->serviceCheck($service)) !== true)
return $service_active;


$allowedRequests = array("add_dns_record","remove_dns_record","modify_dns_record");
$dataRequest = array(
'package' => $package,
'service' => $service,
);

$this->getVirtualMinHelper()->processAjax($this, $getRequest, $postRequest, $allowedRequests, $dataRequest);
$service_fields = $this->serviceFieldsToObject($service->fields);

$account = array('domain' => $service_fields->virtualmin_domain);
$dns_records = $this->getVirtualMinHelper()->cleanArray($this->api()->get_dns($account));

$service_fields = $this->serviceFieldsToObject($service->fields);

$buildVars = array(
"dns_records" => $dns_records,
"action_url" => $this->base_uri . "services/manage/" . $service->id . "/clientTabDns/",
"service_fields" => $service_fields,
"service_id" => $service->id,
"vars", (isset($vars) ? $vars : new stdClass())
);

//build page
return $this->renderTemplate("client_tab_dns", $buildVars);
}
/**
* Initializes the virtualMinLib and returns an instance of that object
* see lib/virtualmin_lib_helper.php
Expand Down

0 comments on commit 9479c83

Please sign in to comment.