<?
function list_versions($file_id,$module="EcmDocs")
{   
   $z="select version,id,date_entered,name from ecmfiles_versions where file_id='".$file_id."' and deleted='0' order by version desc";
   $w=$GLOBALS['db']->query($z);
   while($r=$GLOBALS['db']->fetchByAssoc($w))
   {
		$versions.='<tr>
  <td valign="top" class="tabDetailViewDF">'.$r['name'].'</td>
  <td valign="top" class="tabDetailViewDF"><a href="DownloadEcmFile.php?record='.$r['id'].'">download</a></td>
  <td valign="top" class="tabDetailViewDF">'.number_format($r['version'], 1, '.', '').'</td>
  <td valign="top" class="tabDetailViewDF">'.$r['date_entered'];
  		if(check_is_admin($_SESSION['authenticated_user_id']))$versions.='&nbsp;&nbsp;<a style="cursor:pointer;" onclick="if(confirm(\'Are you sure you want to delete this version?\')){location.href=\'index.php?module=EcmDocs&action=DeleteVersion&record='.$r['id'].'&file_id='.$file_id.'&return_module='.$module.'&return_id='.$_REQUEST['record'].'\';}">delete</a>';
  		$versions.='</td>
</tr>';
	}
	return $versions;
}
?>
