Browse Source

added support for xsd:time in TableAcl

Piotr Labudda 7 năm trước cách đây
mục cha
commit
0012c9dce1
3 tập tin đã thay đổi với 24 bổ sung15 xóa
  1. 1 0
      SE/se-lib/Core/AclBase.php
  2. 7 0
      SE/se-lib/TableAcl.php
  3. 16 15
      SE/se-lib/UI.php

+ 1 - 0
SE/se-lib/Core/AclBase.php

@@ -87,6 +87,7 @@ class Core_AclBase {
   public function isGeomField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
   public function isDateField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
   public function isDateTimeField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isTimeField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
   public function isStringField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
   public function isTextField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
   public function isBinaryField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }

+ 7 - 0
SE/se-lib/TableAcl.php

@@ -1850,6 +1850,12 @@ class TableAcl extends Core_AclBase {
 		return false;
 	}
 
+	public function isTimeField($fldName) {
+		$type = $this->getFieldType($fldName);
+		if (!$type) return false;
+		return ('time' === $type['type']);
+	}
+
 	public function isStringField($fldName) {
 		$type = $this->getFieldType($fldName);
 		if (!$type) return false;
@@ -1972,6 +1978,7 @@ class TableAcl extends Core_AclBase {
 		if ($this->isIntegerField($fieldName)) return 'xsd:integer';
 		else if ($this->isDecimalField($fieldName)) return 'xsd:decimal';
 		else if ($this->isDateTimeField($fieldName)) return 'xsd:dateTime';
+		else if ($this->isTimeField($fieldName)) return 'xsd:time';
 		else if ($this->isDateField($fieldName)) return 'xsd:date';
 		else if ($this->isTextField($fieldName)) return 'p5:text';
 		else if ($this->isGeomField($fieldName)) {

+ 16 - 15
SE/se-lib/UI.php

@@ -473,6 +473,7 @@ class UI {
 		// $colType = $acl->getFieldTypeById($fieldID);
 		// if (!$colType) return "Error - unknown type";
 		$xsdType = $acl->getXsdFieldType($fieldName);
+		DBG::log("DBG: field({$fieldName}) xsdType({$xsdType})");
 
 		$html = new stdClass();
 		$html->_params = array();
@@ -552,21 +553,21 @@ class UI {
 				}
 			} break;
 
-			// case 'xsd:time': { // TODO: ... TableAcl not returns xsd type 'xsd:time'
-			// 	$testDatePicker = true;
-			// 	if ($testDatePicker) {
-			// 		$html->attrs['type'] = 'text';
-			// 		$html->_params[] = 'time';
-			// 		$html->attrs['class'][] = 'se_type-time';// datetimepicker';
-			// 		$html->attrs['data-format'] = 'hh:mm:ss';
-			// 		$html->attrs['maxlength'] = 8;
-			// 		if (substr($html->attrs['value'], 0, 8) == '00:00:00') {
-			// 			$html->attrs['value'] = '';
-			// 		}
-			// 	} else {
-			// 		$html->attrs['type'] = 'time';
-			// 	}
-			// } break;
+			case 'xsd:time': {
+				$testDatePicker = true;
+				if ($testDatePicker) {
+					$html->attrs['type'] = 'text';
+					$html->_params[] = 'time';
+					$html->attrs['class'][] = 'se_type-time';// datetimepicker';
+					$html->attrs['data-format'] = 'hh:mm:ss';
+					$html->attrs['maxlength'] = 8;
+					if (substr($html->attrs['value'], 0, 8) == '00:00:00') {
+						$html->attrs['value'] = '';
+					}
+				} else {
+					$html->attrs['type'] = 'time';
+				}
+			} break;
 
 			// case 'timestamp': { // TODO: timestamp is xsd:integer or xsd:dateTime?
 			// 	$testDatePicker = true;