소스 검색

fixed bug in perm create in AclBase, use namespace in ViewTableAjax

Piotr Labudda 9 년 전
부모
커밋
5294da7597

+ 57 - 2
SE/se-lib/Core/AclBase.php

@@ -20,7 +20,7 @@ class Core_AclBase {
   public function getID() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }// TODO: Legacy
   public function init($force = false) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
   public function isInitialized() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
-  public function getFields() {// @returns array - $this->_fields
+  public function getFields() {// @returns array - $this->_fields // TODO: mved to getFieldListByIdZasob
     /*
       $field = array();
   		$field['name'] = $name;
@@ -32,7 +32,11 @@ class Core_AclBase {
     */
     throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501);
   }
-  public function getRealFieldListByIdZasob() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function getFieldListByIdZasob() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }// TODO: RMME - one field list function
+  public function getRealFieldListByIdZasob() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }// TODO: RMME - one field list function
+  public function getVirtualFieldListByIdZasob() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }// TODO: RMME - one field list function
+  // TODO: public function getFieldList(); // @retuns array of field names
+
   public function isIntegerField($fieldName) { return ('xsd:integer' == $this->getXsdFieldType($fieldName)); }
   public function isDecimalField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
   public function isGeomField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
@@ -55,6 +59,14 @@ class Core_AclBase {
   public function canReadObjectField($fieldName, $record) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
   public function canWriteField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
   public function canWriteObjectField($fieldName, $record) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function hasCreatePerms() {
+		foreach ($this->getFieldListByIdZasob() as $fieldName) {// TODO: use getFieldList
+			if ($this->canCreateField($fieldName)) return true;
+		}
+		return false;
+	}
+
+  public function getRawLabel($posLimit = 20) { return substr($this->getName(), 0, $posLimit); }
 
   public function getItems($params = array()) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
   public function addItem($todoItem) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
@@ -583,4 +595,47 @@ class Core_AclBase {
     return $deleted;
   }
 
+  public static function getAclByNamespace($namespace, $forceTblAclInit) {
+		$userAcl = User::getAcl();
+		$userAcl->fetchGroups();
+		if ('http' != substr($namespace, 0, 4)) $namespace = Api_WfsNs::getBaseWfsUri() . '/' . $namespace;//Request::getHostUri() . '/' . $namespace;
+
+		$baseNsUri = Api_WfsNs::getBaseWfsUri();
+		if ("{$baseNsUri}/" == substr($namespace, 0, strlen($baseNsUri) + 1)) {
+			$schemaNs = substr($namespace, strlen($baseNsUri) + 1);
+			$ns = explode('/', $schemaNs);// "http://biuro.biall-net.pl/wfs/  default_db/{$nazwa_tabeli}/{$nazwa_obj}
+			$sourceName = array_shift($ns);// remove first element - source name
+			if ('default_db' == $sourceName || 'p5_default_db' == $sourceName) {
+				$sourceName = 'default_db';
+				$objName = $ns[0];
+				if (1 == count($ns)) {
+					$acl = $userAcl->getObjectAcl($sourceName, $objName);
+					if (!$acl) throw new Exception("Could not get acl for '{$schemaNs}'");
+					$acl->init($forceTblAclInit);
+					return $acl;
+				}
+				else throw new Exception("Nieznany namespace default_db: '{$schemaNs}'", 501);
+			}
+			else if ('default_objects' == $sourceName || 'SystemObjects' == $sourceName || 'p5_objects' == $sourceName) {
+				$sourceName = 'objects';
+				$objName = $ns[0];
+				if (1 == count($ns)) {
+					$acl = $userAcl->getObjectAcl($sourceName, $objName);
+					if (!$acl) throw new Exception("Could not get acl for '{$schemaNs}'");
+					$acl->init($forceTblAclInit);
+					return $acl;
+				}
+				else throw new Exception("Nieznany namespace SystemObjects: '{$schemaNs}'", 501);
+			}
+			else if ('zasob_' == substr($sourceName, 0, 6)) {
+				$dbName = substr($sourceName, 6);
+				throw new Exception("TODO db[{$dbName}] namespace '{$schemaNs}'", 501);
+			}
+			else throw new Exception("Nieznany namespace '{$schemaNs}'", 501);
+		}
+		else throw new HttpException("Zasoby zewnętrzenj systemu nie są jeszcze zaimplementowane", 501);
+
+		throw new HttpException("TODO L.".__LINE__." ns({$namespace})", 501);
+	}
+
 }

