qz, auto-table control, auto-git pull, etc

This commit is contained in:
2026-02-12 16:18:43 +07:00
parent eb62ba5ee1
commit 71e587a8ca
10 changed files with 724 additions and 565 deletions
+4 -5
View File
@@ -4,9 +4,9 @@
Desc. : CSS Default Configuration Desc. : CSS Default Configuration
Created By : Siau Pheng ([email protected]). Created By : Siau Pheng ([email protected]).
Created Date : December 20th, 2007. Created Date : December 20th, 2007.
Last Modified : December 5th, 2025. Last Modified : February 7th, 2026.
(c) 2009 - 2025, 3FONIA Software; WWW.3FONIA.COM. (c) 2009 - 2026, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/ *******************************************************************/
@@ -329,9 +329,6 @@ ul.dtr-details li.hidden { visibility: hidden !important; display: none !importa
font-weight: bolder !important; font-weight: bolder !important;
font-size: 1.1rem; font-size: 1.1rem;
} }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted {
background-color: var(--bs-yellow);
}
/******************************** Autocomplete ********************************/ /******************************** Autocomplete ********************************/
@@ -487,6 +484,8 @@ input.double, input.integer, input.number {
.footer a { .footer a {
text-decoration: none; text-decoration: none;
--bs-text-opacity: 1; --bs-text-opacity: 1;
}
.footer a:not(#divQZStatus) {
color: inherit !important; color: inherit !important;
} }
+1 -1
View File
@@ -586,4 +586,4 @@ select + .select2-container--bootstrap-5 {
} }
.form-select-lg ~ .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__clear { .form-select-lg ~ .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__clear {
right: 1rem; right: 1rem;
} }
+126 -70
View File
@@ -19,7 +19,9 @@
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; } white-space: nowrap; }
.select2-container .select2-selection--single .select2-selection__clear { .select2-container .select2-selection--single .select2-selection__clear {
position: relative; } background-color: transparent;
border: none;
font-size: 1em; }
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered { .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
padding-right: 8px; padding-right: 8px;
padding-left: 20px; } padding-left: 20px; }
@@ -31,21 +33,29 @@
user-select: none; user-select: none;
-webkit-user-select: none; } -webkit-user-select: none; }
.select2-container .select2-selection--multiple .select2-selection__rendered { .select2-container .select2-selection--multiple .select2-selection__rendered {
display: inline-block; display: inline;
overflow: hidden; list-style: none;
padding-left: 8px;
text-overflow: ellipsis;
white-space: nowrap; }
.select2-container .select2-search--inline {
float: left; }
.select2-container .select2-search--inline .select2-search__field {
box-sizing: border-box;
border: none;
font-size: 100%;
margin-top: 5px;
padding: 0; } padding: 0; }
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button { .select2-container .select2-selection--multiple .select2-selection__clear {
-webkit-appearance: none; } background-color: transparent;
border: none;
font-size: 1em; }
.select2-container .select2-search--inline .select2-search__field {
box-sizing: border-box;
border: none;
font-size: 100%;
margin-top: 5px;
margin-left: 5px;
padding: 0;
max-width: 100%;
resize: none;
height: 18px;
vertical-align: bottom;
font-family: sans-serif;
overflow: hidden;
word-break: keep-all; }
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; }
.select2-dropdown { .select2-dropdown {
background-color: white; background-color: white;
@@ -70,8 +80,9 @@
padding: 6px; padding: 6px;
user-select: none; user-select: none;
-webkit-user-select: none; } -webkit-user-select: none; }
.select2-results__option[aria-selected] {
cursor: pointer; } .select2-results__option--selectable {
cursor: pointer; }
.select2-container--open .select2-dropdown { .select2-container--open .select2-dropdown {
left: 0; } left: 0; }
@@ -137,7 +148,10 @@
.select2-container--default .select2-selection--single .select2-selection__clear { .select2-container--default .select2-selection--single .select2-selection__clear {
cursor: pointer; cursor: pointer;
float: right; float: right;
font-weight: bold; } font-weight: bold;
height: 26px;
margin-right: 20px;
padding-right: 0px; }
.select2-container--default .select2-selection--single .select2-selection__placeholder { .select2-container--default .select2-selection--single .select2-selection__placeholder {
color: #999; } color: #999; }
.select2-container--default .select2-selection--single .select2-selection__arrow { .select2-container--default .select2-selection--single .select2-selection__arrow {
@@ -179,49 +193,79 @@
background-color: white; background-color: white;
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
cursor: text; } cursor: text;
.select2-container--default .select2-selection--multiple .select2-selection__rendered { padding-bottom: 5px;
box-sizing: border-box; padding-right: 5px;
list-style: none; position: relative; }
margin: 0; .select2-container--default .select2-selection--multiple.select2-selection--clearable {
padding: 0 5px; padding-right: 25px; }
width: 100%; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
list-style: none; }
.select2-container--default .select2-selection--multiple .select2-selection__clear { .select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer; cursor: pointer;
float: right;
font-weight: bold; font-weight: bold;
margin-top: 5px; height: 20px;
margin-right: 10px; margin-right: 10px;
margin-top: 5px;
position: absolute;
right: 0;
padding: 1px; } padding: 1px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice { .select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4; background-color: #e4e4e4;
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
cursor: default; box-sizing: border-box;
float: left; display: inline-block;
margin-right: 5px; margin-left: 5px;
margin-top: 5px; margin-top: 5px;
padding: 0 5px; } padding: 0;
padding-left: 20px;
position: relative;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: bottom;
white-space: nowrap; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
cursor: default;
padding-left: 2px;
padding-right: 5px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
background-color: transparent;
border: none;
border-right: 1px solid #aaa;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
color: #999; color: #999;
cursor: pointer; cursor: pointer;
display: inline-block; font-size: 1em;
font-weight: bold; font-weight: bold;
margin-right: 2px; } padding: 0 4px;
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { position: absolute;
color: #333; } left: 0;
top: 0; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline { .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover, .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:focus {
float: right; } background-color: #f1f1f1;
color: #333;
outline: none; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice { .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
margin-left: 5px; margin-left: 5px;
margin-right: auto; } margin-right: auto; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__display {
padding-left: 5px;
padding-right: 2px; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px; border-left: 1px solid #aaa;
border-right: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__clear {
float: left;
margin-left: 10px;
margin-right: auto; } margin-right: auto; }
.select2-container--default.select2-container--focus .select2-selection--multiple { .select2-container--default.select2-container--focus .select2-selection--multiple {
@@ -257,15 +301,6 @@
max-height: 200px; max-height: 200px;
overflow-y: auto; } overflow-y: auto; }
.select2-container--default .select2-results__option[role=group] {
padding: 0; }
.select2-container--default .select2-results__option[aria-disabled=true] {
color: #999; }
.select2-container--default .select2-results__option[aria-selected=true] {
background-color: #ddd; }
.select2-container--default .select2-results__option .select2-results__option { .select2-container--default .select2-results__option .select2-results__option {
padding-left: 1em; } padding-left: 1em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__group { .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
@@ -286,7 +321,16 @@
margin-left: -5em; margin-left: -5em;
padding-left: 6em; } padding-left: 6em; }
.select2-container--default .select2-results__option--highlighted[aria-selected] { .select2-container--default .select2-results__option--group {
padding: 0; }
.select2-container--default .select2-results__option--disabled {
color: #999; }
.select2-container--default .select2-results__option--selected {
background-color: #ddd; }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
background-color: #5897fb; background-color: #5897fb;
color: white; } color: white; }
@@ -314,7 +358,8 @@
cursor: pointer; cursor: pointer;
float: right; float: right;
font-weight: bold; font-weight: bold;
margin-right: 10px; } height: 26px;
margin-right: 20px; }
.select2-container--classic .select2-selection--single .select2-selection__placeholder { .select2-container--classic .select2-selection--single .select2-selection__placeholder {
color: #999; } color: #999; }
.select2-container--classic .select2-selection--single .select2-selection__arrow { .select2-container--classic .select2-selection--single .select2-selection__arrow {
@@ -391,41 +436,52 @@
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
cursor: text; cursor: text;
outline: 0; } outline: 0;
padding-bottom: 5px;
padding-right: 5px; }
.select2-container--classic .select2-selection--multiple:focus { .select2-container--classic .select2-selection--multiple:focus {
border: 1px solid #5897fb; } border: 1px solid #5897fb; }
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
list-style: none;
margin: 0;
padding: 0 5px; }
.select2-container--classic .select2-selection--multiple .select2-selection__clear { .select2-container--classic .select2-selection--multiple .select2-selection__clear {
display: none; } display: none; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice { .select2-container--classic .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4; background-color: #e4e4e4;
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
cursor: default; display: inline-block;
float: left; margin-left: 5px;
margin-right: 5px;
margin-top: 5px; margin-top: 5px;
padding: 0 5px; } padding: 0; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice__display {
cursor: default;
padding-left: 2px;
padding-right: 5px; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove { .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
background-color: transparent;
border: none;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
color: #888; color: #888;
cursor: pointer; cursor: pointer;
display: inline-block; font-size: 1em;
font-weight: bold; font-weight: bold;
margin-right: 2px; } padding: 0 4px; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover { .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #555; } color: #555;
outline: none; }
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice { .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
float: right;
margin-left: 5px; margin-left: 5px;
margin-right: auto; } margin-right: auto; }
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__display {
padding-left: 5px;
padding-right: 2px; }
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px; border-top-left-radius: 0;
margin-right: auto; } border-bottom-left-radius: 0;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px; }
.select2-container--classic.select2-container--open .select2-selection--multiple { .select2-container--classic.select2-container--open .select2-selection--multiple {
border: 1px solid #5897fb; } border: 1px solid #5897fb; }
@@ -462,13 +518,13 @@
max-height: 200px; max-height: 200px;
overflow-y: auto; } overflow-y: auto; }
.select2-container--classic .select2-results__option[role=group] { .select2-container--classic .select2-results__option--group {
padding: 0; } padding: 0; }
.select2-container--classic .select2-results__option[aria-disabled=true] { .select2-container--classic .select2-results__option--disabled {
color: grey; } color: grey; }
.select2-container--classic .select2-results__option--highlighted[aria-selected] { .select2-container--classic .select2-results__option--highlighted.select2-results__option--selectable {
background-color: #3875d7; background-color: #3875d7;
color: white; } color: white; }
+31 -18
View File
@@ -4,7 +4,7 @@
Desc. : JS - Fonia Custom Class v3 Desc. : JS - Fonia Custom Class v3
Created By : Siau Pheng (siaupheng@3fonia.com). Created By : Siau Pheng (siaupheng@3fonia.com).
Created Date : June 19th, 2009. Created Date : June 19th, 2009.
Last Modified : January 26th, 2026. Last Modified : February 10th, 2026.
(c) 2009 - 2026, 3FONIA Software; WWW.3FONIA.COM. (c) 2009 - 2026, 3FONIA Software; WWW.3FONIA.COM.
@@ -13,7 +13,7 @@
'use strict'; 'use strict';
var FoniaJS = { var FoniaJS = {
version: "3.1.1", version: "3.1.2",
APP_ID: 0, APP_ID: 0,
APP_SID: "", APP_SID: "",
WEB_HOST: "", WEB_HOST: "",
@@ -336,18 +336,14 @@ var FoniaJS = {
$('.option-tags').each((i, el) => { $('.option-tags').each((i, el) => {
const elm = $(el); const elm = $(el);
if (!jQuery.isFunction(jQuery.fn.select2)) return; if (!jQuery.isFunction(jQuery.fn.select2)) return;
var _opts = {tags: false, dropdownAutoWidth: true, width: 'auto', theme: 'bootstrap-5'}; var _opts = {tags: false, dropdownAutoWidth: true, width: 'auto', theme: 'bootstrap-5', language: 'id'};
var _dmodal = elm.closest('div.modal'); var _dmodal = elm.closest('div.modal');
if ($(_dmodal).hasClass('modal')) _opts.dropdownParent = _dmodal; if (_dmodal.length) _opts.dropdownParent = _dmodal;
var _sel2 = elm.select2(_opts); var _sel2 = elm.select2(_opts);
if (elm.prop('required')) elm.removeAttr('required'); if (elm.prop('required')) elm.removeAttr('required');
//_sel2.on('select2:close', (e) =>{ $(e.target).valid(); }); //_sel2.on('select2:close', (e) =>{ $(e.target).valid(); });
}); });
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
/*$('.colorpic').each((i, el) => {
$(el).prop('background-color', $(el).val());
});*/
if('function' == typeof jQuery.fn.datepicker){ if('function' == typeof jQuery.fn.datepicker){
$('.pickdate').datepicker({ $('.pickdate').datepicker({
format: 'dd-mm-yyyy', format: 'dd-mm-yyyy',
@@ -364,13 +360,21 @@ var FoniaJS = {
RequestParam: function(aparam) { RequestParam: function(aparam) {
var tmp_hasil = []; var tmp_hasil = [];
var tmp_array = aparam; var tmp_array = aparam;
$('input').each((i, el) => { /*$('input').each((i, el) => {
/*if (el.id.indexOf('_db')!==-1){ if (el.id.indexOf('_db')!==-1){
tmp_array.push(el.id); tmp_array.push(el.id);
}*/
if (el.id.indexOf('_cbox')!==-1){
tmp_array.push(el.id + '=' + el.value);
} }
});*/
var tmp_cblist = {};
$('tbody input[id*="cbox"][type="checkbox"]:checked').map((i, b) => {
const arr = b.id.split('_');
if (!tmp_cblist[arr[0]]) tmp_cblist[arr[0]] = [];
tmp_cblist[arr[0]].push(arr[2]);
// for compatible only
tmp_array.push(b.id + '=' + b.value);
});
$.each(tmp_cblist, (i, b) => {
tmp_array.push('List_CB_' + i + '=' + b.join());
}); });
tmp_array.map(nilai => { tmp_array.map(nilai => {
if (typeof nilai === "string") { if (typeof nilai === "string") {
@@ -594,6 +598,11 @@ var FoniaJS = {
} }
$(elm).nextAll('div.bootstrap-autocomplete').remove(); $(elm).nextAll('div.bootstrap-autocomplete').remove();
$(elm).off(); $(elm).off();
//fixed hidden on modal
var _dbody = $(elm).closest('div.modal-body');
var _dcont = $(elm).closest('div.modal-content');
if (_dbody.length) $(_dbody).css('overflow', 'visible');
if (_dcont.length) $(_dcont).css('overflow', 'visible');
new AutoComplete(elm, objComp); new AutoComplete(elm, objComp);
}, },
getAppID: function() { getAppID: function() {
@@ -786,11 +795,15 @@ class _Request_JSONF extends _Request {
var json = {}, jsono = {'draw':0,'recordsTotal':0,'recordsFiltered':0,'data':[]}; var json = {}, jsono = {'draw':0,'recordsTotal':0,'recordsFiltered':0,'data':[]};
try { try {
json = jQuery.parseJSON(data); json = jQuery.parseJSON(data);
if (!jQuery.isEmptyObject(json) && json[0].draw){ if (!jQuery.isEmptyObject(json) && json.length > 0){
jsono.draw = json[0].draw; $(json).each((i, lini) => {
jsono.recordsTotal = json[0].recordsTotal; if (lini.type == 'table-live' && lini.id == ini.id) {
jsono.recordsFiltered = json[0].recordsFiltered; jsono.draw = lini.config.draw;
jsono.data = json[0].data; jsono.recordsTotal = lini.config.recordsTotal;
jsono.recordsFiltered = lini.config.recordsFiltered;
jsono.data = lini.data;
}
});
} }
} catch (e){ } catch (e){
console.log(e); console.log(e);
+27 -17
View File
@@ -4,16 +4,25 @@
Desc. : JS Setup QZ Connection Desc. : JS Setup QZ Connection
Created By : Siau Pheng (siaupheng@3fonia.com). Created By : Siau Pheng (siaupheng@3fonia.com).
Created Date : May 27th, 2007. Created Date : May 27th, 2007.
Last Modified : January 9th, 2021. Last Modified : February 8th, 2026.
(c) 2008 - 2021, 3FONIA Software; WWW.3FONIA.COM. (c) 2008 - 2026, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/ *******************************************************************/
function startConnection() { function launchQZ() {
if (!qz.websocket.isActive()) {
window.location.assign("qz:launch");
//Retry 5 times, pausing 1 second between each attempt
startConnection({ retries: 5, delay: 1 });
}
}
function startConnection(config) {
config = config ? config : {};
if (!qz.websocket.isActive()) { if (!qz.websocket.isActive()) {
_updateState('Waiting'); _updateState('Waiting');
qz.websocket.connect().then(function() { qz.websocket.connect(config).then(() => {
_updateState('Active'); _updateState('Active');
_findDefaultPrinter(); _findDefaultPrinter();
}); });
@@ -24,7 +33,7 @@ function startConnection() {
function endConnection(){ function endConnection(){
if (qz.websocket.isActive()) { if (qz.websocket.isActive()) {
qz.websocket.disconnect().then(function() { qz.websocket.disconnect().then(() => {
_updateState('Inactive'); _updateState('Inactive');
}); });
} else { } else {
@@ -33,7 +42,7 @@ function endConnection(){
} }
function _findDefaultPrinter(){ function _findDefaultPrinter(){
qz.printers.getDefault().then(function(data) { qz.printers.getDefault().then((data) => {
var _printer = data; var _printer = data;
if (typeof data === 'object' && data.name == undefined) { if (typeof data === 'object' && data.name == undefined) {
if (data.file != undefined) _printer = "FILE: " + data.file; if (data.file != undefined) _printer = "FILE: " + data.file;
@@ -44,35 +53,36 @@ function _findDefaultPrinter(){
} }
FoniaJS._def_printer = data; FoniaJS._def_printer = data;
FoniaJS._def_printname = _printer; FoniaJS._def_printname = _printer;
$(_divStatus).html($(_divStatus).html() + ' // ' + _printer); setTimeout(() => $(_divStatus).html($(_divStatus).html() + ' // ' + _printer), 2000);
}); });
} }
function _updateState(text){ function _updateState(text){
$(_divStatus).html(text); $(_divStatus).html(text).removeClass('border-success border-warning text-success');
if (text == "Active") { if (text == "Active") {
$(_divStatus).css("background-color", "#AAFFAA"); $(_divStatus).addClass('border-success text-success');
} else { } else {
$(_divStatus).css("background-color", "#FFFFC0"); $(_divStatus).addClass('border-warning');
} }
} }
var _divStatus = '#divQZStatus'; const _divStatus = '#divQZStatus';
if (typeof qz !== 'undefined') { if (typeof qz !== 'undefined') {
qz.security.setCertificatePromise(function(resolve, reject) { qz.security.setSignatureAlgorithm("SHA512");
jQuery.ajax({ url:FoniaJS.WEB_PATH+'assets/signing/cert.pem', cache:false, dataType:'text' }).then(resolve, reject); qz.security.setCertificatePromise((resolve, reject) => {
jQuery.ajax({url:FoniaJS.WEB_PATH+'assets/signing/cert.pem', cache:false, dataType:'text'}).then(resolve, reject);
}); });
qz.security.setSignaturePromise(function(toSign) { qz.security.setSignaturePromise((toSign) => {
return function(resolve, reject) { return (resolve, reject) => {
jQuery.post(FoniaJS.WEB_PATH+"assets/signing/sign.php?req="+toSign).then(resolve, reject); jQuery.post(FoniaJS.WEB_PATH+"assets/signing/sign.php?req="+toSign).then(resolve, reject);
}; };
}); });
qz.websocket.setClosedCallbacks(function(evt) { qz.websocket.setClosedCallbacks((evt) => {
_updateState('Inactive'); _updateState('Inactive');
if (evt.reason) console.info("Connection closed: " + evt.reason); if (evt.reason) console.info("Connection closed: " + evt.reason);
}); });
qz.websocket.setErrorCallbacks(function(evt){ qz.websocket.setErrorCallbacks((evt) => {
_updateState('Error'); _updateState('Error');
if (evt.target != undefined) { if (evt.target != undefined) {
var err = (evt.target.readyState >= 2) ? "Connection to QZ Tray was closed" : "A connection error occurred, check log for details"; var err = (evt.target.readyState >= 2) ? "Connection to QZ Tray was closed" : "A connection error occurred, check log for details";
+467 -352
View File
File diff suppressed because it is too large Load Diff
+26 -2
View File
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -17,7 +17,7 @@ declare(strict_types=1);
namespace siaupheng\fonia3\Web; namespace siaupheng\fonia3\Web;
final class Param { final class Param {
private static $__ahasil = array(); private static $__ahasil = [];
public function __construct() { public function __construct() {
if (count(self::$__ahasil)==0) self::__data(); if (count(self::$__ahasil)==0) self::__data();
@@ -56,9 +56,9 @@ final class Param {
return self::$__ahasil; return self::$__ahasil;
} }
public static function Get_ArrayCBOX() { public static function Get_ArrayCBOX() {//note: bisa tidak dipakai lagi
if (count(self::$__ahasil)==0) self::__data(); if (count(self::$__ahasil)==0) self::__data();
$_ahasil = array(); $_ahasil = [];
foreach (self::$__ahasil as $__key => $__val) { foreach (self::$__ahasil as $__key => $__val) {
if (strpos($__key, "_cbox_")>0) { if (strpos($__key, "_cbox_")>0) {
$_tmpkey = substr($__key, strpos($__key, "_cbox_")+6); $_tmpkey = substr($__key, strpos($__key, "_cbox_")+6);
+6 -5
View File
@@ -6,9 +6,9 @@
Desc. : v4 - HTML Table (jQuery & Bootstrap) Desc. : v4 - HTML Table (jQuery & Bootstrap)
Created By : Siau Pheng (siaupheng@3fonia.com). Created By : Siau Pheng (siaupheng@3fonia.com).
Created Date : January 16th, 2008. Created Date : January 16th, 2008.
Last Modified : December 4th, 2025. Last Modified : January 26th, 2026.
(c) 2008 - 2025, 3FONIA Software; WWW.3FONIA.COM. (c) 2008 - 2026, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/ *******************************************************************/
@@ -238,6 +238,7 @@ final class Table {
} }
public function db_table($nama_tabel = "tabel_", $baris_tabel = 10) { public function db_table($nama_tabel = "tabel_", $baris_tabel = 10) {
$adata = [];
$this->__livedata = true; $this->__livedata = true;
$this->prepare_query(); $this->prepare_query();
$id_draw = intval($this->__cpa->Get("draw", 0)); $id_draw = intval($this->__cpa->Get("draw", 0));
@@ -249,9 +250,9 @@ final class Table {
$record = 0; $record = 0;
$this->__cdb->Query("SELECT COUNT(*) Item FROM ".$this->__ttable.$this->__twhere); $this->__cdb->Query("SELECT COUNT(*) Item FROM ".$this->__ttable.$this->__twhere);
if ($this->__cdb->Next()) $record = intval($this->__cdb->Row("Item", 0)); if ($this->__cdb->Next()) $record = intval($this->__cdb->Row("Item", 0));
$adata['draw'] = $id_draw; $adata['type'] = "table-live";
$adata['recordsTotal'] = $record; $adata['id'] = $nama_tabel;
$adata['recordsFiltered'] = $record; $adata['config'] = ['draw' => $id_draw, 'recordsTotal' => $record, 'recordsFiltered' => $record];
$t_order = "ASC"; $t_order = "ASC";
if ($i_order <> 0) { if ($i_order <> 0) {
+33 -92
View File
@@ -6,9 +6,9 @@
Desc. : v4 - Class Update Aplikasi Otomatis Desc. : v4 - Class Update Aplikasi Otomatis
Created By : Siau Pheng (siaupheng@3fonia.com). Created By : Siau Pheng (siaupheng@3fonia.com).
Created Date : June 14th, 2013. Created Date : June 14th, 2013.
Last Modified : May 6th, 2021. Last Modified : February 12th, 2026.
(c) 2013 - 2021, 3FONIA Software; WWW.3FONIA.COM. (c) 2013 - 2026, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/ *******************************************************************/
@@ -17,111 +17,52 @@ declare(strict_types=1);
namespace siaupheng\fonia3\Web; namespace siaupheng\fonia3\Web;
final class Update { final class Update {
private $__amysql = array(); protected $__web_app = [];
protected $__linkdb = null; protected $__linkdb = null;
public function __construct($db = null){ public function __construct($db = null){
if (is_resource($db)) { $this->__linkdb = $db; } if (is_resource($db)) { $this->__linkdb = $db; }
else { $this->__linkdb = new \siaupheng\fonia3\DB\MySQL(); } else { $this->__linkdb = new \siaupheng\fonia3\DB\MySQL(); }
$this->__web_app = $_SESSION['__WEB_APP'];
$this->__amysql = $this->__linkdb->getConfig();
} }
public function check_update() { public function check_update() {
$_ainfo['build_cur'] = $_SESSION['__WEB_APP']['APP_BUILD']; $_ainfo['cur_version'] = $this->__web_app['APP_BUILD'];
$_ainfo['svr_status'] = "Server Online"; $_ainfo['cur_sha'] = substr($this->__web_app['GIT_SHA1'], 0, 10);
$_read = ["","",""]; $_ainfo['cur_sha1'] = $this->__web_app['GIT_SHA1'];
$_ainfo['cur_date'] = $this->__web_app['GIT_DATE'];
$_ainfo['svr_status'] = 1;
$_ainfo['svr_message'] = "Server Online";
$_url = "https://update.3fonia.com/".$_SESSION['__WEB_APP']['REG_ID']."/update.csv"; try {
$_fp = @fopen ($_url, 'r') or $_ainfo['svr_status'] = "Server Offline"; $_url = "https://git.trifonia.cloud/api/v1/repos/".$this->__web_app['GIT_OWNER']."/".$this->__web_app['GIT_REPO']."/commits?limit=1";
if ($_fp) { $_conten = file_get_contents($_url);
$_read = fgetcsv ($_fp); $ajson = json_decode($_conten, true);
fclose ($_fp);
if (count($ajson) > 0) {
$_ainfo['new_sha'] = substr($ajson[0]['sha'], 0, 10);
$_ainfo['new_sha1'] = $ajson[0]['sha'];
$_ainfo['new_date'] = date("d-m-Y H:i:s", strtotime($ajson[0]['created']));
$_ainfo['new_message'] = $ajson[0]['commit']['message'];
}
} catch (Exception $e) {
$_ainfo['svr_status'] = 0;
$_ainfo['svr_message'] = "Server Offline";
} }
$_ainfo['build_new'] = $_read[0];
$_ainfo['file_web'] = $_read[1];
$_ainfo['file_sql'] = $_read[2];
return $_ainfo; return $_ainfo;
} }
public function go_update($file_src="", $build_code="") { public function go_update($new_sha1, $new_date) {
if ($file_src=="") return false; $_target = $this->__web_app['REAL_PATH'];
if (isset($_target)) {
$_folder = $_SESSION['__WEB_APP']['REAL_PATH']."temp"; chdir($_target);
if (!is_dir($_folder)) mkdir($_folder); shell_exec("git pull");
$this->__linkdb->Query("UPDATE app_config SET GIT_SHA1='".$new_sha1."',GIT_DATE='".$new_date."' WHERE REG_ID='".$this->__web_app['APP_CODE']."' LIMIT 1");
$_dst = $_folder."/update.web.zip"; return true;
if ($_dst) unlink($_dst); } else return false;
$new_data = file_get_contents($file_src);
if (!$new_data) return false;
$han_file = @fopen($_dst, 'w');
if (!$han_file) return false;
if ( fwrite($han_file, $new_data) ) {
fclose($han_file);
$zip = new ZipArchive();
if ($zip->open($_dst) === true) {
$zip->extractTo($_SESSION['__WEB_APP']['REAL_PATH']);
$zip->close();
$_SESSION['__WEB_APP']['APP_BUILD'] = $build_code;
$this->__linkdb->Query("UPDATE app_config SET APP_BUILD='".$build_code."' WHERE REG_ID='".$_SESSION['__WEB_APP']['APP_CODE']."' LIMIT 1");
}
}
if (file_exists($_dst)) unlink($_dst);
return true;
} }
public function update_mysql($file_sql="") { public function update_mysql() {
if ($file_sql=="") return false;
$_folder = $_SESSION['__WEB_APP']['REAL_PATH']."temp";
if (!is_dir($_folder)) mkdir($_folder);
$_dst = $_folder."/update.sql.zip";
if ($_dst) unlink($_dst);
$new_data = file_get_contents($file_sql);
if (!$new_data) return false;
$han_file = @fopen($_dst, 'w');
if (!$han_file) return false;
if ( fwrite($han_file, $new_data) ) {
fclose($han_file);
$zip = new ZipArchive();
if ($zip->open($_dst) === true) {
$zip->extractTo($_folder);
$zip->close();
}
}
if (file_exists($_dst)) unlink($_dst);
if (!is_readable($_folder."/update.sql")) return false;
$_link = @new mysqli($this->__amysql['host'], $this->__amysql['user'], $this->__amysql['pwd'], $this->__amysql['db'], $this->__amysql['port'], $this->__amysql['sock']);
if (!$_link->connect_error) return false;
$aSQL = file($_folder."/update.sql");
foreach ($aSQL as $stmt) {
if ($_link->query($stmt) === false) {
$sqlECode = $_link->mysql_errno;
$sqlEText = $_link->error;
$sqlStmt = $stmt;
break;
}
}
if (file_exists($_folder."/update.sql")) unlink($_folder."/update.sql");
if ($sqlECode == 0) {
return true;
} else {
return false;
/*echo "FAIL!<br/>";
echo "Error code: $sqlErrorCode<br/>";
echo "Error text: $sqlErrorText<br/>";
echo "Statement:<br/> $sqlStmt<br/>";*/
}
} }
} }