瀏覽代碼

Proces fix acl usage

Piotr Labudda 11 年之前
父節點
當前提交
e91057a870
共有 3 個文件被更改,包括 22 次插入247 次删除
  1. 1 1
      SE/VERSION
  2. 8 241
      SE/procesy/proces.php
  3. 13 5
      SE/procesy5.php

+ 1 - 1
SE/VERSION

@@ -1 +1 @@
-3.9.7.11
+3.9.7.12

+ 8 - 241
SE/procesy/proces.php

@@ -1,5 +1,6 @@
 <?php
 <?php
 
 
+Lib::loadClass('ProcesHelper');
 
 
 /**
 /**
  * @param $_GET['EDIT'] - ID rekordu do edycji (inline)
  * @param $_GET['EDIT'] - ID rekordu do edycji (inline)
@@ -133,236 +134,9 @@ jQuery(document).ready(function(){
 		echo '<span class="pull-right">'.App::link("Mapa procesów", array('task'=>'VIEW_PROCES_MAP')).'</span>';
 		echo '<span class="pull-right">'.App::link("Mapa procesów", array('task'=>'VIEW_PROCES_MAP')).'</span>';
 	echo'</h1>';
 	echo'</h1>';
 
 
-//wykrywamy czy ma dostepny proces do jakiejs komorki w tej tabeli
-		$userAcl = User::getAcl();
-		$tblAcl = $userAcl->getTableAcl(ProcesHelper::getZasobTableID('CRM_PROCES'));
-	if($tblAcl)
-	if($tblAcl->hasFieldPerm($tblAcl->getFieldIdByName('ID'),'R')) {
-		echo App::link("Pokaz Tabele", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".ProcesHelper::getZasobTableID('CRM_PROCES'));
-		echo "<br>".App::link("Dodaj nowy rekord", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".ProcesHelper::getZasobTableID('CRM_PROCES')."#CREATE");
-
-		
-	} else {
-
-
-			
-		
-		if (!$_SESSION['HIDE_PROCESY']) {
-		echo App::link("Ukryj Tabele", "?task=CRM_PROCES&HIDE_PROCESY=1");
-		} else {
-		echo App::link("Pokaz Tabele", "?task=CRM_PROCES&UNHIDE_PROCESY=1");
-		}
-
-		$table_view = array();
-		$table_view['labels'] = array();
-		$table_view['head'] = array();
-		$table_view['find'] = array();
-		$table_view['foot'] = array();
-		
-		$table_view['labels']['ID'] = "ID";
-		$table_view['labels']['PARENT_ID'] = "P_ID";
-		$table_view['labels']['TYPE'] = "TYPE";
-		$table_view['labels']['DESC'] = "DESC";
-		$table_view['labels']['OPIS'] = "OPIS";
-		$table_view['labels']['DESC_PL'] = "DESC_PL";
-		$table_view['labels']['TAGS'] = "TAGS";
-		$table_view['labels']['A_STATUS'] = "A_STATUS";
-		$table_view['labels']['L_APPOITMENT_USER'] = "L_APPOITMENT_USER";
-		$table_view['labels']['L_APPOITMENT_DATE'] = "L_APPOITMENT_DATE";
-		$table_view['labels']['L_APPOITMENT_INFO'] = "L_APPOITMENT_INFO";
-		$table_view['labels']['A_ADM_COMPANY'] = "A_ADM_COMPANY";
-		
-		$table_view['head']['ID']= 'ID';
-		$table_view['head']['PARENT_ID']= '<span class="P_ID">'."P_ID".'</span>';
-		$table_view['head']['TYPE']= 'TYPE';
-		$table_view['head']['DESC']= 'DESC';
-		$table_view['head']['DESC_PL']= 'DESC_PL';
-		$table_view['head']['TAGS']= 'TAGS';
-		$table_view['head']['OPIS']= 'OPIS';
-		$table_view['head']['A_STATUS'] = 'A_STATUS';
-		$table_view['head']['L_APPOITMENT_USER'] = 'L_APP_USER';
-		$table_view['head']['L_APPOITMENT_DATE'] = 'L_APP_DATE';
-		$table_view['head']['L_APPOITMENT_INFO'] = 'L_APP_INFO';
-		$table_view['head']['A_ADM_COMPANY'] = 'A_ADM_COMPANY';
-		
-		$table_view['find']['ID']= App::field_search( 'ID', "varchar(255)", $_GET['ID'], array('class'=>'i', 'size'=>5) );
-		$table_view['find']['PARENT_ID']= App::field_search( 'P_ID', "varchar(255)", $_GET['P_ID'], array('class'=>'i', 'size'=>5) );
-		$table_view['find']['TYPE']= App::field_search( 'TYPE', $tbl_conf->type('TYPE'), $_GET['TYPE'], array('class'=>'i') );
-		$table_view['find']['DESC']= App::field_search( 'DESC', "varchar(255)", $_GET['DESC'], array('class'=>'i', 'size'=>5) );
-		$table_view['find']['OPIS']= App::field_search( 'OPIS', "varchar(255)", $_GET['OPIS'], array('class'=>'i', 'size'=>5) );
-		$table_view['find']['TAGS']= App::field_search( 'TAGS', "varchar(100)", $_GET['TAGS'], array('class'=>'i', 'size'=>5) );
-		$table_view['find']['A_STATUS'] =  App::field_search( 'A_STATUS', $tbl_conf->type('A_STATUS'), $_GET['A_STATUS'], array('class'=>'i') );
-		$table_view['find']['L_APPOITMENT_USER'] = App::field_search( 'L_APPOITMENT_USER', $tbl_conf->type('L_APPOITMENT_USER'), $_GET['L_APPOITMENT_USER'], array('class'=>'i', 'size'=>5) );
-		$table_view['find']['L_APPOITMENT_DATE'] = App::field_search( 'L_APPOITMENT_DATE', $tbl_conf->type('L_APPOITMENT_DATE'), $_GET['L_APPOITMENT_DATE'], array('class'=>'i', 'size'=>5) );
-		$table_view['find']['L_APPOITMENT_INFO'] = App::field_search( 'L_APPOITMENT_INFO', $tbl_conf->type('L_APPOITMENT_INFO'), $_GET['L_APPOITMENT_INFO'], array('class'=>'i', 'size'=>5) );
-		$table_view['find']['A_ADM_COMPANY'] = App::field_search( 'A_ADM_COMPANY', $tbl_conf->type('A_ADM_COMPANY'), $_GET['A_ADM_COMPANY'], array('class'=>'i', 'size'=>5) );
-		$table_view['find']['IF_TRUE_GOTO']= App::field_search( 'IF_TRUE_GOTO', "varchar(11)", $_GET['IF_TRUE_GOTO'], array('class'=>'i', 'size'=>5) );
-		$table_view['find']['IF_TRUE_GOTO_FLAG']= App::field_search( 'IF_TRUE_GOTO_FLAG', $tbl_conf->type('IF_TRUE_GOTO_FLAG'), $_GET['IF_TRUE_GOTO_FLAG'], array('class'=>'i') );
-		$table_view['find']['A_RECORD_CREATE_AUTHOR']= App::field_search( 'A_RECORD_CREATE_AUTHOR', $tbl_conf->type('A_RECORD_CREATE_AUTHOR'), $_GET['A_RECORD_CREATE_AUTHOR'], array('class'=>'i') );
-		$table_view['find']['A_RECORD_CREATE_DATE']= App::field_search( 'A_RECORD_CREATE_DATE', $tbl_conf->type('A_RECORD_CREATE_DATE'), $_GET['A_RECORD_CREATE_DATE'], array('class'=>'i') );
-		$table_view['find']['A_RECORD_UPDATE_AUTHOR']= App::field_search( 'A_RECORD_UPDATE_AUTHOR', $tbl_conf->type('A_RECORD_UPDATE_AUTHOR'), $_GET['A_RECORD_UPDATE_AUTHOR'], array('class'=>'i') );
-		$table_view['find']['A_RECORD_UPDATE_DATE']= App::field_search( 'A_RECORD_UPDATE_DATE', $tbl_conf->type('A_RECORD_UPDATE_DATE'), $_GET['A_RECORD_UPDATE_DATE'], array('class'=>'i') );
-		
-		$table_view['foot']['PARENT_ID'] = App::field( 'ADD_'.'PARENT_ID', "varchar(255)", V::get('ADD_'.'PARENT_ID', '', $_POST), array('class'=>'i', 'size'=>4) );
-		$table_view['foot']['TYPE'] = App::field( 'ADD_'.'TYPE', $tbl_conf->type('TYPE'), V::get('ADD_'.'TYPE', '', $_POST), array('class'=>'i') );
-		$table_view['foot']['DESC'] = App::field( 'ADD_'.'DESC', "varchar(255)", V::get('ADD_'.'DESC', '', $_POST), array('class'=>'i', 'size'=>14) );
-		$table_view['foot']['DESC_PL'] = App::field( 'ADD_'.'DESC_PL', $tbl_conf->type('DESC_PL'), V::get('ADD_'.'DESC_PL', '', $_POST), array('class'=>'i','size'=>10) );
-		$table_view['foot']['OPIS'] = App::field( 'ADD_'.'OPIS', "varchar(255)", V::get('ADD_'.'OPIS', '', $_POST), array('class'=>'i', 'size'=>20) );
-		$table_view['foot']['IF_TRUE_GOTO'] = App::field( 'ADD_'.'IF_TRUE_GOTO', $tbl_conf->type('IF_TRUE_GOTO'), V::get('ADD_'.'IF_TRUE_GOTO', '', $_POST), array('class'=>'i','size'=>10) );
-		$table_view['foot']['IF_TRUE_GOTO_FLAG'] = App::field( 'ADD_'.'IF_TRUE_GOTO_FLAG', $tbl_conf->type('IF_TRUE_GOTO_FLAG'), V::get('ADD_'.'IF_TRUE_GOTO_FLAG', '', $_POST), array('class'=>'i','size'=>1) );
-		
-		$ses_col_name = 'CRM_PROCES';
-		
-		echo'<table border="1" cellspacing="0" cellpadding="0" class="tbl-view">';
-		echo'<thead>';
-		echo'<tr>'."\n";
-			echo'<th>';
-				echo App::link("C", array('function_init'=>"fun_USERS_COLUMN", 'arg'=>"edit"), array('title'=>"Ustawienia", 'ico'=>'excel.gif', 'ico_height'=>'12'));
-			echo'</th>';
-			foreach ($visible_cols as $field_id => $field_name) {
-				$v = V::get($field_name, str_replace('_', ' ', $field_name), $table_view['head']);
-				echo'<td>';
-					echo $v;
-					if ($field_name != 'ID') {
-						echo ' ';
-						echo App::link("X", array('function_init'=>"fun_USERS_COLUMN", 'arg'=>"hide", 'col_id'=>$field_id), array('title'=>"Ukryj kolumne", 'ico'=>'shutdown.gif', 'ico_height'=>11));
-					}
-				echo'</td>'."\n";
-			}//end foreach
-		echo'</tr>'."\n";
-		echo'<tr class="find">'."\n";
-			echo'<form action="" method="GET">';
-			echo'<input type="hidden" name="task" value="'.App::get_task().'" />';
-			echo'<th style="text-align:center;">';
-				echo'<input type="image" value="'."Szukaj".'" src="'."icon/search.png".'" title="'."Szukaj".'" />';
-			echo'</th>';
-			foreach ($visible_cols as $field_id => $field_name) {
-				$v = V::get($field_name, '', $table_view['find']);
-				$cls = array();
-				$v_label = V::get($field_name, '', $table_view['labels']);
-				if ($v_label && isset($tbl_filter->filters[$v_label])) {
-					if ($tbl_filter->filters[$v_label] != '%') {
-						$cls []= 'selected';
-					}
-				}
-				$cls = (!empty($cls))? ' class="'.implode(' ', $cls).'"' : '';
-				echo'<td'.$cls.'>'.$v.'</td>'."\n";
-			}//end foreach
-			echo'</form>';
-		echo'</tr>'."\n";
-		echo'</thead>';
-		echo'<tbody>';
-		
-		
-		{// fetch data
-			$sql_limit = 1500;// TODO: stronicowanie
-			if ($_SESSION['HIDE_PROCESY']) $sql_limit = "3";
-		
-			$sql_where = array();
-			if ($_GET['EDIT']) {
-				$sql_where []= "CP.`ID`='".$_GET['EDIT']."'";
-			} else {
-				foreach ($tbl_search_params as $k => $req_field_name) {
-					// TODO: FILTER_SEARCH <, >, <=, >=, !
-					$sql_where []= "CP.`".$k."` like '".$_GET[$req_field_name]."'";
-				}
-			}
-			$sql_where = implode(" and ", $sql_where);
-		
-			$query = "SELECT
-					CP.*
-				FROM `CRM_PROCES` as CP
-				where
-					".$sql_where."
-				order by CP.`ID` desc, CP.`PARENT_ID`, CP.`TYPE`, CP.`DESC`
-				limit ".$sql_limit."
-			";
-			$res = DB::query( $query );
-		}
-		
-		
-		$t = 0;
-		while ($r = DB::fetch( $res )) {
-			if ($_GET['EDIT'] == $r->ID) {
-				echo'<form action="'.App::build_http_query("?EDIT=".$r->ID."#".$r->ID).'" method="POST">';
-				echo'<tr class="edit row-'.($t = 1 - $t).'">';
-				echo'<th>';
-					echo'<input type="image" src="'."icon/save.png".'" name="EDIT_SUBMIT" value="'."E ".$r->ID.'" title="'."Zapisz".'">';
-					echo '<br />'.App::link("IMG", "?function_init=fun_IMAGE_ADD&tbl=".'CRM_PROCES'."&id=".$r->ID, array('target'=>'_blank', 'title'=>"Dodaj zdjecia"));
-					echo '<br />'.App::link("P+", array('task'=>"CRM_TESTY_ADD_PYTANIA", 'id_proces'=>$r->ID), array('title'=>'Dodaj pytanie do testow', 'class'=>'btn-p5 btn-red'));
-				echo'</th>';
-				foreach ($visible_cols as $field_id => $field_name) {
-					if ($field_name == 'ID') {
-						echo'<td>';
-							echo'<a id="'.$r->ID.'">'.$r->ID.'</a>';
-							echo ' '.App::link("L", "#TREE".$r->PARENT_ID);
-							echo'<input type="hidden" name="function_init" value="'."fun_CRM_PROCES_EDIT".'">';
-							echo'<input type="hidden" name="task" value="'.App::get_task().'">';
-							echo'<input type="hidden" name="EDIT_ID" value="'.$r->ID.'">';
-						echo '</td>';
-					} else {
-						echo'<td>';
-							if ($tbl_conf->allowWrite($field_name)) {
-								echo App::field( 'EDIT_' . $field_name, $tbl_conf->type($field_name), $r->$field_name, array('class'=>'i') );
-							} else {
-								echo $r->$field_name;
-							}
-						echo'</td>';
-					}
-				}
-				echo '</tr>';
-				echo'</form>';
-			}
-			else {
-				echo "\n".'<tr class="edit row-'.($t = 1 - $t).'">';
-				echo'<th>';
-					if (User_is_admin()) {
-						echo App::link("Edit", "?EDIT=".$r->ID, array('id'=>$r->ID, 'title'=>"Edytuj", 'ico'=>'edit.png'));
-					}
-				echo'</th>';
-				foreach ($visible_cols as $field_id => $field_name) {
-					if ($field_name == 'ID') {
-						echo'<td>';
-						if (User_is_admin()) {
-							echo App::link($r->ID, "?EDIT=".$r->ID."#".$r->ID, array('id'=>$r->ID, 'title'=>'Edytuj'));
-						} else {
-							echo $r->ID;
-						}
-						echo '</td>';
-					} else {
-						echo'<td> '.$r->$field_name.'</td>';
-					}
-				}
-				echo'</tr>';
-			}
-		}
-		echo'</tbody>';
-		
-		
-		
-		if (User_is_admin()) {
-			echo'<tfoot>';
-			echo'<form action="" method="POST">';
-			echo'<tr class="add">';
-				echo'<th colspan=2>';
-					echo'<input type="hidden" name="task" value="'.App::get_task().'" />';
-					echo'<input type="hidden" name="function_init" value="'."fun_CRM_PROCES_ADD".'" />';
-					echo'<input type="image" alt="'."Dodaj".'" src="'."icon/add.gif".'" title="'."Dodaj nowy".'">';
-				echo'</th>';
-				foreach ($visible_cols as $field_id => $field_name) {
-					if ($field_name == 'ID') continue;
-		
-					$v = V::get($field_name, ' ', $table_view['foot']);
-					echo'<td>'.$v.'</td>';
-				}//end foreach
-			echo'</tr>';
-			echo'</form>';
-			echo'</tfoot>';
-		}
-		echo'</table>';
-		
-		
-	}
+	$procesZasobId = ProcesHelper::getZasobTableID('CRM_PROCES');
+	echo App::link("Pokaz Tabele", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID={$procesZasobId}");
+	echo "<br>".App::link("Dodaj nowy rekord", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID={$procesZasobId}#CREATE");
 
 
 echo'<br />';
 echo'<br />';
 
 
@@ -381,7 +155,6 @@ if($DBG_TIME) $time_arr []= array(microtime(true), 'before Tree');
 		echo'<form action="'."".'" method="get" style="margin:0;padding:0;">';
 		echo'<form action="'."".'" method="get" style="margin:0;padding:0;">';
 			echo'<input type="hidden" name="task" value="'.App::get_task().'" />';
 			echo'<input type="hidden" name="task" value="'.App::get_task().'" />';
 			$tree_procesy_filter->show_filters();
 			$tree_procesy_filter->show_filters();
-			// TODO: another form ? function_init ?
 			{// save profile - btn
 			{// save profile - btn
 				echo'<nobr>';
 				echo'<nobr>';
 					echo'<input type="submit" name="save_profile" value="'."Save".'" title="'."Save profile".'" />';
 					echo'<input type="submit" name="save_profile" value="'."Save".'" title="'."Save profile".'" />';
@@ -402,7 +175,7 @@ if($DBG_TIME) $time_arr []= array(microtime(true), 'before Tree');
 			echo'<select name="filter_hist_id">';
 			echo'<select name="filter_hist_id">';
 				foreach ($filter_hist as $k => $v) {
 				foreach ($filter_hist as $k => $v) {
 					echo'<option value="'.$k.'">'.$v.'</option>';
 					echo'<option value="'.$k.'">'.$v.'</option>';
-				}//end foreach
+				}
 			echo'</select>';
 			echo'</select>';
 			echo'</form>';
 			echo'</form>';
 		}
 		}
@@ -410,7 +183,7 @@ if($DBG_TIME) $time_arr []= array(microtime(true), 'before Tree');
 		$tree = new Tree( $tbl );
 		$tree = new Tree( $tbl );
 		$clbk = 'tree_callback__show_item_from_'.$tbl;
 		$clbk = 'tree_callback__show_item_from_'.$tbl;
 		$tree->set_param('show_item_callback', $clbk);
 		$tree->set_param('show_item_callback', $clbk);
-//TODO: add all filters from Filter - $tree_procesy_filter
+
 		$tree->set_param('rozwin', ($tree_procesy_filter->get_arg('filtr_drzewo') == 'ROZWIN'));
 		$tree->set_param('rozwin', ($tree_procesy_filter->get_arg('filtr_drzewo') == 'ROZWIN'));
 		$tree->set_param('rozwin_proces', ($tree_procesy_filter->get_arg('filtr_procesy') == '+'));
 		$tree->set_param('rozwin_proces', ($tree_procesy_filter->get_arg('filtr_procesy') == '+'));
 		$tree->set_param('rozwin_zasoby', ($tree_procesy_filter->get_arg('filtr_zasoby') == '+'));
 		$tree->set_param('rozwin_zasoby', ($tree_procesy_filter->get_arg('filtr_zasoby') == '+'));
@@ -418,14 +191,8 @@ if($DBG_TIME) $time_arr []= array(microtime(true), 'before Tree');
 		$tree->set_param('filtr_img', ($tree_procesy_filter->get_arg('filtr_img') == '+'));
 		$tree->set_param('filtr_img', ($tree_procesy_filter->get_arg('filtr_img') == '+'));
 		$tree->set_param('style', $tree_procesy_filter->get_arg('filtr_view'));
 		$tree->set_param('style', $tree_procesy_filter->get_arg('filtr_view'));
 		$tree->set_param('search_id', $tree_procesy_filter->get_arg('filtr_search_id'));
 		$tree->set_param('search_id', $tree_procesy_filter->get_arg('filtr_search_id'));
-		$tree->set_param('getZasobTableID', ProcesHelper::getZasobTableID('CRM_PROCES'));
-		$tree->set_param('getZasobTableID_CRM_LISTA_ZASOBOW', ProcesHelper::getZasobTableID('CRM_LISTA_ZASOBOW'));
-		$userAcl = User::getAcl();
-		if($userAcl)
-			$tblAcl = $userAcl->getTableAcl(ProcesHelper::getZasobTableID('CRM_PROCES'));
-			if($tblAcl)
-				if($tblAcl->hasFieldPerm($tblAcl->getFieldIdByName('ID'),'R')) $tree->set_param('hasFieldPerm__ID',1);
-
+		$tree->set_param('ProcesTblId', ProcesHelper::getZasobTableID('CRM_PROCES'));
+		$tree->set_param('ZasobTblId', ProcesHelper::getZasobTableID('CRM_LISTA_ZASOBOW'));
 
 
 		//TODO: check perm to edit
 		//TODO: check perm to edit
 
 

+ 13 - 5
SE/procesy5.php

@@ -2151,11 +2151,16 @@ function tree_callback__show_item_from_CRM_PROCES( &$r, &$tree ) {
 		echo App::link("v", array('task'=>'CRM_PROCES', 'function_init'=>'SORT_PRIO_PROCES', 'arg1'=>$r->ID, 'arg1_val'=>'dw'), array('class'=>"btn-clean", 'title'=>"w dol"));
 		echo App::link("v", array('task'=>'CRM_PROCES', 'function_init'=>'SORT_PRIO_PROCES', 'arg1'=>$r->ID, 'arg1_val'=>'dw'), array('class'=>"btn-clean", 'title'=>"w dol"));
 		echo App::link("V", array('task'=>'CRM_PROCES', 'function_init'=>'SORT_PRIO_PROCES', 'arg1'=>$r->ID, 'arg1_val'=>'downdown'), array('class'=>"btn-clean", 'title'=>"w dol o 5 pol"));
 		echo App::link("V", array('task'=>'CRM_PROCES', 'function_init'=>'SORT_PRIO_PROCES', 'arg1'=>$r->ID, 'arg1_val'=>'downdown'), array('class'=>"btn-clean", 'title'=>"w dol o 5 pol"));
 		echo' ';
 		echo' ';
-		  if($tree->get_param('hasFieldPerm__ID'))
-			echo App::link("E", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('getZasobTableID')."#EDIT/".$r->ID, array('title'=>'Pliki', 'class'=>'btn-p5'));
-		  else 
+
+		if ($tree->get_param('ProcesTblId') > 0) {
+			echo App::link("E", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('ProcesTblId')."#EDIT/".$r->ID, array('title'=>'Pliki', 'class'=>'btn-p5'));
+		}
+		else {
 			echo App::link("E", array('task'=>"CRM_PROCES", 'EDIT'=>$r->ID), array('title'=>'Edytuj', 'class'=>'btn-p5'));
 			echo App::link("E", array('task'=>"CRM_PROCES", 'EDIT'=>$r->ID), array('title'=>'Edytuj', 'class'=>'btn-p5'));
-		 if ($tree->get_param('hasFieldPerm__ID')) echo App::link("F", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('getZasobTableID')."#FILES/".$r->ID, array('title'=>'Pliki', 'class'=>'btn-p5'));
+		}
+		if ($tree->get_param('ProcesTblId') > 0) {
+			echo App::link("F", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('ProcesTblId')."#FILES/".$r->ID, array('title'=>'Pliki', 'class'=>'btn-p5'));
+		}
 
 
 		if (!in_array($r->TYPE, array('PROCES_GROUP_1', 'PROCES_GROUP_2'))) {
 		if (!in_array($r->TYPE, array('PROCES_GROUP_1', 'PROCES_GROUP_2'))) {
 			if (!$r->TEST_PYTANIE) {
 			if (!$r->TEST_PYTANIE) {
@@ -2327,8 +2332,11 @@ function tree_callback__show_item_from_CRM_PROCES( &$r, &$tree ) {
 				echo App::link("V", array('function_init'=>'SORT_PRIO_WSKAZNIK', 'arg1'=> $w->CW_ID, 'arg1_val'=>'downdown'), array('class'=>"btn-clean", 'title'=>"w dol o 5 pol"));
 				echo App::link("V", array('function_init'=>'SORT_PRIO_WSKAZNIK', 'arg1'=> $w->CW_ID, 'arg1_val'=>'downdown'), array('class'=>"btn-clean", 'title'=>"w dol o 5 pol"));
 				echo' ';
 				echo' ';
 				echo App::link("E", "?task=CRM_EDIT_CRM_WSKAZNIK&EDIT=".$w->CW_ID."&ID=".$w->CW_ID, array('title'=>'Edytuj', 'class'=>'btn-p5'));
 				echo App::link("E", "?task=CRM_EDIT_CRM_WSKAZNIK&EDIT=".$w->CW_ID."&ID=".$w->CW_ID, array('title'=>'Edytuj', 'class'=>'btn-p5'));
+
+				if ($tree->get_param('ZasobTblId') > 0) {
+					echo App::link("F", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('ZasobTblId')."#FILES/".$w->ID, array('title'=>'Pliki', 'class'=>'btn-p5'));
+				}
 			}
 			}
-				echo App::link("F", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('getZasobTableID_CRM_LISTA_ZASOBOW')."#FILES/".$w->ID, array('title'=>'Pliki', 'class'=>'btn-p5'));
 
 
 			//echo ' <span class="btn-box btn-box-lgreen"'.$w_title_parents_out.'>'.$w->ID.'</span>';
 			//echo ' <span class="btn-box btn-box-lgreen"'.$w_title_parents_out.'>'.$w->ID.'</span>';
 			echo'<span class="green"'.$w_title_parents_out.'>['.$w->ID.']</span>';
 			echo'<span class="green"'.$w_title_parents_out.'>['.$w->ID.']</span>';