diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 00d814bd3..9deb2eb5f 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -11,11 +11,17 @@ class HomeworkCommonController < ApplicationController
before_filter :member_of_course, :only => [:index]
def index
- homeworks = @course.homework_commons.order("created_at desc")
+ @new_homework = HomeworkCommon.new
+ @new_homework.homework_detail_manual = HomeworkDetailManual.new
+ @new_homework.course = @course
+ @page = params[:page] ? params[:page].to_i + 1 : 0
+ @homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
- @homeworks = paginateHelper homeworks,20
+ # @homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset()
+ # @homeworks = paginateHelper homeworks,20
respond_to do |format|
+ format.js
format.html
end
end
diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb
index bc6dcacfa..bb8bb546a 100644
--- a/app/views/courses/show.html.erb
+++ b/app/views/courses/show.html.erb
@@ -1,7 +1,6 @@
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb
index 8799bcab9..8a89d66bc 100644
--- a/app/views/homework_common/index.html.erb
+++ b/app/views/homework_common/index.html.erb
@@ -1,129 +1,41 @@
-
- <%= link_to(image_tag(url_to_avatar(homework.user), :width => "42", :height => "42"), user_path(homework.user), :class => "problem_pic fl") %>
-
- <%= link_to(homework.user.lastname+homework.user.firstname, user_path(homework.user),:class => 'problem_name fl',:target => "_blank") %>
-
<%= l(:label_user_create_project_homework) %>:
- <%= link_to(homework.name, student_work_index_path(:homework => homework.id), :class => 'problem_tit fl fb c_dblue',:target => "_blank") %>
-
-
- <%= l(:lebel_homework_commit)%>
- ( <%= link_to homework.student_works.count, student_work_index_path(:homework => homework.id), :class => 'c_red'%> )
-
- <% if @is_teacher%>
- <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework,:is_in_course => 1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %>
- <%= link_to(l(:button_edit),edit_homework_common_path(homework,:is_in_course => 1), :class => "fr mr10 work_edit ml10") %>
- <%= homework_anonymous_comment(homework)%>
- <% elsif @is_student%>
- <%= student_anonymous_comment homework %>
- <%= student_new_homework homework %>
- <% end %>
-
-
-
-
- <%= homework.description.html_safe %>
-
-
-
+
+
- <% if homework.homework_type == 2 && homework.homework_detail_programing%>
- <% if @is_teacher%>
-
-
- ">
-
- 输入
- |
-
- 输出
- |
-
- <% homework.homework_tests.each do |test|%>
- ">
-
- <%=test.input%>
- |
-
- <%= test.output%>
- |
-
- <% end%>
-
-
-
- <% end%>
-
-
-
开发语言:
-
- <%= homework.language_name%>
-
-
-
- <% end%>
+
-<% end%>
+ <%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0} %>
+
+
-
- <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
-
-
\ 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 6e07e7122..f4c4c64d4 100644
--- a/app/views/users/_user_homework_form.html.erb
+++ b/app/views/users/_user_homework_form.html.erb
@@ -37,11 +37,13 @@
-
- <%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
-
-
-
+ <% unless defined?(select_course)%>
+
+ <%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
+
+
+
+ <% end%>
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 07a149adb..13f093538 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -986,3 +986,94 @@ function show_student_work(url){
}
);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
+ extra = extra || 0;
+ var isFirefox = !!document.getBoxObjectFor || 'mozInnerScreenX' in window,
+ isOpera = !!window.opera && !!window.opera.toString().indexOf('Opera'),
+ addEvent = function (element, type, callback) {
+ element.addEventListener ?
+ element.addEventListener(type, callback, false) :
+ element.attachEvent('on' + type, callback);
+ },
+ getFirstStyle = elem.currentStyle ? function (name) {
+ var val = elem.currentStyle[name];
+
+ if (name === 'height' && val.search(/px/i) !== 1) {
+ var rect = elem.getBoundingClientRect();
+ return rect.bottom - rect.top -
+ parseFloat(getFirstStyle('paddingTop')) -
+ parseFloat(getFirstStyle('paddingBottom')) + 'px';
+ };
+
+ return val;
+ } : function (name) {
+ return getComputedStyle(elem, null)[name];
+ },
+ minHeight = parseFloat(getFirstStyle('height'))
+
+ elem.style.resize = 'none';
+ elem2.style.resize = 'none';
+ var change = function () {
+ var scrollTop, height,
+ padding = 0,
+ style = elem.style,
+ style2 = elem2.style;
+
+
+ if (elem._length === elem.value.length) return;
+ elem._length = elem.value.length;
+ elem2._length = elem._length;
+ if (!isFirefox && !isOpera) {
+ padding = parseInt(getFirstStyle('paddingTop')) + parseInt(getFirstStyle('paddingBottom'));
+ };
+ scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
+
+ elem.style.height = minHeight + 'px';
+ elem2.style.height = minHeight + 'px';
+ if (elem.scrollHeight > minHeight) {
+ if (maxHeight && elem.scrollHeight > maxHeight) {
+ height = maxHeight - padding;
+ style.overflowY = 'auto';
+ style2.overflowY = 'auto';
+ } else {
+ height = elem.scrollHeight - padding;
+ style.overflowY = 'hidden';
+ style2.overflowY = 'hidden';
+ };
+ style.height = height + extra + 'px';
+ style2.height = height + extra + 'px';
+ scrollTop += parseInt(style.height) - elem.currHeight;
+ document.body.scrollTop = scrollTop;
+ document.documentElement.scrollTop = scrollTop;
+ elem.currHeight = parseInt(style.height);
+ };
+ if (elem2.scrollHeight > minHeight) {
+ if (maxHeight && elem2.scrollHeight > maxHeight) {
+ height = maxHeight - padding;
+ style.overflowY = 'auto';
+ style2.overflowY = 'auto';
+ } else {
+ height = elem2.scrollHeight - padding;
+ style.overflowY = 'hidden';
+ style2.overflowY = 'hidden';
+ };
+ style.height = height + extra + 'px';
+ style2.height = height + extra + 'px';
+ scrollTop += parseInt(style2.height) - elem2.currHeight;
+ document.body.scrollTop = scrollTop;
+ document.documentElement.scrollTop = scrollTop;
+ elem2.currHeight = parseInt(style2.height);
+ };
+ };
+
+ addEvent(elem, 'propertychange', change);
+ addEvent(elem, 'input', change);
+ addEvent(elem, 'focus', change);
+ addEvent(elem2, 'propertychange', change);
+ addEvent(elem2, 'input', change);
+ addEvent(elem2, 'focus', change);
+ change();
+};
\ No newline at end of file
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 4fd8d99d2..c559261ef 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -176,7 +176,7 @@ a.homepageWhite:hover {color:#a1ebff}
a.newsGrey {color:#4b4b4b;}
a.newsGrey:hover {color:#000000;}
a.newsRed {color:red;}
-a.newsRed:hovor {color:#888888;}
+a.newsRed:hover {color:#888888;}
a.replyGrey {color:#888888; display:inline-block;}
a.replyGrey:hover {color:#4b4b4b;}
a.replyGrey1 {color:#888888;}
@@ -891,54 +891,109 @@ a:hover.about_me{ color:#0781b4;}
/*20150820课程作业 LB*/
-.HomeWork {width:708px; background-color:#ffffff; padding:10px 20px 20px 20px; border:1px solid #dddddd;}
+.HomeWork {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd; float:right;}
.RightBanner {width:708px; height:34px; border-bottom:1px solid #e9e9e9;}
select.InputBox,input.InputBox,textarea.InputBox{ border:1px solid #d9d9d9; color:#888888; height:28px; line-height:28px; padding-left:5px; font-size:14px;}
-a.BlueCirBtn{ display:block;width:75px; height:28px; background-color:#ffffff; line-height:28px; vertical-align:middle; text-align:center; border:1px solid #15bccf; color:#15bccf; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
-a:hover.BlueCirBtn{ background:#15bccf; color:#fff;}
+a.BlueCirBtn{ display:block;width:75px; height:28px; background-color:#ffffff; line-height:28px; vertical-align:middle; text-align:center; border:1px solid #269ac9; color:#269ac9; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
+a:hover.BlueCirBtn{ background:#269ac9; color:#fff;}
.W440{ width:440px;}
.W120{ width:110px;}
.W700{ width:700px;max-width: 700px;min-width: 700px;}
.w708{width: 708px;}
-a.AnnexBtn{ background: url(../images/homepage_icon2.png) 0px -343px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
-a:hover.AnnexBtn{background: url(../images/homepage_icon2.png) -90px -343px no-repeat; color:#15bccf;}
+.w712{width:712px;max-width:712px;min-width: 712px;}
+.w720{width:721px;}
+.w709{width: 709px;}
+.w701{width: 701px;}
+a.AnnexBtn{ background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
+a:hover.AnnexBtn{background: url(images/homepage_icon2.png) -90px -343px no-repeat !important; color:#3598db;}
a.FilesBtn{ background: url(../images/homepage_icon2.png) 0px -373px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
-a:hover.FilesBtn{background: url(../images/homepage_icon2.png) -89px -372px no-repeat; color:#15bccf;}
-a.BlueCirBtnMini{ display:block;width:40px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #15bccf; color:#15bccf; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
-a:hover.BlueCirBtnMini{ background:#15bccf; color:#fff;}
+a:hover.FilesBtn{background: url(../images/homepage_icon2.png) -89px -372px no-repeat; color:#269ac9;}
+a.BlueCirBtnMini{ display:block;width:40px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #269ac9; color:#269ac9; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
+a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;}
a.DropBtn{background: url(../images/homepage_icon2.png) -125px -339px no-repeat; width:85px; height:20px; display:block; color:#888888; font-size:14px;}
a:hover.DropBtn{background: url(../images/homepage_icon2.png) -125px -370px no-repeat;}
.DropLine{border-top:1px solid #d9d9d9; float:left; width:623px; height:10px; margin-top:10px;}
+/*20150820课程作业 LB*/
+.HomeWork {width:708px; background-color:#ffffff; padding:20px; border:1px solid #dddddd;}
+.RightBanner {font-size:16px; width:733px; color:#4b4b4b; padding:10px 0 0 15px; margin-bottom:10px; background:#fff; border:1px solid #dddddd;height:34px;}
+select.InputBox,input.InputBox,textarea.InputBox{ border:1px solid #d9d9d9; color:#888888; height:28px; line-height:28px; padding-left:5px; font-size:14px;}
+a.BlueCirBtn{ display:block;width:75px; height:28px; background-color:#fff; line-height:28px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
+a:hover.BlueCirBtn{ background:#3598db; color:#fff;}
+.W440{ width:440px;}
+.W120{ width:110px;}
+.W700{ width:700px;}
+/*a.AnnexBtn{ background: url(../images/homepage_icon.png) 0px -343px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}*/
+/*a:hover.AnnexBtn{background: url(../images/homepage_icon.png) -90px -343px no-repeat; color:#3598db;}*/
+a.FilesBtn{ background: url(../images/homepage_icon.png) 0px -373px no-repeat; width:38px; height:20px; display:block; padding-left:20px; color:#888888;}
+a:hover.FilesBtn{background: url(../images/homepage_icon.png) -89px -372px no-repeat; color:#3598db;}
+a.BlueCirBtnMini{ display:block;width:40px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
+a:hover.BlueCirBtnMini{ background:#3598db; color:#fff;}
+a.ProBtn{background: url(../images/homepage_icon.png) -86px -396px no-repeat; width:30px; height:20px; display:block; padding-left:20px; color:#888888;}
+a:hover.ProBtn{background: url(../images/homepage_icon.png) -86px -426px no-repeat; color:#3598db;}
+
+a.DropBtn{background: url(../images/homepage_icon.png) -125px -339px no-repeat; width:85px; height:20px; display:block; color:#888888; font-size:14px;}
+a:hover.DropBtn{background: url(../images/homepage_icon.png) -125px -370px no-repeat;}
+.DropLine{border-top:1px solid #d9d9d9; float:left; width:623px; height:10px; margin-top:10px;}
/*20150820编程作业 LB*/
.W320{ width:320px;}
-.icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
-a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
-.icon_remove{background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:left;}
-a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;}
+.icon_add{ background:url(../images/course/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
+a:hover.icon_add{background:url(../images/course/icons.png) -20px -310px no-repeat;}
+.icon_remove{background:url(../images/course/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:left;}
+a:hover.icon_remove{background:url(../images/course/icons.png) -20px -338px no-repeat;}
/*20150820提交作业 LB*/
.HomeWorkBox{ background:#f6f6f6; padding:10px; margin:10px 0;}
.c_grey{ color:#888888;}
-.c_dark_grey{color:#a9a9a9 !important;}
.HomeWorkP{ width:690px; font-size:14px;}
+.HomeWorkP p{background-color: transparent !important;}
+.HomeWorkP div{background-color: transparent !important;}
.H150{ height:150px;}
.ProResult{width:748px; background-color:#fff; border:1px solid #dddddd;border-bottom:none; }
.ProResultTop{ height:38px; line-height:38px; border-bottom:1px solid #dddddd; background:#f2f2f2; padding:0 10px;}
.ProResultCon{ padding:10px; color:#888888; line-height:24px; border-bottom:1px solid #dddddd; }
.W50{ width:50px;}
.W200{ width:200px;}
+.m_w530{max-width: 530px;}
.ProResultTable{ color:#888888;}
.T_C{ text-align:center;}
.SearchIcon{background:url(../images/homepage_icon2.png) 676px -393px no-repeat; }
.SearchIcon:hover{background:url(../images/homepage_icon2.png) 676px -419px no-repeat; }
-a.link_file_a{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; }
-a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
+a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; }
+a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;}
a.FilesName{ max-width:540px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:block;}
a.FilesName02{ max-width:665px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:block;}
.ProResultUl span { display:block; float:left;}
.ProResultUl li{ line-height:35px; border-bottom:1px solid #dddddd; }
.DateBorder{border:1px solid #d9d9d9; border-left:none; padding:7px 6px 6px 6px;}
-.mb50{margin-bottom: 50px;}
+
+a.UsersEditBtn{ display:block; width:55px; height:20px; border:1px solid #6d6d6d; color:#fff; background:#888888 url(../images/homepage_icon.png) -11px -35px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
+a:hover.UsersEditBtn{ color:#484848; background:#888888 url(../images/homepage_icon.png) -11px -74px no-repeat;}
+a.UsersAttBtn{ display:block; width:55px; height:20px; border:1px solid #d3d3d3; color:#888888; background:#f2f3f3 url(../images/homepage_icon2.png) -9px -6px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
+a:hover.UsersAttBtn{border:1px solid #888888; }
+a.UsersApBtn{ display:block; width:55px; height:20px; border:1px solid #d3d3d3; color:#888888; background:#f2f3f3 url(../images/homepage_icon2.png) -177px -6px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
+a:hover.UsersApBtn{border:1px solid #888888; }
+/*20150906编程作业设置弹框 LB*/
+.C_lgrey{ color:#a5a5a5;}
+.C_Blue{ color:#3598db;}
+a.C_Blue{ color:#3598db;}
+a:hover.C_Blue{ color:#297fb8;}
+.BluePopupBox{ padding:20px; background:#fff; width:707px;}
+/*.BluePopupBox:hover{ border:3px solid #297fb8; }*/
+a.CloseBtn{background:url(../images/CloseBtn.png) 0px 0px no-repeat; width:13px; height:13px; display:block; float:right;}
+a:hover.CloseBtn{background:url(../images/CloseBtn.png) 0px -24px no-repeat; }
+.BluePopuph2{ font-size:16px; font-weight:bold; color:#3598db; }
+.ProBoxResult{width:706px; background-color:#fff; border:1px solid #dddddd;border-bottom:none; max-height:300px; overflow:auto; }
+.W108{ width:108px;}
+.HomeWorkCon{ width:706px;}
+/*20150906导入作业弹框 LB*/
+.ImportBox{ width:708px; max-height:300px;overflow:auto;}
+.ImportBox li{ margin-bottom:10px;}
+.WorkTitle{ max-width:660px; font-size:14px; font-weight:bold; color:#484848;}
+.W520{ width:680px;}
+.ImportSearchIcon{background:url(../images/homepage_icon.png) 656px -393px no-repeat; }
+.ImportSearchIcon:hover{background:url(../images/homepage_icon.png) 656px -419px no-repeat; }
+.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;}
/* 课程主页 */
.rside_nav{ background:#eaebec; padding:10px 10px;}
@@ -980,6 +1035,8 @@ a:hover.c_grey{ color:#333;}
.link_file_a{ display:block; max-width:450px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
.last_time{width:auto; text-align:right; margin-right:70px;}
.link_file_box{ width:360px;}
-a.postOptionLink{float: right;color: #64bdd9;display: block;padding: 1px 5px;border: 1px solid #64bdd9;width: initial;}
-a:hover.postOptionLink {color: #fff;background: #64bdd9;}
+/*a.postOptionLink{float: right;color: #64bdd9;display: block;padding: 1px 5px;border: 1px solid #64bdd9;width: initial;}*/
+/*a:hover.postOptionLink {color: #fff;background: #64bdd9;}*/
+a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;}
+a.postOptionLink:hover {color:#ffffff; background-color:#15bccf;}