<% # encoding: utf-8 %>

  <%= f.error_messages %>

	<!--Widget start-->
	
	<div id="sub-wiget">

		<div id="widget-tags" class="widget-box widget-size-300">
			<div class="widget-action clear tip" title="Setting">
				<a class="action"><i class="icon-cog icon-white"></i></a>
			</div>
			<h3 class="widget-title"><i class="icons-tag"></i><%= f.label :paper_type ,t("personal_conference.paper_type")%></h3>
			<div class="widget-content clear form-horizontal">
				<% @paper_types.each do |paper_type| %>
					<%= content_tag :label,:class => "checkbox inline" do -%>
						<%= check_box_tag 'writing_conference[conference_paper_type_ids][]', paper_type.id, @writing_conference.conference_paper_type_ids.include?(paper_type.id)%>
						<%= paper_type.title %>
            <%= hidden_field_tag 'writing_conference[conference_paper_type_ids][]', '' %>
					<% end %>
				<% end %>
			</div>
		</div>  

		<div id="widget-tags" class="widget-box widget-size-300">
			<div class="widget-action clear tip" title="Setting">
				<a class="action"><i class="icon-cog icon-white"></i></a>
			</div>
			<h3 class="widget-title"><i class="icons-tag"></i><%= f.label :author_type ,t("personal_conference.author_type")%></h3>
			<div class="widget-content clear form-horizontal">
				<% @author_types.each do |author_type| %>
					<%= content_tag :label,:class => "checkbox inline" do -%>
						<%= check_box_tag 'writing_conference[conference_author_type_ids][]', author_type.id, @writing_conference.conference_author_type_ids.include?(author_type.id)%>
						<%= author_type.title %>
            <%= hidden_field_tag 'writing_conference[conference_author_type_ids][]', '' %>
					<% end %>
				<% end %>
			</div>
		</div>  
  

		<div id="widget-tags" class="widget-box widget-size-300">
			<div class="widget-action clear tip" title="Setting">
				<a class="action"><i class="icon-cog icon-white"></i></a>
			</div>
			<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
			<div class="widget-content clear form-horizontal">
				<% @tags.each do |tag| %>
					<%= content_tag :label,:class => "checkbox inline" do -%>
						<%= check_box_tag 'writing_conference[tag_ids][]', tag.id, @writing_conference.tag_ids.include?(tag.id)%>
						<%= tag.name %>
            <%= hidden_field_tag 'writing_conference[tag_ids][]', '' %>
					<% end %>
				<% end %>
			</div>
		</div>  
  
	</div>
  
  
