Przeglądaj źródła

fixed kontakty_view

Piotr Labudda 9 lat temu
rodzic
commit
45502fa1a6
3 zmienionych plików z 30 dodań i 76 usunięć
  1. 19 13
      SE/se-lib/ProcesMenu.php
  2. 11 13
      SE/se-lib/TableAjax.php
  3. 0 50
      SE/superedit-VIEWTABLE_KONTAKTY.php

+ 19 - 13
SE/se-lib/ProcesMenu.php

@@ -367,20 +367,26 @@ jQuery(document).ready(function() {
 		$active = '';
 		$script_name = V::get('SCRIPT_NAME', '', $_SERVER);
 		if (false !== strpos($script_name, 'index.php')) {
-			$menu_init = V::get('MENU_INIT', '', $_GET);
-			switch ($menu_init) {
-				case 'VIEWTABLE_AJAX': $active = 'menu'; break;
-				case 'VIEWTABLE_KONTAKTY': $active = 'kontakty'; break;
-				default: {
-					$fun_init = V::get('FUNCTION_INIT', '', $_GET);
-					switch ($fun_init) {
-						case 'MENU_SELECT_PROCES': $active = 'testy'; break;
-						case 'PRZYPOMNIJ_FUNC': $active = 'przypomnij'; break;
-						case 'PRZYPOMNIJ': $active = 'przypomnij'; break;
-						default:
+			$route = V::get('_route', '', $_GET);
+			if (!empty($route)) {
+				if ('p5_default_db:KONTAKTY_view' == V::get('typeName', '', $_GET)) $active = 'kontakty';
+				else if ('default_db/KONTAKTY_view' == V::get('namespace', '', $_GET)) $active = 'kontakty';
+			} else {
+				$menu_init = V::get('MENU_INIT', '', $_GET);
+				switch ($menu_init) {
+					case 'VIEWTABLE_AJAX': $active = 'menu'; break;
+					default: {
+						$fun_init = V::get('FUNCTION_INIT', '', $_GET);
+						switch ($fun_init) {
+							case 'MENU_SELECT_PROCES': $active = 'testy'; break;
+							case 'PRZYPOMNIJ_FUNC': $active = 'przypomnij'; break;
+							case 'PRZYPOMNIJ': $active = 'przypomnij'; break;
+							default:
+						}
 					}
 				}
 			}
+
 		}
 		else if (false !== strpos($script_name, 'procesy5.php')) {
 			$task = V::get('task', '', $_GET);
@@ -763,8 +769,8 @@ jQuery(document).ready(function() {
 					</ul>
 				</li>
 
-				<li<?php if ($active == 'kontakty') echo ' class="active"'; ?>><a href="index.php?MENU_INIT=VIEWTABLE_KONTAKTY" title="Kontakty">Kontakty</a></li>
-				<li<?php if ($active == 'przypomnij') echo ' class="active"'; ?>><a href="index.php?_route=Przypomnij&KTO=<?php echo User::getLogin(); ?>" title="Przypomnij">Przypomnij</a></li>
+				<li<?= ('kontakty' == $active) ? ' class="active"' : ''; ?>><a href="index.php?_route=ViewTableAjax&namespace=default_db/KONTAKTY_view" title="Kontakty">Kontakty</a></li>
+				<li<?= ('przypomnij' == $active) ? ' class="active"' : ''; ?>><a href="index.php?_route=Przypomnij&KTO=<?php echo User::getLogin(); ?>" title="Przypomnij">Przypomnij</a></li>
 			</ul>
 			<form class="navbar-form navbar-left" style="margin:3px 0;" role="search" action="procesy5.php?task=CRM_SEARCH" method="post">
 				<div class="input-group">

+ 11 - 13
SE/se-lib/TableAjax.php

@@ -5761,6 +5761,7 @@ jQuery(document).ready(function(){
 
 	public function ajaxData($args) {
 		$DBG = ('1' == V::get('DBG', '', $_REQUEST));
+		$acl = $this->_acl;
 
 		$pageSize = V::get('pageSize', $this->_pageSize, $args, 'int');
 		$page = V::get('page', 0, $args, 'int');
@@ -5769,9 +5770,6 @@ jQuery(document).ready(function(){
 		if ($page > 0) {
 			$page -= 1;
 		}
-		else {
-
-		}
 
 		$params = array();
 		$params['limit'] = $pageSize;
@@ -5795,12 +5793,12 @@ jQuery(document).ready(function(){
 
 		$this->setFilters($filters);
 
-		$vCols = $this->_acl->getVirtualFieldListByIdZasob();
+		$vCols = $acl->getVirtualFieldListByIdZasob();
 		if (!empty($vCols)) {
 			if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">vCols (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($vCols);echo'</pre>';}
 		}
 
-		$visibleCols = $this->_acl->getVisibleFieldList();
+		$visibleCols = $acl->getVisibleFieldList();
 		if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">visibleCols (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($visibleCols);echo'</pre>';}
 
 		$jsonData = new stdClass();
@@ -5808,7 +5806,7 @@ jQuery(document).ready(function(){
 		$jsonData->pageSize = $pageSize;
 		$jsonData->filters = $filters;
 		$jsonData->cols = new stdClass();
-		$jsonData->uniqueCol = $this->_acl->getPrimaryKeyField();
+		$jsonData->uniqueCol = $acl->getPrimaryKeyField();
 		$ind = 0;
 		foreach ($visibleCols as $fieldID => $col) {
 			$ind++;
@@ -5820,13 +5818,13 @@ jQuery(document).ready(function(){
 				// Ahmes problems Status colors
 				$columnConfig->format = '<div class="cell-Status-{0}">{0}</div>';
 			}
-			else if ($this->_acl->isGeomField($col)) {
+			else if ($acl->isGeomField($col)) {
 				$columnConfig->type = 'geom';
 			}
 			if ('' !== ($label = $this->_acl->getFieldLabel($col))) {
 				$columnConfig->friendly = $label;
 			}
-			$colType = $this->_acl->getFieldType($col);
+			$colType = $acl->getFieldType($col);
 			if ($colType) {// @see MarkTableAjaxFilterColType
 				if ($colType['type'] == 'date') {
 					//$columnConfig->type = 'date';// TODO: require datetimepicker
@@ -5879,19 +5877,19 @@ jQuery(document).ready(function(){
 				$columnConfig->hidden = true;
 			}
 
-			$columnConfig->description = $this->_acl->getFieldOpis($col);
+			$columnConfig->description = $acl->getFieldOpis($col);
 
 			$jsonData->cols->{$col} = $columnConfig;
 		}
 		$jsonData->rows = array();
-		$jsonData->total = $this->_acl->getTotal($params);
+		$jsonData->total = $acl->getTotal($params);
 		if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">get_total (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($jsonData->total);echo'</pre>';}
-		$items = $this->_acl->getItems($params);
+		$items = $acl->getItems($params);
 		if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">items (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($items);echo'</pre>';}
 		// TODO: add virtual data by Typespecial
 		if (!empty($vCols) && !empty($items)) {
 			foreach ($vCols as $vColID => $vCol) {
-				$colType = $this->_acl->getFieldTypeById($vColID);
+				$colType = $acl->getFieldTypeById($vColID);
 				if ($colType) {
 					continue;// pomin Typespecial dla realnych komorek w bazie danych
 				}
@@ -5923,7 +5921,7 @@ jQuery(document).ready(function(){
 			// TODO: hide items without 'R'
 			foreach ($visibleCols as $kID => $vCol) {
 				// TODO: ID default 'R'
-				if (!$this->_acl->isAllowed($kID, 'R', $vItem)) {
+				if (!$acl->isAllowed($kID, 'R', $vItem)) {
 					$vItem->{$vCol} = '*****';
 				}
 

+ 0 - 50
SE/superedit-VIEWTABLE_KONTAKTY.php

@@ -1,50 +0,0 @@
-<?php
-
-
-function VIEWTABLE_KONTAKTY($params = array()) {
-
-	SE_Layout::menu();
-
-	Lib::loadClass('ProcesHelper');
-	$zasobID = ProcesHelper::getZasobTableID('KONTAKTY_view');
-	if (!$zasobID) {
-		echo "Nr zasobu Kontakty nie został odnaleziony";
-		return;
-	}
-	$zasobObj = ProcesHelper::getZasobTableInfo($zasobID);
-	if (!$zasobObj) {
-		echo "Zasob Kontakty nie został odnaleziony";
-		return;
-	}
-
-	$userAcl = User::getAcl();
-	$userAcl->fetchGroups();
-
-	if (!$userAcl->hasTableAcl($zasobObj->ID)) {
-		?>
-		<div class="container">
-			<div class="alert alert-danger">Brak uprawnień do tabeli nr <?php echo $zasobObj->ID; ?></div>
-		</div>
-		<?php
-		return;
-	}
-
-	$tblAcl = $userAcl->getTableAcl($zasobObj->ID);
-
-	$forceTblAclInit = ('1' == V::get('_force', '', $_GET));
-	$tblAcl->init($forceTblAclInit);
-
-	Lib::loadClass('TableAjax');
-
-	$tbl = new TableAjax($tblAcl);
-	$tblLabel = array();
-	if (!empty($zasobObj->DESC_PL)) $tblLabel []= $zasobObj->DESC_PL;
-	if (!empty($zasobObj->OPIS))    $tblLabel []= $zasobObj->OPIS;
-	$tblLabel = implode(" - ", $tblLabel);
-	$tbl->setLabel($tblLabel);
-	$tbl->addRowFunction('edit');
-	$tbl->addRowFunction('hist');
-	$tbl->addRowFunction('files');
-	$tbl->addRowFunction('cp');
-	echo $tbl->render();
-}