Browse Source

Added Powiązane obiekty menu in TableAjax

Piotr Labudda 8 years ago
parent
commit
a7ce9bf1e5
2 changed files with 27 additions and 1 deletions
  1. 26 0
      SE/se-lib/TableAjax.php
  2. 1 1
      SE/se-lib/TableAjax.php.TableAjax.js

+ 26 - 0
SE/se-lib/TableAjax.php

@@ -406,6 +406,11 @@ class TableAjax extends ViewAjax {
 		UI::showMessagesForTable($this->_tbl);
 		UI::endContainer();
 		$namespace = $acl->getNamespace();
+		{
+			$nsSiblings = ACL::getNamespaceSiblings($namespace);
+			$siblingSelected = $namespace;
+			$baseUrl = Router::getRoute('ViewTableAjax')->getLink();
+		}
 		echo UI::h('div', [ 'class' => "AjaxTableCont" ], [
 			UI::h('ul', [ 'class' => "breadcrumb" ], [
 				UI::h('li', [], [
@@ -454,6 +459,27 @@ class TableAjax extends ViewAjax {
 					])
 				:	'',
 
+				($nsSiblings)
+				?	UI::h('div', [ 'class' => "btn-group pull-right" ], [
+						UI::h('a', [ 'class' => "btn btn-xs btn-default dropdown-toggle",
+							'style' => "margin-right:16px",
+							'data-toggle' => "dropdown",
+							'href' => "#",
+							'title' => "Powiązane obiekty z " . $this->getLabel(),
+						], "Obiekty <span class=\"caret\"></span>"),
+						UI::h('ul', [ 'class' => "dropdown-menu pull-left", 'style' => "max-height:250px;overflow:auto;" ], array_map(function ($sibling) use ($baseUrl, $siblingSelected) {
+							$siblingLabel = explode('/', $sibling); $siblingLabel = array_pop($siblingLabel);
+							return UI::h('li', [ 'class' => "" ], [
+								UI::h('a', [
+									'href' => "{$baseUrl}&namespace={$sibling}",
+									'class' => "btn btn-link " . ($siblingSelected === $sibling ? "active" : ""),
+									'style' => "text-align:left"
+								], $siblingLabel),
+							]);
+						}, $nsSiblings)),
+					])
+				:	'',
+
 				($this->_tbl == 'IN7_MK_BAZA_DYSTRYBUCJI')
 				?	UI::h('a', [ 'class' => "pull-right", 'style' => "padding:0 20px 0 0", 'href' => "index.php?MENU_INIT=TREEJS&ZASOB_ID={$this->_zasobID}" ], "<i class=\"glyphicon glyphicon-eye-open\"></i> Drzewo")
 				:	'',

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

@@ -271,7 +271,7 @@ var TableAjax = function() {
 			var th1W = th1.innerWidth();
 			var th2W = 50 + 2 * 5;//th2.innerWidth();
 			var colsW = stickyCol1Width + stickyCol2Width;
-			jQuery(_uiNodeCont).css({width:'' + (contW - colsW) + 'px', marginLeft:'' + colsW + 'px', overflowX:'scroll', overflowY:'visible', paddingBottom:'1px'});
+			jQuery(_uiNodeCont).css({width:'' + (contW - colsW) + 'px', marginLeft:'' + colsW + 'px', minHeight: '360px', overflowX:'scroll', overflowY:'visible', paddingBottom:'1px'});
 		}
 		_uiNode$Table.find('.stickyCol1').css({
 			position: 'absolute',