diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,8 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper + SYSTEM_MODE_CONF_KEY = 'system.mode' + def user_header menu_items = '' user = User.find(session[:user_id]) @@ -21,9 +23,12 @@ # main page append_to menu_items, '[Main]', 'main', 'list' append_to menu_items, '[Messages]', 'messages', 'list' - append_to menu_items, '[Tasks]', 'tasks', 'list' - append_to menu_items, '[Submissions]', 'main', 'submission' - append_to menu_items, '[Test]', 'test', 'index' + + if (user!=nil) and (Configuration.show_tasks_to?(user)) + append_to menu_items, '[Tasks]', 'tasks', 'list' + append_to menu_items, '[Submissions]', 'main', 'submission' + append_to menu_items, '[Test]', 'test', 'index' + end append_to menu_items, '[Help]', 'main', 'help' #append_to menu_items, '[Settings]', 'users', 'index' append_to menu_items, '[Log out]', 'main', 'login' @@ -48,19 +53,44 @@ st + time.strftime("%X") end + def read_textfile(fname,max_size=2048) + begin + File.open(fname).read(max_size) + rescue + nil + end + end def user_title_bar(user) - if user.site!=nil and user.site.finished? - contest_over_string = < THE CONTEST IS OVER CONTEST_OVER end + + # + # if the contest is in the anaysis mode + if Configuration[SYSTEM_MODE_CONF_KEY]=='analysis' + header = < +ANALYSIS MODE + +ANALYSISMODE + end + + # + # build real title bar < -#{contest_over_string} +#{header}
#{user.full_name}
@@ -73,12 +103,4 @@ TITLEBAR end - def read_textfile(fname,max_size=2048) - begin - File.open(fname).read(max_size) - rescue - nil - end - end - end