Przeglądaj źródła

moved edit and more row func list from TableAjax

Piotr Labudda 9 lat temu
rodzic
commit
e7d646f4d1
3 zmienionych plików z 293 dodań i 274 usunięć
  1. 139 1
      SE/se-lib/Core/AclHelper.php
  2. 90 1
      SE/se-lib/Route/ViewTableAjax.php
  3. 64 272
      SE/se-lib/TableAjax.php

+ 139 - 1
SE/se-lib/Core/AclHelper.php

@@ -1,5 +1,10 @@
 <?php
 
+Lib::loadClass('Api_WfsNs');
+Lib::loadClass('ProcesHelper');
+Lib::loadClass('Router');
+Lib::loadClass('Route_UrlAction');
+
 class Core_AclHelper {// Helper class for Acl
 
   public static function hasCreatePerms($acl) {
@@ -18,7 +23,7 @@ class Core_AclHelper {// Helper class for Acl
     return false;
   }
 
-  public static function getAclByNamespace($namespace, $forceTblAclInit) {
+  public static function getAclByNamespace($namespace, $forceTblAclInit = false) {
 		if ('http' != substr($namespace, 0, 4)) $namespace = Api_WfsNs::getBaseWfsUri() . '/' . $namespace;//Request::getHostUri() . '/' . $namespace;
 
 		$baseNsUri = Api_WfsNs::getBaseWfsUri();
@@ -59,4 +64,137 @@ class Core_AclHelper {// Helper class for Acl
 		throw new HttpException("TODO L.".__LINE__." ns({$namespace})", 501);
 	}
 
+  public static function getMoreFunctionsCell($acl, $args) {
+		$id = V::get('primary_key', 0, $args, 'int');
+		if ($id <= 0) throw new HttpException("404", 404);
+		$record = V::get('record', null, $args);
+
+		$rowFunList = array();
+		$tableName = $acl->getName();
+		$record = ($record)? $record : $acl->getItem($id);
+
+		if(1){// TODO: fetch $totalMsgs from TableMsgs
+			$msgs = Router::getRoute('Msgs');
+			$msgsList = $msgs->getActiveMessagesForTableRecord($tableName, $id);
+			$totalMsgs = count($msgsList);
+			$rowFunc = new stdClass();
+			$rowFunc->id = 'msgs';
+			$rowFunc->ico = 'glyphicon glyphicon-envelope';
+			$rowFunc->href = 'index.php?_route=TableMsgs&_task=tableRow&idTable=' . $acl->getID() . '&idRow=' . $id;
+			$rowFunc->title = "Wiadomości ({$totalMsgs})";
+			$rowFunc->label = "Wiadomości <span class=\"badge\">{$totalMsgs}</span>";
+			$rowFunList[] = $rowFunc;
+		}
+
+		if ('CRM_PROCES' == $acl->getName()) {// TODO: mv to table gui xml or php class
+			// procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id=22001
+			$rowFunc = new stdClass();
+			$rowFunc->ico = 'glyphicon glyphicon-eye-open';
+			$rowFunc->href = "procesy5.php?task=CRM_PROCES&filtr_id={$id}";
+			$rowFunc->title = "Zobacz na drzewie procesów {{$id}}";
+			$rowFunList[] = $rowFunc;
+
+			$wskazniki = ProcesHelper::get_wskazniki($id);
+			$connectedZasobyTotal = count($wskazniki);
+			$rowFunc = new stdClass();
+			$rowFunc->ico = 'glyphicon glyphicon-random';
+			$rowFunc->href = "index.php?MENU_INIT=PROCES_ADD_ZASOB&procesID={$id}";
+			$rowFunc->title = "Powiązane zasoby <span class=\"badge\">{$connectedZasobyTotal}</span>";
+			$rowFunList[] = $rowFunc;
+		}
+
+		if ('CRM_LISTA_ZASOBOW' == $acl->getName()) {// TODO: mv to table gui xml or php class
+			// procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id=22001
+			$rowFunc = new stdClass();
+			$rowFunc->ico = 'glyphicon glyphicon-eye-open';
+			$rowFunc->href = "procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id={$id}";
+			$rowFunc->title = "Zobacz na drzewie zasobów [{$id}]";
+			$rowFunList[] = $rowFunc;
+
+			// index.php?MENU_INIT=ZASOB_OBOWIAZKI&id_zasob=22001
+			$rowFunc = new stdClass();
+			$rowFunc->ico = 'glyphicon glyphicon-random';
+			$rowFunc->href = "index.php?MENU_INIT=ZASOB_OBOWIAZKI&id_zasob={$id}";
+			$rowFunc->title = "Powiązane procesy (OB)";
+			$rowFunList[] = $rowFunc;
+
+			// index.php?MENU_INIT=ZASOB_EXTERNAL_IDS&id_zasob=22001
+			$rowFunc = new stdClass();
+			$rowFunc->ico = 'glyphicon glyphicon-random';
+			$rowFunc->href = "index.php?MENU_INIT=ZASOB_EXTERNAL_IDS&id_zasob={$id}";
+			$rowFunc->title = "Powiązane dane (IDS)";
+			$rowFunList[] = $rowFunc;
+
+			$groupTypeList = array();
+			$groupTypeList[] = 'STANOWISKO';
+			$groupTypeList[] = 'PODMIOT';
+			$groupTypeList[] = 'DZIAL';
+			if (in_array($record->TYPE, $groupTypeList)) {
+				$rowFunc = new stdClass();
+				$rowFunc->ico = 'glyphicon glyphicon-retweet';
+				$rowFunc->href = "index.php?_route=Users&_task=syncGroup&idGroup={$id}";
+				$rowFunc->title = "Synchronizuj do LDAP";
+				$rowFunList[] = $rowFunc;
+			}
+		}
+
+		if ('ADMIN_USERS' == $acl->getName()) {// TODO: mv to table gui xml
+			$isAllowedoReadUserLogin = false;
+			if ($acl->canReadRecord($record)) {
+				$idFieldUserLogin = $acl->getFieldIdByName('ADM_ACCOUNT');
+				if ($idFieldUserLogin) {
+					if ($acl->isAllowed($idFieldUserLogin, 'R', $record)) {
+						$isAllowedoReadUserLogin = true;
+					}
+				}
+			}
+			if ($isAllowedoReadUserLogin) {
+				$rowFunc = new stdClass();
+				$rowFunc->ico = 'glyphicon glyphicon-user';
+				$rowFunc->href = 'index.php?_route=Users&_task=userGroups&usrLogin=' . $record->ADM_ACCOUNT;
+				$rowFunc->title = "Ustal stanowisko";
+				$rowFunList[] = $rowFunc;
+
+				$rowFunc = new stdClass();
+				$rowFunc->ico = 'glyphicon glyphicon-retweet';
+				$rowFunc->href = 'index.php?_route=Users&_task=syncUser&usrLogin=' . $record->ADM_ACCOUNT;
+				$rowFunc->title = "Synchronizuj do LDAP";
+				$rowFunList[] = $rowFunc;
+
+				$rowFunc = new stdClass();
+				$rowFunc->ico = 'glyphicon glyphicon-minus';
+				$rowFunc->href = 'index.php?MENU_INIT=USER_OCENA_PRACOWNIKA&usrLogin=' . $record->ADM_ACCOUNT;
+				$rowFunc->title = "Ocena pracownika";
+				$rowFunList[] = $rowFunc;
+			}
+		}
+
+		if ($urlFunctions = Route_UrlAction::getTableFunctions($acl->getID(), $id, $acl->getName(), User::getLogin())) {
+			foreach ($urlFunctions as $urlFunction) {
+				// TODO: is allowed to view - test by Router::getRoute('UrlAction')->isFunctionAllowedForRecord($routeName = $urlFunction['name'], $acl->getID(), $id);
+				$rowFunction = array();
+				$rowFunction['href'] = $urlFunction['baseLink'];
+				$rowFunction['ico'] = V::get('ico', 'glyphicon glyphicon-share', $urlFunction);
+				$rowFunction['label'] = $urlFunction['label'];
+				$rowFunction['title'] = V::get('title', $urlFunction['label'], $urlFunction);
+				if (!empty($urlFunction['link_target'])) $rowFunction['target'] = $urlFunction['link_target'];
+				if (!empty($urlFunction['cell_id_params'])) {
+					$urlParams = array();// [ "{$urlParamName}={$paramValue}" ]
+					foreach ($urlFunction['cell_id_params'] as $idField => $urlParamName) {
+						$paramValue = '';
+						$fld = $acl->getField($idField);
+						if ($fld) {
+							$fldName = $fld['name'];
+							$paramValue = V::get($fldName, '', $record);
+							$urlParams[] = "{$urlParamName}={$paramValue}";
+						}
+					}
+					if (!empty($urlParams)) $rowFunction['href'] .= "&" . implode("&", $urlParams);
+				}
+				$rowFunList[] = $rowFunction;
+			}
+		}
+		return $rowFunList;
+	}
+
 }

+ 90 - 1
SE/se-lib/Route/ViewTableAjax.php

@@ -8,6 +8,8 @@ Lib::loadClass('Response');
 Lib::loadClass('UI');
 Lib::loadClass('Api_WfsNs');
 Lib::loadClass('Core_AclHelper');
+Lib::loadClass('Route_UrlAction');
+Lib::loadClass('Router');
 
 class Route_ViewTableAjax extends RouteBase {
 
@@ -217,7 +219,7 @@ class Route_ViewTableAjax extends RouteBase {
 				$response->msg = "Usunięto obiekt z mapy dla rekordu {$primaryKey}";// Rekord zapisany pomyślnie
 			} else if ($affected == 0) {
 				$response->type = 'info';
-				$response->msg = "Rekord nie był powiązany z żadnym obiektem na mapie";// Nie wprowadzono żadnych zmian
+				$response->msg = "Nie wprowadzono żadnych zmian";
 			}
 			$response->record = $acl->getItem($primaryKey);
 		}
@@ -229,6 +231,93 @@ class Route_ViewTableAjax extends RouteBase {
 		return $response;
 	}
 
+	public function moreFunctionsCellAjaxAction() {
+		Response::sendTryCatchJson(array($this, 'moreFunctionsCell'), $args = $_GET);
+	}
+	public function moreFunctionsCell($args) {// ajax task 'MORE_FUNCTIONS_CELL'
+		$id = V::get('ID', 0, $args, 'int');
+		if ($id <= 0) throw new HttpException("404", 404);
+		$namespace = V::get('namespace', '', $args, 'word');
+		if (!$namespace) throw new HttpException("Bad Request - missing namespace", 400);
+		$acl = Core_AclHelper::getAclByNamespace($namespace, $forceTblAclInit = ('1' == V::get('_force', '', $args)));
+
+		$response = new stdClass();
+		$response->type = 'success';
+		$response->msg = 'Funkcje';
+		$response->rowFunctions = Core_AclHelper::getMoreFunctionsCell($acl, array('primary_key' => $id));
+		return $response;
+	}
+
+	public function editFormAction() {// namespace, _hash, _primaryKey
+		$args = $_REQUEST;
+		$id = V::get('_primaryKey', 0, $args, 'int');
+		if ($id <= 0) throw new HttpException("Bad Request - missing primaryKey", 400);
+		$namespace = V::get('namespace', '', $args, 'word');
+		if (!$namespace) throw new HttpException("Bad Request - missing namespace", 400);
+		$acl = Core_AclHelper::getAclByNamespace($namespace);
+		$tbl = new TableAjax($acl);
+		$tblLabel = $typeName;
+		if ('default_db' == $acl->getSourceName()) {
+			$tblLabel = array();
+			$zasobObj = ProcesHelper::getZasobTableInfo($acl->getID());
+			if (!$zasobObj) throw new Exception("Zasob TABELA ID=" . $acl->getID() . " nie istnieje");
+			if (!empty($zasobObj->DESC_PL)) $tblLabel []= $zasobObj->DESC_PL;
+			if (!empty($zasobObj->OPIS))    $tblLabel []= $zasobObj->OPIS;
+			$tblLabel = implode(" - ", $tblLabel);
+		}
+
+		$tbl->setSyncUrl(Request::getPathUri() . 'index.php?_route=ViewTableAjax&namespace=' . $acl->getNamespace());
+		$tbl->setLabel($tblLabel);
+		$tbl->addRowFunction('edit');
+		$tbl->addRowFunction('hist');
+		$tbl->addRowFunction('files');
+		$tbl->addRowFunction('cp');
+		$tbl->addRowFunction('msgs');
+		$tbl->sendAjaxEdit($id, $args);
+	}
+	public function editSaveAjaxAction() {
+		Response::sendTryCatchJson(array($this, 'editSaveAjax'), $args = 'JSON_FROM_REQUEST_BODY');
+	}
+	public function editSaveAjax($args) {
+		$namespace = V::get('namespace', '', $args, 'word');
+		if (!$namespace) throw new HttpException("Bad Request - missing namespace", 400);
+		$acl = Core_AclHelper::getAclByNamespace($namespace);
+
+		$primaryKeyField = $acl->getPrimaryKeyField();
+		$primaryKey = V::get('primaryKey', 0, $args, 'int');
+		if (empty($primaryKey)) throw new HttpException("Wrong param id!", 400);
+
+		$item = $acl->getItem($primaryKey);
+		if (!$item) throw new HttpException("Item not exists!", 404);
+
+		$itemFromUser = $acl->convertObjectFromUserInput($args['form'], $type = 'array_by_id', $prefix = 'f');
+
+		$response = new stdClass();
+		$response->primaryKey = $primaryKey;
+		try {
+			$itemFromUser[$primaryKeyField] = $primaryKey;
+			$affected = $acl->updateItem($itemFromUser);
+
+			if ($affected > 0) {
+				$response->type = 'success';
+				$response->msg = "Rekord zapisany pomyślnie";//"Record saved successfully";
+			} else if ($affected == 0) {
+				$response->type = 'info';
+				$response->msg = "Nie wprowadzono żadnych zmian";
+			}
+			$response->record = $acl->getItem($primaryKey);
+			$rowFunList = Core_AclHelper::getMoreFunctionsCell($acl, array('primary_key'=>$primaryKey, 'record'=>$response->record));
+			if (!empty($rowFunList)) $response->rowFunctions = $rowFunList;
+		}
+		catch (Exception $e) {
+			$response->type = 'error';
+			$response->msg = "Wystąpiły błędy!";
+			$response->msg .= $e->getMessage();
+		}
+
+		return $response;
+	}
+
 	/**
 	 * @param string $typeName - 'p5_default_db:TEST_PERMS'
 	 */

+ 64 - 272
SE/se-lib/TableAjax.php

@@ -1244,7 +1244,7 @@ var p5UI_TableAjax_generateFunctionNode = function(funObj, rowPK, props) {
 
 			_popoverCellAjaxXhr = $.ajax({
 				type: 'GET',
-				url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=MORE_FUNCTIONS_CELL&ID=' + rowPK,
+				url: '<?= $this->syncUrl; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=moreFunctionsCellAjax&ID=' + rowPK,
 				dataType: 'json',
 				contentType: "application/json; charset=utf-8",
 				data: ''
@@ -3508,7 +3508,7 @@ jQuery(document).ready(function(){
 					jQuery('<span class="loading-info"> loading ...</span>').appendTo(taskCnt);
 
 					jQuery.ajax({
-						url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=EDIT&ID=' + recordID,
+						url: '<?= $this->syncUrl; ?>&_hash=<?= $this->_htmlID; ?>&_task=editForm&_primaryKey=' + recordID,
 						type: 'GET',
 						dataType: 'text',
 						data: '',
@@ -3918,19 +3918,6 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 
 	public function ajaxTask($task) {
 		switch ($task) {
-			case 'EDIT': {
-				$id = V::get('ID', 0, $_REQUEST, 'int');
-				if ($id > 0) {
-					$this->sendAjaxEdit($id, $_REQUEST);
-				} else {
-					echo '404';
-				}
-				break;
-			}
-			case 'EDIT_SAVE': {
-				$this->sendAjaxResponseJson('ajaxEditSave', $_REQUEST);
-				break;
-			}
 			case 'EDIT_INLINE': {
 				$this->sendAjaxResponseJson('ajaxInlineEdit', $_REQUEST);
 				break;
@@ -4018,10 +4005,6 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 				}
 				break;
 			}
-			case 'MORE_FUNCTIONS_CELL': {
-				$this->sendAjaxResponseJson('ajaxMoreFunctionsCell', $_REQUEST);
-				break;
-			}
 			case 'HIDDEN_COLS_SAVE': {
 				$this->sendAjaxResponseJson('ajaxHiddenColsSave', $_POST);
 				break;
@@ -4207,7 +4190,7 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 		return $response;
 	}
 
-	private function sendAjaxEdit($id, $args) {
+	public function sendAjaxEdit($id, $args) {
 		header("Content-type: text/plain");
 		$DBG = ('1' == V::get('DBG', '', $_REQUEST));
 		$acl = $this->_acl;
@@ -4329,8 +4312,8 @@ jQuery(document).ready(function(){
 	jQuery('.frm-help').popover({trigger:'hover'});
 
 	jQuery('#EDIT_FRM_<?php echo $this->_htmlID; ?>').on('submit', function(){
-		var data = jQuery(this).serialize();
-
+		var formData = {};
+		jQuery(this).serializeArray().map(function(i) { formData[i.name] = i.value; });// TODO: edit Widget - send only updated fields
 		// TODO: change Edit btn to return to edit record with fields -> show form
 
 		var taskCont = jQuery('#<?php echo $this->_htmlID; ?>_task').parent();
@@ -4369,75 +4352,68 @@ jQuery(document).ready(function(){
 			return outMsg;
 		}
 
-		$.ajax({
-			data: data,
-			dataType: 'json',
-			type: "POST",
-			url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=EDIT_SAVE&ID=<?php echo $record->ID; ?>',
-		})
-		.done(function(data, textStatus, jqXHR){
-			var outMsg = notifyAjaxCallback(data);
-			alertCntWrap.removeClass('AjaxTable-loading');
-			//console.log('request finished L.<?php echo __LINE__; ?>');
-			alertCnt.empty();
-			var out = '';
-			out += outMsg;
-			out += '<div class="breadcrumb">' +
-					' <a href="#" onclick="return tableAjaxBackToTable();" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-arrow-left"></i> Wróć do tabeli <?php echo $this->getLabelHtml(); ?></a>' +
-					' <a href="#EDIT/<?php echo $id; ?>/' + Math.random(1).toString().substr(2) + '" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-pencil"></i> Edytuj rekord <?php echo $id; ?></a>' +
-				'</div>';
-			jQuery(out).appendTo(alertCnt);
-
-			// add rowFunctions from response
-			if (data && data.rowFunctions && data.primaryKey) {
-				// cellNode = priv.renderCellRowFunctions(data.rowFunctions, data.primaryKey);
-				var rowFunWrapNode = $('<div class="container"></div>').insertAfter(alertCnt);
-				var rowFunListNode = $('<ul></ul>').appendTo(rowFunWrapNode);
-				var rowPK = '<?php echo $id; ?>';
-				var keys = Object.keys(data.rowFunctions),
-						total = keys.length,
-						moreFuncBtnNode,
-						moreFunctions = [],
-						idx
-				;
-				// if (priv.options.debug) console.log('TableAjax::renderCellRowFunctions: rowFunctions', data.rowFunctions);
-				moreFunctions = keys.splice(3);
-				keys.forEach(function(key) {
-					var cellNode = $('<li></li>');
-					var funObj = data.rowFunctions[key],
-							funcNode = p5UI_TableAjax_generateFunctionNode(funObj, rowPK, {ico: true, label: true})
-					;
-					funcNode.appendTo(cellNode);
-					cellNode.appendTo(rowFunListNode);
-				});
-			}
-		})
-		.fail(function(jqXHR){// jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
-			if (jqXHR.responseJSON) {
-				notifyAjaxCallback(jqXHR.responseJSON);
-			}
-			else {
-				var txt = jqXHR.responseText || 'Wystąpiły błędy';
-				if (jqXHR.status == 404) {
-					jQuery.notify(jqXHR.responseText, 'error');
+		superagent
+			.post('<?= $this->syncUrl; ?>&_hash=<?= $this->_htmlID; ?>&_task=editSaveAjax')
+			.type('json') // header ĺapplication/x-www-form-urlencoded' requires type('form');
+			.send({
+				namespace: '<?= $acl->getNamespace(); ?>',
+				primaryKey: '<?= $record->ID; ?>',
+				form: formData
+			})
+			.set('Accept', 'application/json')
+			.end(function(err, res) {
+				var payload;
+				if (err || !res.ok || 'application/json' !== res.type) {
+					payload = {type: 'warning', msg: res.body.msg || 'Wystąpiły błędy', body: res.body};
 				} else {
-					jQuery.notify(jqXHR.responseText, 'warn');
+					payload = {type: 'success', msg: res.body.msg || '', body: res.body};
+				}
+				var data = res.body;
+
+				alertCntWrap.removeClass('AjaxTable-loading');
+				alertCnt.empty();
+				if (false === ['success', 'info'].indexOf(payload.type)) {
+					jQuery(errorTxt).appendTo(alertCnt);
+					var errLinks = jQuery('<div class="breadcrumb"></div>').appendTo(alertCnt);
+					jQuery('<a href="#" onclick="return tableAjaxBackToTable();"> <i class="icon-arrow-left"></i> Wróć do tabeli <?php echo $this->getLabelHtml(); ?></a>').appendTo(errLinks);
+					var backToEditBtn = jQuery('<a href="#EDIT/<?php echo $id; ?>/' + Math.random(1).toString().substr(2) + '" class="btn btn-link btn-small"> <i class="icon-pencil"></i> Popraw dane <?php echo $id; ?></a>').appendTo(errLinks);
+					backToEditBtn.on('click', function(){
+						alertCnt.remove();
+						taskCont.children().fadeIn('slow');
+						return false;
+					});
+				} else {
+					var outMsg = notifyAjaxCallback(payload);
+					var out = '';
+					out += outMsg;
+					out += '<div class="breadcrumb">' +
+							' <a href="#" onclick="return tableAjaxBackToTable();" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-arrow-left"></i> Wróć do tabeli <?php echo $this->getLabelHtml(); ?></a>' +
+							' <a href="#EDIT/<?php echo $id; ?>/' + Math.random(1).toString().substr(2) + '" class="btn btn-link btn-sm"> <i class="glyphicon glyphicon-pencil"></i> Edytuj rekord <?php echo $id; ?></a>' +
+						'</div>';
+					jQuery(out).appendTo(alertCnt);
+
+					// add rowFunctions from response
+					if (data && data.rowFunctions && data.primaryKey) {
+						var rowFunWrapNode = $('<div class="container"></div>').insertAfter(alertCnt);
+						var rowFunListNode = $('<ul></ul>').appendTo(rowFunWrapNode);
+						var keys = Object.keys(data.rowFunctions),
+								total = keys.length,
+								moreFuncBtnNode,
+								moreFunctions = [],
+								idx
+						;
+						moreFunctions = keys.splice(3);
+						keys.forEach(function(key) {
+							var cellNode = $('<li></li>');
+							var funObj = data.rowFunctions[key],
+									funcNode = p5UI_TableAjax_generateFunctionNode(funObj, data.primaryKey, {ico: true, label: true})
+							;
+							funcNode.appendTo(cellNode);
+							cellNode.appendTo(rowFunListNode);
+						});
+					}
 				}
-			}
-
-			alertCntWrap.removeClass('AjaxTable-loading');
-			//console.log('Request Error: {0}: {1}'.f(textStatus, errorThrown));
-			alertCnt.empty();
-			jQuery(errorTxt).appendTo(alertCnt);
-			var errLinks = jQuery('<div class="breadcrumb"></div>').appendTo(alertCnt);
-			jQuery('<a href="#" onclick="return tableAjaxBackToTable();"> <i class="icon-arrow-left"></i> Wróć do tabeli <?php echo $this->getLabelHtml(); ?></a>').appendTo(errLinks);
-			var backToEditBtn = jQuery('<a href="#EDIT/<?php echo $id; ?>/' + Math.random(1).toString().substr(2) + '" class="btn btn-link btn-small"> <i class="icon-pencil"></i> Popraw dane <?php echo $id; ?></a>').appendTo(errLinks);
-			backToEditBtn.on('click', function(){
-				alertCnt.remove();
-				taskCont.children().fadeIn('slow');
-				return false;
 			});
-		});
 
 		return false;
 	});
@@ -4447,7 +4423,6 @@ jQuery(document).ready(function(){
 		input = jQuery(e.target);
 		btn = input.next('.button-appendBack');
 		btnIco = btn.find('.glyphicon');
-//console.log('title',btn.attr('title'),'val',input.val(),'input', input, 'btn', btn);
 		if (btn.attr('title') != input.val()) {
 			btnIco.show();
 		} else {
@@ -4459,7 +4434,6 @@ jQuery(document).ready(function(){
 		btn = jQuery(this);
 		btnIco = btn.find('.glyphicon');
 		input = btn.prev();
-//console.log('title',btn.attr('title'),'val',input.val(),'input', input, 'btn', btn);
 		if (input.is('input')) {
 			if (btn.attr('title') != input.val()) {
 				input.val(btn.attr('title'));
@@ -4473,43 +4447,6 @@ jQuery(document).ready(function(){
 		exit;
 	}
 
-	private function ajaxEditSave($args) {
-		$acl = $this->_acl;
-		$primaryKeyField = $acl->getPrimaryKeyField();
-		$primaryKey = V::get($primaryKeyField, 0, $args, 'int');
-		if (empty($primaryKey)) throw new HttpException("Wrong param id!", 400);
-
-		$item = $acl->getItem($primaryKey);
-		if (!$item) throw new HttpException("Item not exists!", 404);
-
-		$itemFromUser = $acl->convertObjectFromUserInput($args, $type = 'array_by_id', $prefix = 'f');
-
-		$response = new stdClass();
-		$response->primaryKey = $primaryKey;
-		try {
-			$itemFromUser[$primaryKeyField] = $primaryKey;
-			$affected = $acl->updateItem($itemFromUser);
-
-			if ($affected > 0) {
-				$response->type = 'success';
-				$response->msg = "Rekord zapisany pomyślnie";//"Record saved successfully";
-			} else if ($affected == 0) {
-				$response->type = 'info';
-				$response->msg = "Nie wprowadzono żadnych zmian";
-			}
-			$response->record = $acl->getItem($primaryKey);
-			$rowFunList = $this->getMoreFunctionsCell(array('primary_key'=>$primaryKey, 'record'=>$response->record));
-			if (!empty($rowFunList)) $response->rowFunctions = $rowFunList;
-		}
-		catch (Exception $e) {
-			$response->type = 'error';
-			$response->msg = "Wystąpiły błędy!";
-			$response->msg .= $e->getMessage();
-		}
-
-		return $response;
-	}
-
 	private function sendAjaxCreate($args) {
 		$acl = $this->_acl;
 		header("Content-type: text/plain");
@@ -6193,149 +6130,4 @@ jQuery(document).ready(function(){
 		return $response;
 	}
 
-	public function getMoreFunctionsCell($args) {
-		$id = V::get('primary_key', 0, $args, 'int');
-		if ($id <= 0) throw new HttpException("404", 404);
-		$record = V::get('record', null, $args);
-
-		$rowFunList = array();
-		$acl = $this->_acl;
-		$tableName = $acl->getName();
-		$record = ($record)? $record : $acl->getItem($id);
-
-		if(1){// TODO: fetch $totalMsgs from TableMsgs
-			$msgs = Router::getRoute('Msgs');
-			$msgsList = $msgs->getActiveMessagesForTableRecord($tableName, $id);
-			$totalMsgs = count($msgsList);
-			$rowFunc = new stdClass();
-			$rowFunc->id = 'msgs';
-			$rowFunc->ico = 'glyphicon glyphicon-envelope';
-			$rowFunc->href = 'index.php?_route=TableMsgs&_task=tableRow&idTable=' . $this->_zasobID . '&idRow=' . $id;
-			$rowFunc->title = "Wiadomości ({$totalMsgs})";
-			$rowFunc->label = "Wiadomości <span class=\"badge\">{$totalMsgs}</span>";
-			$rowFunList[] = $rowFunc;
-		}
-
-		if ('CRM_PROCES' == $acl->getName()) {// TODO: mv to table gui xml or php class
-			// procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id=22001
-			$rowFunc = new stdClass();
-			$rowFunc->ico = 'glyphicon glyphicon-eye-open';
-			$rowFunc->href = "procesy5.php?task=CRM_PROCES&filtr_id={$id}";
-			$rowFunc->title = "Zobacz na drzewie procesów {{$id}}";
-			$rowFunList[] = $rowFunc;
-
-			$wskazniki = ProcesHelper::get_wskazniki($id);
-			$connectedZasobyTotal = count($wskazniki);
-			$rowFunc = new stdClass();
-			$rowFunc->ico = 'glyphicon glyphicon-random';
-			$rowFunc->href = "index.php?MENU_INIT=PROCES_ADD_ZASOB&procesID={$id}";
-			$rowFunc->title = "Powiązane zasoby <span class=\"badge\">{$connectedZasobyTotal}</span>";
-			$rowFunList[] = $rowFunc;
-		}
-
-		if ('CRM_LISTA_ZASOBOW' == $acl->getName()) {// TODO: mv to table gui xml or php class
-			// procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id=22001
-			$rowFunc = new stdClass();
-			$rowFunc->ico = 'glyphicon glyphicon-eye-open';
-			$rowFunc->href = "procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id={$id}";
-			$rowFunc->title = "Zobacz na drzewie zasobów [{$id}]";
-			$rowFunList[] = $rowFunc;
-
-			// index.php?MENU_INIT=ZASOB_OBOWIAZKI&id_zasob=22001
-			$rowFunc = new stdClass();
-			$rowFunc->ico = 'glyphicon glyphicon-random';
-			$rowFunc->href = "index.php?MENU_INIT=ZASOB_OBOWIAZKI&id_zasob={$id}";
-			$rowFunc->title = "Powiązane procesy (OB)";
-			$rowFunList[] = $rowFunc;
-
-			// index.php?MENU_INIT=ZASOB_EXTERNAL_IDS&id_zasob=22001
-			$rowFunc = new stdClass();
-			$rowFunc->ico = 'glyphicon glyphicon-random';
-			$rowFunc->href = "index.php?MENU_INIT=ZASOB_EXTERNAL_IDS&id_zasob={$id}";
-			$rowFunc->title = "Powiązane dane (IDS)";
-			$rowFunList[] = $rowFunc;
-
-			$groupTypeList = array();
-			$groupTypeList[] = 'STANOWISKO';
-			$groupTypeList[] = 'PODMIOT';
-			$groupTypeList[] = 'DZIAL';
-			if (in_array($record->TYPE, $groupTypeList)) {
-				$rowFunc = new stdClass();
-				$rowFunc->ico = 'glyphicon glyphicon-retweet';
-				$rowFunc->href = "index.php?_route=Users&_task=syncGroup&idGroup={$id}";
-				$rowFunc->title = "Synchronizuj do LDAP";
-				$rowFunList[] = $rowFunc;
-			}
-		}
-
-		if ('ADMIN_USERS' == $acl->getName()) {// TODO: mv to table gui xml
-			$isAllowedoReadUserLogin = false;
-			if ($acl->canReadRecord($record)) {
-				$idFieldUserLogin = $acl->getFieldIdByName('ADM_ACCOUNT');
-				if ($idFieldUserLogin) {
-					if ($acl->isAllowed($idFieldUserLogin, 'R', $record)) {
-						$isAllowedoReadUserLogin = true;
-					}
-				}
-			}
-			if ($isAllowedoReadUserLogin) {
-				$rowFunc = new stdClass();
-				$rowFunc->ico = 'glyphicon glyphicon-user';
-				$rowFunc->href = 'index.php?_route=Users&_task=userGroups&usrLogin=' . $record->ADM_ACCOUNT;
-				$rowFunc->title = "Ustal stanowisko";
-				$rowFunList[] = $rowFunc;
-
-				$rowFunc = new stdClass();
-				$rowFunc->ico = 'glyphicon glyphicon-retweet';
-				$rowFunc->href = 'index.php?_route=Users&_task=syncUser&usrLogin=' . $record->ADM_ACCOUNT;
-				$rowFunc->title = "Synchronizuj do LDAP";
-				$rowFunList[] = $rowFunc;
-
-				$rowFunc = new stdClass();
-				$rowFunc->ico = 'glyphicon glyphicon-minus';
-				$rowFunc->href = 'index.php?MENU_INIT=USER_OCENA_PRACOWNIKA&usrLogin=' . $record->ADM_ACCOUNT;
-				$rowFunc->title = "Ocena pracownika";
-				$rowFunList[] = $rowFunc;
-			}
-		}
-
-		if ($urlFunctions = Route_UrlAction::getTableFunctions($acl->getID(), $id, $acl->getName(), User::getLogin())) {
-			foreach ($urlFunctions as $urlFunction) {
-				// TODO: is allowed to view - test by Router::getRoute('UrlAction')->isFunctionAllowedForRecord($routeName = $urlFunction['name'], $acl->getID(), $id);
-				$rowFunction = array();
-				$rowFunction['href'] = $urlFunction['baseLink'];
-				$rowFunction['ico'] = V::get('ico', 'glyphicon glyphicon-share', $urlFunction);
-				$rowFunction['label'] = $urlFunction['label'];
-				$rowFunction['title'] = V::get('title', $urlFunction['label'], $urlFunction);
-				if (!empty($urlFunction['link_target'])) $rowFunction['target'] = $urlFunction['link_target'];
-				if (!empty($urlFunction['cell_id_params'])) {
-					$urlParams = array();// [ "{$urlParamName}={$paramValue}" ]
-					foreach ($urlFunction['cell_id_params'] as $idField => $urlParamName) {
-						$paramValue = '';
-						$fld = $acl->getField($idField);
-						if ($fld) {
-							$fldName = $fld['name'];
-							$paramValue = V::get($fldName, '', $record);
-							$urlParams[] = "{$urlParamName}={$paramValue}";
-						}
-					}
-					if (!empty($urlParams)) $rowFunction['href'] .= "&" . implode("&", $urlParams);
-				}
-				$rowFunList[] = $rowFunction;
-			}
-		}
-		return $rowFunList;
-	}
-
-	public function ajaxMoreFunctionsCell($args) {// ajax task 'MORE_FUNCTIONS_CELL'
-		$id = V::get('ID', 0, $args, 'int');
-		if ($id <= 0) throw new HttpException("404", 404);
-
-		$response = new stdClass();
-		$response->type = 'success';
-		$response->msg = 'Funkcje';
-		$response->rowFunctions = $this->getMoreFunctionsCell(array('primary_key' => $id));
-		return $response;
-	}
-
 }