Show More
Commit Description:
[web] added mode + access control, when sites started/finished...
Commit Description:
[web] added mode + access control, when sites started/finished git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@250 6386c4cd-e34a-4fa8-8920-d93eb39b512e
File last commit:
Show/Diff file:
Action:
app/helpers/application_helper.rb | 106 lines | 2.8 KiB | text/x-ruby | RubyLexer |
pramook
initial commit...
r0 # Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
jittat
added user settings...
r13
jittat
[web] added mode + access control, when sites started/finished...
r122 SYSTEM_MODE_CONF_KEY = 'system.mode'
jittat
small changes, layouts...
r22 def user_header
jittat
test interface upload...
r36 menu_items = ''
jittat
added user settings...
r13 user = User.find(session[:user_id])
jittat
clean up layouts...
r25
jittat
[web] improved log-in & roles efficiency...
r104 if (user!=nil) and (session[:admin])
jittat
[web] small styling, split out admin's menu, put config into table.info...
r77 # admin menu
menu_items << "<b>Administrative task:</b> "
jittat
[web] added announcement...
r97 append_to menu_items, '[Announcements]', 'announcements', 'index'
jittat
[web] added message feature...
r102 append_to menu_items, '[Msg console]', 'messages', 'console'
jittat
[web] small styling, split out admin's menu, put config into table.info...
r77 append_to menu_items, '[Problem admin]', 'problems', 'index'
append_to menu_items, '[User admin]', 'user_admin', 'index'
append_to menu_items, '[User stat]', 'user_admin', 'user_stat'
jittat
[web] updated grader monitoring...
r105 append_to menu_items, '[Graders]', 'graders', 'list'
jittat
[web] small styling, split out admin's menu, put config into table.info...
r77 append_to menu_items, '[Site config]', 'configurations', 'index'
menu_items << "<br/>"
end
jittat
clean up layouts...
r25 # main page
jittat
test interface upload...
r36 append_to menu_items, '[Main]', 'main', 'list'
jittat
[web] added message feature...
r102 append_to menu_items, '[Messages]', 'messages', 'list'
jittat
[web] added mode + access control, when sites started/finished...
r122
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
jittat
[web] added help page...
r107 append_to menu_items, '[Help]', 'main', 'help'
#append_to menu_items, '[Settings]', 'users', 'index'
jittat
test interface upload...
r36 append_to menu_items, '[Log out]', 'main', 'login'
menu_items
end
def append_to(option,label, controller, action)
option << ' ' if option!=''
option << link_to_unless_current(label,
:controller => controller,
:action => action)
jittat
added user settings...
r13 end
jittat
[web] fixing ticket #10...
r65 def format_short_time(time)
jittat
[web] more use of utc time...
r120 now = Time.now.gmtime
jittat
[web] fixing ticket #10...
r65 st = ''
if (time.yday != now.yday) or
(time.year != now.year)
st = time.strftime("%x ")
end
st + time.strftime("%X")
end
jittat
[web] added mode + access control, when sites started/finished...
r122 def read_textfile(fname,max_size=2048)
begin
File.open(fname).read(max_size)
rescue
nil
end
end
jittat
more styling...
r78
def user_title_bar(user)
jittat
[web] added mode + access control, when sites started/finished...
r122 header = ''
#
# if the contest is over
if Configuration[SYSTEM_MODE_CONF_KEY]=='contest' and
user.site!=nil and user.site.finished?
header = <<CONTEST_OVER
jittat
[web] added site and time out basic functionality...
r85 <tr><td colspan="2" align="center">
<span class="contest-over-msg">THE CONTEST IS OVER</span>
</td></tr>
CONTEST_OVER
end
jittat
[web] added mode + access control, when sites started/finished...
r122
#
# if the contest is in the anaysis mode
if Configuration[SYSTEM_MODE_CONF_KEY]=='analysis'
header = <<ANALYSISMODE
<tr><td colspan="2" align="center">
<span class="contest-over-msg">ANALYSIS MODE</span>
</td></tr>
ANALYSISMODE
end
#
# build real title bar
jittat
more styling...
r78 <<TITLEBAR
<div class="title">
<table>
jittat
[web] added mode + access control, when sites started/finished...
r122 #{header}
jittat
more styling...
r78 <tr>
<td class="left-col">
#{user.full_name}<br/>
jittat
[web] more use of utc time...
r120 Current time is #{format_short_time(Time.new.gmtime)} UTC<br/>
jittat
more styling...
r78 </td>
<td class="right-col">APIO'08</td>
</tr>
</table>
</div>
TITLEBAR
end
pramook
initial commit...
r0 end