+ 2 - 0
SE/se-lib/Request.php

@@ -28,6 +28,8 @@ class Request {
 		return $uri;
 	}
 
+	public static function getHost() { return V::get('HTTP_HOST', '', $_SERVER); }
+
 	// @usage: Request::getScriptUri();
 	public static function getScriptUri() {
 		// [SCRIPT_URI] => http://biuro.biall-net.pl:34543/dev-pl/se-master/wfs-qgis.php/default_db/

+ 9 - 4
SE/se-lib/Route/ViewTableAjax.php

@@ -6,6 +6,8 @@ Lib::loadClass('TableAjax');
 // Lib::loadClass('Request');
 Lib::loadClass('Response');
 Lib::loadClass('UI');
+Lib::loadClass('Api_WfsNs');
+Lib::loadClass('Core_AclBase');
 
 class Route_ViewTableAjax extends RouteBase {
 
@@ -13,10 +15,13 @@ class Route_ViewTableAjax extends RouteBase {
 		UI::gora();
 		UI::menu();
 		try {
-
-			$typeName = V::get('typeName', '', $_GET, 'word');
-			if (!$typeName) throw new Exception("Wrong param typeName");
-			$acl = $this->getAclFromTypeName($typeName, $forceTblAclInit = ('1' == V::get('_force', '', $_GET)));
+			$namespace = V::get('namespace', '', $_GET, 'word');
+			if (!$namespace) {
+				$typeName = V::get('typeName', '', $_GET, 'word');
+				if (!$typeName) throw new Exception("Wrong param typeName");
+				$namespace = Api_WfsNs::getBaseWfsUri() . '/' . str_replace(':', '/', $typeName);
+			}
+			$acl = Core_AclBase::getAclByNamespace($namespace, $forceTblAclInit = ('1' == V::get('_force', '', $_GET)));
 
 			$forceFilterInit = array();
 			$filterInit = new stdClass();

+ 2 - 0
SE/se-lib/Schema/AccessGroupStorageAcl.php

@@ -11,6 +11,8 @@ class Schema_AccessGroupStorageAcl extends Core_AclBase {// Read only class
   public function isInitialized() { return true; }
   public function getName() { return 'AccessGroup'; }
   public function getRootTableName() { return 'CRM_LISTA_ZASOBOW'; }
+  public function getFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); }
+  public function getVirtualFieldListByIdZasob() { return array(); }
   public function getRealFieldListByIdZasob($force = false) {
     $cols[100000] = 'id';// CRM_LISTA_ZASOBOW.ID
     $cols[100001] = 'name';// CRM_LISTA_ZASOBOW.DESC

+ 2 - 0
SE/se-lib/Schema/AccessOwnerStorageAcl.php

@@ -9,6 +9,8 @@ class Schema_AccessOwnerStorageAcl extends Core_AclBase {
   public function isInitialized() { return true; }
   public function getName() { return 'AccessOwner'; }
   public function getRootTableName() { return 'ADMIN_USERS'; }// TODO: turn off - use getName for generating ref's
+  public function getFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); }
+  public function getVirtualFieldListByIdZasob() { return array(); }
   public function getRealFieldListByIdZasob($force = false) {
     $cols[100000] = 'id';// ADMIN_USERS.ID
     $cols[100001] = 'login';// ADMIN_USERS.ADM_ACCOUNT

+ 2 - 0
SE/se-lib/Schema/FileStorageAcl.php

@@ -11,6 +11,8 @@ class Schema_FileStorageAcl extends Core_AclBase {
   public function isInitialized() { return true; }
   public function getName() { return 'File'; }
   public function getRootTableName() { return 'CRM_FILES'; }
+  public function getFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); }
+  public function getVirtualFieldListByIdZasob() { return array(); }
   public function getRealFieldListByIdZasob() {
     $cols = array();// FileStorage::getFileById()
     $cols[1] = 'id';

+ 2 - 0
SE/se-lib/Schema/KorespondencjaStorageAcl.php

@@ -14,6 +14,8 @@ class Schema_KorespondencjaStorageAcl extends Core_AclBase {
   public function isInitialized() { return true; }
   public function getName() { return 'Korespondencja'; }
   public function getRootTableName() { return 'IN7_DZIENNIK_KORESP'; }
+  public function getFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); }
+  public function getVirtualFieldListByIdZasob() { return array(); }
   public function getRealFieldListByIdZasob($force = false) {
     $cols = $this->parentAcl->getRealFieldListByIdZasob();
     $cols[100000] = 'File';

+ 2 - 0
SE/se-lib/Schema/TestPermsStorageAcl.php

@@ -14,6 +14,8 @@ class Schema_TestPermsStorageAcl extends Core_AclBase {
   public function isInitialized() { return true; }
   public function getName() { return 'TestPerms'; }
   public function getRootTableName() { return 'TEST_PREMS'; }
+  public function getFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); }
+  public function getVirtualFieldListByIdZasob() { return array(); }
   public function getRealFieldListByIdZasob($force = false) {
     $cols = $this->parentAcl->getRealFieldListByIdZasob();
     $cols[100000] = 'File';

+ 31 - 11
SE/se-lib/TableAcl.php

@@ -363,10 +363,15 @@ class TableAcl extends Core_AclBase {
 		if (!$this->hasFieldPerm($idZasob, $taskPerm = 'R')) {
 			if ($this->hasFieldPerm($idZasob, 'V')) return true;
 		}
-		return true;
+		return false;
 	}
   public function canReadObjectField($fieldName, $record) {
 		if (!$this->canReadField($fieldName)) return false;
+		if ('ID' == $fieldName) return true;
+		if ('A_RECORD_CREATE_DATE' == $fieldName) return true;
+		if ('A_RECORD_CREATE_AUTHOR' == $fieldName) return true;
+		if ('A_RECORD_UPDATE_DATE' == $fieldName) return true;
+		if ('A_RECORD_UPDATE_AUTHOR' == $fieldName) return true;
 		if (!$record) return false;
 		$idZasob = $this->getFieldIdByName($fieldName);
 		if (!$idZasob) return false;
@@ -1262,6 +1267,19 @@ class TableAcl extends Core_AclBase {
 		return $cols;
 	}
 
+	public function getFieldListByIdZasob() {
+		$cols = array();
+		foreach ($this->_fields as $idField => $fld) {
+			if ($fld['name'] == 'ID') {
+				$cols[$idField] = 'ID';
+			}
+		}
+		foreach ($this->_fields as $idField => $fld) {
+			if ($fld['name'] == 'ID') continue;
+			$cols[$idField] = $fld['name'];
+		}
+		return $cols;
+	}
 	public function getRealFieldListByIdZasob() {
 		$cols = array();
 		foreach ($this->_fields as $idField => $fld) {
@@ -1278,7 +1296,7 @@ class TableAcl extends Core_AclBase {
 		return $cols;
 	}
 
-	public function getVirtualFieldList() {
+	public function getVirtualFieldListByIdZasob() {
 		$cols = array();
 		foreach ($this->_fields as $kFieldID => $vField) {
 			if ($vField['name'] == 'ID') {
@@ -1295,19 +1313,21 @@ class TableAcl extends Core_AclBase {
 		return $cols;
 	}
 
-	public function getFieldLabel($fieldID) {
-		if (array_key_exists($fieldID, $this->_fields)) {
-			if (!empty($this->_fields[$fieldID]['label'])) {
-				return $this->_fields[$fieldID]['label'];
+	public function getFieldLabel($fieldName) {
+		$idField = $this->getFieldIdByName($fieldName);
+		if (array_key_exists($idField, $this->_fields)) {
+			if (!empty($this->_fields[$idField]['label'])) {
+				return $this->_fields[$idField]['label'];
 			}
 		}
 		return null;
 	}
 
-	public function getFieldOpis($fieldID) {
-		if (array_key_exists($fieldID, $this->_fields)) {
-			if (!empty($this->_fields[$fieldID]['opis'])) {
-				return $this->_fields[$fieldID]['opis'];
+	public function getFieldOpis($fieldName) {
+		$idField = $this->getFieldIdByName($fieldName);
+		if (array_key_exists($idField, $this->_fields)) {
+			if (!empty($this->_fields[$idField]['opis'])) {
+				return $this->_fields[$idField]['opis'];
 			}
 		}
 		return null;
@@ -1629,7 +1649,7 @@ class TableAcl extends Core_AclBase {
 		$dsConfig['object_name'] = $this->getName();
 		$dsConfig['fields'] = $cols;
 		$dsConfig['field_types'] = $this->getTypes();
-		$dsConfig['fields_virtual'] = $this->getVirtualFieldList();
+		$dsConfig['fields_virtual'] = $this->getVirtualFieldListByIdZasob();
 		$dsConfig['acl_fltr_allowed'] = !$this->hasSuperAccessPerms();
 		return DataSourceFactory::buildFromZasobInfo($dsConfig);
 	}

+ 57 - 47
SE/se-lib/TableAjax.php

@@ -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;
 				}
 			}
 		}

+ 3 - 3
SE/se-lib/TreeAjax.php

@@ -18,7 +18,7 @@ class TreeAjax extends ViewAjax {
 		$this->_dataSource = new Data_Tree_Source($tblAcl->getDB());
 		$this->_dataSource->setTable($tblAcl->getName());
 		$this->_dataSource->setCols($tblAcl->getRealFieldList());
-		$this->_dataSource->setVirtualCols($tblAcl->getVirtualFieldList());
+		$this->_dataSource->setVirtualCols($tblAcl->getVirtualFieldListByIdZasob());
 
 		// TODO: mv to config or Zasoby (ALIAS?)
 		switch ($tblAcl->getName()) {
@@ -37,7 +37,7 @@ class TreeAjax extends ViewAjax {
 				$this->_dataSource->setSortField('SORT_PRIO');
 				break;
 			default:
-				
+
 		}
 
 		$hash = V::get('_hash', '', $_GET);
@@ -1174,7 +1174,7 @@ jQuery(document).ready(function(){
 		},
 		onNodeCollapse: function() {
 			var node = this;
-			//table.treetable("unloadBranch", node);// when unloadBranch childrens are only hidden and unnecessary ajax call on expand 
+			//table.treetable("unloadBranch", node);// when unloadBranch childrens are only hidden and unnecessary ajax call on expand
 		},
 		onNodeExpand: function() {
 			var node = this;

+ 1 - 2
SE/superedit-VIEWTABLE_AJAX_EXPORT.php

@@ -85,8 +85,7 @@ function VIEWTABLE_AJAX_EXPORT() {
 	$flds = array_keys($flds);
 	$labels = array();
 	foreach ($flds as $fldName) {
-		$fldId = $tblAcl->getFieldIdByName($fldName);
-		$label = $tblAcl->getFieldLabel($fldId);
+		$label = $tblAcl->getFieldLabel($fldName);
 		$labels[$fldName] = ($label)? $label : $fldName;
 	}