|
|
@@ -208,8 +208,11 @@ class TableAjax extends ViewAjax {
|
|
|
}
|
|
|
|
|
|
private function _showExportFieldsJson() {
|
|
|
- $exportFields = $this->_acl->getExportFieldList();
|
|
|
- return $exportFields;
|
|
|
+ if (method_exists($this->_acl, 'getExportFieldList')) {
|
|
|
+ $exportFields = $this->_acl->getExportFieldList();
|
|
|
+ return $exportFields;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
private function getProcesInitSelected() {
|
|
|
@@ -225,13 +228,11 @@ class TableAjax extends ViewAjax {
|
|
|
|
|
|
public function hasGeomFields() {
|
|
|
$hasGeomFields = false;
|
|
|
- $fieldsList = $this->_acl->getFields();
|
|
|
- foreach ($fieldsList as $kID => $vCol) {
|
|
|
- if ($this->_acl->isGeomField($vCol['name'])) {
|
|
|
- if ($this->_acl->hasFieldPerm($kID, 'R')) {
|
|
|
- $hasGeomFields = true;
|
|
|
- break;
|
|
|
- }
|
|
|
+ $fieldsList = $this->_acl->getFieldListByIdZasob();
|
|
|
+ foreach ($fieldsList as $kID => $fieldName) {
|
|
|
+ if ($this->_acl->isGeomField($fieldName) && $this->_acl->canReadField($fieldName)) {
|
|
|
+ $hasGeomFields = true;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
return $hasGeomFields;
|
|
|
@@ -643,9 +644,11 @@ var p5UI_TableAjax_generateFunctionNode = function(funObj, rowPK, props) {
|
|
|
priv.setStateFilters(priv.options.filterInit);
|
|
|
}
|
|
|
|
|
|
- $.each(priv.options.exportFields, function(ind, col) {
|
|
|
- _exportFieldsSelect[col] = true;
|
|
|
- });
|
|
|
+ if (priv.options.exportFields) {
|
|
|
+ $.each(priv.options.exportFields, function(ind, col) {
|
|
|
+ _exportFieldsSelect[col] = true;
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
//try call webservice for data
|
|
|
priv.update(priv.options.router);
|
|
|
@@ -3507,7 +3510,7 @@ jQuery(document).ready(function(){
|
|
|
rowFunctions: <?php echo json_encode($rowFunctions); ?>,
|
|
|
exportFields: <?php echo json_encode($exportFields); ?>,
|
|
|
specialFilterFunctions: <?php
|
|
|
- $fltrs = $this->_acl->getSpecialFilters();
|
|
|
+ $fltrs = (method_exists($this->_acl, 'getSpecialFilters')) ? $this->_acl->getSpecialFilters() : null;
|
|
|
if (!empty($fltrs)) {
|
|
|
echo json_encode($fltrs);
|
|
|
} else {
|
|
|
@@ -4250,32 +4253,40 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
|
|
|
private function sendAjaxEdit($id, $args) {
|
|
|
header("Content-type: text/plain");
|
|
|
$DBG = ('1' == V::get('DBG', '', $_REQUEST));
|
|
|
+ $acl = $this->_acl;
|
|
|
|
|
|
- $cols = array();
|
|
|
-
|
|
|
- $record = $this->_acl->getItem($id);
|
|
|
- if (!$this->_acl->canWriteRecord($record) && !$this->_acl->hasPermSuperWrite()) {
|
|
|
- echo '<div class="alert alert-danger">';
|
|
|
- echo "Brak dostępu do rekordu";// TODO: more info - reason
|
|
|
- echo '</div>';
|
|
|
+ $record = $acl->getItem($id);
|
|
|
+ if (!$acl->canWriteRecord($record) && !$acl->hasPermSuperWrite()) {
|
|
|
+ UI::alert('danger', "Brak dostępu do rekordu");// TODO: more info - reason
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- $fieldsList = $this->_acl->getFields();
|
|
|
- foreach ($fieldsList as $kID => $vCol) {
|
|
|
- if ($vCol['name'] == 'ID') {
|
|
|
- unset($fieldsList[$kID]);
|
|
|
- continue;
|
|
|
- }
|
|
|
+ $fieldsList = array();
|
|
|
+ foreach ($acl->getFieldListByIdZasob() as $kID => $fieldName) {
|
|
|
+ if ($fieldName == 'ID') continue;
|
|
|
+ $field['name'] = $fieldName;
|
|
|
+ $field['opis'] = $acl->getFieldOpis($fieldName);
|
|
|
+ $field['label'] = $acl->getFieldLabel($fieldName);
|
|
|
+ if (empty($field['label'])) $field['label'] = str_replace('_', ' ', $fieldName);
|
|
|
+ $fieldsList[$kID] = $field;
|
|
|
+ }
|
|
|
+
|
|
|
+ $cols = array();
|
|
|
+ foreach ($fieldsList as $kID => $field) {
|
|
|
$cols[$kID] = '';
|
|
|
+
|
|
|
if ($this->_acl->isAllowed($kID, 'R', $record)) {
|
|
|
- $cols[$kID] = V::get($vCol['name'], '', $record);
|
|
|
+ $cols[$kID] = V::get($field['name'], '', $record);
|
|
|
} else {
|
|
|
$cols[$kID] = '*****';
|
|
|
}
|
|
|
- $cols[$kID] = V::get("f{$kID}", $cols[$kID], $_POST);
|
|
|
|
|
|
- $fieldsList[$kID]['label'] = (!empty($vCol['label']))? $vCol['label'] : str_replace('_', ' ', $vCol['name']);
|
|
|
+ // if ($acl->canReadObjectField($field['name'])) {
|
|
|
+ // $cols[$kID] = V::get($field['name'], '', $record);
|
|
|
+ // } else {
|
|
|
+ // $cols[$kID] = '*****';
|
|
|
+ // }
|
|
|
+ $cols[$kID] = V::get("f{$kID}", $cols[$kID], $_POST);
|
|
|
}
|
|
|
|
|
|
$tsValues = array();
|
|
|
@@ -4306,11 +4317,11 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
|
|
|
<legend>Edycja rekordu Nr <?php echo $record->ID; ?><span class="pull-right valign-btns-bottom"><?php echo $rowFunctionsOut; ?></span></legend>
|
|
|
|
|
|
<?php $tabindex = 0; foreach ($fieldsList as $kID => $vCol) : ?>
|
|
|
- <?php if ($this->_acl->isAllowed($kID, 'W', $record)) : ?>
|
|
|
+ <?php if ($acl->canWriteObjectField($vCol['name'], $record)) : ?>
|
|
|
<div class="form-group">
|
|
|
<label class="col-xs-12 col-sm-3 col-md-2 control-label" for="<?php echo "f{$kID}"; ?>"><?php echo $vCol['label']; ?>
|
|
|
<i class="glyphicon glyphicon-info-sign frm-help" data-toggle="popover" data-trigger="hover" title="" data-content="<?php echo htmlspecialchars($vCol['opis']); ?>" data-original-title="<?php echo "[{$kID}] {$vCol['name']}"; ?>"></i>
|
|
|
- <?php $perms = $this->_acl->getFieldPerms($kID); UI::hotKeyDBG($perms); ?>
|
|
|
+ <?php $perms = $acl->getFieldPerms($kID); UI::hotKeyDBG($perms); ?>
|
|
|
</label>
|
|
|
<div class="col-xs-12 col-sm-9 col-md-10">
|
|
|
<?php
|
|
|
@@ -4318,20 +4329,20 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
|
|
|
if (!empty($tsValues[$kID])) {
|
|
|
$fieldParams['typespecialValue'] = $tsValues[$kID];
|
|
|
}
|
|
|
- echo $this->_acl->showFormItem('W', $kID, "f{$kID}", $cols[$kID], $fieldParams, $record);
|
|
|
+ echo $acl->showFormItem('W', $kID, "f{$kID}", $cols[$kID], $fieldParams, $record);
|
|
|
?>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <?php elseif ($this->_acl->isAllowed($kID, 'R', $record)) : ?>
|
|
|
+ <?php elseif ($acl->canReadObjectField($vCol['name'], $record)) : ?>
|
|
|
<div class="form-group">
|
|
|
<label class="col-xs-12 col-sm-3 col-md-2 control-label" for="<?php echo "f{$kID}"; ?>"><?php echo $vCol['label']; ?>
|
|
|
<i class="glyphicon glyphicon-info-sign frm-help" data-toggle="popover" data-trigger="hover" title="" data-content="<?php echo htmlspecialchars($vCol['opis']); ?>" data-original-title="<?php echo "[{$kID}] {$vCol['name']}"; ?>"></i>
|
|
|
- <?php $perms = $this->_acl->getFieldPerms($kID); UI::hotKeyDBG($perms); ?>
|
|
|
+ <?php $perms = $acl->getFieldPerms($kID); UI::hotKeyDBG($perms); ?>
|
|
|
</label>
|
|
|
<div class="col-xs-12 col-sm-9 col-md-10">
|
|
|
<p style="margin-top:5px;">
|
|
|
<?php
|
|
|
- //echo $this->_acl->showFormItem('R', $kID, "f{$kID}", $cols[$kID], array('appendBack'=>true), $record);
|
|
|
+ //echo $acl->showFormItem('R', $kID, "f{$kID}", $cols[$kID], array('appendBack'=>true), $record);
|
|
|
if (!empty($tsValues[$kID])) {
|
|
|
echo $tsValues[$kID];
|
|
|
} else if (!empty($record->{$vCol['name']})) {
|
|
|
@@ -4827,7 +4838,7 @@ jQuery(document).ready(function(){
|
|
|
$fldId = $acl->getFieldIdByName($vColName);
|
|
|
if ($fldId) {
|
|
|
$visibleColsWithIds[$fldId] = $vColName;
|
|
|
- $label = $acl->getFieldLabel($fldId);
|
|
|
+ $label = $acl->getFieldLabel($vColName);
|
|
|
$label = (!$label)? $vColName : '<span title="' . "[{$fldId}] {$vColName}" . '">' . $label . '</span>';
|
|
|
$visibleColsLabels[$fldId] = $label;
|
|
|
}
|
|
|
@@ -5889,7 +5900,7 @@ jQuery(document).ready(function(){
|
|
|
|
|
|
$this->setFilters($filters);
|
|
|
|
|
|
- $vCols = $this->_acl->getVirtualFieldList();
|
|
|
+ $vCols = $this->_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>';}
|
|
|
}
|
|
|
@@ -5917,7 +5928,7 @@ jQuery(document).ready(function(){
|
|
|
else if ($this->_acl->isGeomField($col)) {
|
|
|
$columnConfig->type = 'geom';
|
|
|
}
|
|
|
- if ('' !== ($label = $this->_acl->getFieldLabel($fieldID))) {
|
|
|
+ if ('' !== ($label = $this->_acl->getFieldLabel($col))) {
|
|
|
$columnConfig->friendly = $label;
|
|
|
}
|
|
|
$colType = $this->_acl->getFieldType($col);
|
|
|
@@ -5973,7 +5984,7 @@ jQuery(document).ready(function(){
|
|
|
$columnConfig->hidden = true;
|
|
|
}
|
|
|
|
|
|
- $columnConfig->description = $this->_acl->getFieldOpis($fieldID);
|
|
|
+ $columnConfig->description = $this->_acl->getFieldOpis($col);
|
|
|
|
|
|
$jsonData->cols->{$col} = $columnConfig;
|
|
|
}
|
|
|
@@ -6082,14 +6093,13 @@ jQuery(document).ready(function(){
|
|
|
|
|
|
$colVis = UserProfile::getHiddenCols($this->_zasobID);
|
|
|
|
|
|
- $fields = $this->_acl->getFields();
|
|
|
- foreach ($fields as $kFldId => $vFld) {
|
|
|
- $vFldName = $vFld['name'];
|
|
|
- if (isset($args[$vFldName])) {
|
|
|
- if ($args[$vFldName] == 'SHOW') {
|
|
|
- $colVis[$kFldId] = 1;
|
|
|
- } else if ($args[$vFldName] == 'HIDE') {
|
|
|
- $colVis[$kFldId] = 0;
|
|
|
+ $fields = $this->_acl->getFieldListByIdZasob();
|
|
|
+ foreach ($fields as $idField => $fieldName) {
|
|
|
+ if (isset($args[$fieldName])) {
|
|
|
+ if ($args[$fieldName] == 'SHOW') {
|
|
|
+ $colVis[$idField] = 1;
|
|
|
+ } else if ($args[$fieldName] == 'HIDE') {
|
|
|
+ $colVis[$idField] = 0;
|
|
|
}
|
|
|
}
|
|
|
}
|