Pārlūkot izejas kodu

- Protect against invalid attributes...
- Use the new absolute URL mechanism
- Added custom sort and Zebra tables for non paginated lists

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1316 a333f486-631f-4898-b8df-5754b55c2be0

dflaven 14 gadi atpakaļ
vecāks
revīzija
3999789d92
1 mainītis faili ar 16 papildinājumiem un 7 dzēšanām
  1. 16 7
      portal/index.php

+ 16 - 7
portal/index.php

@@ -485,7 +485,7 @@ function GetFieldAsHtml($oObj, $sAttCode)
 		{
 		{
 			$aRow = array();
 			$aRow = array();
 			
 			
-			$aRow['key'] = '<a href="./index.php?operation=details&id='.$oRequest->GetKey().'">'.$oRequest->Get('ref').'</a>';
+			$aRow['key'] = '<a href="'.utils::GetAbsoluteUrlAppRoot().'portal/index.php?operation=details&id='.$oRequest->GetKey().'">'.$oRequest->Get('ref').'</a>';
 			$sHilightClass = $oRequest->GetHilightClass();
 			$sHilightClass = $oRequest->GetHilightClass();
 			if ($sHilightClass != '')
 			if ($sHilightClass != '')
 			{
 			{
@@ -498,6 +498,12 @@ function GetFieldAsHtml($oObj, $sAttCode)
 			$aValues[$oRequest->GetKey()] = $aRow;
 			$aValues[$oRequest->GetKey()] = $aRow;
 		}
 		}
 		$oP->Table($aAttribs, $aValues);
 		$oP->Table($aAttribs, $aValues);
+		// Temprory until we merge re-use the paginated tables:
+		$oP->add_ready_script(
+<<<EOF
+		$('table.listResults').tableHover().tablesorter( { widgets: ['myZebra', 'truncatedList']} );
+EOF
+		);
 	}
 	}
 	else
 	else
 	{
 	{
@@ -613,13 +619,16 @@ function DisplayRequestDetails($oP, UserRequest $oRequest, $bEditMode = true)
 				}
 				}
 				foreach($aFields as $sAttCode)
 				foreach($aFields as $sAttCode)
 				{
 				{
-					$iFlags = $oRequest->GetAttributeFlags($sAttCode);
-					if ( ($iFlags & OPT_ATT_HIDDEN) == 0)
+					if (MetaModel::IsValidAttCode(get_class($oRequest), $sAttCode))
 					{
 					{
-						// The field is visible, add it to the current column
-						$val = GetFieldAsHtml($oRequest, $sAttCode);
-						$aDetails[$sTab][$sColIndex][] = array( 'label' => '<span title="'.MetaModel::GetDescription('UserRequest', $sAttCode).'">'.MetaModel::GetLabel('UserRequest', $sAttCode).'</span>', 'value' => $val);
-						$iInputId++;
+						$iFlags = $oRequest->GetAttributeFlags($sAttCode);
+						if ( ($iFlags & OPT_ATT_HIDDEN) == 0)
+						{
+							// The field is visible, add it to the current column
+							$val = GetFieldAsHtml($oRequest, $sAttCode);
+							$aDetails[$sTab][$sColIndex][] = array( 'label' => '<span title="'.MetaModel::GetDescription('UserRequest', $sAttCode).'">'.MetaModel::GetLabel('UserRequest', $sAttCode).'</span>', 'value' => $val);
+							$iInputId++;
+						}
 					}				
 					}				
 				}
 				}
 			}
 			}