|
|
@@ -5952,16 +5952,13 @@ jQuery(document).ready(function(){
|
|
|
}
|
|
|
|
|
|
public function ajaxData($args) {// executed from url: "{$this->syncUrl"&_hash={$this->_htmlID}&_task=loadDataAjax"
|
|
|
- $DBG = ('1' == V::get('DBG', '', $_REQUEST));
|
|
|
$acl = $this->_acl;
|
|
|
|
|
|
$pageSize = V::get('pageSize', $this->_pageSize, $args, 'int');
|
|
|
$page = V::get('page', 0, $args, 'int');
|
|
|
+ $page = ($page > 0) ? $page - 1 : $page;
|
|
|
$currSortCol = V::get('currSortCol', '', $args);
|
|
|
$currSortFlip = V::get('currSortFlip', '', $args);
|
|
|
- if ($page > 0) {
|
|
|
- $page -= 1;
|
|
|
- }
|
|
|
|
|
|
$params = array();
|
|
|
$params['limit'] = $pageSize;
|
|
|
@@ -5992,12 +5989,10 @@ jQuery(document).ready(function(){
|
|
|
$this->setFilters($filters);
|
|
|
|
|
|
$vCols = $acl->getVirtualFieldListByIdZasob();
|
|
|
- if (!empty($vCols)) {
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">vCols (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($vCols);echo'</pre>';}
|
|
|
- }
|
|
|
+ DBG::log($vCols, 'array', "\$vCols");
|
|
|
|
|
|
$visibleCols = $acl->getVisibleFieldListByIdZasob();
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">visibleCols (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($visibleCols);echo'</pre>';}
|
|
|
+ DBG::log($visibleCols, 'array', "\$visibleCols");
|
|
|
|
|
|
$jsonData = new stdClass();
|
|
|
$jsonData->page = $page + 1;
|
|
|
@@ -6024,9 +6019,8 @@ jQuery(document).ready(function(){
|
|
|
}
|
|
|
$colType = $acl->getFieldType($col);
|
|
|
if ($colType) {// @see MarkTableAjaxFilterColType
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">field('.$col.') $colType (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($colType);echo'</pre>';}
|
|
|
if ($colType['type'] == 'date') {
|
|
|
- //$columnConfig->type = 'date';// TODO: require datetimepicker
|
|
|
+ // $columnConfig->type = 'date';// TODO: require datetimepicker
|
|
|
}
|
|
|
if (!empty($colType['simpleType'])) $columnConfig->type = $colType['simpleType'];
|
|
|
} else {// typespecial - no type
|
|
|
@@ -6035,7 +6029,7 @@ jQuery(document).ready(function(){
|
|
|
$columnConfig->xsdType = $acl->getXsdFieldType($col);
|
|
|
if ($columnConfig->xsdType) {
|
|
|
list($prefix, $typeName, $refTypeName) = explode(":", $columnConfig->xsdType);
|
|
|
- DBG::log([$prefix, $typeName, $refTypeName], 'array', "col '{$col}'");
|
|
|
+ DBG::log([$prefix, $typeName, $refTypeName], 'array', "col '{$col}' xsdType");
|
|
|
switch ($prefix) {
|
|
|
case 'ref':
|
|
|
case 'alias_ref':
|
|
|
@@ -6048,6 +6042,8 @@ jQuery(document).ready(function(){
|
|
|
case 'xsd':
|
|
|
switch ($typeName) {
|
|
|
case 'string': $columnConfig->type = 'string'; break;
|
|
|
+ case 'NMTOKEN': $columnConfig->type = 'string'; break; // xsd:NMTOKEN - non empty string without space - pattern: \c+
|
|
|
+ case 'NCName': $columnConfig->type = 'string'; break; // xsd:NCName - non empty without ':' and not started with '-' - pattern: [\i-[:]][\c-[:]]*
|
|
|
case 'integer': $columnConfig->type = 'number'; break;
|
|
|
case 'int': $columnConfig->type = 'number'; break;
|
|
|
case 'long': $columnConfig->type = 'number'; break;
|
|
|
@@ -6071,7 +6067,7 @@ jQuery(document).ready(function(){
|
|
|
|
|
|
$typeSpecial = Typespecial::getInstance($fieldID, $col);
|
|
|
if ($typeSpecial) {
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">typeSpecial (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($typeSpecial);echo'</pre>';}
|
|
|
+ DBG::log($typeSpecial, 'array', "\$typeSpecial id({$fieldID}) col({$col})");
|
|
|
$columnConfig->_tsRetId = $typeSpecial->getReturnId();
|
|
|
if ($columnConfig->_tsRetId == 0) {
|
|
|
$tsParamOut = V::get('param_out', null, $typeSpecial);
|
|
|
@@ -6128,14 +6124,13 @@ jQuery(document).ready(function(){
|
|
|
|
|
|
$jsonData->cols->{$col} = $columnConfig;
|
|
|
}
|
|
|
+ DBG::log($jsonData->cols, 'array', "\$jsonData->cols");
|
|
|
$jsonData->rows = array();
|
|
|
$queryFeatures = $acl->buildQuery($params);
|
|
|
$jsonData->total = $queryFeatures->getTotal();
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">get_total (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($jsonData->total);echo'</pre>';}
|
|
|
$listItems = $queryFeatures->getItems();
|
|
|
$primaryKeyField = $acl->getPrimaryKeyField();
|
|
|
$items = []; foreach ($listItems as $item) $items[ $item[$primaryKeyField] ] = $item;
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">items (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($items);echo'</pre>';}
|
|
|
// TODO: add virtual data by Typespecial
|
|
|
if (!empty($vCols) && !empty($items)) {
|
|
|
foreach ($vCols as $vColID => $vCol) {
|
|
|
@@ -6148,13 +6143,13 @@ jQuery(document).ready(function(){
|
|
|
if ($columnConfig && !empty($columnConfig->_tsSimpleLink)) {
|
|
|
// pomin simple link values - mved to js render
|
|
|
} else {
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Typespecial('.$vColID.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($typeSpecial);echo'</pre>';}
|
|
|
+ DBG::log($typeSpecial, 'array', "Typespecial({$vColID})");
|
|
|
$ids = array_keys($items);
|
|
|
$specialValues = $typeSpecial->getValuesByIds($this->_zasobID, $ids);
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Typespecial('.$vCol.') specialValues (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($specialValues);echo'</pre>';}
|
|
|
+ DBG::log($specialValues, 'array', "Typespecial({$vColID}) \$specialValues");
|
|
|
if (!empty($specialValues)) foreach ($specialValues as $kItemID => $vValues) {
|
|
|
$tsValue = implode('<br>', $vValues);
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Item['.$kItemID.'].'.$vCol.' specialValues (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($items[$kItemID]);echo'</pre>';}
|
|
|
+ DBG::log($items[$kItemID], 'array', "Typespecial({$vColID}) Item[{$kItemID}].{$vCol}");
|
|
|
if (!empty($items[$kItemID][$vCol]) && !empty($tsValue)) {
|
|
|
$items[$kItemID][$vCol] .= ": {$tsValue}";
|
|
|
} else {
|
|
|
@@ -6241,17 +6236,18 @@ jQuery(document).ready(function(){
|
|
|
}
|
|
|
DBG::log($aliasValuesRaw, 'array', '$aliasValuesRaw');
|
|
|
if (!empty($aliasValuesRaw)) {
|
|
|
- if(V::get('DBG_P5', '', $_GET)){echo '{ "$aliasValuesRaw": '.json_encode($aliasValuesRaw).', "dbg": [' . "\n";}
|
|
|
+ DBG::log($aliasValuesRaw, 'array', "DBG_P5: \$aliasValuesRaw");
|
|
|
array_walk($items, function (&$item) use ($fieldName, $sqlLocalKeyName, $aliasValuesRaw) {
|
|
|
$sqlValue = V::get($sqlLocalKeyName, null, $item);
|
|
|
- if(V::get('DBG_P5', '', $_GET)){echo '{ "sqlValue": "'.$sqlValue.'", "remote_value": "'.$aliasValuesRaw[$sqlValue]['remote_value'].'", "item": '.json_encode($item) . '},' . "\n";}
|
|
|
+ DBG::log($sqlValue, 'array', "DBG_P5: \$sqlValue");
|
|
|
+ DBG::log($aliasValuesRaw[$sqlValue]['remote_value'], 'array', "DBG_P5: \$aliasValuesRaw[{$sqlValue}]['remote_value']");
|
|
|
+ DBG::log($item, 'array', "DBG_P5: \$item");
|
|
|
if ($sqlValue !== null && array_key_exists($sqlValue, $aliasValuesRaw)) {
|
|
|
- if(V::get('DBG_P5', '', $_GET)){echo '{ "TODO_update_value": "'.$aliasValuesRaw[$sqlValue]['remote_value'].'"},' . "\n";}
|
|
|
+ DBG::log($aliasValuesRaw[$sqlValue]['remote_value'], 'array', "DBG_P5: TODO_update_value");
|
|
|
$item[$fieldName] = $aliasValuesRaw[$sqlValue]['remote_value'];
|
|
|
- if(V::get('DBG_P5', '', $_GET)){echo '{ "TODO_updated_value": "'.$item[$fieldName].'"},' . "\n";}
|
|
|
+ DBG::log($item[$fieldName], 'array', "DBG_P5: TODO_updated_value");
|
|
|
}
|
|
|
});
|
|
|
- if(V::get('DBG_P5', '', $_GET)){echo "\n".'{}]}';die();}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -6264,7 +6260,7 @@ jQuery(document).ready(function(){
|
|
|
|
|
|
// null => empty string
|
|
|
if (!isset($item[$fieldName]) || (!$item[$fieldName] && $item[$fieldName] !== '0')) {
|
|
|
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">isEmptyString['.$fieldName.'] (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($item[$fieldName]);echo'</pre>';}
|
|
|
+ // DBG::log($item[$fieldName], 'array', "isEmptyString[{$fieldName}]");
|
|
|
$item[$fieldName] = '';
|
|
|
}
|
|
|
}
|