浏览代码

Merge branch 'master' of ssh://biuro.biall-net.pl:2222/plabudda/se

* 'master' of ssh://biuro.biall-net.pl:2222/plabudda/se:
  added open ref js function to override
  added msg for ref fields in form - Funkcja w trakcie tworzenia
a.binder 8 年之前
父节点
当前提交
014485fb63
共有 3 个文件被更改,包括 53 次插入7 次删除
  1. 21 6
      SE/se-lib/TableAjax.php
  2. 24 0
      SE/se-lib/TableAjax.php.openRef.js
  3. 8 1
      SE/se-lib/UI.php

+ 21 - 6
SE/se-lib/TableAjax.php

@@ -1177,12 +1177,26 @@ class TableAjax extends ViewAjax {
 				if ('ref' === columnProps.type) showTooltip = false;
 				if ('ref' === columnProps.type) cellNode.css('padding', "3px")
 				if ('ref' === columnProps.type && priv.options.debug) console.log('renderRow rowPK('+rowPK+') columnProps', columnProps)
-				if ('ref' === columnProps.type) cellNode.html('<a href="index.php?_route=ViewTableAjax' +
-					'&namespace=' + columnProps.xsdRefNsPrefix.replace('__x3A__', '/') + '/' + columnProps.xsdRefType +
-					'&backRefNS=' + priv.options.namespace +
-					'&backRefPK=' + rowPK +
-					'&backRefField=' + columnProps.column +
-					'">przeglądaj</a>')
+				// if ('ref' === columnProps.type) cellNode.html('<a href="index.php?_route=ViewTableAjax' +
+				// 	'&namespace=' + columnProps.xsdRefNsPrefix.replace('__x3A__', '/') + '/' + columnProps.xsdRefType +
+				// 	'&backRefNS=' + priv.options.namespace +
+				// 	'&backRefPK=' + rowPK +
+				// 	'&backRefField=' + columnProps.column +
+				// 	'">przeglądaj</a>')
+				if ('ref' === columnProps.type) {
+					cellNode.html('<a onClick="return p5UI__tableAjaxOpenRefCell(' +
+						'\'' + columnProps.xsdRefNsPrefix.replace('__x3A__', '/') + '/' + columnProps.xsdRefType + '\', ' + // namespace
+						'\'' + priv.options.namespace + '\', ' + // backRefNS
+						'\'' + rowPK + '\', ' + // backRefPK
+						'\'' + columnProps.column + '\')' + // backRefField
+						'" ' +
+						'href="index.php?_route=ViewTableAjax' +
+						'&namespace=' + columnProps.xsdRefNsPrefix.replace('__x3A__', '/') + '/' + columnProps.xsdRefType +
+						'&backRefNS=' + priv.options.namespace +
+						'&backRefPK=' + rowPK +
+						'&backRefField=' + columnProps.column +
+						'">przeglądaj</a>')
+				}
 
 				if (columnProps.xsdType && 'xsd:base64Binary' === columnProps.xsdType) {
 					cellCnt.empty();
@@ -3501,6 +3515,7 @@ class TableAjax extends ViewAjax {
 		'FUNCTION_EDIT_ROUTE' => "TableAjax__EDIT_Route",
 		'URL_EDIT_FORM_AJAX' => "{$this->syncUrl}&_hash={$this->_htmlID}&_task=editFormJson&_primaryKey=",
 	]);
+	UI::inlineJS(__FILE__ . '.openRef.js', []); // p5UI__tableAjaxOpenRefCell
 
 	$fltrs = (method_exists($acl, 'getSpecialFilters')) ? $acl->getSpecialFilters() : null;
 	$jsonSpecialFilters = (!empty($fltrs)) ? json_encode($fltrs) : 'false';

+ 24 - 0
SE/se-lib/TableAjax.php.openRef.js

@@ -0,0 +1,24 @@
+// @require variables:
+// if ('undefined' === typeof TABLE_AJAX_NODE_ID) throw "Missing TABLE_AJAX_NODE_ID"; // $this->_htmlID,
+
+function p5UI__tableAjaxOpenRefCell(namespace, backRefNS, backRefPK, backRefField) {
+	// console.log('p5UI__tableAjaxOpenRefCell', {namespace: namespace, backRefNS: backRefNS, backRefPK: backRefPK, backRefField: backRefField})
+	// return false;
+
+	// <a onClick="return p5UI__tableAjaxOpenRefCell(' +
+	// 	'\'' + columnProps.xsdRefNsPrefix.replace('__x3A__', '/') + '/' + columnProps.xsdRefType + '\', ' + // namespace
+	// 	'\'' + priv.options.namespace + '\', ' + // backRefNS
+	// 	'\'' + rowPK + '\', ' + // backRefPK
+	// 	'\'' + columnProps.column + '\')' + // backRefField
+	// 	'" ' +
+	// 	'href="index.php?_route=ViewTableAjax' +
+	// 	'&namespace=' + columnProps.xsdRefNsPrefix.replace('__x3A__', '/') + '/' + columnProps.xsdRefType +
+	// 	'&backRefNS=' + priv.options.namespace +
+	// 	'&backRefPK=' + rowPK +
+	// 	'&backRefField=' + columnProps.column +
+	// 	'">przeglądaj</a>')
+
+	return true;
+}
+
+global.p5UI__tableAjaxOpenRefCell = p5UI__tableAjaxOpenRefCell

+ 8 - 1
SE/se-lib/UI.php

@@ -492,6 +492,7 @@ class UI {
 		switch ($xsdType) {
 
 			case 'xsd:long':
+			case 'xsd:int':
 			case 'xsd:integer': {
 				$html->attrs['type'] = 'number';
 				$html->attrs['class'][] = 'input-small';
@@ -641,7 +642,13 @@ class UI {
 				return '...';
 			} break;
 
-			default: return "unknown Type \"{$xsdType}\"";
+			default: {
+				if ('ref:' === substr($xsdType, 0, 4)) {
+					return "Funkcja w trakcie przygotowanie (ref do '" . substr($xsdType, 4) . "')";
+				}
+
+				return "unknown Type \"{$xsdType}\"";
+			}
 		}
 
 		$html->attrs['class'][] = 'form-control';