Преглед изворни кода

TableAjax field description in table view

Piotr Labudda пре 11 година
родитељ
комит
2882b00863
3 измењених фајлова са 17 додато и 2 уклоњено
  1. 1 1
      SE/VERSION
  2. 9 0
      SE/se-lib/TableAcl.php
  3. 7 1
      SE/se-lib/TableAjax.php

+ 1 - 1
SE/VERSION

@@ -1 +1 @@
-3.9.7.10
+3.9.7.11

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

@@ -783,6 +783,15 @@ class TableAcl {
 		return null;
 	}
 
+	public function getFieldOpis($fieldID) {
+		if (array_key_exists($fieldID, $this->_fields)) {
+			if (!empty($this->_fields[$fieldID]['opis'])) {
+				return $this->_fields[$fieldID]['opis'];
+			}
+		}
+		return null;
+	}
+
 	public function getTypes() {
 		return $this->_types;
 	}

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

@@ -695,7 +695,11 @@ class TableAjax extends ViewAjax {
 							headCell.on('click', {column: column}, priv.columnClicked);
 						}
 						var colTitle = column;
-						if (props._tsRetId) {
+						if (props.description && props.description.length > 0) {
+							colTitle = props.description;
+							colTitle += ' (' + column + ')';
+						}
+						else if (props._tsRetId) {
 							colTitle = 'Kliknij na pole i przejdź do powiązanych rekordów (' + colTitle + ')';
 						}
 
@@ -4644,6 +4648,8 @@ jQuery(document).ready(function(){
 				}
 			}
 
+			$columnConfig->description = $this->_acl->getFieldOpis($fieldID);
+
 			$jsonData->cols->{$col} = $columnConfig;
 		}
 		$jsonData->rows = array();