Description:
add load button add more admin authorization
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r711:a65ea018c51c - - 2 files changed: 26 inserted, 1 deleted

@@ -7,24 +7,27
7 before_filter :authenticate, :except => [:new,
7 before_filter :authenticate, :except => [:new,
8 :register,
8 :register,
9 :confirm,
9 :confirm,
10 :forget,
10 :forget,
11 :retrieve_password]
11 :retrieve_password]
12
12
13 before_filter :verify_online_registration, :only => [:new,
13 before_filter :verify_online_registration, :only => [:new,
14 :register,
14 :register,
15 :forget,
15 :forget,
16 :retrieve_password]
16 :retrieve_password]
17 before_filter :authenticate, :profile_authorization, only: [:profile]
17 before_filter :authenticate, :profile_authorization, only: [:profile]
18
18
19 + before_filter :admin_authorization, only: [:stat, :toggle_activate, :toggle_enable]
20 +
21 +
19 verify :method => :post, :only => [:chg_passwd],
22 verify :method => :post, :only => [:chg_passwd],
20 :redirect_to => { :action => :index }
23 :redirect_to => { :action => :index }
21
24
22 #in_place_edit_for :user, :alias_for_editing
25 #in_place_edit_for :user, :alias_for_editing
23 #in_place_edit_for :user, :email_for_editing
26 #in_place_edit_for :user, :email_for_editing
24
27
25 def index
28 def index
26 if !GraderConfiguration['system.user_setting_enabled']
29 if !GraderConfiguration['system.user_setting_enabled']
27 redirect_to :controller => 'main', :action => 'list'
30 redirect_to :controller => 'main', :action => 'list'
28 else
31 else
29 @user = User.find(session[:user_id])
32 @user = User.find(session[:user_id])
30 end
33 end
@@ -18,51 +18,73
18 = hidden_field_tag 'submission[problem_id]', @problem.id
18 = hidden_field_tag 'submission[problem_id]', @problem.id
19 .form-group
19 .form-group
20 = label_tag "Task:"
20 = label_tag "Task:"
21 = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true
21 = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true
22 .form-group
22 .form-group
23 = label_tag "Description:"
23 = label_tag "Description:"
24 = link_to_description_if_any "[download] <span class='glyphicon glyphicon-file'></span>".html_safe, @problem
24 = link_to_description_if_any "[download] <span class='glyphicon glyphicon-file'></span>".html_safe, @problem
25
25
26 .form-group
26 .form-group
27 = label_tag 'Language:'
27 = label_tag 'Language:'
28 = select_tag 'language_id', options_from_collection_for_select(Language.all, 'id', 'pretty_name', @lang_id || Language.find_by_pretty_name("Python").id || Language.first.id), class: 'form-control select', style: "width: 100px"
28 = select_tag 'language_id', options_from_collection_for_select(Language.all, 'id', 'pretty_name', @lang_id || Language.find_by_pretty_name("Python").id || Language.first.id), class: 'form-control select', style: "width: 100px"
29 .form-group
29 .form-group
30 + .input-group
31 + %span.input-group-btn
32 + %span.btn.btn-default.btn-file
33 + Browse
34 + = file_field_tag 'load_file'
35 + = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
36 + .form-group
30 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
37 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
31 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
38 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
32 - # latest submission status
39 - # latest submission status
33 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
40 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
34 .panel-heading
41 .panel-heading
35 Latest Submission Status
42 Latest Submission Status
36 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
43 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
37 .panel-body
44 .panel-body
38 %div#latest_status
45 %div#latest_status
39 - if @submission
46 - if @submission
40 = render :partial => 'submission_short',
47 = render :partial => 'submission_short',
41 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
48 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
42 .row
49 .row
43 .col-md-12
50 .col-md-12
44 %h2 Console
51 %h2 Console
45 %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20}
52 %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20}
46
53
47 :javascript
54 :javascript
48 $(document).ready(function() {
55 $(document).ready(function() {
49 e = ace.edit("editor")
56 e = ace.edit("editor")
50 e.setValue($("#text_sourcecode").val());
57 e.setValue($("#text_sourcecode").val());
51 e.gotoLine(1);
58 e.gotoLine(1);
52 $("#language_id").trigger('change');
59 $("#language_id").trigger('change');
53 - brython();
60 +
61 + $("#load_file").on('change',function(evt) {
62 + var file = evt.target.files[0];
63 + var reader = new FileReader();
64 + reader.onload = function(theFile) {
65 + var e = ace.edit("editor")
66 + e.setValue(theFile.target.result);
67 + e.gotoLine(1);
68 + };
69 + reader.readAsText(file)
70 + });
71 +
72 + //brython();
54 });
73 });
55
74
56
75
76 +
77 +
78 +
57 %script#__main__{type:'text/python3'}
79 %script#__main__{type:'text/python3'}
58 :plain
80 :plain
59 import sys
81 import sys
60 import traceback
82 import traceback
61
83
62 from browser import document as doc
84 from browser import document as doc
63 from browser import window, alert, console
85 from browser import window, alert, console
64
86
65 _credits = """ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
87 _credits = """ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
66 for supporting Python development. See www.python.org for more information."""
88 for supporting Python development. See www.python.org for more information."""
67
89
68 _copyright = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
90 _copyright = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
You need to be logged in to leave comments. Login now