Update sync cache metadata and improve error reporting in AJAX handling

This commit is contained in:
2025-01-02 10:32:14 +01:00
parent ed912058e8
commit e05cd81ae0
2 changed files with 21 additions and 20 deletions

View File

@@ -198,19 +198,19 @@
"style.css": { "style.css": {
"type": "-", "type": "-",
"size": 18298, "size": 18298,
"lmtime": 1734279688786, "lmtime": 1734346488819,
"modified": false "modified": false
}, },
"style.css.map": { "style.css.map": {
"type": "-", "type": "-",
"size": 32824, "size": 32824,
"lmtime": 1734279688786, "lmtime": 1734346488819,
"modified": false "modified": false
}, },
"style.scss": { "style.scss": {
"type": "-", "type": "-",
"size": 22746, "size": 22746,
"lmtime": 1734279688647, "lmtime": 1734346488372,
"modified": false "modified": false
} }
}, },

View File

@@ -1,4 +1,5 @@
<?php <?php
error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED);
require_once dirname( __FILE__ ) . '/config.php'; require_once dirname( __FILE__ ) . '/config.php';
/* grid - zapisanie elementu */ /* grid - zapisanie elementu */
@@ -6,12 +7,12 @@ if ( $_POST['a'] == 'gsave' )
{ {
$grid = $_SESSION[ 'g' . $_POST[ 'gtable' ] ]; $grid = $_SESSION[ 'g' . $_POST[ 'gtable' ] ];
if ( is_a( $grid, 'grid' ) ) if ( is_a( $grid, 'grid' ) )
{ {
$values_tmp = json_decode( $_POST[ 'values' ], true ); $values_tmp = json_decode( $_POST[ 'values' ], true );
if ( is_array( $values_tmp ) ) foreach ( $values_tmp as $val ) if ( is_array( $values_tmp ) ) foreach ( $values_tmp as $val )
$values[ $val['name'] ] = $val['value']; $values[ $val['name'] ] = $val['value'];
if ( $grid -> saveElement( $values ) ) if ( $grid -> saveElement( $values ) )
{ {
if ( $values[ $grid -> id ] ) if ( $values[ $grid -> id ] )
@@ -19,8 +20,8 @@ if ( $_POST['a'] == 'gsave' )
else else
$msg = 'Nowy element został dodany.'; $msg = 'Nowy element został dodany.';
} }
$response = array( $response = array(
'status' => 'ok', 'status' => 'ok',
'output' => $grid -> drawResults(), 'output' => $grid -> drawResults(),
'msg' => $msg 'msg' => $msg
@@ -37,10 +38,10 @@ if ( $_POST['a'] == 'gedit' )
{ {
$grid = $_SESSION[ 'g' . $_POST[ 'gtable' ] ]; $grid = $_SESSION[ 'g' . $_POST[ 'gtable' ] ];
if ( is_a( $grid, 'grid' ) ) if ( is_a( $grid, 'grid' ) )
{ {
$response = array( $response = array(
'status' => 'ok', 'status' => 'ok',
'output' => $grid -> drawEdit( (int)$_POST[ 'gedit' ] ) 'output' => $grid -> drawEdit( (int)$_POST[ 'gedit' ] )
); );
} }
else else
@@ -61,14 +62,14 @@ if ( $_POST['a'] == 'gdraw' )
$grid -> hide_column( $_POST['column'], $_POST['hidden'] ); $grid -> hide_column( $_POST['column'], $_POST['hidden'] );
$grid -> hidden_columns[ $_POST['column'] ] = filter_var( $_POST['hidden'], FILTER_VALIDATE_BOOLEAN ); $grid -> hidden_columns[ $_POST['column'] ] = filter_var( $_POST['hidden'], FILTER_VALIDATE_BOOLEAN );
} }
/* zmiana liczby wyświetlanych elementów */ /* zmiana liczby wyświetlanych elementów */
if ( $_POST['glimit'] ) if ( $_POST['glimit'] )
{ {
$grid -> limit = $_POST['glimit']; $grid -> limit = $_POST['glimit'];
$grid -> save_limit( $_POST['glimit'] ); $grid -> save_limit( $_POST['glimit'] );
} }
/* usuwanie wielu elementów */ /* usuwanie wielu elementów */
if ( $_POST['gdelete_multi'] ) if ( $_POST['gdelete_multi'] )
{ {
@@ -76,14 +77,14 @@ if ( $_POST['a'] == 'gdraw' )
$grid -> delete( $id ); $grid -> delete( $id );
$msg = 'Wybrane elementy zostały usunięte.'; $msg = 'Wybrane elementy zostały usunięte.';
} }
/* usuwanie */ /* usuwanie */
if ( $_POST['gdelete'] ) if ( $_POST['gdelete'] )
{ {
if ( $grid -> delete( $_POST['gdelete'] ) ) if ( $grid -> delete( $_POST['gdelete'] ) )
$msg = 'Wybrany element został usunięty.'; $msg = 'Wybrany element został usunięty.';
} }
/* wyszukiwanie */ /* wyszukiwanie */
if ( $_POST['gsearch_column'] ) if ( $_POST['gsearch_column'] )
{ {
@@ -97,7 +98,7 @@ if ( $_POST['a'] == 'gdraw' )
$grid -> save_filters(); $grid -> save_filters();
$grid -> set_cp( 1 ); $grid -> set_cp( 1 );
} }
/* sortowanie */ /* sortowanie */
if ( $_POST[ 'gsort_column' ] ) if ( $_POST[ 'gsort_column' ] )
{ {
@@ -107,15 +108,15 @@ if ( $_POST['a'] == 'gdraw' )
$grid -> order = [ 'column' => $_POST[ 'gsort_column' ], 'type' => 'ASC' ]; $grid -> order = [ 'column' => $_POST[ 'gsort_column' ], 'type' => 'ASC' ];
$grid -> save_order(); $grid -> save_order();
} }
/* zmiana strony */ /* zmiana strony */
if ( $_POST[ 'gpage'] ) if ( $_POST[ 'gpage'] )
$grid -> set_cp( $_POST[ 'gpage'] ); $grid -> set_cp( $_POST[ 'gpage'] );
$response = array( $response = array(
'status' => 'ok', 'status' => 'ok',
'msg' => $msg, 'msg' => $msg,
'output' => $grid -> drawResults() 'output' => $grid -> drawResults()
); );
} }
else else