Просмотр исходного кода

fixed cols order for TableAjax, added type p5:enum as string

Piotr Labudda 9 лет назад
Родитель
Сommit
66bfc0db94
2 измененных файлов с 34 добавлено и 1 удалено
  1. 33 1
      SE/se-lib/AntAclBase.php
  2. 1 0
      SE/se-lib/TableAjax.php

+ 33 - 1
SE/se-lib/AntAclBase.php

@@ -25,7 +25,24 @@ class AntAclBase extends Core_AclBase {
   public function getPrimaryKeyField() { return $this->_primaryKey; }
   public function getFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); }
   public function getVirtualFieldListByIdZasob() { return []; }
-  public function getVisibleFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); } // TODO: get visible fields
+  // public function getVisibleFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); } // TODO: get visible fields
+  public function getVisibleFieldListByIdZasob() {
+    $fields = $this->getRealFieldListByIdZasob();
+    $pkField = $this->getPrimaryKeyField();
+		$cols = array();
+		foreach ($fields as $kFieldID => $fieldName) {
+			if ($pkField === $fieldName) {
+				$id = $kFieldID;
+        break;
+			}
+		}
+		$cols[$id] = 'ID';
+		foreach ($fields as $kFieldID => $fieldName) {
+      if ($pkField === $fieldName) continue;
+			$cols[$kFieldID] = $fieldName;
+		}
+		return $cols;
+	}
   public function getRealFieldListByIdZasob() {
     $cols = array();
     $fakeZasobId = 1000000;
@@ -59,6 +76,21 @@ class AntAclBase extends Core_AclBase {
   public function getAttributesFromZasoby() {
     return [];// TODO: ...
   }
+  public function getXsdFieldParam($fieldName, $paramKey) { // TODO: fetch from db
+    return null;
+  }
+  // public function getXsdFieldParam($fieldName, $paramKey) { // TableAcl
+	// 	return ($this->_schemaClass)
+	// 		? $this->_schemaClass->getFieldParam($fieldName, $paramKey)
+	// 		: null
+	// 	;
+	// }
+	// public function getXsdFieldParam($fieldName, $paramKey) { // SimpleSchema
+  //   if (empty($this->_simpleSchema['root'][$fieldName])) return null;
+  //   if (empty($this->_simpleSchema['root'][$fieldName]['@@params'])) return null;
+  //   if (empty($this->_simpleSchema['root'][$fieldName]['@@params'][$paramKey])) return null;
+  //   return $this->_simpleSchema['root'][$fieldName]['@@params'][$paramKey];
+	// }
 
   public function isGeomField($fieldName) {
     return ('the_geom' === $fieldName); // TODO: ...

+ 1 - 0
SE/se-lib/TableAjax.php

@@ -6098,6 +6098,7 @@ jQuery(document).ready(function(){
 						break;
 					case 'p5':
 						switch ($typeName) {
+							case 'enum': $columnConfig->type = 'string'; break;
 							case 'alias': {
 								$format = $acl->getXsdFieldParam($col, 'format');
 								if ($format) $columnConfig->format = $format;