+
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
@@ -10,8 +10,8 @@
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
- <% end %>
- <% container.saved_attachments.each_with_index do |attachment, i| %>
+ <% end %>
+ <% container.saved_attachments.each_with_index do |attachment, i| %>
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
@@ -20,46 +20,34 @@
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
- <% end %>
-<% end %>
-
- <% project = project %>
-
- <%= button_tag l(:button_browse), :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()',:class => 'sub_btn', :style => ie8? ? 'display:none' : '' %>
- <%= file_field_tag 'attachments[dummy][file]',
- :id => '_file',
- :class => ie8? ? '' : 'file_selector',
- :multiple => true,
- :onchange => 'addInputFiles(this);',
- :style => ie8? ? '' : 'display:none',
- :data => {
- :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
- :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
- :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
- :upload_path => uploads_path(:format => 'js',:project =>project),
- :description_placeholder => l(:label_optional_description),
- :field_is_public => l(:field_is_public),
- :are_you_sure => l(:text_are_you_sure),
- :file_count => l(:label_file_count),
- :delete_all_files => l(:text_are_you_sure_all)
- } %>
-
- <%= l(:label_no_file_uploaded)%>
-
- (<%= l(:label_max_size) %>:
- <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
-
-
- <% content_for :header_tags do %>
- <%= javascript_include_tag 'attachments' %>
- <% end %>
+ <% end %>
+ <% end %>
+
+ <%= file_field_tag 'attachments[dummy][file]',
+ :id => '_file',
+ :class => ie8? ? '' : 'file_selector',
+ :multiple => true,
+ :onchange => 'addInputFiles(this);',
+ :style => ie8? ? '' : 'display:none',
+ :data => {
+ :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
+ :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
+ :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
+ :upload_path => uploads_path(:format => 'js',:project =>nil),
+ :description_placeholder => l(:label_optional_description),
+ :field_is_public => l(:field_is_public),
+ :are_you_sure => l(:text_are_you_sure),
+ :file_count => l(:label_file_count),
+ :delete_all_files => l(:text_are_you_sure_all)
+ } %>
+
+
-
-
-
-
-
-
-
\ No newline at end of file
+<% content_for :header_tags do %>
+ <%= javascript_include_tag 'attachments' %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb
index 3a4c3496c..90fa51715 100644
--- a/app/views/users/_user_homework_form.html.erb
+++ b/app/views/users/_user_homework_form.html.erb
@@ -2,20 +2,16 @@
@@ -30,27 +26,17 @@
-
+
+ <%= select_tag :course_id,options_for_select(get_as_teacher_courses(User.current),homework.course_id), {:class => "InputBox W700 SearchIcon"} %>
-
- <%= render :partial => 'attachments/new_form', :locals => {:container => homework} %>
-
-
+ <%= render :partial => 'users/user_homework_attachment', :locals => { :container => homework } %>
-
\ No newline at end of file
diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb
index 6476f9e71..7998128e0 100644
--- a/app/views/users/_user_homework_list.html.erb
+++ b/app/views/users/_user_homework_list.html.erb
@@ -30,7 +30,8 @@
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
- <% if is_teacher%>
+ <%# if is_teacher%>
+ <% if false%>
diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb
index 48666a0cb..0191dca7f 100644
--- a/app/views/users/user_homeworks.html.erb
+++ b/app/views/users/user_homeworks.html.erb
@@ -20,10 +20,18 @@
发布作业
<% homework = HomeworkCommon.new %>
- <%= labelled_form_for homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
+ <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
<%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
<% end%>
+
+<%else%>
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 6679151e3..f39542562 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -308,6 +308,7 @@ RedmineApp::Application.routes.draw do
resources :users do
collection do
match "tag_saveEx" , :via => [:get, :post]
+ post "user_new_homework"
end
member do
match 'user_projects_index', :to => 'users#user_projects_index', :via => :get
@@ -326,7 +327,7 @@ RedmineApp::Application.routes.draw do
match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
match 'watch_projects', :to => 'users#watch_projects', :via => :get
-
+ #
# added by bai
match 'show_score', :to => 'users#show_score', :via => :get
match 'topic_score_index', :to => 'users#topic_score_index', :via => [:get, :post]
diff --git a/db/schema.rb b/db/schema.rb
index a77eceb9a..6aa6da41d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -476,6 +476,13 @@ ActiveRecord::Schema.define(:version => 20150826061843) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
+ create_table "discuss_demos", :force => true do |t|
+ t.string "title"
+ t.text "body"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "documents", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.integer "category_id", :default => 0, :null => false
@@ -906,7 +913,6 @@ ActiveRecord::Schema.define(:version => 20150826061843) do
t.datetime "created_on"
t.integer "comments_count", :default => 0, :null => false
t.integer "course_id"
- t.datetime "updated_on"
end
add_index "news", ["author_id"], :name => "index_news_on_author_id"
@@ -1311,6 +1317,7 @@ ActiveRecord::Schema.define(:version => 20150826061843) do
t.datetime "updated_at", :null => false
t.integer "late_penalty", :default => 0
t.integer "absence_penalty", :default => 0
+ t.integer "system_score"
end
create_table "student_works_evaluation_distributions", :force => true do |t|
@@ -1528,7 +1535,6 @@ ActiveRecord::Schema.define(:version => 20150826061843) do
t.string "identity_url"
t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64
- t.integer "gid"
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js
index 42a1271cd..2b6b94eae 100644
--- a/public/javascripts/new_user.js
+++ b/public/javascripts/new_user.js
@@ -54,19 +54,34 @@ function show_more_project(url){
}
);
}
-//
-//$(function(){
-// $(".newsType").mouseover(function(){
-// $(".resourcesIcon").css({background:"url(images/resource_icon_list.png) 0px -25px no-repeat"});
-// });
-// $(".newsType").mouseout(function(){
-// $(".resourcesIcon").css({background:"url(images/resource_icon_list.png) 0px 0px no-repeat"});
-// });
-// $(".resourcesSelected").mouseover(function(){
-// $(".resourcesIcon").css({background:"url(images/resource_icon_list.png) 0px -25px no-repeat"});
-// });
-// $(".resourcesSelected").mouseout(function(){
-// $(".resourcesIcon").css({background:"url(images/resource_icon_list.png) 0px 0px no-repeat"});
-// });
-//});
-//个人动态 end
\ No newline at end of file
+
+//老师提交 新建/修改 作业
+function submit_homework(id)
+{
+ if(!regex_homework_name())
+ {
+ $("#homework_name").focus();
+ }
+ else
+ {
+ homework_description_editor.sync();
+ $("#"+id).submit();
+ }
+}
+
+//验证新建作业的名字
+function regex_homework_name()
+{
+ var name = $.trim($("#homework_name").val());
+
+ if(name=="")
+ {
+ $("#homework_name_span").text("名称不能为空");
+ return false;
+ }
+ else
+ {
+ $("#homework_name_span").text("");
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css
index 0afeb28e5..22e13709b 100644
--- a/public/stylesheets/new_user.css
+++ b/public/stylesheets/new_user.css
@@ -868,11 +868,30 @@ img.ui-datepicker-trigger {
width:16px;
height:15px;
float:left;
+ margin: 7px;
}
/*消息*/
.homepageNewsType {width:95px; font-size:12px; color:#888888; display:block;}
.homepageNewsTypeNotRead {width:95px; font-size:12px; color:#888888; display:block;}
+.calendar_input{border-left:none !important;border-bottom: none!important; border-top: none!important; border-right: 1px solid #d9d9d9;}
+.calendar_div{border: 1px solid #d9d9d9;}
+#attachments_fields input.filename {
+ border: 0;
+ height: 1.8em;
+ max-width: 670px;
+ color: #7f7f7f;
+ background-color: inherit;
+ background: url(../images/pic_file.png) 0 3px no-repeat;
+ padding-left: 18px;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ margin-bottom: 3px;
+}
+.description{display: none !important;}
+.ispublic-label{display: none !important;}
+.is_public_checkbox{display: none !important;}