<% if ( current_user && current_user.admin? ) or session.instructor?( current_user ) %>
	<% if session.time && session.time > Time.now && !session.cancelled %>
		<%= javascript_include_tag 'modal' %>
		<div id="cancel-session-dialog" class="content-section">
			<h2>Cancel Session</h2>
			<p>
				Are you sure you want to cancel this class? All registered attendees will be notified that the session has been cancelled.
			</p>
			<%= form_tag({:action => 'show'}, { :method => :delete }) %>
				<%= label_tag "custom_message", "Reason for Cancellation (optional):", :class => 'field-label' %>
				<%= text_area_tag "custom_message", nil, :rows => 10, :cols => 60 %><br/>
				<%= submit_tag "Cancel Session" %>
				<%= link_to_function "Don't cancel", "cancel_modal.hide()" %>
			</form>
		</div>
		<script type="text/javascript">
			var cancel_modal = new modal($('cancel-session-dialog'));
			$('cancel-session-link').observe('click', function() {
				cancel_modal.show();
			});
		</script>
	<% end %>
<% end %>
<% if ( current_user && current_user.admin? ) or session.instructor?( current_user ) %>
	<% if !session.new_record? && session.time && session.time > Time.now && !session.cancelled %>
		<%= javascript_include_tag 'modal' %>
		<div id="cancel-session-dialog" class="content-section">
			<h2>Cancel Session</h2>
			<p>
				Are you sure you want to cancel this class? All registered attendees will be notified that the session has been cancelled.
			</p>
			<%= form_tag({:action => 'show'}, { :method => :delete }) %>
				<%= label_tag "custom_message", "Reason for Cancellation (optional):", :class => 'field-label' %>
				<%= text_area_tag "custom_message", nil, :rows => 10, :cols => 60 %><br/>
				<%= submit_tag "Cancel Session" %>
				<%= link_to_function "Don't cancel", "cancel_modal.hide()" %>
			</form>
		</div>
		<script type="text/javascript">
			var cancel_modal = new modal($('cancel-session-dialog'));
			$('cancel-session-link').observe('click', function() {
				cancel_modal.show();
			});
		</script>
	<% end %>
<% end %>
Fix crash when there is an error creating a new session
Fix crash when there is an error creating a new session