<!--Wiget End-->
<!--Post Start-->

	<div id="post-body">
		<div id="post-body-content" class="clear">
		
			<div class="title">
				<%= f.label :year ,t("personal_conference.year")%>
				<%= select_year((@writing_conference.year ? @writing_conference.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_conference[year]'} ) %>
			</div>
			
			<ul class="nav nav-tabs">
				<% @site_in_use_locales.each_with_index do |locale, i| %>
			    <li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
				<% end %>
			</ul>
			
			<div class="title">
				<%= f.label :period_start_date ,t("personal_conference.period_start_date")%>
				<%= f.date_select :period_start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
			</div>
			
			<div class="title">
				<%= f.label :period_end_date ,t("personal_conference.period_end_date")%>
				<%= f.date_select :period_end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
			</div>
			
			<div class="tab-content">
			
				<% @site_in_use_locales.each_with_index do |locale, i| %>
				
				<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
					<div class="title">
						<%= f.label :paper_title ,t("personal_conference.paper_title")%>
						<%= f.fields_for :paper_title_translations do |f| %>
							<%= I18nVariable.from_locale(locale) %>
							<%= f.text_field locale, :class=>'post-title', :value => (@writing_conference.paper_title_translations[locale] rescue nil) %>
						<% end %>
					</div>
					
					<div class="title">
						<%= f.label :conference_title ,t("personal_conference.conference_title")%>
						<%= f.fields_for :conference_title_translations do |f| %>
							<%= I18nVariable.from_locale(locale) %>
							<%= f.text_field locale, :class=>'post-title', :value => (@writing_conference.conference_title_translations[locale] rescue nil) %>
						<% end %>
					</div>
					
					<div class="title">
						<%= f.label :location ,t("personal_conference.location")%>
						<%= f.fields_for :location_translations do |f| %>
							<%= I18nVariable.from_locale(locale) %>
							<%= f.text_field locale, :class=>'post-title', :value => (@writing_conference.location_translations[locale] rescue nil) %>
						<% end %>
					</div>
					
					<div class="title">
						<%= f.label :sponsor ,t("personal_conference.sponsor")%>
						<%= f.fields_for :sponsor_translations do |f| %>
							<%= I18nVariable.from_locale(locale) %>
							<%= f.text_field locale, :class=>'post-title', :value => (@writing_conference.sponsor_translations[locale] rescue nil) %>
						<% end %>
					</div>

					<div class="title">
						<%= f.label :authors,t("web_resource.authors") %>
						<%= f.fields_for :authors_translations do |f| %>
								<%= I18nVariable.from_locale(locale) %>
								<%= f.text_area locale, :size => "60x3", :value => (@writing_conference.authors_translations[locale] rescue nil) %>
						<% end %>
					</div>
					
				</div>

				<% end %>
				
			</div>
			
			<div class="title">
				<%= f.label :publication_date ,t("personal_conference.publication_date")%>
				<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month, :day] }, {:class => 'span1'} %>
			</div>

			<div class="title">
				<%= f.label :url, t("personal_conference.url") %>
				<%= f.text_field :url %>
			</div>
			
			<div class="title">
				<%= f.label :keywords, t("personal_conference.keywords") %>
				<%= f.text_field :keywords %>
			</div>

			<div class="title">
				<%= f.label :abstract, t("personal_conference.abstract") %>
				<%= f.text_field :abstract %>
			</div>

			<div class="title">
				<%= f.label :language, t("personal_journal.language") %>
				<%= f.select :language, WritingConference::LANGUAGE_TYPES, :prompt => 'Select' %>
			</div>

			<div class="title">
				<%= f.label :note, t("personal_conference.note") %>
				<%= f.text_area :note, :size => "60x3" %>
			</div>
			
		</div>
		
		
		
		
			
		<div>
					
			<div id='plugin_files' class="plugin_files_block">
				
			<table class="table table-condensed">
				<thead>
					<tr>
						<th>File</th>
						<th>File Name</th>
						<th class="span1"></th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<td style="text-align:center" colspan="3">
							<div id='add_plugin_file' class="info_input plugin_files_block">
								<%= hidden_field_tag 'plugin_file_field_count', @writing_conference.writing_conference_files.count %>
								<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
							</div>
						</td>
					</tr>
				
				</tfoot>
				<tbody>
					
					<% @writing_conference.writing_conference_files.each_with_index do |writing_conference_file, i| %>
						<%= f.fields_for :writing_conference_files, writing_conference_file do |f| %>
							<%= render :partial => 'form_file', :object => writing_conference_file, :locals => {:f => f, :i => i} %>
						<% end %>
					<% end %>	
				</tbody>
			</table>
			
			</div>
			
		</div>
		
		
		
		
		
		
	</div>
	
<!--Post End-->

  
	<div class="form-actions">
	<%= f.submit t('submit'), :class=>'btn btn-primary' %>
	<%= link_to t('cancel'), get_go_back, :class=>"btn" %> 
	</div> 
	

<% content_for :page_specific_javascript do %>
	<%= javascript_include_tag "archive_plugin_form" %>
	<script>
		$('#add_plugin_file a.add').live('click', function(){
			var new_id = $(this).prev().attr('value');
			var old_id = new RegExp("new_add_plugin_files", "g");
			$(this).prev().attr('value', parseInt(new_id) + 1);
			$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_conference_files) %>").replace(old_id, new_id));
		});
		
		$('.add_plugin_files_block a.delete').live('click', function(){
		  $(this).parents('.list_item').remove();
		});

		$('.action a.remove_existing_record').live('click', function(){
		  $(this).next('.should_destroy').attr('value', 1);
		  $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
		});

	</script>
<% end %>
