Location: PHPKode > projects > PHPmyCDMouse > phpmycdmouse_031/browse_browse_cd.php
<?
/*
   Copyright (C) 2003  by Uwe Thiel, Germany

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
    USA.
*/


##### if there's no ID set, list all media in database

		if ($GetResults->num_rows()>0) {
		   if ($ID=="0") { # only print Header first time when choosing CD
		   ?>
		   <br><br>
		   <table width=100% CELLPADDING=2>
		   <tr><td colspan=6><h1><b>Listing all CDs:</b></h1></td></tr>
		   <tr class="ListHeader" align=center><td width=32px></td><td><b>Inv. string</b></td><td><b>Name</b></td><td><b>Category</b></td><td><b>CDSize</b></td><td><b>#Files</b></td><td><b>#SubDirs</b></td><td><b>Description</b></td></tr>
		   <?
                        $browscount=1;

			while ($GetResults->next_record()) { ?>
				<tr onmouseover="this.className='MouseOverRow';" <?if ($BrowseBy=="CD") echo "class=\"Fileline" . strval($browscount%2) . "\"  onmouseout=\"this.className='"."Fileline" . strval($browscount%2)."'\"";?> ><td width=32px><a href="<?=$_SERVER["PHP_SELF"]?>?LookupType=Browse&BrowseBy=CD&ID=<?=$GetResults->f("ID")?>" title="Browse this CD" class="BrowseList"><img width=32px,height=32px BORDER=0 src="showicon.php?type=<?echo brows_lend_disp($GetResults->f(ID), icon);?>"></a></td><td><?if ($BrowseBy=="Category") echo"<li>";?><a href="<?=$_SERVER["PHP_SELF"]?>?LookupType=Browse&<?
                $browscount++;
    		echo "BrowseBy=CD&ID=".$GetResults->f("ID");?>" <?echo "title=\"Browse this CD\" ";?>class="BrowseList"><?
		  if ($GetResults->f("CDNumber")=="") echo "Not set"; else echo(strval($GetResults->f("CDNumber")));?></a></td><td><a title="List info about this CD" href="javascript:catpopup('cdinfo.php?CDID=<?=$GetResults->f("ID")?>')"><?=$GetResults->f("Label")?></a></td><td><a href="<?=$_SERVER["PHP_SELF"]?>?LookupType=Browse&BrowseBy=Category&ID=<?=$GetResults->f("CategoryID");?>" title="Browse this category" class="BrowseList"><? if ($GetResults->f("CategoryName")=="") echo "Main Category"; else echo($GetResults->f("CategoryName")); ?></a></td><td align=right><? echo(number_format($GetResults->f("CDsize"),0,$decpoint,$comma));?></td><td align=right><? echo(number_format($GetResults->f("NrFiles"),0,$decpoint,$comma));?> </td><td align=right> <? echo(number_format($GetResults->f("NrSubDirs"),0,$decpoint,$comma));?></td><td><?if ($GetResults->f("Description")=="") echo "Not set"; else echo($GetResults->f("Description"));?>
			</td></tr>
<?			}
####
require("./page_linklist.php");
?>
</table><br>
<?
require($Footer);
die();

#### Media listing finished if no ID is set

   }
	}


	if ($FileList->num_rows()>0) {
		$Counter=0;

##################################################################### this is the Filelist-Data-section



		while($FileList->next_record()) {

			if ($Counter==0) {       #### First print CD-Info at the top of the page (and only once)
                        ?>
                        <table cellpadding=3 width=100%>
			<tr><td colspan=6><h1>Listing CD</h1></td></tr>
                        <tr><td colspan=6 height=20px></td></tr>
			<tr class="CDInfoLine2"><td colspan=3><h2><b>Info about this CD:</b></h2></td><td colspan=2 align=right><?if ($Access[ChangeCDinfo]) { ?><input type="button" name="changecdinfo" value="Change CD-Properties" onclick="catpopup('cdinfo.php?Action=Edit&CDID=<?=$ID?>')"><? } ?></td><td align=left><form action="<?=$PHP_SELF?>?BrowseBy=CD&ID=<?=$ID?>" method="post"><input type="submit" name="dirbrowsesubmit" value="Browse through Directories"></form></td></tr>
                        <tr class="CDInfoLine0"><td><b>Inventary-Nr.:</b></td><td><? if ($FileList->f("CDNumber")=="" || $FileList->f("CDNumber")=="0") echo("Not set"); else echo($FileList->f("CDNumber"));?></td><td><b>Category:</b></td><td><? if ($GetCDCatname->f("CategoryName")=="" || $GetCDCatname->f("CategoryName")=="0") echo("Main Category"); else echo($GetCDCatname->f("CategoryName"));?></td><td><b>Name:</b></td><td><?=$FileList->f("CDLabel")?></td></tr>
                        <tr class="CDInfoLine1"><td><b>AddedDate:</b></td><td><?=$FileList->f("CDAddedDate")?></td><td><b>Created:</b></td><td><?=$FileList->f("CDCreated")?></td><td><b>Description:</b></td><td><?if($FileList->f("Description")!="") echo $FileList->f("Description"); else echo "not set";?></td></tr>
                        <tr class="CDInfoLine0"><td><b>Size (bytes):</b></td><td><?=number_format($FileList->f("CDsize"),0,$decpoint,$comma)?></td><td><b>#Files</b></td><td><?=number_format($FileList->f("NrFiles"),0,$decpoint,$comma)?></td><td><b>#SubDirs</b></td><td><?=number_format($FileList->f("NrSubDirs"),0,$decpoint,$comma)?></td></tr>
				<tr class="CDInfoLine2"><td ><h2><b>Lend state:</b></h2></td>
				<?if (brows_lend_disp($FileList->f("ID"), state) && $Access[ManageLends]) { ?>
				<td colspan="1" align="left"><img width=32px,height=32px BORDER=0 src="showicon.php?type=<?echo brows_lend_disp($FileList->f("ID"), icon);?>"></td>
				<td colspan="3" align="right"><input type=button value="show adress" name="showadressbutton" onClick="popupvar('adresses.php?adressid=<?=brows_lend_disp($FileList->f("ID"), adressid)?>',760,500)"></td><td>
				<? }
				else { ?>
				<td colspan="4" align=left><img width=32px,height=32px BORDER=0 src="showicon.php?type=<?echo brows_lend_disp($FileList->f("ID"), icon);?>"></td><td>
				<? } ##of else above
				 if ($Access[ManageLends]) {
				  if (brows_lend_disp($FileList->f("ID"), state)) { ##if this media has been lent
				?>
				<input type=button value="got back" name="modifylendbutton" onClick="popupvar('adrlendmodify.php?cdid=<?=$FileList->f(ID)?>&dellend=true',760,500)">
                <?
				} ###of if(brows.....
				else {
				?>
				<input type=button value="lend out" name="modifylendbutton" onClick="popupvar('adresses.php?cdid=<?=$FileList->f(ID)?>&addlend=true',760,500)">
                <?
				} ###else of if(brows.....
				} ##of if ($Access
				?></td></tr>
						<tr><td></td></tr>
                        </table><br>
	                <b>Page <?=($FileOffset/$LinesPerPage+1)?> of <?=ceil($RecordCount->f("FileCount")/$LinesPerPage)?></b>
                       <table width=100% CELLPADDING=2>
                       <tr class="ListHeader"><td  width=56px><b>Type</b></td><td  ><b>Size</b></td><td  ><b>Date Time</b></td><td  ><b>Directory</b></td><td  ><b>File Name</b></td><td  ><b>File Label</b></td>
                       </tr>

	              <?
	  	      } ###of if ($Counter==0)



			$Counter++;
			$FilesizeTemp=number_format($FileList->f("Filesize"),0,$decpoint,$comma);
			$exttmp=explode(".",$FileList->f("Filename"));
			if (count($exttmp)>1) $ext=strtolower($exttmp[count($exttmp)-1]); else $ext=""; ##   calculate extension for iconview
?>
<tr class="FileLine<?=$Counter%2?>" onmouseover="this.className='MouseOverRow';" onmouseout="this.className='FileLine<?=$Counter%2?>';"><td><?

    ?>
    <a href="cddirbrowse.php?ID=<?=$FileList->f('ID')?>&BrowseDir=<?if ($FileList->f("Filetype")=="d") if ($FileList->f("LinkTarget") !="") echo $FileList->f("LinkTarget"); else if ($FileList->f("SubDir")=="/") echo $FileList->f("SubDir").$FileList->f("Filename"); else echo $FileList->f("SubDir")."/".$FileList->f("Filename"); else echo $FileList->f("SubDir"); ?>" class="BrowseList" title="Browse through the directories of this CD">
    <?
    if($FileList->f("Filetype")=="d") { ####Directory-Icons:
	      if ($FileList->f("LinkTarget") !="") {
	            ?>
		    <img width=32px,height=32px BORDER=0 src="showicon.php?type=dirlink">
		     <? } ##of if Linktarget !="")
		       else {
		       		      ?>
		      <img width=32px,height=32px BORDER=0 src="showicon.php?type=dir">
		<?      }  ##of else from Linktarget
		        }  ## of filetype =="d"
		       else {
		                                      ########Now the File-Icons:
                         if ($FileList->f("LinkTarget") !="") {
	                 ?>
		            <img width=32px,height=32px BORDER=0 src="showicon.php?type=filelink">
		            <? } ##of if Linktarget !="")
		               else {
		               ?>
		               <img width=32px,height=32px BORDER=0 src="showicon.php?ext=<?=$ext?>">
		             <?      }  ##of else from Linktarget
                               } ### of else (filetype==d)


	       #####################################################End of Icons
	?></td><td align=right><?=$FilesizeTemp?></td><td><?=$FileList->f("FileDatetime")?></td><td><?=$FileList->f("SubDir")?></td><td><a title="List info about <?=$FileList->f("Filename")?>" href="javascript:catpopup('fileinfo.php?FileID=<?=$FileList->f("FileID")?>')"><?=$FileList->f("Filename")?></a></td><td><?=$FileList->f("FileLabel")?></td><?







}

require("./page_linklist.php");
?></table><?
	}
	else { ?>
	<table width=100% CELLPADDING=2>
	<tr class="ListHeader"><td  ></td></tr>
	<tr class="FileLine1"><td align=left><br><div class="Alert">No Records Found</div></td></tr>
	<tr class="ListHeader"><td align=left></td></tr>

	</table>
	<?}

?>
Return current item: PHPmyCDMouse