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": {
"type": "-",
"size": 18298,
"lmtime": 1734279688786,
"lmtime": 1734346488819,
"modified": false
},
"style.css.map": {
"type": "-",
"size": 32824,
"lmtime": 1734279688786,
"lmtime": 1734346488819,
"modified": false
},
"style.scss": {
"type": "-",
"size": 22746,
"lmtime": 1734279688647,
"lmtime": 1734346488372,
"modified": false
}
},

View File

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