<% # encoding: utf-8 %>

<% if @frontend_style == '1' %>

	<div class="o-archives layout-table">

		<table>
			<thead>
				<tr>
					<th class="column-ctrl col-title"><%= sortable(:title, t("archive.Title"))%></th>
					<th class="column-ctrl col-file"><%= t("archive.Files")%></th>
					<th class="column-ctrl col-category"><%= sortable(:archive_file_category, t("archive.Category"))%></th>
				</tr>
			</thead>
			<tbody>

				<% @archive_files.each_with_index do |post,i| %>
				<tr <% if ( (i + 1) % 2 ) == 0 %> class="even" <% end %>>
					<td>
						<div class="o-archives-title"><%= post.title %>
						<% if !post.is_hot.blank? %><span class="o-archives-hot"><%= t('hot')%></span><% end %>
						</div>
					</td>
					<td>
						<div class="o-archives-list-item">
							<% if !post.archive_file_multiples.blank? %>
							<ol>
								<% post.archive_file_multiples.asc(:sort_number).each do | afile |  %>
									<%  if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %>
										<li>
											<%= link_to (!afile.file_title.blank? ? afile.file_title : t('archive.download') ), afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} if afile.file.file %>
											<%= post.get_file_icon(afile.file.url) %>
										</li>
									<% end %>
								<% end %>
							</ol>
							<% end %>
						</div>
					</td>
					<td><div class="o-archives-category">
						<%= post.category.title if !post.category.blank? %>
					</div></td>
				</tr>
				<% end %>

			</tbody>
		</table>
	</div>

	<%= paginate @archive_files, :param_name => :page_main, :params => {:inner => 'false'} %>

<% elsif @frontend_style == '2' %>

	<div class="o-archives">
		<div class="o-archives-content">
				<% @archive_file_datas.each do |afcpost| %>
				<div class="o-archives-group">
					<h2 class="o-archives-category h2"><%= afcpost["title"] %></h2>
					<div class="o-archives-content">
					<div class="o-archives-list">
						<ul>
							<% afcpost["archive_files"].each do |post| %>
							<li>
								<h3 class="o-archives-title h3">
									<%= post["title"] %>
									<% if !post["is_hot"].blank? %><span class="o-archives-hot"><%= t('hot')%></span><% end %>
								</h3>
								<div class="o-archives-list-item">
									<ol>
										<% post["archive_file_multiples"].each do | afile |  %>
												<li>
													<%= link_to afile["file_title"], afile["url"], {:target => '_blank', :title => afile["file_title"], :class => "o-archives-file"} %>
													<%= afile["icon"] %>
												</li>
										<% end %>
									</ol>
								</div>
							</li>
							<% end %>
						</ul>
					</div>
				</div>
			<% end %>
		</div>
	</div>

<% end %>

<%= stylesheet_link_tag "archive/archives" %>









