Explorar o código

fixed view list process for table

Piotr Labudda %!s(int64=7) %!d(string=hai) anos
pai
achega
405bf13bf9
Modificáronse 1 ficheiros con 31 adicións e 70 borrados
  1. 31 70
      SE/se-lib/TableAjax.php.procesInitFiltr.js

+ 31 - 70
SE/se-lib/TableAjax.php.procesInitFiltr.js

@@ -14,86 +14,47 @@ function p5Utils__convertAttrsToHtml(attributes) {
 	}).join(" ")
 }
 
-function _viewProcesInitListItem(pInitId, label, selected) {
-	var jsInfo = "window.open('procesy5.php?task=PROCES_VIEW_LIST&id_proces=" + pInitId + "&HIDE_PANEL=0&show_big_img=1&group_stanowiska=1');return false;";
+function _viewDropdown_item_infoLink(id, label) {
 	var h = p5Utils__convertToHtml;
-
-	return h('form', { className: "form-inline", method: "post", action: "", style: "padding: 3px 20px" }, [
-		h('input', { type: "hidden", name: "_rootPostTask", value: "SetPermsByProces" }),
-		h('input', { type: "hidden", name: "id_proces", value: pInitId }),
-		h('i', {
-			className: "glyphicon glyphicon-info-sign",
-			style: "color:#aaa; cursor:help",
-			onclick: jsInfo,
-			title: "Przeglądaj proces {" + pInitId + "} " + label,
-			onmouseover: "this.style.color = '#337AB7'", onmouseout: "this.style.color = '#aaa'"
-		}),
-		h('button', {
-			className: "btn btn-link" + ( selected ? " disabled" : "" ),
-			style: "padding:0 3px",
-			title: "Uruchom filtr procesu {" + pInitId + "}"
-		}, [
-			" {" + pInitId + "} " + label,
-		]),
-	]);
-}
-function _viewProcesGotoAndRetListItem(gotoId, label, selected) {
-	var jsInfo = "window.open('procesy5.php?task=PROCES_VIEW_LIST&id_proces=" + gotoId + "&HIDE_PANEL=0&show_big_img=1&group_stanowiska=1');return false;";
-	var h = p5Utils__convertToHtml;
-
-	return h('form', { className: "form-inline", method: "post", action: "", style: "padding:3px 20px; margin-left:20px" }, [
-		h('input', { type: "hidden", name: "_rootPostTask", value: "SetPermsByProces" }),
-		h('input', { type: "hidden", name: "id_proces", value: gotoId }),
-		h('i', {
-			className: "glyphicon glyphicon-info-sign",
-			style: "color:#aaa; cursor:help",
-			title: "Przeglądaj proces {" + gotoId + "} " + label,
-			onclick: jsInfo,
-			onmouseover: "this.style.color = '#337AB7'", onmouseout: "this.style.color = '#aaa'"
-		}),
-		h('button', {
-			className: "btn btn-link" + ( selected ? " disabled" : "" ),
-			style: "padding:0 3px",
-			title: "Uruchom filtr procesu {" + gotoId + "}"
-		}, [
-			" {" + gotoId + "} " + label,
-		]),
-	]);
+	var viewProcessLink = "procesy5.php?task=PROCES_VIEW_LIST&id_proces=" + id + "&HIDE_PANEL=0&show_big_img=1&group_stanowiska=1";
+
+	return h('i', {
+		className: "glyphicon glyphicon-info-sign",
+		style: "color:#aaa; cursor:help; vertical-align:middle",
+		title: "Przeglądaj proces {" + id + "} " + label,
+		onclick: "window.open('" + viewProcessLink + "');return false;",
+		onmouseover: "this.style.color = '#337AB7'", onmouseout: "this.style.color = '#aaa'"
+	});
 }
-function _viewProcesGotoAndRetLvl2ListItem(gotoLvl2Id, label, selected) {
-	var jsInfo = "window.open('procesy5.php?task=PROCES_VIEW_LIST&id_proces=" + gotoLvl2Id + "&HIDE_PANEL=0&show_big_img=1&group_stanowiska=1');return false;";
+function _viewDropdown_item_setPermsLink(id, label, selected) {
 	var h = p5Utils__convertToHtml;
 
-	return h('form', { className: "form-inline", method: "post", action: "", style: "padding:3px 20px; margin-left:40px" }, [
-		h('input', { type: "hidden", name: "_rootPostTask", value: "SetPermsByProces" }),
-		h('input', { type: "hidden", name: "id_proces", value: gotoLvl2Id }),
-		h('i', { className: "glyphicon glyphicon-arrow-right", style: "color:#aaa" }),
-		h('i', {
-			className: "glyphicon glyphicon-info-sign",
-			style: "color:#aaa; cursor:help",
-			title: "Przeglądaj proces {" + gotoLvl2Id + "} " + label,
-			onclick: jsInfo,
-			onmouseover: "this.style.color = '#337AB7'", onmouseout: "this.style.color = '#aaa'"
-		}),
-		h('button', {
-			className: "btn btn-link" + ( selected ? " disabled" : "" ),
-			style: "padding:0 3px",
-			title: "Uruchom filtr procesu {" + gotoLvl2Id + "}"
-		}, [
-			" {" + gotoLvl2Id + "} " + label,
-		]),
+	return h('button', {
+		className: "btn btn-link" + (selected ? " disabled" : ""),
+		style: "padding:0 3px",
+		title: "Uruchom filtr procesu {" + id + "}"
+	}, [
+		" {" + id + "} " + label,
 	]);
 }
 
-
-function _viewDropdownListItem(id, label, selected, callback) {
+function _viewDropdown_listItem(id, label, selected, deepLevel, showArrowIcon) { // showArrowIcon: if process type === goto_and_return
 	var h = p5Utils__convertToHtml;
+	var marginLeft = 20 * (deepLevel || 0);
 
 	return h('li', {
 		style: "white-space:nowrap; overflow:hidden; max-width:500px; /* text-overflow:ellipsis; */",
 		onmouseover: "this.style.backgroundColor='#f5f5f5'", onmouseout: "this.style.backgroundColor='#fff'",
 	}, [
-		callback(id, label, selected),
+		h('form', { className: "form-inline", method: "post", action: "", style: "padding:3px 20px; margin-left:" + marginLeft + "px" }, [
+			h('input', { type: "hidden", name: "_rootPostTask", value: "SetPermsByProces" }),
+			h('input', { type: "hidden", name: "id_proces", value: id }),
+			(showArrowIcon)
+			? h('i', { className: "glyphicon glyphicon-arrow-right", style: "color:#aaa; vertical-align:middle; margin-right:2px" })
+			: null,
+			_viewDropdown_item_infoLink(id, label),
+			_viewDropdown_item_setPermsLink(id, label, selected),
+		]),
 	]);
 }
 
@@ -110,19 +71,19 @@ function toggleProcesInitFiltr(n) {
 				var sel = (pInitData.pInitListSelected && pInitData.pInitListSelected == vInitId);
 
 				return [
-					_viewDropdownListItem(vInitId, pInitData.pInitList[vInitId], sel, _viewProcesInitListItem)
+					_viewDropdown_listItem(vInitId, pInitData.pInitList[vInitId], sel, deepLvl = 0, showArrowIcon = false)
 				].concat(
 					(!gotoIds) ? null : Object.keys(gotoIds).map(function (gotoId) {
 						var gotoLvl2Ids = gotoIds[gotoId];
 						var sel = (pInitData.pInitListSelected && pInitData.pInitListSelected == vInitId);
 
 						return [
-							_viewDropdownListItem(gotoId, pInitData.pInitList[gotoId], sel, _viewProcesGotoAndRetListItem)
+							_viewDropdown_listItem(gotoId, pInitData.pInitList[gotoId], sel, deepLvl = 1, showArrowIcon = true)
 						].concat(
 							(!gotoLvl2Ids) ? null : Object.keys(gotoLvl2Ids).map(function (gotoLvl2Id) {
 								// var vBool = gotoLvl2Ids[gotoLvl2Id];
 
-								return _viewDropdownListItem(gotoLvl2Id, pInitData.pInitList[gotoLvl2Id], sel, _viewProcesGotoAndRetLvl2ListItem);
+								return _viewDropdown_listItem(gotoLvl2Id, pInitData.pInitList[gotoLvl2Id], sel, deepLvl = 2, showArrowIcon = true);
 							}).join("\n")
 						).join("\n");
 					}).join("\n")