<?php defined('_JEXEC') or die('Restricted access'); ?>

			<form enctype="multipart/form-data" action="index.php" method="post" name="filename" id="filename">
			<table class="adminheading">
			<tr>
				<th class="billets_uploadfile">
				<?php echo _BILLETS_UPLOADFILE; ?>
				</th>
			</tr>
			</table>
	
			<table class="adminform">
			<tr>
				<td align="left">
				<div class="note">
				<?php echo _BILLETS_ADDONSNOTICE."<br />"._BILLETS_SELECTFILETYPEBELOW; ?>
				</div>
				<input class="text_area" name="userfile" type="file" size="70"/>
				<input class="button" type="submit" value="<?php echo _BILLETS_UPLOADFILEANDINSTALL; ?>" />
				</td>
			</tr>
			</table>
			
			<p></p>
	
			<input type="hidden" name="option" value="<?php echo $option;?>" />
			<input type="hidden" name="controller" value="<?php echo $this->_name; ?>" />
			<input type="hidden" name="task" value="uploadaddon"/>
			<input type="hidden" name="type" value="<?php echo $this->type; ?>" />
			</form>

		<form action="index.php" method="post" name="adminForm" id="adminForm">
		<table class="adminheading">
		<tr>
			<th class='billets_addons'>
            <?php echo _BILLETS_INSTALLED." "._BILLETS_." "._BILLETS_ADDONS; ?>
			</th>
			<td class='right'>
			<?php echo _BILLETS_FILTER; ?>
			</td>
			<td class='right'>
			<input type="text" name="search" value="<?php echo htmlspecialchars( $search );?>" class="text_area" onChange="document.adminForm.submit();" />
			</td>
			<td class='right'>
            <?php echo $this->types ; ?>
			</td>
		</tr>
		</table>

		<table class="adminlist">
		<thead>
            <tr>
                <th width="5">
                #
                </th>
                <th width="20">
                <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
                </th>
                <th class="title">
                <?php echo JHTML::_('grid.sort', _BILLETS_TITLE, "title", $this->order_dir, $this->order, $task ); ?>
                </th>
                <th class="title">
                <?php echo JHTML::_('grid.sort', _BILLETS_TYPE, "type", $this->order_dir, $this->order, $task ); ?>
                </th>
                <th class="title">
                <?php echo JHTML::_('grid.sort', _BILLETS_PUBLISHED, "published", $this->order_dir, $this->order, $task ); ?>
                </th>
                <th class="title">
                <?php echo JHTML::_('grid.sort', _BILLETS_VERSION, "version", $this->order_dir, $this->order, $task ); ?>
                </th>
                <th class="title">
                <?php echo JHTML::_('grid.sort', _BILLETS_AUTHOR, "author", $this->order_dir, $this->order, $task ); ?>
                </th>
                <th class="title">
                <?php echo JHTML::_('grid.sort', _BILLETS_CORE."?", "iscore", $this->order_dir, $this->order, $task ); ?>
                </th>
            </tr>
		</thead>
        <tbody>
		<?php
        $k = 0;
        for ($i=0, $n=count( $this->items ); $i < $n; $i++)
        {
            $row =& $this->items[$i];
            $checked    = JHTML::_( 'grid.id', $i, $row->id );
        	$published 	= JHTML::_('grid.published', $row, $i );			
            $link = JRoute::_( 'index.php?option='.$option.'&controller='.$this->_name.'&task=edit&cid[]='. $row->id );
            ?>
            <tr class="<?php echo "row$k"; ?>">
                <td>
                <?php echo $i + 1 + $this->limitstart; ?>
                </td>
                <td>
                <?php echo $checked; ?>
                </td>
                <td>
                    <a href="<?php echo $link; ?>" title="<?php echo _BILLETS_VIEW; ?>">
                    <?php echo stripslashes( $row->title ); ?>
                    </a>
                </td>
                <td>
                    <?php echo stripslashes( $row->type ); ?>
                </td>
                <td>
                	<?php echo $published; ?>
                </td>
                <td>
                    <?php 
                    if ($row->version) { echo $row->version; }
                    if ($row->created_datetime > 0) { echo " (".JHTML::_('date', $row->created_datetime, "%Y-%m-%d" ).")"; }
                    ?>                        
                </td>
                <td>
                    <?php 
                    if ($row->author_name) { echo $row->author_name."<br />"; }
                    if ($row->author_email) { echo "<a href='mailto:".$row->author_email."'>".$row->author_email."</a><br />"; }
                    if ($row->author_url) { echo "<a href='".$row->author_url."'>".$row->author_url."</a>"; }
                    ?>
                </td>
                <?php 
                echo "<td class='noborder'>";
                    echo $row->iscore ? "<img src='".$mainframe->getCfg('live_site')."/components/".$option."/images/iscore_16.png' alt='"._BILLETS_CORE."' title='"._BILLETS_CORE."'>" : ' ';
                echo "</td>";
                ?>
            </tr>
            <?php 
            echo "<tr class='row".$k."'>";
                echo "<td class='topnowrap' colspan='4'>";
                    if ($row->description) { ?>
                    <span class="href" id="showhidedescription_<?php echo $row->id; ?>" onclick="displayDiv ('description_<?php echo $row->id; ?>', 'showhidedescription_<?php echo $row->id; ?>', '<?php echo _BILLETS_SHOWDESCRIPTION; ?>', '<?php echo _BILLETS_HIDEDESCRIPTION; ?>');"><?php echo _BILLETS_HIDEDESCRIPTION; ?></span> 				
                      <?php }                  
                echo "</td>";
                echo "<td colspan='4' class='billets_faded'>"; 
                    if ($row->description) { ?>
                    <div id="description_<?php echo $row->id; ?>">
                        <?php 
                        echo "<div class='billets_paddedl'>";
                        echo nl2br( stripslashes( $row->description ) );
                        echo "</div>";				  
                        ?>
                    </div>
                <?php }
                echo "</td>";
            echo "</tr>"; ?>
            <?php
            $k = 1 - $k;
        }
        ?>
        </tbody>
        <tfoot>
        	<tr>
                <td colspan='8'>
                    <div class="pagination">
                    <?php echo $this->pagination->getListFooter(); ?>
                    </div>            
                </td>
            </tr>
        </tfoot>

		</table>
                
		<input type="hidden" name="option" value="<?php echo $option; ?>" />
		<input type="hidden" name="controller" value="<?php echo $this->_name; ?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="id" value="" />
		<input type="hidden" name="order" value="<?php echo $this->order; ?>" />
		<input type="hidden" name="order_dir" value="<?php echo $this->order_dir; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>