diff --git a/README.md b/README.md index d8d26ad..f6d30c8 100644 --- a/README.md +++ b/README.md @@ -90,22 +90,25 @@ or ### Screenshots -[![Screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data.jpg) +[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-cards.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-cards.jpg) +[![My idlers screenshot2](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-table.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-table.jpg) -[![screenshot2](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-MORE-1.1.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-MORE-1.1.jpg) +[![My idlers screenshot3](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-more-modal.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-more-modal.jpg) +[![My idlers screenshot4](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-edit-modal.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-edit-modal.jpg) -[![screenshot3](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-EDIT-1.1.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-EDIT-1.1.jpg) +[![My idlers screenshot5](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-order-servers.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-order-servers.jpg) +[![My idlers screenshot6](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-search.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-search.jpg) -[![screenshot4](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-order-table.png)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-order-table.png) +[![My idlers screenshot7](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-summary-card.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-summary-card.jpg) +[![My idlers screenshot8](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-compare-two-servers.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-compare-two-servers.jpg) -[![screenshot5](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-tally-card.png)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-tally-card.png) - -[![screenshot6](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-table-view.png)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-table-view.png) +[![My idlers screenshot9](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-add-server-from-yabs.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-add-server-from-yabs.jpg) +[![My idlers screenshot10](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-add-shared-hosting.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-add-shared-hosting.jpg) [![Auto complete location](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-location.gif)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-location.gif) diff --git a/assets/css/style.css b/assets/css/style.css index 5691985..fea7246 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -51,6 +51,9 @@ body { .container { max-width: 720px } + .nav-link { + padding: .5rem 0.45rem; + } } @media (min-width: 992px) { @@ -1184,10 +1187,27 @@ button.close { background: #00ff340f; } -.objects-table th:first-child, .objects-table td:first-child { +.objects-table th:first-child, .objects-table td:first-child, .compare-table th:first-child, .compare-table td:first-child { position: sticky; left: 0; background-color: #f6f6f6; + text-align: left; +} + +.compare-table td, .compare-table th { + text-align: center; +} + +.plus-td { + background: #71ed7136; +} + +.neg-td { + background: #ed827136; +} + +.equal-td { + background: #6189ff26; } .table-btn { @@ -1540,4 +1560,10 @@ input:checked + .slider:before { .modal-lg { max-width: 800px; } +} + +@media (max-width: 700px) { + .nav-link { + padding: 0.5rem 0.45rem; + } } \ No newline at end of file diff --git a/assets/js/scripts.min.js b/assets/js/scripts.min.js index 4cb5c1b..99ab497 100644 --- a/assets/js/scripts.min.js +++ b/assets/js/scripts.min.js @@ -18,6 +18,30 @@ jQuery Tags CUSTOM SCRIPTS/FUNCS */ +function YABSdebug(result){ + if (result == 1){ + return 'Success'; + } else if (result == 2){ + return 'Wrong version'; + } else if (result == 3){ + return 'Didnt start at right spot'; + } else if (result == 4){ + return 'Not correct format'; + } else if (result == 5){ + return 'Not a correct YABs command output'; + } else if (result == 6){ + return 'GeekBench 5 only allowed'; + } else if (result == 7){ + return 'GeekBench test failed'; + } else if (result == 8){ + return 'Didnt copy output correctly'; + } else if (result == 9){ + return 'Less than 50 lines'; + } else { + return 'Unknown '+result; + } +} + $(document).ready(function () { $("#yabsForm").submit(function (e) { e.preventDefault(e); @@ -26,7 +50,11 @@ $(document).ready(function () { url: "calls.php", data: $("#yabsForm").serialize(), success: function (result) { - location.reload(); + if (result.length == 1) { + alert('ERROR: ' + YABSdebug(result)); + } else { + location.reload(); + } } }); }); @@ -155,8 +183,37 @@ $(document).ready(function () { } else if ($("#tableViewDiv").hasClass("active")){ loadTable(); } + + //Compare section + $("#compare_s1").change(function () { + var server1_id = $("#compare_s1 option:selected").val(); + var server2_id = $("#compare_s2 option:selected").val(); + if (server2_id.length !== 0) { + compareTableCall(server1_id, server2_id); + } + }); + $("#compare_s2").change(function () { + var server2_id = $("#compare_s2 option:selected").val(); + var server1_id = $("#compare_s1 option:selected").val(); + if (server1_id.length !== 0) { + compareTableCall(server1_id, server2_id); + } + }); + }); +function compareTableCall(id1, id2) { + $("#compareTableDiv").empty(); + $.ajax({ + type: "GET", + url: "calls.php", + data: {"type": "compare_table", "server1": id1, "server2": id2}, + success: function (result) { + $("#compareTableDiv").append(result); + } + }); +} + function loadCards(){ $.ajax({ type: "GET", diff --git a/calls.php b/calls.php index 6e6c01f..b615b98 100644 --- a/calls.php +++ b/calls.php @@ -46,6 +46,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } elseif ($_GET['type'] == 'object_tables') { header('Content-Type: text/html; charset=utf-8'); echo $idle->objectTables(); + } elseif ($_GET['type'] == 'compare_table') { + header('Content-Type: text/html; charset=utf-8'); + echo $idle->compareTable($_GET['server1'], $_GET['server2']); } } } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { @@ -56,8 +59,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (isset($_POST['action']) && $_POST['action'] == 'insert') {//From an insert 'type' form $insert = new itemInsert($_POST); if (isset($_POST['from_yabs'])) {//From add form YABs - $insert->insertBasicWithYabs();//Insert basic data from form - $insert->insertYabsData();//Insert YABs data from the form + $id = $insert->insertBasicWithYabs();//Insert basic data from form + $response_code = $insert->insertYabsData();//Insert YABs data from the form + if ($response_code != 1) { + header('Content-Type: text/html; charset=utf-8'); + $update = new itemUpdate(array('me_server_id' => $id)); + $update->deleteObjectData(); + echo $response_code; + exit; + } } elseif (isset($_POST['manual'])) {//From add form manual $insert->insertBasic(); } elseif (isset($_POST['shared_hosting_form'])) {//From shared hosting form diff --git a/class.php b/class.php index 3277c13..d8f2bc9 100644 --- a/class.php +++ b/class.php @@ -19,6 +19,8 @@ class idlersConfig const COLOR_TABLE = true; const DEFAULT_VIEW = 'CARDS';//CARDS or TABLE + + const SAVE_YABS_OUTPUT = true;//true or false } class elementHelpers extends idlersConfig @@ -566,6 +568,20 @@ class helperFunctions extends elementHelpers $date = new DateTime($ahead_date); return $date->diff($today)->format("%a"); } + + protected function deleteYabsForId(string $id) + { + if ($handle = opendir("yabs/")) { + while (false !== ($file = readdir($handle))) { + if ('.' === $file) continue; + if (strpos($file, $id) !== false) { + unlink("yabs/$file"); + } + } + closedir($handle); + } + } + } class idlers extends helperFunctions @@ -596,7 +612,7 @@ class idlers extends helperFunctions protected function pageContents() { - $this->navTabs(array('Services', 'Add', 'Order', 'Info', 'Search'), array('#services', '#add_server', '#order', '#info', '#search')); + $this->navTabs(array('Services', 'Add', 'Order', 'Info', 'Search', 'Compare'), array('#services', '#add_server', '#order', '#info', '#search', '#compare')); $this->outputString('
'); $this->outputString('
'); $this->viewSwitcherIcon(); @@ -649,6 +665,10 @@ class idlers extends helperFunctions $this->outputString('