Added a constant to set view as Cards or Table
Added a constant to set view as Cards or Table. "CARDS", "TABLE" this means on page load that default view will be showing.
This commit is contained in:
parent
3de0b0956c
commit
c882d47026
54
assets/js/scripts.min.js
vendored
54
assets/js/scripts.min.js
vendored
|
@ -149,8 +149,36 @@ $(document).ready(function () {
|
||||||
$('.next-dd').val(one_month_on);
|
$('.next-dd').val(one_month_on);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($("#cardsViewDiv").hasClass("active")) {
|
||||||
|
loadCards();
|
||||||
|
} else if ($("#tableViewDiv").hasClass("active")){
|
||||||
|
loadTable();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function loadCards(){
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "calls.php",
|
||||||
|
data: {"type": "object_cards"},
|
||||||
|
success: function (result) {
|
||||||
|
$("#cardsViewDiv").append(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadTable(){
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "calls.php",
|
||||||
|
data: {"type": "object_tables"},
|
||||||
|
success: function (result) {
|
||||||
|
$("#tableViewDiv").append(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
$(".location-input").autocomplete({
|
$(".location-input").autocomplete({
|
||||||
source: function (request, response) {
|
source: function (request, response) {
|
||||||
|
@ -175,7 +203,6 @@ $(function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).on("click", "#viewMoreServer", function () {
|
$(document).on("click", "#viewMoreServer", function () {
|
||||||
var serverId = this.getAttribute("value");
|
var serverId = this.getAttribute("value");
|
||||||
$("#viewMoreModalBody").empty();
|
$("#viewMoreModalBody").empty();
|
||||||
|
@ -315,35 +342,28 @@ $(document).on("click", "#checkUpStatus", function () {
|
||||||
|
|
||||||
$(document).on("click", "#viewSwitcherIcon", function () {
|
$(document).on("click", "#viewSwitcherIcon", function () {
|
||||||
var icon = $(this).children().first();
|
var icon = $(this).children().first();
|
||||||
if ($("#serversTable").children().length == 0){
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: "calls.php",
|
|
||||||
data: {"type": "object_tables"},
|
|
||||||
success: function (result) {
|
|
||||||
$("#tableViewDiv").append(result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
icon.removeClass("fa-table");
|
|
||||||
icon.addClass("fa-th");
|
|
||||||
$("#cardsViewDiv" ).hide();
|
|
||||||
$("#tableViewDiv" ).show();
|
|
||||||
$('#viewSwitchIcon').prop('title', 'Switch to cards');
|
|
||||||
} else {
|
|
||||||
if (icon.hasClass("fa-table")) {
|
if (icon.hasClass("fa-table")) {
|
||||||
|
if ($("#serversTable").children().length == 0) {
|
||||||
|
loadTable();
|
||||||
|
}
|
||||||
icon.removeClass("fa-table");
|
icon.removeClass("fa-table");
|
||||||
icon.addClass("fa-th");
|
icon.addClass("fa-th");
|
||||||
$("#cardsViewDiv").hide();
|
$("#cardsViewDiv").hide();
|
||||||
$("#tableViewDiv").show();
|
$("#tableViewDiv").show();
|
||||||
$('#viewSwitchIcon').prop('title', 'Switch to cards');
|
$('#viewSwitchIcon').prop('title', 'Switch to cards');
|
||||||
|
|
||||||
} else if (icon.hasClass("fa-th")) {
|
} else if (icon.hasClass("fa-th")) {
|
||||||
|
if ($("#cardsViewDiv").children().length == 0) {
|
||||||
|
loadCards();
|
||||||
|
}
|
||||||
icon.removeClass("fa-th");
|
icon.removeClass("fa-th");
|
||||||
icon.addClass("fa-table");
|
icon.addClass("fa-table");
|
||||||
|
$("#cardsViewDiv").addClass("active");
|
||||||
|
$("#tableViewDiv").removeClass("active");
|
||||||
$("#tableViewDiv").hide();
|
$("#tableViewDiv").hide();
|
||||||
$("#cardsViewDiv").show();
|
$("#cardsViewDiv").show();
|
||||||
$('#viewSwitchIcon').prop('title', 'Switch to table');
|
$('#viewSwitchIcon').prop('title', 'Switch to table');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#virt').change(function(){
|
$('#virt').change(function(){
|
||||||
|
|
|
@ -40,6 +40,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||||
$idle->getIpForDomain($_GET['hostname'], $_GET['dns_type']);
|
$idle->getIpForDomain($_GET['hostname'], $_GET['dns_type']);
|
||||||
} elseif ($_GET['type'] == 'check_up') {
|
} elseif ($_GET['type'] == 'check_up') {
|
||||||
echo $idle->checkIsUp($_GET['host']);
|
echo $idle->checkIsUp($_GET['host']);
|
||||||
|
} elseif ($_GET['type'] == 'object_cards') {
|
||||||
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
|
echo $idle->objectCards();
|
||||||
} elseif ($_GET['type'] == 'object_tables') {
|
} elseif ($_GET['type'] == 'object_tables') {
|
||||||
header('Content-Type: text/html; charset=utf-8');
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
echo $idle->objectTables();
|
echo $idle->objectTables();
|
||||||
|
|
28
class.php
28
class.php
|
@ -17,6 +17,8 @@ class idlersConfig
|
||||||
|
|
||||||
//Have slight background color for server table values: was special price and due soon
|
//Have slight background color for server table values: was special price and due soon
|
||||||
const COLOR_TABLE = true;
|
const COLOR_TABLE = true;
|
||||||
|
|
||||||
|
const DEFAULT_VIEW = 'CARDS';//CARDS or TABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
class elementHelpers extends idlersConfig
|
class elementHelpers extends idlersConfig
|
||||||
|
@ -598,12 +600,17 @@ class idlers extends helperFunctions
|
||||||
$this->outputString('<div id="myTabContent" class="tab-content">');
|
$this->outputString('<div id="myTabContent" class="tab-content">');
|
||||||
$this->outputString('<div class="tab-pane server-cards fade active show" id="services">');
|
$this->outputString('<div class="tab-pane server-cards fade active show" id="services">');
|
||||||
$this->viewSwitcherIcon();
|
$this->viewSwitcherIcon();
|
||||||
$this->tagOpen('div', '', 'cardsViewDiv');
|
if (self::DEFAULT_VIEW == 'CARDS') {
|
||||||
$this->serverCards();
|
$cards_start = 'active';
|
||||||
$this->sharedHostingCards();
|
$table_start = '';
|
||||||
$this->domainCards();
|
} else {
|
||||||
|
$cards_start = '';
|
||||||
|
$table_start = 'active';
|
||||||
|
}
|
||||||
|
$this->tagOpen('div', $cards_start, 'cardsViewDiv');
|
||||||
|
//Object cards
|
||||||
$this->tagClose('div');
|
$this->tagClose('div');
|
||||||
$this->tagOpen('div', '', 'tableViewDiv');
|
$this->tagOpen('div', $table_start, 'tableViewDiv');
|
||||||
//Objects tables
|
//Objects tables
|
||||||
$this->tagClose('div', 2);
|
$this->tagClose('div', 2);
|
||||||
$this->outputString('<div class="tab-pane fade" id="add_server">');
|
$this->outputString('<div class="tab-pane fade" id="add_server">');
|
||||||
|
@ -981,6 +988,13 @@ class idlers extends helperFunctions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function objectCards()
|
||||||
|
{
|
||||||
|
$this->serverCards();
|
||||||
|
$this->sharedHostingCards();
|
||||||
|
$this->domainCards();
|
||||||
|
}
|
||||||
|
|
||||||
public function objectTables()
|
public function objectTables()
|
||||||
{
|
{
|
||||||
$this->serverTable();
|
$this->serverTable();
|
||||||
|
@ -3082,7 +3096,11 @@ class idlers extends helperFunctions
|
||||||
protected function viewSwitcherIcon()
|
protected function viewSwitcherIcon()
|
||||||
{
|
{
|
||||||
$this->rowColOpen('row text-center', 'col-12');
|
$this->rowColOpen('row text-center', 'col-12');
|
||||||
|
if (self::DEFAULT_VIEW == 'CARDS') {
|
||||||
$this->outputString('<a id="viewSwitcherIcon"><i class="fas fa-table" id="viewSwitchIcon" title="Switch to table"></i></a>');
|
$this->outputString('<a id="viewSwitcherIcon"><i class="fas fa-table" id="viewSwitchIcon" title="Switch to table"></i></a>');
|
||||||
|
} else {
|
||||||
|
$this->outputString('<a id="viewSwitcherIcon"><i class="fas fa-th" id="viewSwitchIcon" title="Switch to cards"></i></a>');
|
||||||
|
}
|
||||||
$this->tagClose('div', 2);
|
$this->tagClose('div', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user