Automatic generation produced by ISE Eiffel
indexing
description: "handler for event related requests"
author: "Peizhu Li, <lip@student.ethz.ch>"
date: "$05.02.2008$"
revision: "$0.8.1$"
class
EVENT_HANDLER
inherit
INFORMATICS_HANDLER
redefine
make
end
APPLICATION_CONSTANTS
create
make
feature -- access
event_dao: EVENT_DAO
-- all events
feature -- creation
make
-- handler initialization
do
Precursor {INFORMATICS_HANDLER}
end
feature -- process request
handling_request
-- dispatching requests to relevant handling routines, processing request
require else
context /= Void
do
create {EVENT_DAO_FILE_IMPL} event_dao.make (context.config.get_constant ("app_data_folder"), context.config.get_constant ("event_list_data_file_name"), context.config.get_constant ("event_id_generator_data_file_name"))
create return_view.make (context.config.template)
if context.command_string.is_equal ("eventform") then
display_event_form
elseif context.command_string.is_equal ("save") then
validate_and_save_event
elseif context.command_string.is_equal ("delete") then
delete_event
display_event_list
elseif context.command_string.is_equal ("approve") then
approve_event
display_event_list
elseif context.command_string.is_equal ("reject") then
reject_event
display_event_list
elseif context.command_string.is_equal ("details") then
display_event_details
elseif context.command_string.is_equal ("logout") then
logout_user
display_event_list
elseif context.command_string.is_equal ("list") then
display_event_list
elseif context.command_string.is_equal ("past") or context.command_string.is_equal ("approved") or context.command_string.is_equal ("rejected") then
display_event_list
elseif context.command_string.is_equal ("ownevents") then
display_event_list
else
redirect_to_invalid_request_page
end
end
feature {NONE} -- implementation
------------------------------------------------------------------------------------------------
approve_event
-- handling a "Approve Event" request, check permission and event_id parameter, update event status as "Approved" if ok, display notification message.
local
id: NATURAL_64
the_event: EVENT
do
if actual_user.role /= role_administrator then
redirect_to_permission_denied_page
elseif not context.field_defined ("event_id") then
redirect_to_invalid_request_page
else
id := context.text_field_value ("event_id").to_natural_64
the_event := event_dao.get_event_by_id (id)
if the_event /= Void then
the_event.set_status (accepted)
event_dao.update_event (the_event)
event_dao.persist_data
end
end
return_view.enable_section ("EVENT_UPDATED")
return_view.replace_marker_with_string ("UPDATE_MESSAGE", "Event approved.")
end
reject_event
-- handling a "reject Event" request, check permission and event_id parameter, update event status as "Rejected" if ok, display notification message.
local
id: NATURAL_64
the_event: EVENT
do
if actual_user.role /= role_administrator then
redirect_to_permission_denied_page
elseif not context.field_defined ("event_id") then
redirect_to_invalid_request_page
else
id := context.text_field_value ("event_id").to_natural_64
the_event := event_dao.get_event_by_id (id)
if the_event /= Void then
the_event.set_status (rejected)
event_dao.update_event (the_event)
event_dao.persist_data
end
return_view.enable_section ("EVENT_UPDATED")
return_view.replace_marker_with_string ("UPDATE_MESSAGE", "Event rejected.")
end
end
delete_event
-- handling a "delete event" request, check permission and "event_id" parameter, delete event if permission ok and display notification message.
local
id: NATURAL_64
the_event: EVENT
do
if not context.field_defined ("event_id") then
redirect_to_invalid_request_page
else
id := context.text_field_value ("event_id").to_natural_64
the_event := event_dao.get_event_by_id (id)
if actual_user.role /= role_administrator and then not (the_event /= Void and then the_event.submitted_by.is_equal (actual_user.username) and then the_event.event_status = proposed) then
redirect_to_permission_denied_page
else
if the_event /= Void then
event_dao.delete_event (the_event)
event_dao.persist_data
end
return_view.enable_section ("EVENT_UPDATED")
return_view.replace_marker_with_string ("UPDATE_MESSAGE", "Event deleted.")
end
end
end
display_event_details
-- Handling request, generate "Event Details" page
local
id: NATURAL_64
the_event: EVENT
admin_command: STRING_8
do
if context.field_defined ("event_id") then
id := context.text_field_value ("event_id").to_natural_64
the_event := event_dao.get_event_by_id (id)
check
found_event: the_event /= Void
end
if actual_user.role = role_administrator or (the_event.submitted_by.is_equal (actual_user.username) and then the_event.event_status = proposed) then
admin_command := "{
<td style="padding: 0px 10px 0px 0px">
<a href="{#CGI_FILE_NAME#}?event&cmd=eventform&mode=edit&event_id={#event_id#}">Edit</a>
</td>
<td>
<a href="{#CGI_FILE_NAME#}?event&cmd=delete&event_id={#event_id#}">Delete</a>
</td>
}"
return_view.replace_marker_with_string ("ADMIN_EVENT_COMMAND", admin_command)
return_view.replace_marker_with_string ("event_id", id.out)
end
restore_event_data (the_event)
end
end
display_event_list
-- generate an event-list view
local
table_content: STRING_8
a_event: EVENT
odd_row: BOOLEAN
the_event_list: EVENT_LIST
today: DATE
listed_days: INTEGER_32
sorter: SORT_HELPER
view: STRING_8
do
if actual_user.role = role_administrator then
create return_view.make (context.config.get_constant ("adminlist_template"))
end
if context.field_defined ("view") and then not context.text_field_value ("view").is_empty then
create view.make_from_string (context.text_field_value ("view"))
else
create view.make_from_string (context.command_string)
end
create a_event.make
create table_content.make_empty
create today.make_now
listed_days := context.config.get_constant ("listed_days").to_integer
event_dao.event_list.start
the_event_list := event_dao.event_list.duplicate (event_dao.event_list.count)
create sorter
sorter.sort_event_list_by_starting_date (the_event_list)
if the_event_list.count > 0 then
the_event_list.start
odd_row := True
from
the_event_list.start
until
the_event_list.after
loop
if actual_user.role /= role_administrator then
if view.is_equal ("ownevents") then
if the_event_list.item.submitted_by.is_equal (actual_user.email) then
table_content.append (format_event_for_list (the_event_list.item, odd_row))
odd_row := not odd_row
end
elseif the_event_list.item.event_status = accepted then
if view.is_equal ("past") then
if today.days - the_event_list.item.starting_date.days > listed_days then
table_content.append (format_event_for_list (the_event_list.item, odd_row))
odd_row := not odd_row
end
else
if today.days - the_event_list.item.starting_date.days <= listed_days then
table_content.append (format_event_for_list (the_event_list.item, odd_row))
odd_row := not odd_row
end
end
end
else
if view.is_equal ("approved") then
if the_event_list.item.event_status = accepted then
table_content.append (format_event_for_adminlist (the_event_list.item, odd_row))
odd_row := not odd_row
end
elseif view.is_equal ("rejected") then
if the_event_list.item.event_status = rejected then
table_content.append (format_event_for_adminlist (the_event_list.item, odd_row))
odd_row := not odd_row
end
else
if the_event_list.item.event_status = proposed then
table_content.append (format_event_for_adminlist (the_event_list.item, odd_row))
odd_row := not odd_row
end
end
end
the_event_list.forth
end
end
if view.is_equal ("ownevents") then
return_view.replace_marker_with_string ("EVENT_LIST_TITLE", "Submitted Events")
elseif view.is_equal ("past") then
return_view.replace_marker_with_string ("EVENT_LIST_TITLE", "Past Events")
elseif view.is_equal ("approved") then
return_view.replace_marker_with_string ("EVENT_LIST_TITLE", "Approved Events")
elseif view.is_equal ("rejected") then
return_view.replace_marker_with_string ("EVENT_LIST_TITLE", "Rejected Events")
elseif actual_user.role = role_administrator then
return_view.replace_marker_with_string ("EVENT_LIST_TITLE", "Proposed Events")
else
return_view.replace_marker_with_string ("EVENT_LIST_TITLE", "Current Events")
end
if actual_user.role = role_administrator then
if view.is_equal ("approved") then
return_view.enable_alternative_section ("EVENT_VIEW", 1)
elseif view.is_equal ("rejected") then
return_view.enable_alternative_section ("EVENT_VIEW", 2)
end
end
return_view.replace_marker_with_string ("EVENT_LIST", table_content)
if actual_user.role /= role_guest then
return_view.remove_section ("GUEST_INFORMATION")
if actual_user.role = role_normal_user then
return_view.enable_section ("USER_INFORMATION")
end
end
end
logout_user
-- logout user
do
create actual_user.make
my_session.set_email ("")
my_session.set_username ("")
end
validate_and_save_event
-- validate event submission form, save/update event to storage
local
error_messages: HASH_TABLE [STRING_8, STRING_8]
error_string: STRING_8
mode: STRING_8
event_id: STRING_8
new_event, tmp_event: EVENT
do
create new_event.make
error_messages := validate_event_form (new_event)
if error_messages.count = 0 then
if context.field_defined ("mode") then
mode := context.text_field_value ("mode")
if mode.is_equal ("edit") then
if not context.field_defined ("event_id") then
redirect_to_invalid_request_page
else
event_id := context.text_field_value ("event_id")
new_event.set_id (event_id.to_natural_64)
tmp_event := event_dao.get_event_by_id (event_id.to_natural_64)
if actual_user.role /= role_administrator and then not (tmp_event /= Void and then tmp_event.submitted_by.is_equal (actual_user.username) and then tmp_event.event_status = proposed) then
redirect_to_permission_denied_page
else
if tmp_event /= Void then
if actual_user.role /= role_administrator then
new_event.set_status (tmp_event.event_status)
new_event.set_submitter (tmp_event.submitted_by)
end
event_dao.update_event (new_event)
end
event_dao.persist_data
return_view.replace_marker_with_string ("FORM_TITLE", "Event Saved")
return_view.remove_section ("USER_EVENT_SUBMIT_NOTICE")
return_view.remove_section ("EVENT_UPDATE_SUCEEDED_SUBMIT")
return_view.enable_section ("EVENT_UPDATE_SUCEEDED_EDIT")
return_view.replace_marker_with_string ("SUCCEED_MESSAGE", "Event saved.")
if actual_user.role = role_administrator then
return_view.enable_section ("ADMINISTRATOR_INFORMATION")
end
restore_event_data (new_event)
return_view.replace_marker_with_string ("event_id", event_id.out)
return_view.replace_marker_with_string ("FORM_TITLE", "Edit Event")
return_view.replace_marker_with_string ("BUTTON_TEXT", "Save")
return_view.replace_marker_with_string ("SAVE_MODE", "edit")
end
end
else
event_dao.event_id_generator.generate_next_id
new_event.set_id (event_dao.event_id_generator.id)
new_event.set_status (proposed)
new_event.set_submitter (actual_user.username)
event_dao.add_event (new_event)
event_dao.persist_data
return_view.replace_marker_with_string ("FORM_TITLE", "Event Submitted")
if actual_user.role = role_administrator then
return_view.remove_section ("USER_EVENT_SUBMIT_NOTICE")
return_view.enable_section ("EVENT_UPDATE_SUCEEDED_EDIT")
return_view.replace_marker_with_string ("SUCCEED_MESSAGE", "Event submitted.")
return_view.replace_marker_with_string ("BUTTON_TEXT", "Submit")
else
return_view.remove_section ("USER_EVENT_SUBMIT_NOTICE")
return_view.remove_section ("USER_EVENT_SUBMIT_FORM")
return_view.enable_section ("EVENT_UPDATE_SUCEEDED_SUBMIT")
end
end
end
end
if error_messages.count > 0 then
return_view.enable_section ("VALIDATION_ERROR_MESSAGES")
error_string := expand_error_string (error_messages)
return_view.replace_marker_with_string ("ERROR_MESSAGES", error_string)
restore_event_data (new_event)
display_event_form
end
end
display_event_form
-- update and display the event submission form based on current context (administrators/users, new event/modify a existing event)
local
actual_event: EVENT
event_id: STRING_8
do
if actual_user.role = role_administrator then
return_view.remove_section ("USER_EVENT_SUBMIT_NOTICE")
end
if context.field_defined ("mode") then
if context.text_field_value ("mode").is_equal ("add") then
return_view.replace_marker_with_string ("FORM_TITLE", "Submit Event")
return_view.replace_marker_with_string ("BUTTON_TEXT", "Submit")
return_view.replace_marker_with_string ("SAVE_MODE", "add")
elseif context.text_field_value ("mode").is_equal ("edit") and then context.field_defined ("event_id") then
event_id := context.text_field_value ("event_id")
actual_event := event_dao.get_event_by_id (event_id.to_natural_64)
check
found_event_by_id: actual_event /= Void
end
restore_event_data (actual_event)
return_view.replace_marker_with_string ("event_id", event_id.out)
return_view.replace_marker_with_string ("FORM_TITLE", "Edit Event")
return_view.replace_marker_with_string ("BUTTON_TEXT", "Save")
return_view.replace_marker_with_string ("SAVE_MODE", "edit")
end
if actual_user.role = role_administrator then
return_view.enable_section ("ADMINISTRATOR_INFORMATION")
return_view.replace_marker_with_string ("submitted_by", actual_user.email)
end
end
end
feature {NONE} -- event list
format_event_for_list (an_event: EVENT; odd_row: BOOLEAN): STRING_8
-- format an_event into a specific row in a HTML Table as expected in the predefined HTML template (for normal user/guest's event-list view)
local
left_border_class, mid_class, right_border_class: STRING_8
empty_date: DATE
do
create empty_date.make_day_month_year (1, 1, 1111)
if odd_row then
left_border_class := "position_row_odd_left_border"
mid_class := "position_row_odd"
right_border_class := "position_row_odd_right_border"
else
left_border_class := "position_row_even_left_border"
mid_class := "position_row_even"
right_border_class := "position_row_even_right_border"
end
create Result.make_empty
Result.append ("<tr><td class=%"" + left_border_class + "%"><a href=%"{#CGI_FILE_NAME#}?event&cmd=details&event_id=" + an_event.id.out + "%">" + an_event.name + "</a></td>%N")
Result.append (" <td class=%"" + mid_class + "%">" + an_event.starting_date.formatted_out ("[0]dd/[0]mm/yyyy") + " - " + an_event.ending_date.formatted_out ("[0]dd/[0]mm/yyyy") + "</td>%N")
Result.append (" <td class=%"" + mid_class + "%">" + an_event.city + "</td>%N")
Result.append (" <td class=%"" + mid_class + "%">" + an_event.country + "</td>%N")
if not an_event.papers_submission_deadline.is_equal (empty_date) then
Result.append (" <td class=%"" + mid_class + "%">" + an_event.papers_submission_deadline.formatted_out ("[0]dd/[0]mm/yyyy") + "</td>%N")
else
Result.append (" <td class=%"" + mid_class + "%"> </td>%N")
end
Result.append (" <td class=%"" + mid_class + "%">" + an_event.main_sponsor + "</td>%N")
Result.append (" <td class=%"" + right_border_class + "%">" + an_event.proceedings_publisher + "</td>%N</tr>%N")
end
format_event_for_adminlist (an_event: EVENT; odd_row: BOOLEAN): STRING_8
-- format an_event into a specific row in a HTML Table as expected in the predefined HTML template (for administrator's event-list view)
local
left_border_class, mid_class, right_border_class: STRING_8
edit, approve, reject, delete: STRING_8
view: STRING_8
do
if odd_row then
left_border_class := "position_row_odd_left_border"
mid_class := "position_row_odd"
right_border_class := "position_row_odd_right_border"
else
left_border_class := "position_row_even_left_border"
mid_class := "position_row_even"
right_border_class := "position_row_even_right_border"
end
if context.field_defined ("view") and then not context.text_field_value ("view").is_empty then
create view.make_from_string (context.text_field_value ("view"))
else
create view.make_from_string (context.command_string)
end
edit := "<a href=%"{#CGI_FILE_NAME#}?event&cmd=eventform&mode=edit&event_id=" + an_event.id.out + "%">Edit</a>"
if an_event.event_status.is_equal (proposed) then
approve := "<a href=%"{#CGI_FILE_NAME#}?event&cmd=approve&event_id=" + an_event.id.out + "&view=" + view + "%">Approve</a>"
reject := "<a href=%"{#CGI_FILE_NAME#}?event&cmd=reject&event_id=" + an_event.id.out + "&view=" + view + "%">Reject</a>"
delete := "<a href=%"{#CGI_FILE_NAME#}?event&cmd=delete&event_id=" + an_event.id.out + "&view=" + view + "%">Delete</a>"
elseif an_event.event_status.is_equal (accepted) then
approve := ""
reject := ""
delete := "<a href=%"{#CGI_FILE_NAME#}?event&cmd=delete&event_id=" + an_event.id.out + "&view=" + view + "%">Delete</a>"
elseif an_event.event_status.is_equal (rejected) then
approve := ""
reject := ""
delete := "<a href=%"{#CGI_FILE_NAME#}?event&cmd=delete&event_id=" + an_event.id.out + "&view=" + view + "%">Delete</a>"
else
approve := ""
reject := ""
delete := "<a href=%"{#CGI_FILE_NAME#}?event&cmd=delete&event_id=" + an_event.id.out + "&view=" + view + "%">Delete</a>"
end
create Result.make_empty
Result.append ("<tr><td class=%"" + left_border_class + "%"><a href=%"{#CGI_FILE_NAME#}?event&cmd=details&event_id=" + an_event.id.out + "%">" + an_event.name + "</a></td>%N")
Result.append (" <td class=%"" + mid_class + "%">" + an_event.starting_date.formatted_out ("[0]dd/[0]mm/yyyy") + " - " + an_event.ending_date.formatted_out ("[0]dd/[0]mm/yyyy") + "</td>%N")
Result.append (" <td class=%"" + mid_class + "%">" + an_event.city + "</td>%N")
Result.append (" <td class=%"" + mid_class + "%">" + an_event.country + "</td>%N")
Result.append (" <td class=%"" + mid_class + "%">" + an_event.main_sponsor + "</td>%N")
Result.append (" <td class=%"" + mid_class + "%"><a href=%"{#CGI_FILE_NAME#}?user&cmd=details&user_id=" + an_event.submitted_by + "%">" + an_event.submitted_by + "</a></td>%N")
Result.append (" <td class=%"" + mid_class + "%" align=%"right%">" + edit + "</td>%N")
Result.append (" <td class=%"" + mid_class + "%" align=%"right%">" + approve + "</td>%N")
Result.append (" <td class=%"" + mid_class + "%" align=%"right%">" + reject + "</td>%N")
Result.append (" <td class=%"" + right_border_class + "%">" + delete + "</td>%N</tr>%N")
end
feature {NONE} -- event form
parse_date_string (value: STRING_8): DATE
-- parsing a DD/MM/YYYY string, return a Date object when success or void if failed
local
day, month, year: INTEGER_32
month_start, year_start: INTEGER_32
date_checker: DATE_VALIDITY_CHECKER
do
if value.has ('/') then
month_start := value.index_of ('/', 1)
day := value.substring (1, month_start - 1).to_integer
end
if month_start > 0 then
year_start := value.index_of ('/', month_start + 1)
if year_start > 0 then
month := value.substring (month_start + 1, year_start - 1).to_integer
end
end
if year_start > 0 then
year := value.substring (year_start + 1, value.count).to_integer
end
create date_checker
if date_checker.is_correct_date (year, month, day) then
create Result.make_day_month_year (day, month, year)
else
Result := Void
end
end
validate_event_form (an_event: EVENT): HASH_TABLE [STRING_8, STRING_8]
-- validate the event submission form, save and return a [Error-Message, Form-Field] table for validation failures
-- an_event is updated with user inputs
require
environment_set: context /= Void
local
validator: FORM_VALIDATOR
error_string_table: HASH_TABLE [STRING_8, STRING_8]
a_date: DATE
temp_keywords, temp_additional_sponsors: ARRAYED_LIST [STRING_8]
do
create validator.make (context)
create error_string_table.make (100)
if not validator.is_must_field_filled ("event_name") then
error_string_table.put ("Event name must be specified.", "Event name")
else
an_event.set_name (validator.get_field_string ("event_name"))
end
if not validator.is_must_field_filled ("start_date") then
error_string_table.put ("Starting date must be specified.", "Starting date")
else
a_date := parse_date_string (validator.get_field_string ("start_date"))
if a_date /= Void then
an_event.set_starting_date (a_date)
else
error_string_table.put ("Starting date is invalid.", "Starting date")
end
end
if not validator.is_must_field_filled ("end_date") then
error_string_table.put ("Ending date must be specified.", "Ending date")
else
a_date := parse_date_string (validator.get_field_string ("end_date"))
if a_date /= Void then
an_event.set_ending_date (a_date)
else
error_string_table.put ("Ending date is invalid.", "Ending date")
end
end
if not validator.is_must_field_filled ("city") then
error_string_table.put ("The city must be specified.", "City")
else
an_event.set_city (validator.get_field_string ("city"))
end
if not validator.is_must_field_filled ("country") or validator.get_field_string ("country").is_equal ("Please choose") then
error_string_table.put ("The Country must be specified.", "Country")
else
an_event.set_country (validator.get_field_string ("country"))
end
if not validator.is_must_field_filled ("deadline") then
error_string_table.put ("The paper submission deadline must be specified.", "Deadline")
else
a_date := parse_date_string (validator.get_field_string ("deadline"))
if a_date /= Void then
an_event.set_papers_submission_deadline (a_date)
else
error_string_table.put ("Paper submission deadline is invalid.", "Paper submission deadline")
end
end
if not validator.is_must_field_filled ("sponsor") then
error_string_table.put ("The main sponsor must be specified.", "Main sponsor")
else
an_event.set_main_sponsor (validator.get_field_string ("sponsor"))
end
if not validator.is_must_field_filled ("conference_url") then
error_string_table.put ("An url for the event must be specified.", "Conference url")
else
an_event.set_url (validator.get_field_string ("conference_url"))
end
if not validator.is_must_field_filled ("contact_name") then
error_string_table.put ("A contact person must be specified.", "Contact name")
else
an_event.set_contact_name (validator.get_field_string ("contact_name"))
end
if not validator.is_must_field_filled ("contact_email") then
error_string_table.put ("A email for contact must be specified.", "Contact email")
else
an_event.set_contact_email (validator.get_field_string ("contact_email"))
end
if not validator.is_must_field_filled ("contact_role") then
error_string_table.put ("The role of the given contact must be specified.", "Contact role")
else
an_event.set_contact_role (validator.get_field_string ("contact_role"))
end
create temp_keywords.make_filled (5)
temp_keywords [1] := validator.get_field_string ("keyword_1")
temp_keywords [2] := validator.get_field_string ("keyword_2")
temp_keywords [3] := validator.get_field_string ("keyword_3")
temp_keywords [4] := validator.get_field_string ("keyword_4")
temp_keywords [5] := validator.get_field_string ("keyword_5")
an_event.set_keywords (temp_keywords)
create temp_additional_sponsors.make_filled (5)
temp_additional_sponsors [1] := validator.get_field_string ("sponsor_1")
temp_additional_sponsors [2] := validator.get_field_string ("sponsor_2")
temp_additional_sponsors [3] := validator.get_field_string ("sponsor_3")
temp_additional_sponsors [4] := validator.get_field_string ("sponsor_4")
temp_additional_sponsors [5] := validator.get_field_string ("sponsor_5")
an_event.set_additional_sponsors (temp_additional_sponsors)
an_event.set_short_description (validator.get_field_string ("description"))
an_event.set_additional_notes (validator.get_field_string ("notes"))
an_event.set_conference_chair_1 (validator.get_field_string ("chair_1"))
an_event.set_conference_chair_2 (validator.get_field_string ("chair_2"))
an_event.set_program_committee_chair_1 (validator.get_field_string ("committee_1"))
an_event.set_program_committee_chair_2 (validator.get_field_string ("committee_2"))
an_event.set_organizing_chair (validator.get_field_string ("organization"))
an_event.set_proceeding_type (validator.get_field_string ("proceedings"))
an_event.set_proceedings_publisher (validator.get_field_string ("publisher"))
if actual_user.role = role_administrator then
an_event.set_submitter (validator.get_field_string ("submitted_by"))
if validator.get_field_string ("accepted").is_equal ("1") then
an_event.set_status (accepted)
elseif validator.get_field_string ("rejected").is_equal ("1") then
an_event.set_status (rejected)
else
an_event.set_status (proposed)
end
end
if validator.is_field_value_not_empty ("deadline_1") then
a_date := parse_date_string (context.text_field_value ("deadline_1"))
if a_date /= Void then
an_event.set_additional_deadline_1 (a_date)
else
error_string_table.put ("The first additional deadline is invalid.", "Additional deadline")
end
end
an_event.set_additional_deadline_specification_1 (validator.get_field_string ("topic_1"))
if validator.is_field_value_not_empty ("deadline_2") then
a_date := parse_date_string (context.text_field_value ("deadline_2"))
if a_date /= Void then
an_event.set_additional_deadline_2 (a_date)
else
error_string_table.put ("The second additional deadline is invalid.", "Additional deadline")
end
end
an_event.set_additional_deadline_specification_2 (validator.get_field_string ("topic_2"))
if validator.is_field_value_not_empty ("deadline_3") then
a_date := parse_date_string (context.text_field_value ("deadline_3"))
if a_date /= Void then
an_event.set_additional_deadline_3 (a_date)
else
error_string_table.put ("The third additional deadline is invalid.", "Additional deadline")
end
end
an_event.set_additional_deadline_specification_3 (validator.get_field_string ("topic_3"))
Result := error_string_table
end
restore_event_data (a_event: EVENT)
-- fill the event form with given event data
local
empty_date: DATE
s1, s2: STRING_8
do
create empty_date.make_day_month_year (1, 1, 1111)
s1 := ""
s2 := ""
return_view.replace_marker_with_string ("event_name", a_event.name)
if not a_event.starting_date.is_equal (empty_date) then
s1 := a_event.starting_date.day.out + "/" + a_event.starting_date.month.out + "/" + a_event.starting_date.year.out
return_view.replace_marker_with_string ("start_date", s1)
end
if not a_event.ending_date.is_equal (empty_date) then
s2 := a_event.ending_date.day.out + "/" + a_event.ending_date.month.out + "/" + a_event.ending_date.year.out
return_view.replace_marker_with_string ("end_date", s2)
end
return_view.replace_marker_with_string ("event_date", s1 + " - " + s2)
return_view.replace_marker_with_string ("city", a_event.city)
return_view.replace_marker_with_string ("country", a_event.country)
if not a_event.papers_submission_deadline.is_equal (empty_date) then
s1 := a_event.papers_submission_deadline.day.out + "/" + a_event.papers_submission_deadline.month.out + "/" + a_event.papers_submission_deadline.year.out
return_view.replace_marker_with_string ("deadline", s1)
end
return_view.replace_marker_with_string ("sponsor", a_event.main_sponsor)
return_view.replace_marker_with_string ("conference_url", a_event.url)
return_view.replace_marker_with_string ("contact_name", a_event.contact_name)
return_view.replace_marker_with_string ("contact_email", a_event.contact_email)
return_view.replace_marker_with_string ("contact_role", a_event.contact_role)
return_view.replace_marker_with_string ("keywords", a_event.keywords [1] + " " + a_event.keywords [2] + " " + a_event.keywords [3] + " " + a_event.keywords [4] + " " + a_event.keywords [5])
return_view.replace_marker_with_string ("keywords_1", a_event.keywords [1])
return_view.replace_marker_with_string ("keywords_2", a_event.keywords [2])
return_view.replace_marker_with_string ("keywords_3", a_event.keywords [3])
return_view.replace_marker_with_string ("keywords_4", a_event.keywords [4])
return_view.replace_marker_with_string ("keywords_5", a_event.keywords [5])
return_view.replace_marker_with_string ("additonal_sponsors", a_event.additional_sponsors [1] + " " + a_event.additional_sponsors [2] + " " + a_event.additional_sponsors [3] + " " + a_event.additional_sponsors [4] + " " + a_event.additional_sponsors [5])
return_view.replace_marker_with_string ("sponsors_1", a_event.additional_sponsors [1])
return_view.replace_marker_with_string ("sponsors_2", a_event.additional_sponsors [2])
return_view.replace_marker_with_string ("sponsors_3", a_event.additional_sponsors [3])
return_view.replace_marker_with_string ("sponsors_4", a_event.additional_sponsors [4])
return_view.replace_marker_with_string ("sponsors_5", a_event.additional_sponsors [5])
return_view.replace_marker_with_string ("description", a_event.short_description)
return_view.replace_marker_with_string ("notes", a_event.additional_notes)
return_view.replace_marker_with_string ("chair_1", a_event.conference_chair_1)
return_view.replace_marker_with_string ("chair_2", a_event.conference_chair_2)
return_view.replace_marker_with_string ("committee_1", a_event.program_committee_chair_1)
return_view.replace_marker_with_string ("committee_2", a_event.program_committee_chair_2)
return_view.replace_marker_with_string ("organization", a_event.organizing_chair)
return_view.replace_marker_with_string ("proceedings", a_event.proceeding_type)
return_view.replace_marker_with_string ("publisher", a_event.proceedings_publisher)
if not a_event.additional_deadline_1.is_equal (empty_date) then
s1 := a_event.additional_deadline_1.day.out + "/" + a_event.additional_deadline_1.month.out + "/" + a_event.additional_deadline_1.year.out
return_view.replace_marker_with_string ("deadline_1", s1)
end
if not a_event.additional_deadline_2.is_equal (empty_date) then
s1 := a_event.additional_deadline_2.day.out + "/" + a_event.additional_deadline_2.month.out + "/" + a_event.additional_deadline_2.year.out
return_view.replace_marker_with_string ("deadline_2", s1)
end
if not a_event.additional_deadline_3.is_equal (empty_date) then
s1 := a_event.additional_deadline_3.day.out + "/" + a_event.additional_deadline_3.month.out + "/" + a_event.additional_deadline_3.year.out
return_view.replace_marker_with_string ("deadline_3", s1)
end
return_view.replace_marker_with_string ("topic_1", a_event.additional_deadline_specification_1)
return_view.replace_marker_with_string ("topic_2", a_event.additional_deadline_specification_2)
return_view.replace_marker_with_string ("topic_3", a_event.additional_deadline_specification_3)
return_view.replace_marker_with_string ("SELECTED_COUNTRY", "<option value=%"" + a_event.country + "%" selected=%"selected%">" + a_event.country + "</option>")
return_view.replace_marker_with_string ("SELECTED_ROLE", "<option value=%"" + a_event.contact_role + "%" selected=%"selected%">" + a_event.contact_role + "</option>")
return_view.replace_marker_with_string ("SELECTED_PROCEEDING", "<option value=%"" + a_event.proceeding_type + "%" selected=%"selected%">" + a_event.proceeding_type + "</option>")
if not a_event.submitted_by.is_empty then
return_view.replace_marker_with_string ("submitted_by", a_event.submitted_by)
elseif not actual_user.email.is_empty then
return_view.replace_marker_with_string ("submitted_by", actual_user.email)
end
if a_event.event_status.is_equal (accepted) then
return_view.replace_marker_with_string ("accepted", "checked=%"checked%"")
elseif a_event.event_status.is_equal (rejected) then
return_view.replace_marker_with_string ("rejected", "checked=%"checked%"")
else
return_view.replace_marker_with_string ("proposed", "checked=%"checked%"")
end
end
invariant
invariant_clause: True
end -- class EVENT_HANDLER
-- Generated by ISE Eiffel --
For more details: www.eiffel.com