 <%@ page import="java.util.List" %>
 <%@ page import="zall.bean.*" %>
 <%@ page import="java.sql.Timestamp" %>
 <%
 User user = (User)session.getAttribute("user");
 Folder folder = (Folder)request.getAttribute("folder");
 %>
  
    <DIV id="main">
	<DIV id="container">
		<DIV id="content">
			<TABLE id="edit-row" width="100%" border="0"><TR>
				<TD>		
				<%if( folder.getParent() != null ){ %>
					<button type="button" onClick="window.location='gallery?folder=<%=folder.getParent().getId()%>'"><img src="img/arrow_undo.png" style="width: 10px; padding-right: 5px;">...Back</button>
				<%} %>
				</TD><TD>
				<%if( user.canEdit( folder ) && folder.getParent() != null ){ %>
					<form action="gallery?folder=<%=folder.getParent().getId() %>" method="post" align="right">                         
						<input type="hidden" name="id" value="<%=folder.getId() %>">
						
						<%if( !folder.isPrivate() ){ %>
							<button type="submit" name="action" value="mkprivate" ><img src="img/user-silhouette.png" style="width: 10px; padding-right: 5px;">Private</button>
						<%}else{ %>
							<button type="submit" name="action" value="mkprivate" ><img src="img/user-share.png" style="width: 10px; padding-right: 5px;">Public</button>	
						<%} %>
						<button type="submit" name="action" value="rmdir" onClick="return confirm ('Are you sure you want to delete this folder?')"><img src="img/delete.png" style="width: 10px; padding-right: 5px;">Delete</button>
					</form>
				<%} %>
				</TD>			
			</TR></TABLE>
			<% // Folders
			   for( Folder subfolder : ((List<Folder>)request.getAttribute("subfolders")) ){ %>			
			<DIV class="entry-content">			
				<DIV class="entry-content">
                    <%if( subfolder.isPrivate() ){ %>
                    <SPAN class="private"></SPAN>
                    <%} else if( subfolder.getDate().after(new Timestamp(System.currentTimeMillis()-10*24*60*60*1000) )){ %>
                    <SPAN class="new"></SPAN>
                    <%} %>
					<A href="gallery?folder=<%=subfolder.getId()%>">
						<SPAN class="slide-title" style="opacity: 0; "><%=subfolder.getName()%></SPAN>
                    	<IMG class="thumbnail" src="img/folder.png" width="125" height="125" alt="<%=subfolder.getName()%>">
                    	<SPAN class="cover-up"></SPAN
                    ></A>
				</DIV>
			</DIV><!-- .post -->
            <% } %>	
			
			
			<% // Media
			   for( Media media : (List<Media>)request.getAttribute("media") ){
				if( media instanceof Image ){ %>
			<DIV class="entry-content">
			<% 	} else if( media instanceof Video ){ %>	
			<DIV class="video">
			<% 	} %>	
			
				<DIV class="entry-content">
                    <%if( media.getDate().after(new Timestamp(System.currentTimeMillis()-10*24*60*60*1000)) ){ %><SPAN class="new"></SPAN><%} %>
					<A href="media?type=<%=media.getType() %>&id=<%=media.getId()%>"><SPAN class="slide-title" style="opacity: 0; "><%=media.getTitle()%></SPAN>
                    <IMG class="thumbnail" src="content?type=<%=media.getType() %>&id=<%=media.getId()%>&size=small" width="125" height="125" alt="<%=media.getTitle()%>"><SPAN class="cover-up"></SPAN></A>
				</DIV>
			</DIV><!-- .post -->
            <% } %>	
            
            <!-- 
			<DIV id="nav-below" class="navigation">                  
				<DIV class="nav-previous">
                    <A href="#"><SPAN class="meta-nav">&laquo;</SPAN> Older posts</A>
                </DIV>
				<DIV class="nav-next">
                    <a href="#" >Newer posts <span class="meta-nav">&raquo;</span></a>
                </DIV>
			</DIV>	
			 -->
		</DIV><!-- #content -->
	</DIV><!-- #container -->
    </DIV><!-- #main -->