Compare commits

...

433 Commits

Author SHA1 Message Date
huang 1f3417a974 Merge branch 'develop' 2017-10-14 16:18:56 +08:00
huang eb457f4774 add migrate 2017-10-14 15:25:07 +08:00
huang 0beebb2d52 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-14 11:09:38 +08:00
huang 0b4aed3806 pushlish game的时候同步tpi脚本 2017-10-14 11:09:15 +08:00
caishi 3e5194fcd8 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-14 10:31:35 +08:00
caishi 5bb78aeb80 实训tpi查看参考答案的弹框文字信息修改 2017-10-14 10:30:56 +08:00
XuCheng642 321414b2cc Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 23:31:20 +08:00
XuCheng642 00be96425b Merge branch 'dev_xucheng' into develop 2017-10-13 23:31:02 +08:00
XuCheng642 6b8956e9ef 其他用户头像去除点击事件 课程搜索 2017-10-13 23:28:34 +08:00
daiao 7c804a6f77 PHTWeb实训 2017-10-13 22:52:13 +08:00
caishi 1826c370f3 TPI评论点赞换行 2017-10-13 22:32:57 +08:00
cxt 2529aaa7f3 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 22:13:20 +08:00
cxt a4489ca708 学生列表按成绩排序 2017-10-13 22:13:07 +08:00
XuCheng642 ee5cec2add Merge branch 'develop' into dev_xucheng 2017-10-13 22:05:15 +08:00
XuCheng642 27cf3bb3ce Merge branch 'dev_xucheng' into develop 2017-10-13 22:04:16 +08:00
XuCheng642 99c86a6e76 单位列表添加市 2017-10-13 22:02:56 +08:00
cxt 5e4a80d245 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 21:59:32 +08:00
cxt 64664d826e 实训作业说明的样式 2017-10-13 21:59:09 +08:00
cxt ab4f85565c 实训作业的说明 2017-10-13 21:57:53 +08:00
XuCheng642 3b8de931a2 单位修改 2017-10-13 21:57:17 +08:00
XuCheng642 f495767066 Merge branch 'develop' into dev_xucheng 2017-10-13 21:44:58 +08:00
XuCheng642 f52960e2eb Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 21:44:03 +08:00
XuCheng642 39a7165cfa Merge branch 'dev_xucheng' into develop 2017-10-13 21:43:42 +08:00
XuCheng642 ab2f6dd687 班级成员列表成绩排序 2017-10-13 21:42:30 +08:00
huang 662e4d8fb0 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 21:01:41 +08:00
huang 50653d1eb9 解决版本库空白问题 2017-10-13 21:01:25 +08:00
XuCheng642 06ad49e199 Merge branch 'develop' into dev_xucheng 2017-10-13 20:23:29 +08:00
XuCheng642 667fc4e947 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 20:22:47 +08:00
XuCheng642 e821cbab4b Merge branch 'dev_xucheng' into develop 2017-10-13 20:22:19 +08:00
XuCheng642 fbfa68f843 实训列表页 2017-10-13 20:20:32 +08:00
daiao bba766a026 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 20:00:14 +08:00
daiao e312c0d153 不用显示登录名,innov 改为:“3分钟前登录” 的字样,显示当前用户的最新登录情况 2017-10-13 19:59:56 +08:00
caishi a06ed3e136 Merge branch 'dev_cs' into develop 2017-10-13 19:50:27 +08:00
caishi 9cbaf8e4fc 去掉编辑试卷里面的设置 2017-10-13 19:49:07 +08:00
daiao 1772f2b405 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 19:46:28 +08:00
daiao dc79af7f16 PHPweb实训只有评测后才能点击查看效果 2017-10-13 19:45:48 +08:00
miss f661d4d9f2 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 19:45:22 +08:00
miss c93f446e5a 删除资源的tip问题 2017-10-13 19:44:58 +08:00
cxt 8326189ba5 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 19:31:33 +08:00
cxt 7ff96b64ad 实训作业得分bug 2017-10-13 19:31:14 +08:00
daiao 3733b3ed92 PHP实训 2017-10-13 19:26:04 +08:00
daiao 345eac26e7 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 19:19:18 +08:00
daiao eab4e2a88c PHP/Web实训 2017-10-13 19:19:03 +08:00
huang 19129fb8c5 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 19:07:38 +08:00
huang 818631b573 添加gitlab API,获取当前user的某个项目id 2017-10-13 19:07:06 +08:00
cxt 3f027ea05c Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop
Conflicts:
	app/views/games/_game_show.html.erb
2017-10-13 18:57:16 +08:00
daiao 95a65e114b Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 18:53:55 +08:00
daiao 9a798f3944 Merge branch 'dev_daiao' into develop
Conflicts:
	app/views/praise_tread/_edu_praise.html.erb
	app/views/users/show.html.erb
2017-10-13 18:53:32 +08:00
XuCheng642 e9f2cab081 Merge branch 'develop' into dev_xucheng 2017-10-13 18:53:23 +08:00
XuCheng642 d38c142c82 Merge branch 'dev_xucheng' into develop 2017-10-13 18:52:11 +08:00
XuCheng642 70351781bf Merge branch 'develop' into dev_xucheng 2017-10-13 18:51:49 +08:00
XuCheng642 8017a1e4d9 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 18:50:39 +08:00
XuCheng642 d89cb8085c Merge branch 'dev_xucheng' into develop 2017-10-13 18:50:13 +08:00
XuCheng642 efac20f6a6 单位搜索剔除当前 2017-10-13 18:49:10 +08:00
cxt b3fbfb2197 Merge branch 'dev_cs' into develop 2017-10-13 18:48:41 +08:00
cxt dc88bad0fa Merge branch 'dev_cxt' into develop 2017-10-13 18:47:48 +08:00
cxt 0ad4779842 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 18:47:33 +08:00
miss 39bbbc882a Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 18:46:38 +08:00
miss 37ef75c4c9 全部实训首页的排版错乱问题 2017-10-13 18:46:06 +08:00
daiao 026d2dbfc3 解码还原 2017-10-13 18:39:55 +08:00
cxt 2b7615c877 试卷题目ke编辑器上传图片,给出图片格式的提示框位置没有居中,且样式不是公用样式 2017-10-13 17:33:45 +08:00
daiao ce095feff9 解码格式 2017-10-13 17:26:08 +08:00
daiao 7b51a8ff25 安全转换URL 2017-10-13 17:24:53 +08:00
daiao baaa5d4add 测试集将空格匹配成+ 2017-10-13 17:05:57 +08:00
daiao 56281e41e4 解码测试集的实际输出 2017-10-13 16:55:47 +08:00
daiao 68c7d9769a 字符编码将空格 匹配成 + 2017-10-13 16:48:06 +08:00
daiao aee32c105f 增加日志 2017-10-13 16:28:42 +08:00
daiao c001844fef 增加日志 2017-10-13 16:24:34 +08:00
cxt a3cf8e9697 实训路径优化 2017-10-13 16:23:39 +08:00
daiao 4d087f8b5f 测试实际输出转码 2017-10-13 16:20:54 +08:00
daiao 0a354770d0 中间层代码测试 2017-10-13 16:04:40 +08:00
cxt d264d65a01 在试卷未发布时加入新的学生,试卷到达发布时间后,答题统计中新学生有两条记录 2017-10-13 15:13:54 +08:00
cxt 28c588cb5f 编辑试卷中点击某题的“向下插入xx题”按钮,弹出新建题目后点击取消,再编辑某题,给出提示不能编辑 2017-10-13 15:12:39 +08:00
cxt 478b68c872 试卷选用功能 2017-10-13 15:06:55 +08:00
caishi 5f928d4188 公共题库认证提示 2017-10-13 14:39:48 +08:00
daiao b7df6d9109 PHP/web实训功能 2017-10-13 14:27:03 +08:00
daiao d4dfa38bd9 PHP/Web实训功能 2017-10-13 14:16:14 +08:00
caishi a35b742654 小问题 2017-10-13 11:29:59 +08:00
cxt 2b6455afef Merge branch 'dev_cs' into dev_cxt 2017-10-13 10:44:32 +08:00
cxt c3cf3d0edd 实训作业的作业描述显示与实训简介一致 2017-10-13 10:43:30 +08:00
caishi 3039110297 发送、确定、评测等按钮改为橙色背景 2017-10-13 10:43:06 +08:00
cxt 6b08813b4f 新建试卷时,在试卷标题处按回车试卷信息就保存了 2017-10-13 10:27:54 +08:00
caishi 3d503336e0 橙色按钮 2017-10-13 10:15:43 +08:00
caishi f1afd9c987 试卷选用弹框 2017-10-13 10:13:19 +08:00
miss d7cbe6e5ce Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-13 09:58:27 +08:00
miss 4c42d42cf2 分班样式的调整以及资源删除的样式调整 2017-10-13 09:57:47 +08:00
cxt b77f8fc2a2 教师评阅与试卷预览的选项顺序不一致 、
教师评阅试卷主观题时,不拖动评分条直接在评分框中输入分数,会直接显示-1
2017-10-13 09:45:33 +08:00
huang bdb80aba12 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-12 21:55:06 +08:00
huang ea860db299 实训搜索添加PHP类型 2017-10-12 21:54:56 +08:00
cxt 901d850a8b 双击邀请码的复制处理 2017-10-12 20:26:02 +08:00
cxt 1349bee916 学生的普通、实训作业列表需要突出显示”未提交“的作业状态 2017-10-12 20:17:25 +08:00
daiao 7885f297e4 实训审批列表为空 2017-10-12 19:56:43 +08:00
cxt 1f3cfac3c7 Merge branch 'develop' into dev_cxt 2017-10-12 19:54:20 +08:00
cxt d3e65e7bca 实训作业的导出成绩 2017-10-12 19:52:35 +08:00
caishi bf4b45c3b5 Merge branch 'develop' into dev_cs 2017-10-12 19:51:54 +08:00
caishi fe547ad572 fork实训已发布和不能访问的显示 2017-10-12 19:50:59 +08:00
caishi 184a86f03e Merge branch 'dev_cs' into develop 2017-10-12 19:33:54 +08:00
caishi 2455f2eb44 技能标签提示框去掉关闭icon 2017-10-12 19:32:52 +08:00
cxt 62a0094cf2 平台讨论区的位置栏,点击姓名报错 2017-10-12 19:29:20 +08:00
cxt abf3f953e0 作业列表的序号 2017-10-12 18:51:47 +08:00
cxt 27d8542e40 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-12 18:36:08 +08:00
cxt 10884221b5 测验历史数据的题号迁移 2017-10-12 18:35:55 +08:00
daiao 263670b7d2 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-12 18:12:06 +08:00
daiao ccb43b3063 实训去除流控 2017-10-12 18:11:52 +08:00
cxt c3671baa6e Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-12 18:08:08 +08:00
cxt 71dafc8dd4 代码样式 2017-10-12 18:07:54 +08:00
huang 1e10cb8bad pingce 2017-10-12 18:04:03 +08:00
huang f404adcf70 评测去掉waiting time 2017-10-12 17:57:35 +08:00
cxt c97ebf5a2d 试卷预览页面去掉textarea框 2017-10-12 17:43:11 +08:00
cxt c7dc2a7878 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-12 17:34:30 +08:00
cxt f9f1e25965 试卷相关 2017-10-12 17:34:14 +08:00
caishi 25e10eda6d Merge branch 'develop' into dev_cs 2017-10-12 17:34:02 +08:00
caishi 0e1dea9ade 资源动态标题颜色333 2017-10-12 17:33:28 +08:00
caishi 9a8ba7ad9f Merge branch 'develop' into dev_cs 2017-10-12 17:27:38 +08:00
caishi b962a87d7e Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-12 17:27:00 +08:00
caishi 8b9edbfaec Merge branch 'dev_cs' into develop 2017-10-12 17:26:39 +08:00
caishi 908e131548 回复评论右侧对齐 2017-10-12 17:26:12 +08:00
XuCheng642 e258ab7411 Merge branch 'develop' into dev_xucheng 2017-10-12 17:05:34 +08:00
XuCheng642 797aac75b5 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-12 17:04:29 +08:00
XuCheng642 85aad0dacc Merge branch 'dev_xucheng' into develop 2017-10-12 17:04:07 +08:00
caishi 58f92fd5e4 Merge branch 'develop' into dev_cs 2017-10-12 17:04:04 +08:00
caishi 3ca3181ad2 Merge branch 'dev_cs' into develop 2017-10-12 17:03:24 +08:00
XuCheng642 5d46242841 Merge branch 'develop' into dev_xucheng 2017-10-12 17:02:49 +08:00
caishi 6d434de277 选择排序方式后的颜色 2017-10-12 17:02:06 +08:00
XuCheng642 ee9dc6c6aa Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop
Conflicts:
	app/controllers/managements_controller.rb
	app/views/users/show.html.erb
2017-10-12 17:01:44 +08:00
XuCheng642 c35e17535f Merge branch 'dev_xucheng' into develop 2017-10-12 16:54:47 +08:00
XuCheng642 c72c4d2076 单位修改 2017-10-12 16:53:00 +08:00
daiao 24dda6a3c6 TPI的webssh点击后再连接 2017-10-12 16:41:38 +08:00
daiao c49b82d514 消息机制未上线之前,请将实训的评论通过发留言的形式通知用户 2017-10-12 16:40:35 +08:00
cxt 1d98d89911 Merge branch 'dev_cxt' into develop 2017-10-12 16:24:11 +08:00
cxt c4ed5921a6 试卷详情页面样式修改,整体与作业保持一致 2017-10-12 16:22:47 +08:00
miss 8bd27d4f3d 匿评申诉的样式问题 2017-10-12 16:17:06 +08:00
caishi d1b1d6317d 新建课堂的课程名称增加tip 2017-10-12 16:06:45 +08:00
cxt b8a958ddbb Merge branch 'dev_cs' into dev_cxt
Conflicts:
	app/views/exercise/_new_question.html.erb
2017-10-12 15:29:11 +08:00
cxt b0b47b5443 试卷的题干换成ke 2017-10-12 15:26:39 +08:00
caishi 45262f05f9 Merge branch 'dev_cs' of https://bdgit.trustie.net/hushasha/bigdata into dev_cs 2017-10-12 11:24:31 +08:00
caishi 90cc507bcb 新建作业下拉菜单 2017-10-12 11:24:10 +08:00
daiao 9df7340f13 新增实训fork的列表页面 2017-10-12 11:18:27 +08:00
cxt cd64199151 Merge branch 'develop' into dev_cxt
Conflicts:
	app/views/exercise/_edit_MC.html.erb
2017-10-12 11:14:11 +08:00
cxt 86a6232795 题干换成ke 支持贴图 2017-10-12 11:12:43 +08:00
huang 37bb1cb749 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-12 10:51:39 +08:00
huang 5fe03a3ec6 添加实训脚本迁移;实训技术平台增加PHP、PHP/web 2017-10-12 10:51:25 +08:00
caishi 349b259c0e Merge branch 'develop' into dev_cs 2017-10-12 09:22:39 +08:00
caishi f9a36285fe 新建试卷时调整题目顺序,点击上下移动后tip不消失 2017-10-12 09:21:19 +08:00
daiao 424e8b2d34 实训管理员界面重置策略更换 2017-10-11 17:35:10 +08:00
daiao 7b62bd836f 实训路径样式调整 2017-10-11 17:30:44 +08:00
daiao bbdd86b5da 导出excel的sheet名称修改 2017-10-11 17:09:42 +08:00
daiao 091ee1e352 各种错误页面(无权限等)的用户反馈,在论坛中的来源文字修改 2017-10-11 17:05:00 +08:00
caishi 5b0cabb42c 试卷的tab 2017-10-11 16:31:23 +08:00
daiao 52d546bc1c Merge branch 'dev_cxt' into develop 2017-10-11 16:26:50 +08:00
daiao c47403efd5 超级管理员的实训统计增加1个学生单位的统计报表 2017-10-11 16:23:45 +08:00
cxt 570258bd81 实训统计 2017-10-11 15:30:55 +08:00
cxt 3602e7be1c Merge branch 'dev_cxt' of https://bdgit.trustie.net/hushasha/bigdata into dev_cxt 2017-10-11 15:18:39 +08:00
daiao 82faefdb86 超级管理员的实训统计增加1个学生单位的统计报表 2017-10-11 15:15:51 +08:00
caishi cdf58a2709 实训作业和普通作业未提交tip 2017-10-11 14:55:34 +08:00
huang d5fb001c1c Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-11 14:48:35 +08:00
huang 2e085f9e5d 实训添加几种镜像 2017-10-11 14:48:15 +08:00
cxt 1f1f30f3c3 课堂动态的帖子动态,在回复的时候浏览数+1 2017-10-11 11:27:26 +08:00
cxt fcd09d3808 指定自动授权单位的某些试用申请,没有自动授权 2017-10-11 10:34:42 +08:00
caishi 594a0a1d4a Fork 2017-10-11 09:59:20 +08:00
cxt a51f3b760d 实训统计导出的报表修正 2017-10-11 09:40:32 +08:00
cxt 6ef62db5fa 试卷删除弹框提示信息完善 2017-10-10 17:01:59 +08:00
cxt 6dc66e269e Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-10 16:52:40 +08:00
cxt b6914a6e1e 试卷相关调整 2017-10-10 16:50:22 +08:00
daiao 268a626e7a 实训路径的ke简介和ke学习须知,都改为md 2017-10-10 16:45:41 +08:00
cxt c69f9c9d9f 课程列表数据混乱,educoder创建的C++程序设计课程有多条记录 2017-10-10 15:59:52 +08:00
caishi 8a88006e69 TPI and TPM 评论回复 2017-10-10 15:24:13 +08:00
caishi 32a4903efb 作业问答评论回复 2017-10-10 15:19:00 +08:00
daiao 8313ccfbd7 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-10 15:12:48 +08:00
daiao c1efa07788 实训TPM增加评论功能 2017-10-10 15:11:53 +08:00
caishi c94e1ff079 作业说明外加Issues 2017-10-10 14:50:29 +08:00
cxt ea08271e9c 试卷列表的调整 2017-10-10 14:29:08 +08:00
cxt 485a10ef70 实训路径编辑问题 2017-10-10 10:38:11 +08:00
cxt 13d4ddb76d 实训申请发布的时候增加“技能标签”的判断 2017-10-10 10:20:53 +08:00
daiao 0b08a7005b TPI评论点赞局部刷新样式不对 2017-10-10 09:20:17 +08:00
daiao bbfb1f72e4 Merge branch 'dev_daiao' of https://bdgit.trustie.net/hushasha/bigdata into dev_daiao 2017-10-09 17:31:00 +08:00
daiao 6eeaf998f4 html实训,点击评测后,还是一片白 2017-10-09 17:30:35 +08:00
caishi c1314b5d43 Merge branch 'dev_daiao' of https://bdgit.trustie.net/hushasha/bigdata into dev_daiao 2017-10-09 17:23:48 +08:00
caishi ce33efba30 TPI评论 2017-10-09 17:23:17 +08:00
cxt c90d2cf7ed Merge branch 'develop' into dev_cxt 2017-10-09 16:23:30 +08:00
cxt 58b667a44b Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-09 16:23:15 +08:00
cxt 9739f2bdae 基本资料保存时,同单位同学号不能保存 2017-10-09 16:22:55 +08:00
huang 028d5e087c 实训后台删除一并删除gitlab版本库 2017-10-09 15:59:39 +08:00
XuCheng642 70bf2efb87 Merge branch 'develop' into dev_xucheng 2017-10-09 15:20:01 +08:00
XuCheng642 fc6457c3ea Merge branch 'dev_xucheng' into develop 2017-10-09 15:19:28 +08:00
huang c4f4bc7437 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-09 15:16:50 +08:00
XuCheng642 ef6c3a443a 回复和点赞样式修改 2017-10-09 15:16:34 +08:00
huang 75a279952d 实训复制去掉复制合作者的功能 2017-10-09 15:16:26 +08:00
cxt cd6486671f 课堂的作业列表按照发布时间倒序排序 2017-10-09 14:38:54 +08:00
daiao 26de87d603 点击意见反馈应该跳转到给Educoder留言页面 2017-10-09 14:34:33 +08:00
caishi 41ee4b838d 留言页面的所有头像应该为圆形
平台弹框只有一个选择按钮时去掉弹框右上角的叉叉键
2017-10-09 14:15:03 +08:00
daiao 73adf1844f TPI评论使用新版样式 2017-10-09 14:13:59 +08:00
daiao 249c62333e Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-10-09 11:07:40 +08:00
daiao 1215994034 实训选择题tpi页面也需要有评测信息 2017-10-09 11:07:21 +08:00
daiao fbfa0aa113 实训选择题在有必填项未填时进行保存,应该定位到未填项处 2017-10-09 09:45:48 +08:00
caishi f16fed72fc Merge branch 'develop' into dev_cs 2017-10-09 09:16:38 +08:00
cxt aac531ca54 超级管理员的实训审批 2017-09-30 23:12:39 +08:00
caishi 9e2049e0cf Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 22:53:16 +08:00
caishi 114f578078 答题统计搜索 2017-09-30 22:52:45 +08:00
huang eeca0ec059 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 22:49:17 +08:00
huang e18e10ba42 区分正式版测试版domain问题 2017-09-30 22:49:05 +08:00
caishi f2128033c6 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 22:44:50 +08:00
caishi 61d5420127 TPI技能标签 2017-09-30 22:44:19 +08:00
daiao afff86bff5 Merge branch 'dev_daiao' into develop 2017-09-30 22:35:51 +08:00
daiao c728f4caa1 Merge branch 'develop' into dev_daiao 2017-09-30 22:35:10 +08:00
daiao 0878597cc4 贴吧样式冲突 2017-09-30 22:34:48 +08:00
caishi 1a4cb0b69c Merge branch 'dev_cs' into develop 2017-09-30 22:34:06 +08:00
caishi 79c31feede 实训首页-技术平台 2017-09-30 22:32:41 +08:00
daiao 236445e368 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 22:02:25 +08:00
daiao 880f9a7c06 还原TPI回复功能 2017-09-30 22:02:04 +08:00
caishi c084243f83 Merge branch 'develop' into dev_cs 2017-09-30 21:59:54 +08:00
daiao 49ffc348e2 Merge branch 'dev_daiao' into develop
Conflicts:
	app/views/games/_shixun_comment_list.html.erb
2017-09-30 21:40:23 +08:00
huang a3c8e28c52 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 21:40:12 +08:00
huang 77f0001cd0 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 21:38:18 +08:00
huang a9c5a42594 实训修改代码不重置 2017-09-30 21:37:43 +08:00
daiao 766f1a416e Merge branch 'dev_daiao' of https://bdgit.trustie.net/hushasha/bigdata into dev_daiao 2017-09-30 21:35:11 +08:00
daiao 112f350995 帖子回复功能 2017-09-30 21:34:57 +08:00
miss 6d940e2b61 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 21:28:02 +08:00
miss 4e2b8184fa 文件路径弹框的滚动条增加 2017-09-30 21:27:37 +08:00
huang dc17d4d6c5 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 21:27:34 +08:00
huang d6517c11c1 实训搜索添加verilog类型搜索 2017-09-30 21:26:52 +08:00
caishi 918cba0f95 技能标签 2017-09-30 21:26:22 +08:00
miss abf89afc37 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 21:17:31 +08:00
huang 8c0bc45909 Merge branch 'dev_huang' into develop 2017-09-30 21:15:17 +08:00
miss 9d1f88a71a Merge branch 'dev_huang' of https://bdgit.trustie.net/hushasha/bigdata into dev_huang 2017-09-30 21:12:44 +08:00
miss 48fc5484bb 文件路径的获取 2017-09-30 21:12:22 +08:00
huang 2dd285f6e7 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 21:06:25 +08:00
huang 88d151ec31 Merge branch 'dev_huang' into develop 2017-09-30 21:06:10 +08:00
cxt 8e250f6774 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 21:02:51 +08:00
cxt 7861ed7499 班级动态显示帖子菜单需要与帖子列表中的菜单保持一致 2017-09-30 21:02:18 +08:00
huang 500d8e1082 指定文件目录代码为空的时候给出提示 2017-09-30 20:51:02 +08:00
cxt f4ba07cc82 学生匿评多次时,应该覆盖上一条评分,且给出提交弹框的内容改为“评分已更新” 2017-09-30 20:46:57 +08:00
caishi ae68c11d84 Merge branch 'dev_daiao' of https://bdgit.trustie.net/hushasha/bigdata into dev_daiao 2017-09-30 20:42:48 +08:00
caishi 76b27ffe83 TPI评论 2017-09-30 20:42:15 +08:00
huang a2837e8cfa Merge branch 'dev_huang' of https://bdgit.trustie.net/hushasha/bigdata into dev_huang 2017-09-30 20:41:35 +08:00
huang c6c9507abe 文件目录添加根目录 2017-09-30 20:41:05 +08:00
miss a9826d556a 文件路径的提示 2017-09-30 20:32:57 +08:00
miss bf9046ec27 Merge branch 'dev_huang' of https://bdgit.trustie.net/hushasha/bigdata into dev_huang
# Conflicts:
#	app/views/shixuns/_achieve_ways.html.erb
2017-09-30 20:11:55 +08:00
miss 0760e7d9e0 路径的获取 2017-09-30 20:10:35 +08:00
huang 2f0d5155ef 去掉注释 2017-09-30 20:09:23 +08:00
huang c1b4199f24 实训路径目录回退效果 2017-09-30 20:08:42 +08:00
daiao e00bb90c23 Merge branch 'develop' into dev_daiao
Conflicts:
	app/views/games/_shixun_comment_list.html.erb
	app/views/layouts/_logined_header.html.erb
2017-09-30 19:51:30 +08:00
daiao 7dcc150a25 贴吧缺陷修复 2017-09-30 19:49:53 +08:00
caishi 1cdecbb312 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 19:42:39 +08:00
miss 87401900d3 Merge branch 'dev_huang' of https://bdgit.trustie.net/hushasha/bigdata into dev_huang
# Conflicts:
#	app/views/shixuns/_achieve_ways.html.erb
2017-09-30 19:42:18 +08:00
caishi 274095eed2 合作者 2017-09-30 19:41:06 +08:00
huang 1fd9f3a9dd 文件目录权限 2017-09-30 19:39:13 +08:00
miss d46088baf0 Merge branch 'dev_huang' of https://bdgit.trustie.net/hushasha/bigdata into dev_huang 2017-09-30 19:25:42 +08:00
huang b2304597b4 实训路径文件目录选择 2017-09-30 19:25:35 +08:00
daiao cb13f6d360 Merge branch 'dev_daiao' of https://bdgit.trustie.net/hushasha/bigdata into dev_daiao 2017-09-30 19:24:20 +08:00
miss a45a85cce8 弹框样式 2017-09-30 19:23:51 +08:00
daiao a5289610a3 实训TPI的回复 2017-09-30 19:23:38 +08:00
cxt ffe6388ef9 实训作业列表不需要显示未评,实训作业详情页面“你的评阅”需要隐藏 2017-09-30 19:17:51 +08:00
cxt e88c3d97ac 在线课堂首页中我管理的数据应该与我的主页一致,显示身为管理员和教师的课堂 2017-09-30 19:05:41 +08:00
huang 47439cb94d Merge branch 'develop' into dev_huang
Conflicts:
	app/controllers/shixuns_controller.rb
2017-09-30 18:43:16 +08:00
cxt f9a8519cc1 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 18:41:14 +08:00
cxt 4d4251ecfc Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 18:40:18 +08:00
huang ff62264235 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 18:40:12 +08:00
huang 1f51fa5a82 代码同步更新的一些修改 2017-09-30 18:39:51 +08:00
caishi c0f1c278d7 Merge branch 'dev_cs' into develop 2017-09-30 18:39:27 +08:00
caishi 25a39ed828 试卷 2017-09-30 18:38:26 +08:00
cxt 78aded0451 空白块 2017-09-30 18:38:19 +08:00
cxt f85f9fe6a3 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 18:35:17 +08:00
cxt 216a102f0a 评阅时刷新评阅情况 2017-09-30 18:34:21 +08:00
caishi c7ac2bdb41 Merge branch 'dev_cxt' into dev_cs
Conflicts:
	app/views/messages/_course_show.html.erb
	app/views/student_work/index.html.erb
2017-09-30 18:27:00 +08:00
caishi 18b01609cc 保存多选题 2017-09-30 18:23:35 +08:00
huang e38cee66b8 文件目录 2017-09-30 18:12:25 +08:00
cxt b17305f848 bug修复 2017-09-30 17:38:17 +08:00
miss 61a75ca0d7 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 16:57:21 +08:00
miss 60707b1ed8 二次回复样式的冲突 2017-09-30 16:56:55 +08:00
cxt d0010977dd Merge branch 'dev_cs' into develop 2017-09-30 16:54:50 +08:00
cxt af3ca949dc 删除班级只能是班级管理员才可以,教师成员中其他教师或助教不应该有此操作 2017-09-30 16:53:06 +08:00
cxt ab8a8bfebc 发布实训作业时,点击确认按钮后弹框没有消失导致可以点击无数次,生成多条一样的数据 2017-09-30 16:49:24 +08:00
huang 2ee93c73f6 Merge branch 'dev_new_gitlab_huang' into develop 2017-09-30 16:48:40 +08:00
huang ddbad8ea77 代码更新权限 2017-09-30 16:47:01 +08:00
caishi 5ee2755dd2 新建试卷入口 2017-09-30 16:45:49 +08:00
huang 5952f529b8 Merge branch 'dev_new_gitlab_huang' of https://bdgit.trustie.net/hushasha/bigdata into dev_new_gitlab_huang 2017-09-30 16:43:44 +08:00
huang cbf70d83cb 允许实训成员编辑实训 2017-09-30 16:43:12 +08:00
huang 90ade97d88 开启挑战的时候将educoder加入到myshixun中 2017-09-30 16:38:38 +08:00
cxt 0a5b79739a Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 16:34:31 +08:00
huang 5032b368f5 数据迁移及发布实训的时候不同步gitlab角色 2017-09-30 16:33:59 +08:00
cxt 91ba070ca8 Merge branch 'dev_cxt' into develop
Conflicts:
	app/helpers/application_helper.rb
	app/views/messages/_course_show.html.erb
	app/views/student_work/index.html.erb
	public/stylesheets/css/taskstyle.css
2017-09-30 16:33:07 +08:00
cxt 05f4fff34f Merge branch 'dev_cxt' of https://bdgit.trustie.net/hushasha/bigdata into dev_cxt 2017-09-30 16:31:18 +08:00
cxt d38a301ca8 已发布的实训路径增加“撤销发布”功能 2017-09-30 16:30:49 +08:00
caishi 7771a83ea9 删除选项 2017-09-30 16:30:43 +08:00
miss 5afcbb72c6 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop
# Conflicts:
#	app/controllers/shixuns_controller.rb
#	public/stylesheets/css/edu-public.css
2017-09-30 16:18:36 +08:00
miss 48cbae56a3 fork按钮的位置问题 2017-09-30 16:13:45 +08:00
miss cde511e613 更新代码的刷新效果的显示 2017-09-30 16:10:55 +08:00
huang 7588aa39a8 0 2017-09-30 16:10:37 +08:00
cxt 1b5b77b6c5 测验的编辑 2017-09-30 16:10:07 +08:00
huang cba5c75ba0 Merge branch 'dev_huang' of https://bdgit.trustie.net/hushasha/bigdata into dev_huang 2017-09-30 15:37:01 +08:00
huang b54362162c Merge branch 'develop' into dev_huang 2017-09-30 15:36:48 +08:00
caishi d29ffa7f47 TPI中的全部任务,技能标签 +0 更换成“无” 2017-09-30 15:35:23 +08:00
huang 8855b87aef 更新提示添加判断 2017-09-30 15:34:52 +08:00
huang b1e1ffcf80 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-30 15:33:48 +08:00
huang 44c4f4a3a9 Merge branch 'dev_new_gitlab_huang' into develop 2017-09-30 15:33:34 +08:00
miss c8262cfeaa 文件路径的弹框 2017-09-30 15:32:27 +08:00
huang 7904f693f0 更新代码效果 2017-09-30 15:29:46 +08:00
caishi 342204cb69 Merge branch 'develop' into dev_cs 2017-09-30 15:07:59 +08:00
caishi 5734398b38 去掉讨论-帖子列表里面的帖子总数 2017-09-30 15:07:33 +08:00
caishi cb16a1b4b7 Merge branch 'dev_new_gitlab_huang' of https://bdgit.trustie.net/hushasha/bigdata into dev_new_gitlab_huang
Conflicts:
	app/controllers/games_controller.rb
2017-09-30 14:57:03 +08:00
caishi f8320101a5 TPI遮罩层 2017-09-30 14:53:58 +08:00
cxt 3b25304329 Merge branch 'dev_cxt' of https://bdgit.trustie.net/hushasha/bigdata into dev_cxt
Conflicts:
	app/views/exercise/student_exercise_list.html.erb
2017-09-30 14:38:16 +08:00
cxt 799d97d640 老师评阅 2017-09-30 14:36:17 +08:00
huang 018e24d26e 克隆完成后删除代码 2017-09-30 14:33:01 +08:00
huang a7251a950d 完成代码同步测试版 2017-09-30 11:30:51 +08:00
miss 4da74f872c TPM的tip 2017-09-30 11:29:30 +08:00
miss 88b5a20c47 分页个数 2017-09-30 10:50:12 +08:00
miss adb0aa3f66 文件路径弹框 2017-09-30 10:48:43 +08:00
huang 3c19e12081 实训版本库代码同步功能 2017-09-30 10:42:26 +08:00
caishi 7c23cd9948 动态新建 2017-09-30 10:29:59 +08:00
caishi b900ad466d Merge branch 'develop' into dev_cs 2017-09-30 10:05:22 +08:00
caishi b17691a9ab 学生列表加作业成绩列 2017-09-30 10:00:50 +08:00
caishi 25691d9c65 论坛帖子详情显示 2017-09-30 09:33:38 +08:00
caishi 2266ff1eae 动态新建 2017-09-29 22:04:47 +08:00
caishi 9f8a01aa0a Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-29 22:02:26 +08:00
caishi ca2ddbb90c 动态新建 2017-09-29 22:01:56 +08:00
XuCheng642 eb96e47a85 Merge branch 'develop' into dev_xucheng 2017-09-29 21:58:10 +08:00
XuCheng642 2689e95638 Merge branch 'dev_xucheng' into develop 2017-09-29 21:57:09 +08:00
XuCheng642 2e8151b123 Merge branch 'develop' into dev_xucheng 2017-09-29 21:56:46 +08:00
XuCheng642 3424b03f77 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-29 21:56:16 +08:00
XuCheng642 39c2e4ee18 Merge branch 'dev_xucheng' into develop 2017-09-29 21:55:48 +08:00
XuCheng642 368d19fc73 Merge branch 'develop' into dev_xucheng 2017-09-29 21:55:26 +08:00
XuCheng642 601ddd46f6 Merge branch 'dev_xucheng' into develop 2017-09-29 21:54:55 +08:00
caishi 4ee161c720 新建话题回车事件 2017-09-29 21:53:20 +08:00
XuCheng642 fbf3d3f747 作业回复链接 2017-09-29 21:53:08 +08:00
caishi 246783284c Merge branch 'dev_daiao' into develop 2017-09-29 21:49:33 +08:00
caishi 0e933e3393 Merge branch 'dev_cs' into develop 2017-09-29 21:48:30 +08:00
caishi 3e6bc1894a 论坛列表 2017-09-29 21:46:49 +08:00
caishi a0de6028e7 合作者弹框 2017-09-29 21:35:43 +08:00
caishi 82890205c5 Merge branch 'develop' into dev_cs 2017-09-29 21:23:27 +08:00
caishi bb5dc3af6f Merge branch 'dev_daiao' into develop
Conflicts:
	app/views/messages/_common_reply_box.html.erb
2017-09-29 21:18:50 +08:00
caishi 7f489fddc8 问吧样式、链接修改 2017-09-29 21:15:48 +08:00
miss aa9ab75149 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-29 21:11:25 +08:00
miss 12cebcb252 学员统计板块的金币值模块以及其它问题的修改。tip样式的增加与修改 2017-09-29 21:10:56 +08:00
XuCheng642 50f72b6f96 Merge branch 'develop' into dev_xucheng 2017-09-29 20:26:18 +08:00
XuCheng642 7738fe021a Merge branch 'dev_xucheng' into develop 2017-09-29 20:24:58 +08:00
XuCheng642 811ea0f324 Merge branch 'develop' into dev_xucheng
Conflicts:
	app/views/managements/_leave_message_list.html.erb
2017-09-29 20:18:23 +08:00
caishi cd3c25d600 编辑试卷 2017-09-29 19:25:06 +08:00
XuCheng642 917b41ac0f Fork功能缺陷修复 2017-09-29 19:22:54 +08:00
XuCheng642 4617e8d803 自动授权学校 2017-09-29 18:44:40 +08:00
XuCheng642 d938f413f7 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-29 18:38:31 +08:00
XuCheng642 231fa0dcf7 链接 2017-09-29 18:38:21 +08:00
cxt ad324eb899 迁移文件 2017-09-29 18:20:57 +08:00
cxt f98f554aaf 试卷 2017-09-29 18:18:38 +08:00
XuCheng642 c8a1c5fc81 lianjei 2017-09-29 17:05:35 +08:00
XuCheng642 dcb3662744 Merge branch 'develop' into dev_xucheng 2017-09-29 16:44:40 +08:00
XuCheng642 2e2fb7a69e Merge branch 'dev_xucheng' into develop 2017-09-29 16:43:03 +08:00
XuCheng642 1cb048adae 样式 2017-09-29 16:41:40 +08:00
XuCheng642 d679111b41 Merge branch 'develop' into dev_xucheng
Conflicts:
	app/views/shixuns/_shixun_top.html.erb
	public/stylesheets/css/edu-common.css
2017-09-29 16:35:44 +08:00
XuCheng642 164022a23e Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-29 16:24:22 +08:00
XuCheng642 cbb648dd40 自动授权列表 2017-09-29 16:18:41 +08:00
daiao 60a1e135a8 Merge branch 'dev_daiao' into develop 2017-09-29 16:03:57 +08:00
daiao 17c145a0f5 讨论评论无法局部刷新 2017-09-29 16:02:08 +08:00
caishi f6aad05821 系统提示性弹框的文字请统一改为黑色333
实训TPM待审核状态的tip修改
2017-09-29 15:56:17 +08:00
cxt e13bb9316f 试卷的插入、上下移动、删除等功能 2017-09-29 15:55:37 +08:00
daiao 5eb28b5dfa 讨论详情 2017-09-29 14:11:21 +08:00
daiao f88832796b 讨论按照置顶与非指定排序 2017-09-29 11:29:09 +08:00
daiao b023d5fbaf 顶部导航的“论坛”页面 2017-09-29 11:13:16 +08:00
miss dfe5fe828e Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-29 11:11:01 +08:00
cxt 786430697b Merge branch 'dev_cxt' of https://bdgit.trustie.net/hushasha/bigdata into dev_cxt 2017-09-29 10:20:27 +08:00
cxt 37f5b9ff46 试卷作品列表 2017-09-29 10:20:09 +08:00
huang d2138f41bd 测试集 2017-09-28 19:27:27 +08:00
huang 8987c8a5e1 修改测试集不能需要重置实训 2017-09-28 19:21:58 +08:00
huang b90e145f77 衣服不状态可以编辑测试集 2017-09-28 19:18:15 +08:00
caishi 06940f58b3 显示效果以及点击效果 2017-09-28 19:16:13 +08:00
huang c4be38c705 修改复制提示语 2017-09-28 18:16:44 +08:00
daiao aa4ec780b7 讨论详情页二级回复功能 2017-09-28 17:29:36 +08:00
cxt 7aef72d7a3 在线试卷 2017-09-28 16:51:15 +08:00
caishi c04cc8d889 成员管理 2017-09-28 16:51:14 +08:00
huang e46c4a57e3 发布了修改版本也会触发事件 2017-09-28 16:20:05 +08:00
miss 3602ecfad2 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-28 16:11:02 +08:00
miss e070769613 tip调整 2017-09-28 16:10:26 +08:00
daiao 19a9f76a66 Merge branch 'dev_daiao' of https://bdgit.trustie.net/hushasha/bigdata into dev_daiao 2017-09-28 15:28:31 +08:00
daiao bfd4ee86ec 一级回复与点赞功能 2017-09-28 15:28:03 +08:00
huang fad2fb478f 实训复制失败添加日志区分 2017-09-28 14:12:42 +08:00
huang 3ce5368a9a 老师角色 2017-09-28 11:29:05 +08:00
huang fc0673e6d7 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-28 11:11:40 +08:00
huang 76cd81ec8e 复制权限修改 2017-09-28 11:11:15 +08:00
caishi f5be8c5fe9 Merge branch 'develop' into dev_cs 2017-09-28 10:44:09 +08:00
miss a423955eb4 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-28 10:43:49 +08:00
miss 02a87a1981 tip的各种问题的修改 2017-09-28 10:43:16 +08:00
caishi e37cf3cc52 Merge branch 'dev_cs' into develop 2017-09-28 10:43:08 +08:00
caishi d12b097716 回复+Issues 2017-09-28 10:42:09 +08:00
miss ae4c134953 tip问题的解决 2017-09-27 17:41:01 +08:00
caishi 4b86e27630 搜索框外加一部分Issues 2017-09-27 16:23:19 +08:00
miss 74f97f79ad 文件路径的弹框 2017-09-27 15:09:18 +08:00
daiao 7352d510d1 在实训选择题的名称中输入字符后回车,会给出一个校验失败的信息 2017-09-27 10:48:50 +08:00
daiao 8a41a9aea1 新建、删除选择题需要重置关卡,删除关卡时,给出提示。 2017-09-27 10:27:51 +08:00
caishi b7bddb17b8 实训路径简介和学习须知部分的字体颜色 2017-09-27 09:19:34 +08:00
daiao 82bb30622f 删除关卡报500 2017-09-27 08:47:48 +08:00
daiao 6f9ad2bdab 选择题缺陷 2017-09-26 18:48:07 +08:00
daiao b520e61fc2 单选题缺陷 2017-09-26 18:43:41 +08:00
daiao b760be953f Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-26 18:31:38 +08:00
daiao 14c6ba0479 选择题缺陷修复 2017-09-26 18:31:15 +08:00
caishi 765acb78e6 Merge branch 'develop' into dev_cs 2017-09-26 16:51:58 +08:00
caishi 28dedd7a69 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-26 16:51:10 +08:00
caishi 82c5ee1a90 未答 2017-09-26 16:41:31 +08:00
daiao f07104bdb2 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-26 16:14:26 +08:00
daiao 6e27beea08 选择题权限控制 2017-09-26 16:14:14 +08:00
cxt bf634b56e1 实训统计调整 2017-09-26 15:53:17 +08:00
caishi 743c4858f3 Merge branch 'develop' into dev_cs 2017-09-26 15:46:21 +08:00
caishi 6a90e814be Merge branch 'dev_cs' into develop 2017-09-26 15:46:08 +08:00
cxt 8496663455 试卷 2017-09-26 15:45:26 +08:00
caishi 9cf742222e Merge branch 'develop' into dev_cs 2017-09-26 15:45:11 +08:00
caishi 137eb2739d Issues 2017-09-26 15:38:44 +08:00
cxt 5f1d6cd962 作业的统计 2017-09-26 15:32:31 +08:00
cxt 0ee95f0307 Merge branch 'dev_cs' into dev_cxt 2017-09-26 15:20:15 +08:00
cxt ae2dedec92 Merge branch 'develop' into dev_cxt 2017-09-26 15:18:22 +08:00
cxt 0ad0577896 Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop 2017-09-26 15:14:17 +08:00
cxt 31f199a3f6 实训统计调整 2017-09-26 15:13:57 +08:00
caishi 39c4213bbe 实训tpi中预期输出的答案没有从冒号后开始 2017-09-26 11:10:09 +08:00
caishi c6355d649e Merge branch 'develop' into dev_cs 2017-09-26 10:41:14 +08:00
caishi b47bd5c1bc 试卷页面 2017-09-26 10:40:04 +08:00
caishi 587e1ab5bf 试卷页面 2017-09-26 10:06:57 +08:00
daiao e4f304d431 问吧 2017-09-26 10:06:31 +08:00
huang 62862ffa3b Merge branch 'dev_daiao' of https://bdgit.trustie.net/hushasha/bigdata into dev_daiao
Conflicts:
	app/views/challenges/edit.html.erb
2017-09-26 10:02:15 +08:00
huang ce9630b6cd 文件路径 2017-09-26 10:01:03 +08:00
daiao 71e7725e5c 贴吧 2017-09-26 08:40:27 +08:00
huang ec56f1f05a 文件目录 2017-09-25 16:50:51 +08:00
cxt 45f8f82d51 学生匿评他人作品也需要新开窗口 2017-09-25 15:50:42 +08:00
cxt 483c27cb20 作业列表显示的未评数与作业详情中的未评数不一致 2017-09-25 15:49:17 +08:00
daiao 61fbd6a8e8 Merge branch 'develop' into dev_daiao
Conflicts:
	app/controllers/managements_controller.rb
	app/views/managements/classroom_classment.html.erb
2017-09-25 15:17:30 +08:00
cxt 9e83da1974 调整 2017-09-25 15:03:24 +08:00
huang b54b869f51 Merge branch 'develop' into dev_huang 2017-09-25 14:12:35 +08:00
cxt 58c1625b63 身份为学生,在帖子列表对非自己发布的帖子应该只有发送操作,对自己发布的帖子应该没有置顶操作 2017-09-25 11:03:49 +08:00
XuCheng642 93f39cd85c Merge branch 'develop' into dev_xucheng 2017-09-25 10:52:14 +08:00
XuCheng642 e987f8a019 Merge branch 'dev_xucheng' into develop 2017-09-25 10:51:38 +08:00
cxt 09bd52dccd Merge branch 'develop' into dev_cxt 2017-09-25 10:41:47 +08:00
XuCheng642 1ceca30356 issue 2017-09-25 09:01:38 +08:00
caishi ee237d08eb Merge branch 'develop' into dev_cs 2017-09-22 21:02:00 +08:00
daiao 9599ccd152 导出excel 2017-09-15 11:02:19 +08:00
huang 9a4741298f 实训单个关卡添加背景知识 2017-09-07 16:11:12 +08:00
385 changed files with 11580 additions and 5073 deletions

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the debates controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -536,6 +536,21 @@ class AccountController < ApplicationController
redirect_to professional_certification_account_path
end
# 修改资料时判断学号是否已使用
def check_user_student_id
data = {result:0, account:""}
if params[:student_id] && params[:school_id]
if UserExtensions.where("student_id = '#{params[:student_id]}' and school_id = #{params[:school_id]} and user_id != #{User.current.id}").count > 0
user = User.where(:id => UserExtensions.where("student_id = '#{params[:student_id]}' and school_id = #{params[:school_id]} and user_id != #{User.current.id}").map(&:user_id)).first
data[:account] = user.mail.blank? ? user.user_phone : user.user_mail
else
data[:result] = 1
end
end
render :json => data
end
# 实名认证时判断学号是否已使用
def check_student_id
data = {result:0, account:""}
if params[:student_id] && params[:school_id]
@ -555,6 +570,7 @@ class AccountController < ApplicationController
render :json => data
end
# 实名认证时判断证件号码是否已使用
def check_id_number
data = {result:0, account:""}
if params[:id_number]
@ -586,7 +602,8 @@ class AccountController < ApplicationController
def apply_trail
apply_action = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization", :status => 0).first
if User.current.user_extensions.identity == 1 && !User.current.user_extensions.student_id.nil? && User.current.user_extensions.student_id != "" && !User.current.user_extensions.school.nil? && [1579, 2438, 1587, 117].include?(User.current.user_extensions.school_id)
school_ids = School.where(:auto_users_trial => 1).map(&:id)
if User.current.user_extensions.identity == 1 && !User.current.user_extensions.student_id.nil? && User.current.user_extensions.student_id != "" && !User.current.user_extensions.school.nil? && school_ids.include?(User.current.user_extensions.school_id)
User.current.update_attributes(:certification => 1)
@tip = "申请成功,我们将在一分钟内完成审核"
if apply_action.blank?

View File

@ -132,6 +132,8 @@ class ChallengesController < ApplicationController
end
end
@index = params[:position].to_i - 1
# 发起重置请求
shixun_modify_status_without_publish(@shixun, 1)
respond_to do |format|
format.js
end
@ -157,6 +159,8 @@ class ChallengesController < ApplicationController
answer = params[:choice][:answer][index] == "0" ? false : true
ChallengeQuestion.create(:option_name => test, :challenge_choose_id => @challenge_choose.id, :position => index, :right_key => answer)
end
# 发起重置请求
shixun_modify_status_without_publish(@shixun, 1)
@challenge_choose.challenge_tags.delete_all unless @challenge_choose.challenge_tags.blank?
unless params[:knowledge].blank?
params[:knowledge][:input].each do |input|
@ -197,7 +201,8 @@ class ChallengesController < ApplicationController
def destroy_challenge_choose
@challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first
@challenge_choose.destroy
# 发起重置请求
shixun_modify_status_without_publish(@shixun, 1)
redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun)
end
@ -255,7 +260,7 @@ class ChallengesController < ApplicationController
end
end
# 向jenkins端发送请求构建公共测试用例
add_shixun_modify_status(@shixun, 1)
shixun_modify_status_publish(@shixun, 1)
elsif params[:tab].to_i == 5
@challenge_tags.delete_all unless @challenge_tags.blank?
unless params[:knowledge].blank?

View File

@ -50,17 +50,18 @@ class CoursesController < ApplicationController
@syllabuses_num = Course.all.count
#@syllabus_count = all_syllabuses.count
# 我创建的课堂
create_syllabuses = Course.where(:tea_id => @user.id)
#create_syllabuses = Course.where(:tea_id => @user.id)
# 我参与的课堂
join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}")
@join_syllabuses_count = join_syllabuses.where(:is_end => 0, :is_delete => 0).count
@create_syllabuses_count = create_syllabuses.where(:is_end => 0, :is_delete => 0).count
#join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}")
# @join_syllabuses_count = @user.courses.not_deleted_not_end.order("updated_at desc").select{ |course| !@user.has_teacher_role(course)}.count
# @create_syllabuses_count = @user.courses.not_deleted_not_end.order("updated_at desc").select{ |course| @user.has_teacher_role(course)}.count
@my_courses_count = @user.courses.not_deleted_not_end.count
# 页面筛选的课程
if @select == "create"
@syllabuses = create_syllabuses.where("is_end = 0 and is_delete = 0 and name like '%#{@search}%'")
@syllabuses = @user.courses.not_deleted_not_end.where("name like '%#{@search}%'").order("updated_at desc").select{ |course| @user.has_teacher_role(course)}
elsif @select == "join"
@syllabuses = join_syllabuses.where("is_end = 0 and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'")
@syllabuses = @user.courses.not_deleted_not_end.where("name like '%#{@search}%'").order("updated_at desc").select{ |course| !@user.has_teacher_role(course)}
elsif @select == "end"
# 归档的课堂
end_syllabuses = Course.where("is_end = 1 and name like '%#{@search}%'")
@ -105,7 +106,7 @@ class CoursesController < ApplicationController
end
def shixun_statistics
@homeworks = @course.homework_commons.where("homework_type = 4").order("created_at asc")
@homeworks = @course.homework_commons.where("homework_type = 4 and publish_time < '#{Time.now}'").order("publish_time desc")
filename="#{format_date(Time.now)}_#{@course.teacher.show_real_name.to_s}_#{@course.name}_实训数据报告";
respond_to do |format|
@ -532,11 +533,22 @@ class CoursesController < ApplicationController
@search = params[:search]
q = params[:search] ? "#{params[:search].strip}" : ""
if @order == "student_id"
@members = @course.members.joins("join user_extensions on members.user_id = user_extensions.user_id").order("student_id #{@r_sort}").select{|m| m.roles.to_s.include?("Student")}
else
@members = @course.members.joins("join users on members.user_id = users.id").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@r_sort}, login #{@r_sort}").select{|m| m.roles.to_s.include?("Student")}
end
# if @order == "student_id"
# @members = @course.members.joins("join user_extensions on members.user_id = user_extensions.user_id").order("student_id #{@r_sort}").select{|m| m.roles.to_s.include?("Student")}
# else
# @members = @course.members.joins("join users on members.user_id = users.id").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@r_sort}, login #{@r_sort}").select{|m| m.roles.to_s.include?("Student")}
# end
@members = Member.find_by_sql("SELECT members.*,(
SELECT SUM(student_works.work_score)
FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.homework_type in (1, 4)
AND homework_commons.course_id = #{@course.id}
AND student_works.user_id = members.user_id
) AS score FROM members
JOIN students_for_courses
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
WHERE members.course_id = #{@course.id} ORDER BY score desc")
if q.nil? || q == ""
else
members = []
@ -575,11 +587,22 @@ class CoursesController < ApplicationController
@search = params[:search]
q = params[:search] ? "#{params[:search].strip}" : ""
if @order == "student_id"
@members = @course.members.where(:course_group_id => 0).joins("join user_extensions on members.user_id = user_extensions.user_id").order("student_id #{@sort}").select{|m| m.roles.to_s.include?("Student")}
else
@members = @course.members.where(:course_group_id => 0).joins("join users on members.user_id = users.id").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@sort}, login #{@b_sort}").select{|m| m.roles.to_s.include?("Student")}
end
@members = Member.find_by_sql("SELECT members.*,(
SELECT SUM(student_works.work_score)
FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.homework_type in (1, 4)
AND homework_commons.course_id = #{@course.id}
AND student_works.user_id = members.user_id
) AS score FROM members
JOIN students_for_courses
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
WHERE members.course_id = #{@course.id} AND members.course_group_id = 0 ORDER BY score desc")
# if @order == "student_id"
# @members = @course.members.where(:course_group_id => 0).joins("join user_extensions on members.user_id = user_extensions.user_id").order("student_id #{@sort}").select{|m| m.roles.to_s.include?("Student")}
# else
# @members = @course.members.where(:course_group_id => 0).joins("join users on members.user_id = users.id").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@sort}, login #{@b_sort}").select{|m| m.roles.to_s.include?("Student")}
# end
if q.nil? || q == ""
else
members = []
@ -612,17 +635,28 @@ class CoursesController < ApplicationController
end
def has_group_student_list
@order, @r_sort = params[:order] || "student_id", params[:sort] || "asc"
@sort = @r_sort == "desc" ? "asc" : "desc"
#@order, @r_sort = params[:order] || "student_id", params[:sort] || "asc"
#@sort = @r_sort == "desc" ? "asc" : "desc"
@search = params[:search]
q = params[:search] ? "#{params[:search].strip}" : ""
@group = @course.course_groups.find params[:group_id]
if @order == "student_id"
@members = @course.members.where(:course_group_id => @group.id).joins("join user_extensions on members.user_id = user_extensions.user_id").order("student_id #{@sort}").select{|m| m.roles.to_s.include?("Student")}
else
@members = @course.members.where(:course_group_id => @group.id).joins("join users on members.user_id = users.id").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@sort}, login #{@b_sort}").select{|m| m.roles.to_s.include?("Student")}
end
@members = Member.find_by_sql("SELECT members.*,(
SELECT SUM(student_works.work_score)
FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.homework_type in (1, 4)
AND homework_commons.course_id = #{@course.id}
AND student_works.user_id = members.user_id
) AS score FROM members
JOIN students_for_courses
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
WHERE members.course_id = #{@course.id} AND members.course_group_id = #{@group.id} ORDER BY score desc")
# if @order == "student_id"
# @members = @course.members.where(:course_group_id => @group.id).joins("join user_extensions on members.user_id = user_extensions.user_id").select{|m| m.roles.to_s.include?("Student")}.reorder("student_id #{@sort}")
# else
# @members = @course.members.where(:course_group_id => @group.id).joins("join users on members.user_id = users.id").select{|m| m.roles.to_s.include?("Student")}.reorder("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@sort}, login #{@b_sort}")
# end
if q.nil? || q == ""
else
members = []
@ -634,6 +668,7 @@ class CoursesController < ApplicationController
end
@members = members
end
#分页
@member_count = @members.count
@all_member_ids = @members.map(&:id).join(",")
@ -2006,6 +2041,83 @@ class CoursesController < ApplicationController
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
black = Spreadsheet::Format.new :color => :black, :weight => :bold, :size => 10
current_row = 0
sheet = book.create_worksheet :name => "学员统计"
sheet.row(0).default_format = blue
sheet.row(0).concat(["学生id","学生姓名","作业编号","作业/实训名称","关卡"," 经验值","金币","评测历史","评测时间","评测结果"])
course.student.each_with_index do |course, i|
# 总统计
count_exp_score = 0
count_gold_score = 0
count_test = 0
count_time = 0
game_count = 0
# end
user = course.student
current_row += 1
sheet[current_row, 0] = user.login
sheet[current_row, 1] = user.show_real_name
homeworks.each_with_index do |homework, j|
# 关卡统计
count_game_exp_score = 0
count_game_gold_score = 0
count_game_test = 0
count_game_time = 0
# end
sheet[current_row, 2] = "# #{j + 1}"
sheet[current_row, 3] = homework.name
shixun = homework.homework_commons_shixuns.shixun if homework.homework_commons_shixuns
if shixun
shixun.challenges.each_with_index do |challenge, k|
sheet[current_row, 4] = "#{k+1}"
games = Game.where(:challenge_id => challenge.id, :user_id => user.id)
game_count = game_count + games.count
if games.count > 0
games.each do |game|
sheet[current_row, 5] = game.final_score ? "+#{game.final_score.to_s}" : "--"
sheet[current_row, 6] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i}" : "+#{game.final_score.to_i}") : "--"
count_exp_score += (game.final_score ? game.final_score.to_i : 0)
count_gold_score += (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0)
count_game_exp_score += (game.final_score ? game.final_score.to_i : 0)
count_game_gold_score += (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0)
count = game.outputs.count
if count > 0
outputs = game.outputs.where(:test_set_position => 1).reorder("created_at asc")
outputs.each_with_index do |output, k|
count_test += 1
count_game_test += 1
sheet[current_row, 7] = "#{k+1}次评测"
sheet[current_row, 8] = k == 0 ? game_spend_time((output.created_at - game.created_at).to_i) : game_spend_time((output.created_at - outputs[k-1].created_at).to_i)
count_time = count_time + (k == 0 ? (output.created_at - game.created_at).to_i : (output.created_at - outputs[k-1].created_at).to_i)
count_game_time += (k == 0 ? (output.created_at - game.created_at).to_i : (output.created_at - outputs[k-1].created_at).to_i)
sheet[current_row, 9] = game.outputs.where(:query_index => output.query_index).select{|ou| ou.result == false}.count > 0 ? "失败" : "成功"
current_row += 1
end
else
current_row += 1
end
end
else
current_row += 1
end
end
end
sheet[current_row,4] = "合计"
sheet[current_row,5] = count_game_exp_score >= 0 ? "+#{count_game_exp_score}" : "-#{count_game_exp_score}"
sheet[current_row,6] = count_game_gold_score >= 0 ? "+#{count_game_gold_score}" : "#{count_game_gold_score}"
sheet[current_row,7] = "#{count_game_test}次评测"
sheet[current_row,8] = game_spend_time((count_game_time == 0 ? 0 : (count_game_time / count_test)).to_i)+"/次"
sheet.row(current_row).default_format = black
current_row += 1
end
sheet[current_row,2] = "合计"
sheet[current_row,4] = "#{game_count}"
sheet[current_row,5] = count_exp_score >= 0 ? "+#{count_exp_score}" : "-#{count_exp_score}"
sheet[current_row,6] = count_gold_score >= 0 ? "+#{count_gold_score}" : "#{count_gold_score}"
sheet[current_row,7] = "#{count_test}次评测"
sheet[current_row,8] = game_spend_time((count_time == 0 ? 0 : (count_time / count_test)).to_i)+"/次"
sheet.row(current_row).default_format = black
end
homeworks.each_with_index do |homework, i|
sheet = book.create_worksheet :name => "#{i+1}次作业"
sheet.row(0).default_format = blue
@ -2042,20 +2154,20 @@ class CoursesController < ApplicationController
user = game.user
sheet[current_row,6] = user.login
sheet[current_row,7] = user.show_real_name
sheet[current_row,8] = game.final_score ? "+#{game.final_score.to_s} 经验值" : "--"
sheet[current_row,8] = game.final_score ? "+#{game.final_score.to_s}" : "--"
count_exp_score = count_exp_score + (game.final_score ? game.final_score.to_i : 0)
sheet[current_row,9] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i} 金币" : "+#{game.final_score.to_i} 金币") : "--"
sheet[current_row,9] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i}" : "+#{game.final_score.to_i}") : "--"
count_gold_score = count_gold_score + (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0)
count = game.outputs.count
if count > 0
outputs = game.outputs.where(:test_set_position => 1)
outputs.order("created_at asc").each_with_index do |output, k|
outputs = game.outputs.where(:test_set_position => 1).reorder("created_at asc")
outputs.each_with_index do |output, k|
count_test = count_test + 1
sheet[current_row,10] = "#{k+1}次评测"
sheet[current_row,11] = k == 0 ? 0 : (output.created_at - outputs[k-1].created_at).to_i
count_time += count_time + (k == 0 ? 0 : (output.created_at - outputs[k-1].created_at).to_i)
sheet[current_row,12] = output.result.nil? ? "--" : (output.result ? "成功" : "失败")
sheet[current_row,11] = k == 0 ? game_spend_time((output.created_at - game.created_at).to_i) : game_spend_time((output.created_at - outputs[k-1].created_at).to_i)
count_time = count_time + (k == 0 ? (output.created_at - game.created_at).to_i : (output.created_at - outputs[k-1].created_at).to_i)
sheet[current_row,12] = game.outputs.where(:query_index => output.query_index).select{|ou| ou.result == false}.count > 0 ? "失败" : "成功"
current_row = current_row + 1
end
else
@ -2068,10 +2180,10 @@ class CoursesController < ApplicationController
sheet[current_row,6] = "合计"
sheet[current_row,7] = games.count.to_s + ""
sheet[current_row,8] = count_exp_score >= 0 ? "+#{count_exp_score} 经验值" : "-#{count_exp_score} 经验值"
sheet[current_row,9] = count_gold_score >= 0 ? "+#{count_gold_score} 金币" : "-#{count_gold_score} 金币"
sheet[current_row,8] = count_exp_score >= 0 ? "+#{count_exp_score}" : "-#{count_exp_score}"
sheet[current_row,9] = count_gold_score >= 0 ? "+#{count_gold_score}" : "#{count_gold_score}"
sheet[current_row,10] = "#{count_test}次评测"
sheet[current_row,11] = count_time
sheet[current_row,11] = game_spend_time((count_time == 0 ? 0 : (count_time / count_test)).to_i)+"/次"
sheet.row(current_row).default_format = black
current_row = current_row + 1
end

View File

@ -0,0 +1,2 @@
class DebatesController < ApplicationController
end

View File

@ -1,3 +1,4 @@
# encoding: utf-8
class DiscussesController < ApplicationController
include ApplicationHelper
before_filter :find_dis_object, :except => [:destroy]
@ -6,10 +7,40 @@ class DiscussesController < ApplicationController
def create
if @model
if params[:reply_id].blank?
notes = User.current.show_name.to_s + " 评论了你发布的实训:<a href='#{shixun_discuss_shixun_path(@model)}'>#{params[:content]}</a>"
@model.discusses << Discuss.new(:content => params[:content], :user_id => User.current.id, :praise_count => 0, :challenge_id => params[:challenge_id])
JournalsForMessage.create(
:jour_id => @model.user_id,
:jour_type => "Principal",
:user_id => User.current.id,
:reply_id => 0,
:is_readed => 0,
:private => 1,
:notes => notes
)
else
@model.discusses << Discuss.new(:content => params[:content], :user_id => User.current.id, :parent_id => params[:reply_id], :root_id => params[:reply_id], :praise_count => 0, :challenge_id => params[:challenge_id])
notes = User.current.show_name.to_s + " 评论了你的回复:<a href='#{shixun_discuss_shixun_path(@model)}'>#{params[:content]}</a>"
user_id = Discuss.find(params[:reply_id]).try(:user_id)
@model.discusses << Discuss.new(
:content => params[:content],
:user_id => User.current.id,
:parent_id => params[:reply_id],
:root_id => params[:reply_id],
:praise_count => 0,
:challenge_id => params[:challenge_id]
)
JournalsForMessage.create(
:jour_id => user_id,
:jour_type => "Principal",
:user_id => User.current.id,
:reply_id => 0,
:is_readed => 0,
:private => 1,
:notes => notes
)
end
if params[:dis_type] == "Shixun"
redirect_to shixun_discuss_shixun_path(@model, :challenge_id => params[:challenge_id])
end

View File

@ -1,115 +1,109 @@
#encoding: utf-8
class ExerciseController < ApplicationController
layout "base_courses"
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy,
:commit_exercise, :commit_answer,:publish_exercise,:republish_exercise,
:show_student_result,:student_exercise_list, :update_question_num,
:send_to_course, :get_student_uncomplete_question, :edit_question_score]
:send_to_course, :get_student_uncomplete_question, :edit_question_score, :setting, :set_public,
:ex_setting]
before_filter :find_course, :only => [:index,:new,:create]
include ExerciseHelper
def index
publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
publish_exercises.each do |exercise|
exercise.update_column('exercise_status', 2)
course = exercise.course
course.members.each do |m|
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
end
end
if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?)
render_403
return
end
remove_invalid_exercise(@course)
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
if @is_teacher || User.current.admin?
exercises = @course.exercises.order("created_at asc")
#remove_invalid_exercise(@course)
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @is_teacher
exercises = @course.exercises.order("created_at desc")
else
exercises = @course.exercises.where("exercise_status <> 1").order("created_at asc")
exercises = @course.exercises.where("exercise_status <> 1").order("created_at desc")
end
@exercises = paginateHelper exercises,20 #分页
@left_nav_type = 8
if params[:type]
@type = params[:type]
exercises = exercises.where(:exercise_status => params[:type])
end
@search = params[:search] ? params[:search].to_s.strip : ""
if params[:search]
exercises = exercises.where("exercise_name like '%#{@search}%'")
end
@exercises = paginateHelper exercises,15 #分页
@left_nav_type = 4
respond_to do |format|
format.js
format.html
end
end
def show
publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
publish_exercises.each do |exercise|
exercise.update_column('exercise_status', 2)
course = exercise.course
course.members.each do |m|
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
end
end
unless User.current.member_of_course?(@course) || User.current.admin?
render_403
return
end
@exercise = Exercise.find params[:id]
@exercise.course_messages.each do |message|
if User.current.id == message.user_id && message.viewed == 0
message.update_attributes(:viewed => true) if message.viewed == 0
end
end
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
exercise_end = @exercise.end_time.nil? ? false : @exercise.end_time > Time.now
if @exercise.time == -1
@can_edit_excercise = exercise_end
else
@can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end
end
unless @is_teacher
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
if @exercise_user.nil?
eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false)
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
elsif @exercise_user.start_at.nil?
@exercise_user.update_attributes(:start_at => Time.now)
end
exercise_end = @exercise.end_time.nil? ? false : @exercise.end_time > Time.now
if @exercise.time == -1
@can_edit_excercise = exercise_end && @exercise_user.commit_status == 0
else
@can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id) && exercise_end
end
#score = calculate_student_score(@exercise, User.current)
#@exercise_user.update_attributes(:objective_score => score, :score => (score + (@exercise_user.subjective_score > 0 ? @exercise_user.subjective_score : 0)))
else
@can_edit_excercise = false
end
# @percent = get_percent(@exercise,User.current)
@exercise_questions = @exercise.exercise_questions
@left_nav_type = 8
#@exercise_questions = @exercise.exercise_questions
respond_to do |format|
format.html {render :layout => 'base_courses'}
format.html {render :layout => 'base_edu'}
end
#end
end
def new
option = {
:exercise_name => "",
:course_id => @course.id,
:exercise_status => 1,
:user_id => User.current.id,
:time => "",
:end_time => "",
:publish_time => "",
:exercise_description => "",
:show_result => 1
}
@exercise = Exercise.create option
if @exercise
redirect_to edit_exercise_url @exercise.id
# option = {
# :exercise_name => "",
# :course_id => @course.id,
# :exercise_status => 1,
# :user_id => User.current.id,
# :time => "",
# :end_time => "",
# :publish_time => "",
# :exercise_description => "",
# :show_result => 1
# }
@exercise = Exercise.new
respond_to do |format|
format.html{render :layout => 'base_edu'}
end
end
def create
if params[:exercise]
exercise = Exercise.find(params[:exercise_id]) if params[:exercise_id]
exercise ||= Exercise.new
exercise = Exercise.new
exercise.exercise_name = params[:exercise][:exercise_name]
exercise.exercise_description = params[:exercise][:exercise_description]
exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1)
exercise.publish_time = params[:exercise][:publish_time]
exercise.user_id = User.current.id
exercise.time = params[:exercise][:time]
exercise.course_id = params[:course_id]
exercise.time = -1
exercise.exercise_status = 1
if exercise.save
@exercise = exercise
@ -121,21 +115,15 @@ class ExerciseController < ApplicationController
end
def edit
@left_nav_type = 8
respond_to do |format|
format.html{render :layout => 'base_courses'}
end
format.html{render :layout => 'base_edu'}
end
end
def update
@exercise.exercise_name = params[:exercise][:exercise_name]
@exercise.exercise_description = params[:exercise][:exercise_description]
@exercise.time = params[:exercise][:time].blank? ? -1 : params[:exercise][:time]
@exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1)
@exercise.publish_time = params[:exercise][:publish_time]
@exercise.show_result = params[:show_result] ? 1 : 0
@exercise.question_random = params[:question_random] ? 0 : 1
@exercise.choice_random = params[:choice_random] ? 0 : 1
if @exercise.save
respond_to do |format|
format.js
@ -148,15 +136,34 @@ class ExerciseController < ApplicationController
def destroy
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @exercise && @exercise.destroy
if @is_teacher
exercises = Exercise.where("course_id =?", @course.id)
else
exercises = Exercise.where("course_id =? and exercise_status =?", @course.id, 2)
end
@exercises = paginateHelper exercises,20 #分页
respond_to do |format|
format.js
end
redirect_to exercise_index_path(:course_id => @course.id)
end
end
def setting
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@is_new = params[:is_new] ? true : false
respond_to do |format|
format.html{render :layout => 'base_edu'}
end
end
def ex_setting
@exercise.publish_time = params[:exercise_publish_time] if params[:exercise_publish_time]
@exercise.end_time = params[:exercise_end_time] if params[:exercise_end_time]
@exercise.time = -1
@exercise.question_random = params[:question_random] ? 1 : 0
@exercise.choice_random = params[:choice_random] ? 1 : 0
@exercise.score_open = params[:score_open] ? 1 : 0
@exercise.answer_open = params[:answer_open] ? 1 : 0
if @exercise.save
redirect_to student_exercise_list_exercise_path(@exercise)
end
end
def set_public
if User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
@exercise.update_attributes(:is_public => true)
end
end
@ -165,7 +172,7 @@ class ExerciseController < ApplicationController
@exercise = Exercise.find(params[:id])
exercise_questions = @exercise.exercise_questions
@exercise_questions = paginateHelper exercise_questions, 5
@left_nav_type = 8
@left_nav_type = 4
respond_to do |format|
format.html{render :layout => 'base_courses'}
end
@ -178,10 +185,7 @@ class ExerciseController < ApplicationController
option = {
:question_title => question_title,
:question_type => params[:question_type] || 1,
:question_number => params[:question_type] == "1"? @exercise.exercise_questions.where("question_type = 1").count + 1 :
(params[:question_type] == "2" ? (@exercise.exercise_questions.where("question_type = 2").count + 1) :
(params[:question_type] == "3" ? (@exercise.exercise_questions.where("question_type = 3").count + 1) :
@exercise.exercise_questions.where("question_type = 4").count + 1)),
:question_number => @exercise.exercise_questions.count + 1,
:question_score => params[:question_score]
}
@exercise_questions = @exercise.exercise_questions.new option
@ -197,20 +201,23 @@ class ExerciseController < ApplicationController
end
end
# 如果是插入的话那么从插入的这个id以后的question_num都将要+1
if params[:quest_id]
if params[:quest_id] != "0"
@is_insert = true
if @exercise_questions.question_type == 1
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number + 1")
#@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1")
elsif @exercise_questions.question_type == 2
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number + 1")
elsif @exercise_questions.question_type == 3
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number + 1")
else
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number + 1")
insert_que = ExerciseQuestion.find params[:quest_id]
if insert_que
@exercise.exercise_questions.where("question_number>?",insert_que.question_number).update_all("question_number = question_number + 1")
# if @exercise_questions.question_type == 1
# ExerciseQuestion.where("question_number>?",params[:quest_num].to_i).update_all(" question_number = question_number + 1")
# elsif @exercise_questions.question_type == 2
# ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number + 1")
# elsif @exercise_questions.question_type == 3
# ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number + 1")
# else
# ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number + 1")
# end
# @exercise_question_num = params[:quest_num].to_i
@exercise_questions.question_number = insert_que.question_number + 1
end
# @exercise_question_num = params[:quest_num].to_i
@exercise_questions.question_number = params[:quest_num].to_i + 1
end
if @exercise_questions.save
# params[:exercise_choice] 标准答案参数
@ -327,16 +334,17 @@ class ExerciseController < ApplicationController
@exercise_question = ExerciseQuestion.find params[:exercise_question]
@exercise = @exercise_question.exercise
if @exercise_question.question_type == 1
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1")
#@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1")
elsif @exercise_question.question_type == 2
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1")
elsif @exercise_question.question_type == 3
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1")
else
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number - 1")
end
ExerciseQuestion.where("question_number>?",params[:quest_num].to_i).update_all("question_number = question_number - 1")
# if @exercise_question.question_type == 1
# ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1")
# #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1")
# elsif @exercise_question.question_type == 2
# ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1")
# elsif @exercise_question.question_type == 3
# ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1")
# else
# ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number - 1")
# end
# @exercise_question_num = params[:quest_num].to_i
# @exercise_questions.question_number = params[:quest_num].to_i - 1
#
@ -358,12 +366,12 @@ class ExerciseController < ApplicationController
exercise_questions = @exercise.exercise_questions
if @exercise_question
if params[:opr] == 'up' && @exercise_question.question_number > 1
@before_que = exercise_questions.where("question_type = #{@exercise_question.question_type} and question_number = #{@exercise_question.question_number - 1}").first
@before_que = exercise_questions.where("question_number = #{@exercise_question.question_number - 1}").first
if @before_que && @exercise_question.update_attribute('question_number', @exercise_question.question_number - 1)
@before_que.update_attribute('question_number', @before_que.question_number + 1)
end
elsif params[:opr] == 'down' && @exercise_question.question_number < exercise_questions.count
@after_que = exercise_questions.where("question_type = #{@exercise_question.question_type} and question_number = #{@exercise_question.question_number + 1}").first
@after_que = exercise_questions.where("question_number = #{@exercise_question.question_number + 1}").first
if @after_que && @exercise_question.update_attribute('question_number', @exercise_question.question_number + 1)
@after_que.update_attribute('question_number', @after_que.question_number - 1)
end
@ -470,77 +478,69 @@ class ExerciseController < ApplicationController
end
def student_exercise_list
=begin
if @exercise.end_time <= Time.now
@course.student.each do |student|
if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,@exercise.id).empty?
ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => true,:score=>0)
end
s_score = calculate_student_score(@exercise, student.student)
exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, @exercise.id).first
exercise_user.update_attributes(:score => s_score)
end
end
=end
@name,@select_group = params[:name].to_s.strip || "",params[:group]
@order,@b_sort,@name,@group,@comment,@status = params[:order] || "end_at",params[:sort] || "desc",params[:name].to_s.strip || "",params[:ex_group], params[:ex_comment], params[:ex_status]
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @is_teacher
@all_exercises = @course.exercises.order("created_at desc")
else
@all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc")
end
student_id = @course.student.blank? ? "(-1)" : "(" + @course.student.map{|student| student.student_id}.join(",") + ")"
if @select_group
if @select_group == "0"
none_group_students = @course.members.select{ |member| member.course_group_id == 0 }
if none_group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + none_group_students.map{ |member| member.user_id }.join(',') + ')'
end
elsif @select_group == "-1"
all_group_students = @course.members.select{ |member| member.course_group_id }
if all_group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + all_group_students.map{ |member| member.user_id }.join(',') + ')'
end
if @group
group_students = @course.members.where(:course_group_id => @group).joins("join users on members.user_id = users.id").select{|m| m.roles.to_s.include?("Student")}
if group_students.empty?
student_in_group = '(-1)'
else
course_group = CourseGroup.find_by_id(@select_group)
group_students = course_group.users
if group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + group_students.map{ |user| user.id }.join(',') + ')'
end
student_in_group = '(' + group_students.map{ |member| member.user_id }.join(',') + ')'
end
if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time <= Time.now)
@exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id in #{student_id} and user_id in #{student_in_group}"), @name
if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? && @exercise.score_open && @exercise.end_time <= Time.now)
@exercise_users_list = @exercise.exercise_users.where("user_id in #{student_in_group}").order("#{@order} #{@b_sort}")
@show_all = true;
elsif !@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time > Time.now
@exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id = ? and user_id in #{student_id} and user_id in #{student_in_group}",User.current.id), @name
elsif !@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty?
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and user_id in #{student_in_group}",User.current.id)
else
@exercise_users_list = []
end
else
if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time <= Time.now)
@exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id in #{student_id}"), @name
if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? && @exercise.score_open && @exercise.end_time <= Time.now)
@exercise_users_list = @exercise.exercise_users.where("user_id in #{student_id}").order("#{@order} #{@b_sort}")
@show_all = true;
elsif !@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time > Time.now
@exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id = ? and user_id in #{student_id}",User.current.id), @name
elsif User.current.member_of_course?(@course)
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and user_id in #{student_id}",User.current.id)
else
@exercise_users_list = []
end
end
@exercise_count = @exercise.exercise_users.where("commit_status = 1 and user_id in #{student_id}").count
@left_nav_type = 8
unless @comment.blank?
if @comment.include?('0')
@exercise_users_list = @exercise_users_list.where(:subjective_score => -1)
else
@exercise_users_list = @exercise_users_list.where("subjective_score != -1")
end
end
unless @status.blank?
@exercise_users_list = @exercise_users_list.where(:commit_status => @status)
end
@exercise_users_list = search_exercise_member @exercise_users_list, @name
@tab = params[:tab].nil? ? 1 : params[:tab].to_i
@score = @b_sort == "desc" ? "asc" : "desc"
@exercise_count = @exercise_users_list.count
@has_commit_count = @exercise.exercise_users.where(:commit_status => 1).count
@no_group_count = @course.members.where(:course_group_id => 0).select{|m| m.roles.to_s.include?("Student")}.count
@limit = 50
@is_remote = true
@page = (params['page'] || 1).to_i
@exercise_pages = Paginator.new @exercise_count, @limit, @page
@offset ||= @exercise_pages.offset
@exercise_users_list = paginateHelper @exercise_users_list, @limit
respond_to do |format|
format.js
format.html
format.html{render :layout => 'base_edu'}
format.xls {
filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@exercise.exercise_name}#{l(:excel_exercise_list)}.xls"
filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@exercise.exercise_name}#{l(:excel_exercise_list)}.xls"
send_data(exercise_to_xls(@exercise_users_list), :type => "text/excel;charset=utf-8; header=present",
:filename => filename_for_content_disposition(filename))
}
@ -690,11 +690,11 @@ class ExerciseController < ApplicationController
else
# 更新提交状态
cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first
cur_exercise_user.update_attributes(:status => 1, :commit_status => 1)
if @exercise.time && @exercise.time != -1
cur_exercise_user.update_attributes(:status => 1, :commit_status => 1, :end_at => Time.now)
#if @exercise.time && @exercise.time != -1
score = calculate_student_score(@exercise, User.current)
cur_exercise_user.update_attributes(:score => score)
end
cur_exercise_user.update_attributes(:objective_score => score, :score => score + (cur_exercise_user.subjective_score > 0 ? cur_exercise_user.subjective_score : 0))
#end
# 答题过程中需要统计完成量
#@uncomplete_question = get_uncomplete_question(@exercise, User.current)
# 获取改学生的考试得分
@ -748,16 +748,20 @@ class ExerciseController < ApplicationController
#查看学生的答卷情况
def show_student_result
@user = User.find params[:user_id]
@can_edit_excercise = false
@exercise_questions = @exercise.exercise_questions
#score = calculate_student_score(@exercise, @user)
#eu = get_exercise_user(@exercise.id, @user.id)
#eu.update_attributes(:score => score)
@exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first
@left_nav_type = 8
respond_to do |format|
format.html {render :layout => 'base_courses'}
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @is_teacher || (User.current.member_of_course?(@exercise.course) && @exercise.exercise_status > 2)
@user = User.find params[:user_id]
#@can_edit_excercise = false
@exercise_questions = @exercise.exercise_questions
#score = calculate_student_score(@exercise, @user)
#eu = get_exercise_user(@exercise.id, @user.id)
#eu.update_attributes(:score => score)
@exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first
respond_to do |format|
format.html {render :layout => 'base_edu'}
end
else
render_403
end
end
@ -820,11 +824,13 @@ class ExerciseController < ApplicationController
# 查作者是我,或者作者是当前课程的老师,且不在当前课程内的试卷 进行导入
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
@r_sort = @b_sort == "desc" ? "asc" : "desc"
courses = User.current.courses.not_deleted.select { |course| User.current.allowed_to?(:as_teacher,course)}
course_ids = courses.empty? ? "(-1)" : "(" + courses.map { |course| course.id}.join(',') + ")"
@search = params[:search] ? params[:search].to_s.strip.downcase : ""
#courses = User.current.courses.not_deleted.select { |course| User.current.allowed_to?(:as_teacher,course)}
#course_ids = courses.empty? ? "(-1)" : "(" + courses.map { |course| course.id}.join(',') + ")"
#none_courses = User.current.courses.where("is_delete = 1 or #{Course.table_name}.id = #{params[:course_id].to_i}")
#none_course_ids = none_courses.empty? ? "(-1)" : "(" + none_courses.map { |course| course.id}.join(',') + ")"
@exercises = Exercise.where("(user_id = #{User.current.id} or course_id in #{course_ids}) and course_id != #{params[:course_id].to_i}").order("#{@order} #{@b_sort}")
#@exercises = Exercise.where("(user_id = #{User.current.id} or course_id in #{course_ids}) and course_id != #{params[:course_id].to_i} and exercise_name like '%#{@search}%'").order("#{@order} #{@b_sort}")
@exercises = Exercise.where("user_id = #{User.current.id} and exercise_name like '%#{@search}%'").order("#{@order} #{@b_sort}")
@course_id = params[:course_id]
@is_remote = true
@ex_count = @exercises.count
@ -859,15 +865,15 @@ class ExerciseController < ApplicationController
def import_other_exercise
course_id = params[:course_id]
@course = Course.find(course_id)
params[:exercise_id].each_with_index do |ex,i|
exercise = Exercise.find(ex)
if params[:exercise_id]
exercise = Exercise.find(params[:exercise_id])
option = {
:exercise_name => exercise.exercise_name,
:exercise_status => 1,
:user_id => User.current.id,
:show_result => 1,
:course_id => @course.id,
:time => exercise.time,
:time => -1,
:exercise_description => exercise.exercise_description
}
@exercise = Exercise.create option
@ -899,9 +905,6 @@ class ExerciseController < ApplicationController
end
@exercise.save
end
respond_to do |format|
format.js
end
end
private
@ -937,7 +940,7 @@ class ExerciseController < ApplicationController
else
name = name.downcase
select_exercises = exercises.select{ |exercise|
exercise.user[:login].to_s.downcase.include?(name) || exercise.user.user_extensions[:student_id].to_s.downcase.include?(name) || (exercise.user[:lastname].to_s.downcase + exercise.user[:firstname].to_s.downcase).include?(name)
exercise.user.user_extensions[:student_id].to_s.downcase.include?(name) || (exercise.user[:lastname].to_s.downcase + exercise.user[:firstname].to_s.downcase).include?(name)
}
end
select_exercises

View File

@ -119,8 +119,10 @@ class ForumsController < ApplicationController
end
def index
order = ""
order = "sticky desc, created_at desc"
@order_str = ""
@user = User.current
=begin
if(params[:reorder_complex])
order = "replies_count #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
@order_str = "reorder_complex="+params[:reorder_complex]
@ -134,6 +136,7 @@ class ForumsController < ApplicationController
order = "#{Memo.table_name}.updated_at desc"
@order_str = "reorder_time=desc"
end
=end
@memo = Memo.new(:forum => @forum)
@memos = Memo.where("parent_id is null")
@topic_count = @memos.count
@ -144,14 +147,18 @@ class ForumsController < ApplicationController
reorder(order).
preload(:author, {:last_reply => :author}).
all
@forums = Forum.find_by_sql("SELECT *,topic_count + memo_count tm FROM `forums` order by tm desc;")
#@forums = Forum.find_by_sql("SELECT *,topic_count + memo_count tm FROM `forums` order by tm desc;")
@my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count
@my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count
@errors = params[:errors]
memos_id = Memo.where("author_id =?", User.current.id).map(&:id)
@memos_praise_count = PraiseTread.where(:praise_tread_object_id => memos_id, :praise_tread_object_type => "Memo").count
respond_to do |format|
format.js
format.html {
render :layout => 'base_new_forum'
render :layout => 'base_edu'
}# show.html.erb
format.json { render json: @forum }
end
@ -181,13 +188,10 @@ class ForumsController < ApplicationController
end
@memo = Memo.new(:forum => @forum)
@topic_count = @forum.topics.count
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@memos = @forum.topics.includes(:last_reply).
limit(@topic_pages.per_page).
offset(@topic_pages.offset).
reorder(order).
preload(:author, {:last_reply => :author}).
all
@limit = 20
@is_remote = true
@topic_pages = Paginator.new @topic_count, @limit, params['page'] || 1
@memos = paginateHelper @forum.topics.includes(:last_reply).reorder(order).preload(:author, {:last_reply => :author}), @limit
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and parent_id is null").count
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and parent_id is not null").count
@errors = params[:errors]

View File

@ -3,14 +3,77 @@ class GamesController < ApplicationController
layout "base_myshixun"
skip_before_filter :verify_authenticity_token, :only => [:file_update]
before_filter :find_myshixun, :only => [:index]
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :prev_step,:outputs_show, :file_edit, :file_update, :get_waiting_time,
:game_status, :change_status, :answer, :minus_score, :refresh_game_list, :reset_original_code, :reset_new_code, :evaluating_choice]
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :prev_step,:outputs_show, :file_edit, :file_update, :get_waiting_time, :web_display,
:game_status, :change_status, :answer, :minus_score, :refresh_game_list, :reset_original_code, :reset_new_code, :evaluating_choice, :sync_codes]
before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update, :reset_original_code, :reset_new_code, :html_show]
before_filter :allowd_manager
before_filter :allowd_view, :only => [:show]
before_filter :find__shixun_language, :only => [:show, :entry]
include ApplicationHelper
require 'open3'
# 同步更新最新代码
# 同步完成后需要更新myshixun的commit_id为实训的commit最新值
# --------------------------
# 新思路有冲突则则重置没有冲突直接pull
# --------------------------
def sync_codes
g = Gitlab.client
myshixun_user_login = User.where(:id => @myshixun.user_id).first.try(:login)
myshixun_rep_identifier = Repository.where(:myshixun_id => @myshixun.id, :type => "Repository::Gitlab").first.try(:identifier)
gitlab_address = Redmine::Configuration['gitlab_address']
myshixun_domain = Redmine::Configuration['myshixun_domain']
gitlab_myshixun_url = git_myshixun_url(@myshixun, @myshixun.try(:user_id))
shixun = @myshixun.shixun
gitlab_shixun_url = git_shixun_url(shixun, (shixun.try(:fork_from).blank? ? "educoder" : "eduforge"))
if RUBY_PLATFORM =~ /w32/
path = "c:/test/"
else
path = "/home/pdl/myshixun_shell"
end
script = "cd #{path}
git clone #{gitlab_address.to_s+'/'+myshixun_user_login+'/'+ myshixun_rep_identifier}.git
cd #{myshixun_rep_identifier}/
git remote set-url origin https://#{shixun.fork_from.blank? ? "educoder" : "eduforge"}:xinhu1ji2qu3@#{myshixun_domain}/#{myshixun_user_login}/#{myshixun_rep_identifier}.git
git remote add remote_origin #{gitlab_shixun_url}
#git pull
git pull remote_origin master
if [ $? -eq 0 ];then
echo -e 'git pull succssed'
else
git reset --hard #{@myshixun.commit_id}
git pull remote_origin master
if [ $? -eq 0 ];then
echo -e 'git reset and pull succssed'
else
echo -e 'git reset and pull failed'
fi
fi
git push -f origin master
if [ $? -eq 0 ];then
echo -e 'git push succssed'
else
echo -e 'git push failed'
fi
cd ../
rm -rf #{myshixun_rep_identifier}/"
aFile =File.new(File.join("#{path}","#{@myshixun.identifier}.sh"), "w+")
if aFile
aFile.syswrite(script)
else
logger.error "Unable to open file!"
end
system("sh #{path}/#{@myshixun.identifier}.sh")
# stdin, stdout, stderr = Open3.popen3("sh #{path}/#{@myshixun.identifier}.sh")
shixun_new_commit = g.commits(@myshixun.shixun.try(:gpid)).first.try(:id)
@myshixun.update_column(:commit_id, shixun_new_commit)
sleep(2) # g
respond_to do |format|
format.js{ redirect_to myshixun_game_path( @game, :myshixun_id => @myshixun)}
end
# render :json => {:status => 200}
end
def index
@games = @myshixun.games.includes(:challenge)
@games_count = @games.count
@ -26,19 +89,38 @@ class GamesController < ApplicationController
# @praise 判断是否点赞
# @tread 判断是否踩
# git_repository_url @myshixun, "Myshixun"
# @st 0 实践任务 1 多选任务 2 单选任务
# @st 0 实践任务 1 选择题任务
def show
# g = Gitlab.client
# g_name = g.project(@myshixun.gpid).try(:name)
# g_rep = @myshixun.repository
# g_identifier = g_rep.try(:identifier)
# if g_name.include?("-") || g_identifier.include?("-")
# g_user_id = @myshixun.owner.try(:gid)
# g_name = g_name.split("-")
# g_project_name = g_name[0]
# num = g_name[1]
# g_id = g.current_user_project(g_user_id, g_project_name).first.try(:id)
# sql = "update `repositories` set identifier='#{g_project_name}' where id=#{g_rep.id}"
# ActiveRecord::Base.connection.execute(sql)
# @myshixun.update_attribute(:gpid, g_id)
# end
# 展示全部实训
# git_myshixun_url_ip @myshixun, user_id
@is_subject = params[:is_subject]
if @game.status == 1
# 放置页面ajax数据还没获取就关闭
@game.update_attribute(:status, 0)
end
# logger.info("#################%%%%%%#{@game.outputs.first.out_put}")
# @games = @myshixun.games.includes(:challenge)
@game_challenge = @game.challenge
@challenges = Challenge.where(:shixun_id => @myshixun.shixun_id)
@shixun = @myshixun.shixun
# 判断tpm是否修改了
@tpm_modified = tpm_is_modified(@myshixun, @shixun.try(:gpid))
# end
@praise_count = PraiseTread.where(:praise_tread_object_id => @game_challenge.id, :praise_tread_object_type => "Challenge").count
@tread_count = PraiseTread.where(:praise_tread_object_id => @game_challenge.id, :praise_tread_object_type => "ChallengeTread").count
# @games_count = @games.count
@ -166,7 +248,7 @@ class GamesController < ApplicationController
raise("实训云平台繁忙繁忙等级94")
end
render :json => {:result => "success", :onRun => res['onRun'], :waitNum => res['waitNum'], :waitingTime => res['waitingTime'], :resubmit => resubmit }
#render :json => {:result => "success", :onRun => 0, :waitNum => 12, :waitingTime => 1234 }
#render :json => {:result => "success", :onRun => 0, :waitNum => 12, :waitingTime => 1234 }
rescue Exception => e
render :json => {:result => "failed"}
end
@ -430,16 +512,36 @@ class GamesController < ApplicationController
end
end
# web渲染
def web_display
path = @game.challenge.path.strip
port = (50000 + @game.myshixun_id).to_s
# 测试
#path = "src/step1/Helloworld.php"
#port = (50000+4116).to_s
@url = "http://106.75.96.108:" + port + '/' + path
respond_to do |format|
format.html{render :layout => false}
end
end
def minus_score
@game_challenge = @game.challenge
user = User.current
challenge_score = @game_challenge.score.to_i
reward_grade(user, @game.id, 'Answer', -challenge_score)
@answer = @game_challenge.answer
@game.update_column(:answer_open, true)
respond_to do |format|
format.js
@answer = ""
if @game.challenge.st == 0
@answer = @game_challenge.answer
else
@game_challenge.challenge_chooses.each_with_index do |choose, index|
@answer += ""+ ((index + 1).to_s) +"题:<br />"
@answer += (choose.answer.blank? ? choose.standard_answer : choose.answer)
@answer += "<br /><br /><br />"
end
end
@game.update_column(:answer_open, true)
end
def refresh_game_list

View File

@ -9,10 +9,10 @@ class HomeworkCommonController < ApplicationController
before_filter :find_course, :only => [:index,:new,:create]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,
:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works,
:set_score_open,:alert_score_open_modal,:add_to_homework_bank,:publish_homework,:setting,:set_public,:homework_setting]
:set_score_open,:alert_score_open_modal,:add_to_homework_bank,:publish_homework,:setting,:set_public,:homework_setting,:update_explanation]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,
:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,
:open_student_works,:add_to_homework_bank,:publish_homework]
:open_student_works,:add_to_homework_bank,:publish_homework,:update_explanation]
before_filter :member_of_course, :only => [:index,:setting]
def index
@ -31,22 +31,22 @@ class HomeworkCommonController < ApplicationController
end
if @order.blank?
if @is_teacher
@homework_commons = @homework_commons.order("created_at desc")
@homework_commons = @homework_commons.order("publish_time desc")
else
@homework_commons = @homework_commons.where("publish_time <= '#{Time.now}'").order("created_at desc")
@homework_commons = @homework_commons.where("publish_time <= '#{Time.now}'").order("publish_time desc")
end
else
case @order
when '1'
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and end_time > '#{Time.now}'").order("homework_commons.created_at desc")
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and end_time > '#{Time.now}'").order("homework_commons.publish_time desc")
when '3'
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.evaluation_end > '#{Time.now}'").order("homework_commons.created_at desc")
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.evaluation_end > '#{Time.now}'").order("homework_commons.publish_time desc")
when '4'
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.appeal_time > '#{Time.now}')").order("homework_commons.created_at desc")
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.appeal_time > '#{Time.now}')").order("homework_commons.publish_time desc")
when '5'
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and archive_time > '#{Time.now}')").order("homework_commons.created_at desc")
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and archive_time > '#{Time.now}')").order("homework_commons.publish_time desc")
else
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order}").order("homework_commons.created_at desc")
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order}").order("homework_commons.publish_time desc")
end
end
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
@ -335,11 +335,11 @@ class HomeworkCommonController < ApplicationController
if @homework.homework_type == 4
if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation].to_i
@homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation].to_i
# if @homework.end_time < Time.now
# @homework.student_works.each do |student_work|
# set_shixun_final_score @homework, student_work, @homework_detail_manual.answer_open_evaluation
# end
# end
if @homework.end_time < Time.now
@homework.student_works.each do |student_work|
set_shixun_final_score @homework, student_work, @homework_detail_manual.answer_open_evaluation
end
end
end
@homework.score_open = params[:homework_score_open] ? 1 : 0
else
@ -471,6 +471,13 @@ class HomeworkCommonController < ApplicationController
end
end
#更新作业说明
def update_explanation
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
@homework.update_attribute('explanation', params[:homework_common][:explanation])
redirect_to student_work_index_path(:homework => @homework.id, :tab => 2)
end
#加入到题库
def add_to_homework_bank
if params[:type] && (params[:type].to_i == 1 || params[:type].to_i == 3)

View File

@ -7,6 +7,80 @@ class ManagementsController < ApplicationController
include UsersHelper
include ApplicationHelper
#用户修改
def account
@user = User.find(params[:user_id])
ue = @user.user_extensions
# @trail_authentication = ApplyAction.where(:user_id => @user.id, :container_type => "TrialAuthorization").order("created_at desc").first
# @authentication = @user.authentication
# if @user.nickname.nil? || @user.lastname.nil? || ue.try(:identity).nil? || ue.try(:location).nil? || ue.try(:location).nil?
# @require_auth = true
# else
# if User.current.certification != 1 && (@trail_authentication.blank? || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 5*60) < Time.now.to_i))
# @require_trail_auth = true
# end
# end
# @s_message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddSchools').first
# @d_message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddDepartment').first
# AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddSchools').update_all(:viewed => true)
# AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddDepartment').update_all(:viewed => true)
lg = @user.login
@pref = @user.pref
diskfile = disk_filename('User', @user.id)
diskfile1 = diskfile + 'temp'
begin
if request.post?
@user.nickname = params[:nickname]
@user.lastname = params[:lastname]
@user.firstname = ""
@user.show_realname = params[:show_realname] ? 0 : 1
@user.pref.attributes = params[:pref]
@user.mail = params[:mail]
@user.phone = params[:phone]
@user.password = params[:new_password]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
@se = @user.extensions
@se.school_id = params[:occupation]
@se.department_id = params[:department_id]
@se.gender = params[:sex]
@se.location = params[:province] if params[:province]
@se.location_city = params[:city] if params[:city]
@se.identity = params[:identity].to_i if params[:identity]
if @se.identity == 0
@se.technical_title = params[:te_technical_title] if params[:te_technical_title]
@se.student_id = nil
elsif @se.identity == 1
@se.student_id = params[:no] if params[:no]
@se.technical_title = nil
elsif @se.identity == 2
@se.technical_title = params[:pro_technical_title] if params[:pro_technical_title]
@se.student_id = nil
end
@se.brief_introduction = params[:brief_introduction]
if @user.save && @se.save
reward_grade(@user, @user.id, 'Account', 500)
# 头像保存
FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1
@user.pref.save
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
set_language_if_valid @user.language
flash[:notice] = l(:notice_account_updated)
return
else
@user.login = lg
end
end
# 不管前面是否有异常,如果文件已存在就删除
ensure
File.delete(diskfile1) if File.exist?(diskfile1)
end
@setting_type = 1
end
# 镜像管理
def mirror_repository
@menu_type = 3
@ -360,7 +434,7 @@ end
@menu_type = 6
@sub_type = 2
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
@department = ApplyAddDepartment.where(:status => 1)
@department = Department.where(:is_auth => 1)
search=params[:search]
if search.blank?
@department = @department
@ -479,17 +553,77 @@ end
end
# 修改单位名称
def upload_logo
@menu_type = 6
@sub_type = 1
@next_type = 1
@school = School.find(params[:school])
end
# 修改单位名称为其他
def school_upload_logo
school = School.where(:id => params[:applied_id]).first
ApplyAddSchools.where(:school_id => params[:applied_id]).destroy_all
before_apply_departments = Department.where(:school_id => params[:applied_id])
after_apply_deparments = Department.where(:school_id => params[:school_id])
before_apply_departments.each do |department|
after_dep = Department.where(:school_id => params[:school_id], :name => department.name).first
if after_dep
UserExtensions.where(:school_id => params[:applied_id], :department_id => department.id).update_all(:department_id => after_dep.id)
else
new_department = Department.create(:name => department.name,:school_id =>params[:school_id], :is_auth => 1)
UserExtensions.where(:school_id => params[:applied_id]).update_all(:department_id => new_department.id)
end
ApplyAddDepartment.where(:department_id => department.id).destroy_all
department.destroy
end
UserExtensions.where(:school_id => params[:applied_id]).update_all(:school_id => params[:school_id])
school.destroy
redirect_to departments_part_managements_path
end
# 修改单位信息
def school_message_update
school = School.where(:name =>params[:schoolname]).first
school_id = school.id
School.where(:id => school_id).update_all(:province => params[:province],:city =>params[:city],:address => params[:address],:shool_code => params[:school_code])
redirect_to departments_part_managements_path
end
# 删除单位
def delete_school
school = School.where(:id => params[:school]).first
UserExtensions.where(:school_id => params[:school]).update_all(:school_id => nil, :department_id => nil)
ApplyAddSchools.where(:school_id => params[:school]).destroy_all
ApplyAddDepartment.where(:school_id => params[:school]).destroy_all
school.destroy
redirect_to departments_part_managements_path
end
def save_school
uploaded_io = params[:logo]
sl = School.create(:name => params[:schoolname],:province => params[:province],:city => params[:city],:address => params[:address])
# sl = School.create(:name => params[:school],:province => params[:schollProvince],:city => params[:schoolCity],:address => params[:address])
unless uploaded_io.nil?
File.new(Rails.root.join('public', 'images', 'school', sl.id.to_s+'.png'), 'wb').write(sl.id)
# File.new(Rails.root.join('public', 'images', 'school', sl.id.to_s+'.png'), 'wb') do |file|
# file.write(uploaded_io.read)
# end
File.open(Rails.root.join('public', 'images', 'school', sl.id.to_s+'.png'), 'wb') do |file|
file.write(uploaded_io.read)
end
sl.logo_link = '/images/school/'+sl.id.to_s+'.png'
sl.save
end
@user = User.current
@se = @user.extensions
# if @user.save && @se.save
# diskfile1 = disk_filename('school', sl.id , 'id')
# diskfileID = diskfile1 + 'temp'
# begin
# FileUtils.mv diskfileID, diskfile1, force: true if File.exist? diskfileID
# ensure
# File.delete(diskfileID) if File.exist?(diskfileID)
# end
# end
redirect_to departments_part_managements_path
end
@ -523,6 +657,9 @@ end
applied_department = ApplyAddDepartment.find(params[:id])
applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment")
applied_message.update_all(:status => 1)
if applied_department.department
applied_department.department.update_attributes(:is_auth => 1)
end
applied_department.update_attribute(:status, 1) unless applied_department.nil?
AppliedMessage.create(:user_id => applied_department.user_id, :status => 1, :viewed => 0, :applied_id => applied_department.id, :applied_type => "ApplyAddDepartment", :name => applied_department.name )
UserExtensions.where(:user_id => applied_department.user_id).update_all(:department_id => applied_department.department_id)
@ -673,17 +810,16 @@ end
# 单位审批修改
def all_schools
apply_schools = ApplyAddSchools.where("status = 0")
apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")"
apply_school_ids = apply_schools.empty? ? "(#{params[:school_id].to_i})" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")"
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p", :p => search)
#@schools = School.all
@schools = School.where("id not in #{apply_school_ids} and id != #{params[:school_id].to_i} and #{School.table_name}.name like :p", :p => search)
else
#@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
@schools = School.where("id not in #{apply_school_ids}")
@schools = School.where("id not in #{apply_school_ids} and id != #{params[:school_id].to_i}")
end
@edit_id = params[:school_id]
@search = params[:search]
@upload = params[:upload]
respond_to do |format|
format.js
end
@ -703,9 +839,28 @@ end
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => 0, :applied_id => aas.id, :applied_type => "ApplyAddSchools", :name => school.name )
users = UserExtensions.where("school_id = #{aas.school_id}")
users.update_all(:school_id => school.id)
ApplyAddDepartment.where(:school_id => aas.school_id).update_all(:school_id => school.id)
Department.where(:school_id => aas.school_id).update_all(:school_id => school.id)
# 判断重复
before_apply_departments = Department.where(:school_id => params[:applied_id])
after_apply_deparments = Department.where(:school_id => params[:school_id])
before_apply_departments.each do |department|
after_dep = Department.where(:school_id => params[:school_id], :name => department.name).first
if after_dep
UserExtensions.where(:school_id => params[:applied_id], :department_id => department.id).update_all(:department_id => after_dep.id)
else
UserExtensions.where(:school_id => params[:applied_id]).update_all(:department_id => new_department.id)
if after_dep.status == 2 ||after_dep.status == 3
new_department = Department.create(:name => department.name,:school_id =>params[:school_id], :is_auth => 1)
else
new_department = Department.create(:name => department.name,:school_id =>params[:school_id], :is_auth => 0)
end
end
ApplyAddDepartment.where(:department_id => department.id).destroy_all
department.destroy
end
UserExtensions.where(:school_id => params[:applied_id]).update_all(:school_id => params[:school_id])
# Department.where(:school_id => aas.school_id).update_all(:school_id => school.id)
aas.school.destroy
aas.update_attribute(:school_id, school.id)
end
@ -734,7 +889,7 @@ end
user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
@courselist = @courselist.includes(:user).where("concat(users.lastname, users.firstname) like '%#{search}%'")
else
@courselist= @courselist.where("name like '%#{search}%'")
@courselist = @courselist.where("name like '%#{search}%'")
end
end
@courselist = @courselist.order("created_at #{@sx_order}")
@ -802,7 +957,9 @@ end
@courses = @courses.joins("join users u on courses.tea_id = u.id").where("concat(u.lastname, u.firstname) like '%#{@search}%'")
end
else
@courses= @courses.where("name like '%#{@search}%'")
school = School.where("name like '%#{@search}%'").map(&:id)
@courses = @courses.where(:school_id => school)
# @courses= @courses.where("name like '%#{@search}%'")
end
@courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").reorder("updatetime #{@sx_order}")
@export_courses = @courses
@ -932,7 +1089,7 @@ end
# 0 全部1 活动的; 2 已注册; 3 锁定
def users
@menu_type
@menu_type = 7
@sub_type = 1
status = params[:user_status].nil? ? 0 : params[:user_status].to_i
@us_order = params[:us_order].blank? ? "desc" : params[:us_order] # 排序
@ -1060,6 +1217,14 @@ end
end
end
# 允许复制
def shixun_can_copy
if params[:shixun_id]
shixun = Shixun.find params[:shixun_id]
shixun.update_attributes(:can_copy => !shixun.can_copy)
end
end
# 已关闭的实训
def close_shixuns
@menu_type = 3
@ -1110,19 +1275,32 @@ end
def auto_users_trial
@menu_type = 7
@sub_type = 3
@schools = School.where("0=0")
@schools_count = @schools.count
@apply_action = School.where(:auto_users_trial => 1).order('updated_at desc')
@auto_school_ids = @apply_action.empty? ? "(-1)" : "(" + @apply_action.map(&:id).join(",") + ")"
@apply_action_count = @apply_action.count
limit = 20
@is_remote = true
@schools_pages = Paginator.new @schools_count, limit, params['page'] || 1
@offset ||= @schools_pages.offset
@schools = paginateHelper @schools, limit
@apply_action_pages = Paginator.new @apply_action_count, limit, params['page'] || 1
@offset ||= @apply_action_pages.offset
@apply_action = paginateHelper @apply_action, limit
respond_to do |format|
format.html
format.js
end
end
# 添加
def create_auto_users_trial
School.where(:id => params[:school]).update_all(:auto_users_trial => 1)
redirect_to auto_users_trial_managements_path
end
# 删除
def update_auto_users_trial
School.where(:id => params[:school]).update_all(:auto_users_trial => 0)
redirect_to auto_users_trial_managements_path
end
def search_user
=begin
@ -1363,7 +1541,14 @@ end
user = User.find(apply_user.user_id)
apply_user.update_attribute(:status, 1)
user.update_attribute(:authentication, true)
@unapproved_user = ApplyUserAuthentication.where(:status => 0, :auth_type => 1).order("updated_at desc")
@unapproved_user_count = @unapproved_user.count
@limit = 15
@is_remote = true
@unapproved_user_pages = Paginator.new @unapproved_user_count, @limit, params['page'] || 1
@offset ||= @unapproved_user_pages.offset
@unapproved_user = paginateHelper @unapproved_user, @limit
respond_to do |format|
format.js
end
@ -1374,6 +1559,7 @@ end
apply_user = ApplyUserAuthentication.where(:id => params[:apply_id], :auth_type => 2).first
reason = apply_user.update_attributes(:status => 2, :remarks => params[:reject_reason])
render :json => {success: reason}
end
# 同意职业认证
@ -1383,6 +1569,12 @@ end
apply_user.update_attribute(:status, 1)
user.update_attribute(:professional_certification, true)
@unapproved_user = ApplyUserAuthentication.where(:status => 0, :auth_type => 2).order("updated_at desc")
@unapproved_user_count = @unapproved_user.count
@limit = 15
@is_remote = true
@unapproved_user_pages = Paginator.new @unapproved_user_count, @limit, params['page'] || 1
@offset ||= @unapproved_user_pages.offset
@unapproved_user = paginateHelper @unapproved_user, @limit
respond_to do |format|
format.js
end
@ -1411,6 +1603,7 @@ end
@menu_type = 10
@sub_type = 5
@type = trial_authorization_status params[:type]
# sql = select * from apply_actions where dealer_id is null
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type).order("created_at desc")
search = params[:search]
unless search.blank?
@ -1470,16 +1663,16 @@ end
else #同意
shixun.update_column('status', 2)
apply_action.update_attributes(:status => 1, :dealer_id => User.current.id)
shixun_modify_status_without_publish shixun, 1
add_shixun_modify_status shixun, 1
# 实训发布后则不允许修改代码
g = Gitlab.client
shixun.shixun_members.each do |member|
gid = User.find(member.user_id).try(:gid)
g.edit_team_member(shixun.gpid, gid, 10) # 3代表角色master
end
# 加入超级管理员
admin_gid = User.where(:admin => 1).first.try(:gid)
g.add_team_member(shixun.gpid, admin_gid, 40) # 30代表角色master
# g = Gitlab.client
# shixun.shixun_members.each do |member|
# gid = User.find(member.user_id).try(:gid)
# g.edit_team_member(shixun.gpid, gid, 10) # 3代表角色master
# end
# # 加入超级管理员
# admin_gid = User.where(:admin => 1).first.try(:gid)
# g.add_team_member(shixun.gpid, admin_gid, 40) # 30代表角色master
end
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => 0)
@authorizations_count = @authorizations.count

View File

@ -1,6 +1,6 @@
class MemosController < ApplicationController
default_search_scope :memos
before_filter :find_forum, :only => [:new, :create, :preview, :update]
before_filter :find_forum, :only => [:new, :create, :preview, :update, :reply]
before_filter :find_attachments, :only => [:preview]
before_filter :find_memo, :except => [:new, :create, :preview]
before_filter :authenticate_user_edit, :only => [:edit, :update]
@ -29,13 +29,14 @@ class MemosController < ApplicationController
def new
# 如何是问吧主页来的,导航不显示具体贴吧名
@user = User.current
@memo = Memo.new
@my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count
@my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count
@my_forums_count = Memo.where("author_id =? and parent_id is null",@user.id).count
@my_memos_count = Memo.where("author_id =? and parent_id is not null", @user.id).count
@forums = Forum.reorder("topic_count desc,updated_at desc")
respond_to do |format|
format.js
format.html {render layout: 'base_new_forum'}
format.html {render layout: 'base_edu'}
format.json { render json: @memo }
end
end
@ -88,6 +89,7 @@ class MemosController < ApplicationController
REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE)
def show
@user = User.current
# 更新贴吧帖子留言对应的memo_messages的viewed字段
unless @memo.children.blank?
@memo.children.each do |child|
@ -141,19 +143,20 @@ class MemosController < ApplicationController
respond_to do |format|
format.js
format.html {render :layout => 'base_new_forum'}
format.html {render :layout => 'base_edu'}
format.json { render json: @memo }
format.xml { render xml: @memo }
end
end
def edit
@my_topic_count = 0
@my_replies_count = Memo.where(:parent_id => @memo.id).count
@forums = Forum.reorder("topic_count desc,updated_at desc")
@replying = false
#@my_topic_count = 0
#@my_replies_count = Memo.where(:parent_id => @memo.id).count
#@forums = Forum.reorder("topic_count desc,updated_at desc")
#@replying = false
@user = User.current
respond_to do |format|
format.html {render :layout => 'base_new_forum'}
format.html {render :layout => 'base_edu'}
end
end
@ -162,10 +165,9 @@ class MemosController < ApplicationController
@flag = false
respond_to do |format|
if( #@memo.update_column(:subject, params[:memo][:subject]) &&
@memo.update_column(:content, params[:memo][:content]) &&
@memo.update_column(:sticky, params[:memo][:sticky]) &&
@memo.update_column(:lock, params[:memo][:lock]) &&
if( @memo.update_column(:content, params[:memo][:content]) &&
@memo.update_column(:sticky, params[:memo][:sticky].to_i) &&
@memo.update_column(:lock, params[:memo][:lock].to_i) &&
@memo.update_column(:subject,params[:memo][:subject]) &&
@memo.update_column(:updated_at,Time.now))
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
@ -173,7 +175,7 @@ class MemosController < ApplicationController
@flag = @memo.save
# @memo.root.update_attribute(:updated_at, @memo.updated_at)
format.js
format.html {redirect_to back_memo_url, notice: "#{l :label_memo_update_succ}"}
format.html {redirect_to back_memo_url}
else
format.js
format.html { render action: "edit" }
@ -182,12 +184,64 @@ class MemosController < ApplicationController
end
end
def reply
if params[:memo].present? && params[:memo][:parent_id].present?
parent = Memo.find params[:memo][:parent_id]
@memo = params[:activity_id].blank? ? parent : Memo.find(params[:activity_id].to_i)
@reply = Memo.new
@reply.author = User.current
@reply.forum_id = parent.forum_id
@reply.content = params[:content]
@reply.subject = "RE: #{@memo.subject}"
#@reply.reply_id = params[:id]
@reply.root_id = parent.root_id.nil? ? parent.id : parent.root_id
# @reply.reply_id = params[:id]
parent.children << @reply
else
@reply = Memo.new()
@reply.content = params[:content]
@reply.subject = @memo.subject
@reply.author = User.current
@reply.forum_id = @forum.id
#@reply.content = @quote + @reply.content
#@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
@reply.root_id = @memo.id
@reply.safe_attributes = params[:reply]
@memo.children << @reply
# @reply.reply_id = params[:id]
end
redirect_to message_replies_forum_memo_path(@memo.forum, @memo, :user_activity_id => params[:user_activity_id])
end
def message_replies
@replies = Memo.where(:root_id => @memo.id).order("created_at desc")
@reply_count = @replies.count
@replies = get_no_children_comments_all @replies
#@limit_count = @replies.count
#@page = params[:page] ? params[:page].to_i + 1 : 0
#@limit = 10
#@replies = @replies[@page * @limit..@page * @limit + 9]
@reply = Message.new()
@user_activity_id = params[:user_activity_id].blank? ? @memo.id : params[:user_activity_id].to_i
respond_to do |format|
format.js
end
end
def destroy
@memo.destroy
respond_to do |format|
# format.html { redirect_to @back_url }
format.html { redirect_to back_memo_or_forum_url }
#format.html { redirect_to @back_url }
format.html { redirect_to forums_path }
format.js{
@memo = Memo.find(params[:user_activity_id].to_i)
@replies = Memo.where(:root_id => @memo.id).order("created_at desc")
@reply_count = @replies.count
@replies = get_no_children_comments_all @replies
#redirect_to message_replies_forum_memo_path(@memo.forum, @memo, :user_activity_id => params[:user_activity_id])
}
format.json { head :no_content }
end
end
@ -196,7 +250,13 @@ class MemosController < ApplicationController
def change_sticky
@memo.sticky ? @memo.update_attribute(:sticky, false) : @memo.update_attribute(:sticky, true)
respond_to do |format|
format.html { redirect_to forum_memo_path(@memo.forum, @memo) }
format.html {
if params[:index]
redirect_to forums_path
else
redirect_to forum_memo_path(@memo.forum, @memo)
end
}
end
end

View File

@ -283,6 +283,9 @@ class MessagesController < ApplicationController
#@replies = @replies[@page * @limit..@page * @limit + 9]
@reply = Message.new()
@user_activity_id = params[:user_activity_id].blank? ? @topic.id : params[:user_activity_id].to_i
if !params[:user_activity_id].blank? && params[:user_activity_id].to_i != @topic.id
@topic.update_attributes(:visits => @topic.visits + 1)
end
respond_to do |format|
format.js
end
@ -406,10 +409,15 @@ class MessagesController < ApplicationController
def sticky_topic
(render_403; return false) unless (User.current.admin? || User.current.allowed_to?(:as_teacher, @course))
@topic.update_attributes(:sticky => @topic.sticky == 1 ? 0 : 1)
if params[:is_board]
redirect_to course_boards_path(@course)
else
redirect_to board_message_path(@topic.board_id, @topic)
respond_to do |format|
format.js
format.html{
if params[:is_board]
redirect_to course_boards_path(@course)
else
redirect_to board_message_path(@topic.board_id, @topic)
end
}
end
end

View File

@ -235,7 +235,19 @@ class MyController < ApplicationController
if @user.save && @se.save
reward_grade(@user, @user.id, 'Account', 500)
# 修改邮箱的时候同步修改到gitlab
if @se.identity == 1
school_ids = School.where(:auto_users_trial => 1).map(&:id)
if !@se.student_id.nil? && @se.student_id != "" && !@se.school.nil? && school_ids.include?(@se.school_id)
apply_action = ApplyAction.where(:user_id => @user.id, :container_type => "TrialAuthorization", :status => 0).first
unless apply_action.blank?
@user.update_attributes(:certification => 1)
apply_action.update_attributes(:status => 1)
end
end
end
# 修改邮箱的时候同步修改到gitlab
# if changed_mail || changed_login
# g = Gitlab.client
# s = Trustie::Gitlab::Sync.new

View File

@ -118,6 +118,7 @@ class MyshixunsController < ApplicationController
# resubmit 1表示已通关后重新评测0表示非重新评测
# retry_status 0初始值1重新评测失败2重新评测成功
def training_task_status
#params[:jsonTestDetails] = '{"buildID":"1","compileSuccess":"1","msg":[{"caseId":"1","expectedOutput":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyNDcK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoz MjIK","input":"Mg0KMjMsNTYsNzgsOTANCjIxLDU2LDc4LDc2LDkx","output":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyNDcK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoz MjIK","passed":"1"},{"caseId":"2","expectedOutput":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyMjgK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoy MzUK56ysMuS9jeWQjOWtpueahOaAu+WIhuS4ujoyMDYK","input":"Mw0KOTgsNzYsNTQNCjkwLDU0LDg3LDQNCjc4LDI2LDEyLDkw","output":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyMjgK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoy MzUK56ysMuS9jeWQjOWtpueahOaAu+WIhuS4ujoyMDYK","passed":"1"}],"outPut":"Y29tcGlsZSBzdWNjZXNzZnVsbHk","resubmit":"57D9COBR_5806","status":"0"}'
jsonTestDetails = JSON.parse(params[:jsonTestDetails])
status = jsonTestDetails['status']
game_id = jsonTestDetails['buildID']
@ -131,7 +132,9 @@ class MyshixunsController < ApplicationController
challenge = game.challenge
unless jenkins_testsets.blank?
jenkins_testsets.each do |j_test_set|
logger.info("j_test_set: ############## #{j_test_set['output']}")
actual_output = tran_base64_decode64(j_test_set['output'])
logger.info "actual_output:################################################# #{actual_output}"
game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'],
:actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index, :compile_success => compile_success.to_i)
# output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first

View File

@ -126,12 +126,22 @@ class SchoolController < ApplicationController
chinese << char
end
end
if(condition == '')
@school = School.reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100)
@school_count = School.count
if params[:no_school_ids]
if(condition == '')
@school = School.where("id not in #{params[:no_school_ids]}").reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100)
@school_count = School.count
else
@school = School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100)
@school_count = School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
end
else
@school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100)
@school_count = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
if(condition == '')
@school = School.reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100)
@school_count = School.count
else
@school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100)
@school_count = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
end
end
result = []
@ -171,6 +181,8 @@ class SchoolController < ApplicationController
school.name = params[:name].strip
school.pinyin = Pinyin.t(params[:name].strip, splitter: '')
school.province = params[:province]
school.city = params[:city]
school.address = params[:address]
#status 0未处理 1通过 2拒绝
applyschool = ApplyAddSchools.new

View File

@ -14,15 +14,40 @@ class ShixunsController < ApplicationController
CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z)
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
# 获取版本库文件目录
def search_file_list
path = params[:path]
@path = to_path_param(path)
g = Gitlab.client
@dir = g.trees(@shixun.gpid, :path => @path).map{|tree|[tree.type, (@path.blank? ? tree.name : "#{@path}"+"/"+tree.name )]}
logger.info("dir is ##{@dir}")
respond_to do |format|
format.js
end
# render :json => {:dir => @dir}
end
def achieve_ways
@repository = @shixun.repository
@entries = @repository.entries(@path, @rev)
# @entries = Gitlab.client.trees(@shixun.gpid).map{|tree| tree.name}
end
def statistics_students
@statistics = @shixun.myshixuns.where("").order("created_at desc")
@statistics_count = @statistics.count
@limit = 10
@is_remote = true
@statistic_pages = Paginator.new @statistics_count, @limit, params['page'] || 1
@offset ||= @statistic_pages.offset
@statistics = paginateHelper @statistics, @limit
pub_shixun = ApplyAction.where(:container_type => "ApplyShixun", :status => 1, :container_id => @shixun.id).last
if pub_shixun.present?
updated_at = pub_shixun.updated_at
@statistics = @shixun.myshixuns.select{|myshixun| myshixun.updated_at > updated_at}
@statistics = @statistics.map(&:id)
@statistics = Myshixun.where(:id => @statistics).order("created_at desc")
#@statistics = @shixun.myshixuns.where("created_at > #{updated_at}").order("created_at desc")
@statistics_count = @statistics.count
@limit = 15
@is_remote = true
@statistic_pages = Paginator.new @statistics_count, @limit, params['page'] || 1
@offset ||= @statistic_pages.offset
@statistics = paginateHelper @statistics, @limit
end
end
@ -32,44 +57,53 @@ class ShixunsController < ApplicationController
render :json => {status: "success"}
end
# 注意shixun_id 格式 /shixun_migrate?shixun_id=100
# 注意language 格式 /shixun_migrate?language="Java,Python"
def shixun_migrate
unless User.current.admin?
render_403
return
end
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
if params[:shixun_id]
shixuns = Shixun.where(:id => params[:shixun_id])
if params[:language]
language = params[:language].split("/")
logger.info(language)
shixuns = Shixun.where(:language => language)
elsif params[:shixun_id]
shixuns = Shixun.where(:id => params[:shixun_id])
else
shixuns = Shixun.all
end
shixuns.each do |shixun|
begin
logger.info("shixun id is #{shixun.id}")
tpiList =[]
gameInfo = shixun.gameInfo
myshixuns = shixun.myshixuns
if myshixuns.present?
myshixuns.each do |myshixun|
logger.info("tpiID is #{myshixun.id}")
tpiID = myshixun.id
instanceGitURL = git_myshixun_url_ip(myshixun, myshixun.try(:user_id))
logger.info("instanceGitURL is #{instanceGitURL}")
tpiList << {:tpiID => tpiID, :instanceGitURL => instanceGitURL}
logger.info("###############{tpiList.to_json unless tpiList.blank?}")
if shixuns.present?
shixuns.each do |shixun|
begin
logger.info("shixun id is #{shixun.id}")
tpiList =[]
gameInfo = shixun.gameInfo
myshixuns = shixun.myshixuns
if myshixuns.present?
myshixuns.each do |myshixun|
logger.info("tpiID is #{myshixun.id}")
tpiID = myshixun.id
instanceGitURL = git_myshixun_url_ip(myshixun, myshixun.try(:user_id))
logger.info("instanceGitURL is #{instanceGitURL}")
tpiList << {:tpiID => tpiID, :instanceGitURL => instanceGitURL}
logger.info("###############{tpiList.to_json unless tpiList.blank?}")
logger.info("************#{tpiList}")
logger.info("************#{tpiList}")
end
end
tpiList = Base64.urlsafe_encode64(tpiList.to_json) unless tpiList.blank?
params = {:gameInfo => "#{gameInfo}", :tpiList => "#{tpiList}" }
logger.info("params is #{params}")
uri = "#{shixun_tomcat}/bridge/dataTransfer/transfer"
logger.info("uri is #{uri}")
res = uri_exec uri, params
logger.info("=====res is #{res['code']}")
render :json => {:result => "success"}
rescue Exception => e
logger.info("error ====> #{e.message}")
end
tpiList = Base64.urlsafe_encode64(tpiList.to_json) unless tpiList.blank?
params = {:gameInfo => "#{gameInfo}", :tpiList => "#{tpiList}" }
logger.info("params is #{params}")
uri = "#{shixun_tomcat}/bridge/dataTransfer/transfer"
logger.info("uri is #{uri}")
res = uri_exec uri, params
logger.info("=====res is #{res['code']}")
rescue Exception => e
logger.info("error ====> #{e.message}")
end
end
end
@ -114,9 +148,9 @@ class ShixunsController < ApplicationController
@rev = params[:rev]
@content = params[:content]
code_file = g.edit_file(@shixun.gpid, :content => params[:content], :file_path => @path, :branch_name => @rev, :commit_message => "shixun entry")
if @shixun.try(:status).to_i < 2
shixun_modify_status_without_publish(@shixun, 1)
end
# if @shixun.try(:status).to_i < 2
# shixun_modify_status_without_publish(@shixun, 1)
# end
respond_to do |format|
format.js
end
@ -281,7 +315,7 @@ class ShixunsController < ApplicationController
@courses = CourseList.where(:support_shixuns_search => 1)
#if !@course.blank? && (@major.blank? || MajorCourse.where(:major_id => @major, :course_list_id => @course).count == 1)
if !@course.blank?
@shixuns = @shixuns.where(:id => ShixunMajorCourse.where(:course_list_id => @course).map(&:shixun_id))
@shixuns = @shixuns.where(:id => ShixunMajorCourse.where(:course_list_id => @course).map(&:shixun_id))
end
# if !@major.blank? && MajorCourse.where(:major_id => @major, :course_list_id => @course).count == 0
# @course = nil
@ -342,16 +376,26 @@ class ShixunsController < ApplicationController
# jenkins回调脚本
# gameID 及实训ID
def publish
@status = 0
@position = ""
begin
@shixun.update_attributes!(:status => 1)
apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first
if apply && apply.status == 0
@status = 0
else
ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => User.current.id, :status => 0)
notes = User.current.show_name.to_s + " 申请发布实训:<a href='#{shixun_path(@shixun)}'>#{@shixun.name}</a>"
JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0)
@status = 1
@shixun.challenges.each do |challenge|
if challenge.challenge_tags.count == 0
@status = 2
@position = (@position == "" ? @position : (@position + "")) + challenge.position.to_s + ""
end
end
if @status == 0
@shixun.update_attributes!(:status => 1)
apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first
if apply && apply.status == 0
@status = 0
else
ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => User.current.id, :status => 0)
notes = User.current.show_name.to_s + " 申请发布实训:<a href='#{shixun_path(@shixun)}'>#{@shixun.name}</a>"
JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0)
@status = 1
end
end
rescue Exception => e
@jenkin_error = true
@ -415,8 +459,13 @@ class ShixunsController < ApplicationController
s.sync_user(User.current)
end
gshixun = g.fork(@shixun.gpid, User.current.gid)
if !gshixun.try(:id).blank?
myshixun.update_column(:gpid, gshixun.id) if myshixun.try(:gpid).blank? # 为了防止多次fork
if gshixun.try(:id).present?
myshixun.update_column(:gpid, gshixun.id) if myshixun.try(:gpid).blank?
# educoder 加入到myshixun中
myshixun_admin_gid = User.where(:login => "educoder").first.try(:gid)
g.add_team_member(gshixun.id, myshixun_admin_gid, 40) # 30代表角色master
commit_id = g.commits(@shixun.gpid).first.try(:id)
myshixun.update_column(:commit_id, commit_id)
rep = Repository.create!(:myshixun_id => myshixun.id, :identifier => gshixun.name,:project_id => -1, :shixun_id => -2)
rep.update_column(:type, "Repository::Gitlab")
rep_url = Base64.urlsafe_encode64(git_shixun_url_ip @shixun, (@shixun.try(:fork_from).blank? ? "educoder" : "eduforge")) # 注意educoder为默认给实训创建版本库的用户如果换成别的用户名字要相应的修改
@ -546,6 +595,10 @@ class ShixunsController < ApplicationController
end
def copy
unless (@shixun.can_copy && User.current.user_extensions.try(:identity) == 0 && User.current.professional_certification)
render_403
return
end
ActiveRecord::Base.transaction do
begin
new_shixun = Shixun.new
@ -573,26 +626,31 @@ class ShixunsController < ApplicationController
user_gid = User.find_by_mail("eduforge@163.com").try(:gid)
gshixun = g.fork(@shixun.gpid, user_gid)
raise "版本库创建失败" if gshixun.try(:id).blank?
gshixun = g.edit_project(gshixun.id, new_shixun.identifier, new_shixun.identifier)
raise "版本库创建失败" if (gshixun.try(:name) != new_shixun.identifier || gshixun.try(:path) != new_shixun.identifier)
#gshixun = g.edit_project(gshixun.id, new_shixun.identifier, new_shixun.identifier)
raise "实训复制失败" if (gshixun.try(:name) != new_shixun.identifier || gshixun.try(:path) != new_shixun.identifier)
new_shixun.update_column(:gpid, gshixun.id)
# 同步复制者至gitlab,必须要求用户绑定了邮箱
ShixunMember.create!(:user_id => User.current.id, :shixun_id => new_shixun.try(:id), :role => 1)
s = Trustie::Gitlab::Sync.new
gid = User.current.try(:gid)
u = g.add_team_member(gshixun.id, gid, 40) # 3代表角色master
# 同步复制合作者,合作者加入到gitlab
unless User.current.manager_of_shixun?(@shixun)
ShixunMember.create!(:user_id => User.current.id, :shixun_id => new_shixun.try(:id), :role => 1)
end
@shixun.shixun_members.each do |shixun_member|
if ShixunMember.where(:shixun_id => new_shixun.try(:id), :user_id => shixun_member.user_id).blank?
ShixunMember.create!(:user_id => shixun_member.try(:user_id), :shixun_id => new_shixun.try(:id),
:role => (shixun_member.try(:user_id) == User.current.id ? 1 : 2))
end
s = Trustie::Gitlab::Sync.new
gid = User.find(shixun_member.user_id).try(:gid)
u = s.g.add_team_member(gshixun.id, gid, 40) # 3代表角色master
if u.blank?
raise("同步Gitlab数据失败")
end
end
# # 同步复制合作者,合作者加入到gitlab
# unless User.current.manager_of_shixun?(@shixun)
# ShixunMember.create!(:user_id => User.current.id, :shixun_id => new_shixun.try(:id), :role => 1)
# end
# @shixun.shixun_members.each do |shixun_member|
# if ShixunMember.where(:shixun_id => new_shixun.try(:id), :user_id => shixun_member.user_id).blank?
# ShixunMember.create!(:user_id => shixun_member.try(:user_id), :shixun_id => new_shixun.try(:id),
# :role => (shixun_member.try(:user_id) == User.current.id ? 1 : 2))
# end
# s = Trustie::Gitlab::Sync.new
# gid = User.find(shixun_member.user_id).try(:gid)
# u = s.g.add_team_member(gshixun.id, gid, 40) # 3代表角色master
# if u.blank?
# raise("同步Gitlab数据失败")
# end
# end
# 同步复制关卡
if @shixun.challenges.present?
@shixun.challenges.each do |challenge|
@ -667,6 +725,16 @@ class ShixunsController < ApplicationController
end
end
def fork_list
@shixuns = Shixun.where(:fork_from => @shixun.id)
@shixuns_count = @shixuns.count
@limit = 16
@is_remote = true
@shixun_pages = Paginator.new @shixuns_count, @limit, params['page'] || 1
@offset ||= @shixun_pages.offset
@shixuns = paginateHelper @shixuns, @limit
end
def show
respond_to do |format|
format.html{redirect_to shixun_challenges_path(@shixun)}
@ -735,15 +803,20 @@ class ShixunsController < ApplicationController
end
def shixun_discuss
@discusses = @shixun.discusses.where(:parent_id => nil).reorder("created_at desc")
@discusses = @shixun.discusses.reorder("created_at desc")
@discusses_count = @discusses.count
@limit = 15
@is_remote = true
@discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1
@offset ||= @discusses_pages.offset
@discusses = paginateHelper @discusses, @limit
#@limit = 15
#@is_remote = true
#@discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1
# @offset ||= @discusses_pages.offset
#@discusses = paginateHelper @discusses, @limit
#@game_challenge = params[:challenge_id].blank? ? Challenge.find(@discusses.challenge_id) : Challenge.find(params[:challenge_id])
@game_challenge = Challenge.find(params[:challenge_id].to_i)
challenge_id = params[:challenge_id].nil? ? @shixun.challenges.first.try(:id) : params[:challenge_id].to_i
@game_challenge = Challenge.find(challenge_id)
respond_to do |format|
format.js
format.html
end
end
def destroy
@ -752,6 +825,8 @@ class ShixunsController < ApplicationController
return
end
Subject.where(:id => @shixun.stage_shixuns.map(&:subject_id)).destroy_all
g = Gitlab.client
g.delete_project(@shixun.gpid) if @shixun.try(:gpid).present?
@shixun.destroy
respond_to do |format|
format.html{ redirect_to shixuns_managements_path }

View File

@ -39,7 +39,7 @@ class StagesController < ApplicationController
@stage.name = params[:stage_name]
@stage.description = params[:stage_des]
ActiveRecord::Base.transaction do
if @stage.save && params[:shixun_id]
if @stage.save
begin
@stage.stage_shixuns.destroy_all
params[:shixun_id].each do |shixun_id|

View File

@ -336,6 +336,7 @@ class StudentWorkController < ApplicationController
def index
# 作业消息状态更新?
@tab = params[:tab].nil? ? 1 : params[:tab].to_i
homeworkcommon_messages = CourseMessage.where(:user_id => User.current.id, :viewed => 0, :course_message_id => @homework.id, :course_message_type => "HomeWorkCommon")
homeworkcommon_messages.update_all(:viewed => true)
studentwork_messages = CourseMessage.where(:user_id => User.current.id, :viewed => 0, :course_id => @homework.course, :course_message_type => "StudentWork")
@ -689,7 +690,7 @@ class StudentWorkController < ApplicationController
@score = student_work_score @work,User.current
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if (@homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4) && !@is_teacher && @work.user != User.current
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
@student_work_scores = StudentWorksScore.where(:id => @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").select("max(id)"))
else
@student_work_scores = student_work_score_record(@work)
end
@ -994,7 +995,9 @@ class StudentWorkController < ApplicationController
@work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first
@score = @new_score
if @homework.homework_detail_manual.comment_status == 3 && !@is_teacher && @work.user != User.current
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
@st_cover = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").count > 1 ? 1 : 0
@student_work_scores = StudentWorksScore.where(:id => @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").select("max(id)"))
#@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
else
@student_work_scores = student_work_score_record(@work)
end
@ -1698,34 +1701,54 @@ class StudentWorkController < ApplicationController
count_row += 1
end
elsif @homework.homework_type == 3 #分组作业
if @homework.anonymous_comment ==0
sheet1.row(0).concat([l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
else
sheet1.row(0).concat([l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
end
count_row = 1
items.each do |homework|
sheet1[count_row,0] = get_group_member_names homework
sheet1[count_row,1] = homework.name
sheet1[count_row,2] = (homework.project_id == 0 || homework.project_id.nil?) ? l(:excel_no_project) : homework.project.name
sheet1[count_row,3] = strip_html homework.description
sheet1[count_row,4] = homework.teacher_score.nil? ? l(:label_without_score) : homework.teacher_score.round(2)
sheet1[count_row,5] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : homework.teaching_asistant_score.round(2)
if @homework.anonymous_comment ==0
sheet1.row(0).concat([l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
sheet1[count_row,6] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
sheet1[count_row,7] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
sheet1[count_row,8] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,10] = format_time(homework.created_at)
else
sheet1.row(0).concat([l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
end
count_row = 1
items.each do |homework|
sheet1[count_row,0] = get_group_member_names homework
sheet1[count_row,1] = homework.name
sheet1[count_row,2] = (homework.project_id == 0 || homework.project_id.nil?) ? l(:excel_no_project) : homework.project.name
sheet1[count_row,3] = strip_html homework.description
sheet1[count_row,4] = homework.teacher_score.nil? ? l(:label_without_score) : homework.teacher_score.round(2)
sheet1[count_row,5] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : homework.teaching_asistant_score.round(2)
if @homework.anonymous_comment ==0
sheet1[count_row,6] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
sheet1[count_row,7] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
sheet1[count_row,8] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,10] = format_time(homework.created_at)
else
sheet1[count_row,6] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,7] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,8] = format_time(homework.created_at)
end
count_row += 1
sheet1[count_row,6] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,7] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,8] = format_time(homework.created_at)
end
count_row += 1
end
elsif @homework.homework_type == 4 #普通作业
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),l(:excel_homework_complete_status),
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
count_row = 1
shixun = @homework.homework_commons_shixuns.shixun
items.each do |homework|
sheet1[count_row,0]=homework.user.id
sheet1[count_row,1] = homework.user.show_name
sheet1[count_row,2] = homework.user.login
sheet1[count_row,3] = homework.user.user_extensions.student_id
sheet1[count_row,4] = homework.user.mail
sheet1[count_row,5] = homework.name
sheet1[count_row,6] = homework.work_status == 0 ? '--' : had_passed_changllenge_num(shixun, homework.user).to_s+"/"+shixun.challenges.count.to_s
sheet1[count_row,7] = homework.teacher_score.nil? ? l(:label_without_score) : homework.teacher_score.round(2)
sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : homework.teaching_asistant_score.round(2)
sheet1[count_row,9] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,10] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,11] = format_time(homework.created_at)
count_row += 1
end
end
book.write xls_report
xls_report.string

View File

@ -6,6 +6,7 @@ class SubjectsController < ApplicationController
before_filter :find_subject, :except => [:index, :new, :create, :create_subject, :new_subject, :append_to_stage]
include ApplicationHelper
include SubjectsHelper
def index
@order = params[:order] || "myshixun_count"
@ -33,6 +34,7 @@ class SubjectsController < ApplicationController
def show
@stages = @subject.stages
@is_manager = User.current.manager_of_subject?(@subject)
end
def new
@ -129,6 +131,11 @@ class SubjectsController < ApplicationController
redirect_to subject_path(@subject)
end
def cancel_has_publish
@subject.update_attributes(:status => 0)
redirect_to subject_path(@subject)
end
def destroy
if @subject
ApplyAction.where(:container_type => "ApplySubject", :container_id => @subject.id).destroy_all

View File

@ -321,6 +321,16 @@ class UsersController < ApplicationController
when 'Syllabus'
@reply = JournalsForMessage.find params[:reply_id]
@type = 'Syllabus'
when 'Memo'
@reply = Memo.find params[:reply_id]
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@type = 'Memo'
when 'Challenge'
@reply = Discuss.find params[:reply_id]
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@type = 'Challenge'
end
respond_to do |format|
format.js
@ -390,6 +400,9 @@ class UsersController < ApplicationController
comment.root_id = reply.root_id
reply.children << comment
@is_project = params[:is_project] if params[:is_project]
redirect_to message_replies_board_message_path(@root, :board_id => @root.board_id, :user_activity_id => params[:user_activity_id])
return
when 'BlogComment'
@root = reply.root
comment = BlogComment.new
@ -447,6 +460,20 @@ class UsersController < ApplicationController
comment.subject = "#{@root.subject}"
comment.root_id = reply.root_id
reply.children << comment
when 'Challenge'
@game_challenge = Challenge.where(:id => reply.challenge_id).first
@root = reply.root
comment = Discuss.new
comment.user_id = User.current.id
comment.content = params[:reply_message]
comment.root_id = reply.root_id
comment.challenge_id = reply.challenge_id
comment.dis_type = "Shixun"
comment.dis_id = @game_challenge.shixun.try(:id)
comment.praise_count = 0
reply.children << comment
@discusses = @game_challenge.shixun.discusses.reorder("created_at desc")
@discusses_count = @discusses.count
end
update_course_activity(@root.class.to_s,@root.id)
update_user_activity(@root.class.to_s,@root.id)

View File

@ -33,6 +33,32 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
# 作品列表的提交状态
def list_work_status status
case status
when 0
str = "未提交"
when 1
str = "<span class='color-light-green'>按时提交</span>"
when 2
str = "<span class='color-orange'>延时提交</span>"
end
end
# 判断TPM的代码是否被修改了
def tpm_is_modified myshixun, shixun_gpid
g = Gitlab.client
myshixun_commit_id = myshixun.commit_id
if myshixun_commit_id.blank?
myshixun_commit_id = g.commits(myshixun.gpid).last.try(:id)
myshixun.update_column(:commit_id, myshixun_commit_id)
end
shixun_commit_id = g.commits(shixun_gpid).first.try(:id)
result = myshixun_commit_id != shixun_commit_id ? true :false
return result
end
# 定义当前关卡是否有权开启下一关
# :实训若发布了,必须通过当前关卡才能查看下一关
# :未发布的实训,除了最后一关,其它的关卡都可以进入下一关
@ -44,7 +70,6 @@ module ApplicationHelper
end
end
# 适用与已经用url_safe编码后回调字符串形式
def tran_base64_decode64 str
if str.blank?
@ -91,9 +116,26 @@ module ApplicationHelper
# res返回结果0表示正确-1表示有异常
def add_shixun_modify_status shixun, type
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
# 更新测试集
gameInfo = shixun.gameInfo
uri ="#{shixun_tomcat}/bridge/game/publishGame"
params = {gameInfo:gameInfo}
# 更新脚本
tpiList =[]
myshixuns = shixun.myshixuns
if myshixuns.present?
myshixuns.each do |myshixun|
logger.info("tpiID is #{myshixun.id}")
tpiID = myshixun.id
instanceGitURL = git_myshixun_url_ip(myshixun, myshixun.try(:user_id))
logger.info("instanceGitURL is #{instanceGitURL}")
tpiList << {:tpiID => tpiID, :instanceGitURL => instanceGitURL}
logger.info("###############{tpiList.to_json unless tpiList.blank?}")
end
end
tpiList = Base64.urlsafe_encode64(tpiList.to_json) unless tpiList.blank?
params = {:gameInfo => "#{gameInfo}", :tpiList => "#{tpiList}" }
logger.info("%%%%%%%%%%%%params is #{params}")
# end
res = uri_exec uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级90")
@ -101,6 +143,34 @@ module ApplicationHelper
shixun_modify_status_without_publish shixun, type
end
def shixun_modify_status_publish shixun, type
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
# 更新测试集
gameInfo = shixun.gameInfo
uri ="#{shixun_tomcat}/bridge/game/publishGame"
# 更新脚本
tpiList =[]
myshixuns = shixun.myshixuns
if myshixuns.present?
myshixuns.each do |myshixun|
logger.info("tpiID is #{myshixun.id}")
tpiID = myshixun.id
instanceGitURL = git_myshixun_url_ip(myshixun, myshixun.try(:user_id))
logger.info("instanceGitURL is #{instanceGitURL}")
tpiList << {:tpiID => tpiID, :instanceGitURL => instanceGitURL}
logger.info("###############{tpiList.to_json unless tpiList.blank?}")
end
end
tpiList = Base64.urlsafe_encode64(tpiList.to_json) unless tpiList.blank?
params = {:gameInfo => "#{gameInfo}", :tpiList => "#{tpiList}" }
logger.info("%%%%%%%%%%%%params is #{params}")
# end
res = uri_exec uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级90")
end
end
# 仅仅产生记录用于已执行publish的方法
# ShixunModify中status 1表示有更改开启实训的时候需要重置0表示不需要重置或已重置完成
def shixun_modify_status_without_publish shixun, type
@ -201,7 +271,7 @@ module ApplicationHelper
# 实训语言的种类
def shixun_language
["Java", "C", "C++", "Python2.7", "Python3.6", "MySQL/Java", "Html", "JFinal", "Docker", "Ethereum", "Dynamips", "MachineLearning", "verilog"]
["Java", "C", "C++", "Python2.7", "Python3.6", "MySQL/Java", "Html", "JFinal", "Docker", "Ethereum", "Dynamips", "MachineLearning", "Verilog","Spark","MySQL/Python3.6","PHP","PHP/Web"]
end
# 实训试用专业
@ -463,6 +533,14 @@ module ApplicationHelper
gitUrl = gitlab_address.to_s+"/"+login+"/"+ rep_identify + "."+"git"
end
# myshixun git url by domain
def git_myshixun_url myshixun, user_id
login = User.where(:id => user_id).first.try(:login)
rep_identify = Repository.where(:myshixun_id => myshixun.id, :type => "Repository::Gitlab").first.try(:identifier)
gitlab_address = Redmine::Configuration['gitlab_address']
gitUrl = gitlab_address.to_s+"/"+login+"/"+ rep_identify + "."+"git"
end
def uri_exec uri, params
begin
logger.error("@parmas is #{params}, url is #{uri}")
@ -501,22 +579,22 @@ module ApplicationHelper
# homework_common状态
# 0挂起1提交中2匿评中3评阅中
def new_homework_common_status status
case status
when 0
"未发布"
when 1
"提交中"
when 2
"补交中"
when 3
"匿评中"
when 4
"申诉中"
when 5
"评阅中"
when 6
"已结束"
end
case status
when 0
"未发布"
when 1
"提交中"
when 2
"补交中"
when 3
"匿评中"
when 4
"申诉中"
when 5
"评阅中"
when 6
"已结束"
end
end
# 作业不同状态的不同样式
@ -535,7 +613,7 @@ module ApplicationHelper
style = 'edu-filter-btn-red'
when '评阅中'
style = 'edu-filter-btn-green'
when '已结束'
when '已结束', '已截止'
style = 'edu-filter-btn-end'
when '已开启补交'
style = 'edu-filter-btn-late'
@ -557,9 +635,10 @@ module ApplicationHelper
# 未评阅
def had_unevaluate_count homework_common
count = StudentWorksScore.find_by_sql("SELECT count(distinct student_work_id) as count FROM student_works_scores sws, student_works sw, homework_commons hc where hc.id =#{homework_common.id} and sw.homework_common_id=hc.id and sw.is_delete = 0 and sws.student_work_id = sw.id and sws.user_id=#{User.current.id};").first.try(:count).to_i
student_count = homework_common.course.student.count
return student_count - count
#count = StudentWorksScore.find_by_sql("SELECT count(distinct student_work_id) as count FROM student_works_scores sws, student_works sw, homework_commons hc where hc.id =#{homework_common.id} and sw.homework_common_id=hc.id and sw.is_delete = 0 and sws.student_work_id = sw.id and sws.user_id=#{User.current.id};").first.try(:count).to_i
has_comment = User.current.student_works_scores.where(:student_work_id => homework_common.student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count
student_count = homework_common.student_works.count
return student_count - has_comment
end
# 该阶段还有多长时间结束/距下一阶段还有多长时间
@ -605,6 +684,28 @@ module ApplicationHelper
result
end
# 试卷:该阶段还有多长时间结束/距下一阶段还有多长时间
def exercise_curr_time exercise
result = {}
status = ""
time = ""
case exercise.exercise_status
when 1
status = "未发布"
when 2
if exercise.end_time && exercise.end_time >= Time.now
status = "提交中"
time = how_much_time(exercise.end_time)
end
when 3
status = "已截止"
time = format_time exercise.end_time
end
result[:status] = status
result[:time] = time
result
end
# 公共分页
def paginator_list objs, objs_count, limit, is_remote
@is_remote = is_remote
@ -944,7 +1045,7 @@ module ApplicationHelper
score = obj.issue_num * 4 + obj.issue_journal_num + (obj.changeset_num||0) * 4 + obj.board_num * 2 + obj.board_message_num + obj.attach_num * 5
end
# 获取组织成员中文名字
# 获取组织成员中文名字
def get_org_member_role_name member
unless member.roles[0].nil?
case member.roles[0].name
@ -1154,7 +1255,7 @@ module ApplicationHelper
name = h(user.name(options[:format]))
else
name = h(user.show_name)
end
end
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "pro_info_p"
else
h(user.to_s)
@ -1761,7 +1862,7 @@ module ApplicationHelper
def authority_pubilic_for_files(project, file)
@result = false
if (is_project_manager?(User.current.id, @project.id) && User.current.allowed_to?(:manage_files, project)) || file.author_id == User.current.id || User.current.admin &&
project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project"
project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project"
@result = true
end
return @result
@ -2032,7 +2133,7 @@ module ApplicationHelper
elsif @organization
title << (@organization.name.nil? ? "创新源于实践" : @organization.name)
elsif @forum || params[:controller] == "forums"
title << "问吧"
title << "论坛"
elsif @my_syllabuses
title << "我的课堂"
elsif @user
@ -2054,7 +2155,7 @@ module ApplicationHelper
title << @user.show_name
end
elsif @syllabus
title << (@syllabus.title.nil? ? "在线课堂" : @syllabus.title)
title << (@syllabus.title.nil? ? "在线课堂" : @syllabus.title)
else
title << (User.current.id == 2 ? "未登录" : User.current.show_name)
end
@ -2778,7 +2879,7 @@ module ApplicationHelper
def check_all_links(form_name)
link_to_function_none(l(:button_check_all), "checkAll('#{form_name}', true)") + "&nbsp;".html_safe + " | "+ "&nbsp;".html_safe +
link_to_function_none(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
link_to_function_none(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
end
# 本次修改,修改为只显示关闭的所占%比
@ -2792,8 +2893,8 @@ module ApplicationHelper
content_tag('span',
content_tag('tr',
(pcts[0] > 0 ? content_tag('span', '', :style => "width: #{pcts[0]}%;", :class => 'roadmap_progressbar_inner', :title => "已关闭:#{pcts[0]}%") : ''.html_safe) #+
# (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done', :title => "开发中:#{pcts[1]}%") : ''.html_safe) +
#(pcts[1] > 0 ? content_tag('span', '', :style => "width: #{pcts[1]}%;", :class => 'roadmap_progressbar ml5', :title => "未完成:#{pcts[1]}%") : ''.html_safe), :style => "width: #{width}"
# (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done', :title => "开发中:#{pcts[1]}%") : ''.html_safe) +
#(pcts[1] > 0 ? content_tag('span', '', :style => "width: #{pcts[1]}%;", :class => 'roadmap_progressbar ml5', :title => "未完成:#{pcts[1]}%") : ''.html_safe), :style => "width: #{width}"
), :class => 'roadmap_progressbar ml5').html_safe
# + content_tag('p', legend, :class => 'percent').html_safe
end
@ -2932,11 +3033,11 @@ module ApplicationHelper
end
end
if sources && !sources.empty?
super(sources, options)
else
''
end
if sources && !sources.empty?
super(sources, options)
else
''
end
end
def content_for(name, content = nil, &block)
@ -3226,17 +3327,17 @@ module ApplicationHelper
# 课程某个班级的成员
def syllabus_course_member user, course
result = false
syllabus = course.syllabus
if syllabus
syllabus.courses.each do |course|
if user.member_of_course?(course)
result = true
return result
result = false
syllabus = course.syllabus
if syllabus
syllabus.courses.each do |course|
if user.member_of_course?(course)
result = true
return result
end
end
end
end
result
result
end
def attachment_candown attachment
@ -3656,48 +3757,48 @@ module ApplicationHelper
def anonymous_comment_link(bid, course)
link = case bid.comment_status
when 0
confirm_info = "开启匿评后学生将不能对作品进行提交、修改、删除等操作\n"
confirm_info += anonymous_comment_notice(bid,course)
confirm_info += '是否确定开启匿评?'
link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => confirm_info, disable_with: '加载中...'
when 1
confirm_info = "关闭匿评后所有同学将不能继续进行匿评,且将公开已提交作品列表\n"
confirm_info += anonymous_comment_notice(bid,course)
confirm_info += '是否确定关闭匿评?'
link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => confirm_info
when 2
'匿评结束'
end
when 0
confirm_info = "开启匿评后学生将不能对作品进行提交、修改、删除等操作\n"
confirm_info += anonymous_comment_notice(bid,course)
confirm_info += '是否确定开启匿评?'
link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => confirm_info, disable_with: '加载中...'
when 1
confirm_info = "关闭匿评后所有同学将不能继续进行匿评,且将公开已提交作品列表\n"
confirm_info += anonymous_comment_notice(bid,course)
confirm_info += '是否确定关闭匿评?'
link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => confirm_info
when 2
'匿评结束'
end
content_tag('span', link, id: "#{bid.id}_anonymous_comment")
end
def anonymous_comment_notice(bid, course)
case bid.comment_status
when 0
@student_size ||= searchStudent(course).size
@homework_size = bid.homeworks.size
percent = @homework_size.to_f / (@student_size == 0 ? 1 : @student_size)
confirm_info = "目前#{@student_size}个学生,总共提交了#{@homework_size}份作品,占#{number_to_percentage(percent * 100, precision: 1)}\n"
when 1
@homework_evaluations = 0
bid.homeworks.map { |homework| @homework_evaluations += homework.homework_evaluations.count}
teachers = "("
teacher_members = searchTeacherAndAssistant(course)
teacher_members.each do |member|
if member == teacher_members.last
teachers += member.user_id.to_s + ")"
else
teachers += member.user_id.to_s + ","
end
end
@has_evaluations = 0
bid.homeworks.map { |homework| @has_evaluations += homework.rates(:quality).where("seems_rateable_rates.rater_id not in #{teachers}").count}
case bid.comment_status
when 0
@student_size ||= searchStudent(course).size
@homework_size = bid.homeworks.size
percent = @homework_size.to_f / (@student_size == 0 ? 1 : @student_size)
confirm_info = "目前#{@student_size}个学生,总共提交了#{@homework_size}份作品,占#{number_to_percentage(percent * 100, precision: 1)}\n"
when 1
@homework_evaluations = 0
bid.homeworks.map { |homework| @homework_evaluations += homework.homework_evaluations.count}
teachers = "("
teacher_members = searchTeacherAndAssistant(course)
teacher_members.each do |member|
if member == teacher_members.last
teachers += member.user_id.to_s + ")"
else
teachers += member.user_id.to_s + ","
end
end
@has_evaluations = 0
bid.homeworks.map { |homework| @has_evaluations += homework.rates(:quality).where("seems_rateable_rates.rater_id not in #{teachers}").count}
percent = @has_evaluations.to_f / (@homework_evaluations == 0 ? 1 : @homework_evaluations)
confirm_info = "目前总共分配了#{@homework_evaluations}份匿评作品,已评价#{@has_evaluations}份作品,占#{number_to_percentage(percent * 100, precision: 1)}\n"
end
confirm_info
percent = @has_evaluations.to_f / (@homework_evaluations == 0 ? 1 : @homework_evaluations)
confirm_info = "目前总共分配了#{@homework_evaluations}份匿评作品,已评价#{@has_evaluations}份作品,占#{number_to_percentage(percent * 100, precision: 1)}\n"
end
confirm_info
end
def get_technical_title user
@ -3833,12 +3934,12 @@ module ApplicationHelper
link = link_to "启动匿评","javascript:void(0)", :class => "wpostOptionLink", :title => "作业截止日期之前不可以启动匿评"
elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'wpostOptionLink'
when 2
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'wpostOptionLink'
when 3
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
when 1
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'wpostOptionLink'
when 2
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'wpostOptionLink'
when 3
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end
else
link = link_to "启动匿评","javascript:void(0)", :class => "wpostOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评"
@ -3980,33 +4081,33 @@ module ApplicationHelper
if User.current.allowed_to?(:as_teacher, homework.course)
link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "查看作品", :target => '_blank'
else User.current.member_of_course?(homework.course)
work = cur_user_works_for_homework homework
project = cur_user_projects_for_homework homework
if work.nil? && homework.end_time >= Time.now
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
else
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
end
elsif work.nil? && homework.end_time < Time.now
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
else
link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'btn_orange_big fr mt5', :target => '_blank'
end
work = cur_user_works_for_homework homework
project = cur_user_projects_for_homework homework
if work.nil? && homework.end_time >= Time.now
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank'
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "查看作品",student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "匿评已结束", :target => '_blank'
elsif homework.homework_type == 2 && homework.end_time >= Time.now#编程作业不能修改作品
link_to "修改作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
elsif homework.end_time >= Time.now && work.user_id == User.current.id
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
else
link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "作业截止后不可修改作品", :target => '_blank'
end
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
end
elsif work.nil? && homework.end_time < Time.now
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
else
link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'btn_orange_big fr mt5', :target => '_blank'
end
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank'
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "查看作品",student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "匿评已结束", :target => '_blank'
elsif homework.homework_type == 2 && homework.end_time >= Time.now#编程作业不能修改作品
link_to "修改作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
elsif homework.end_time >= Time.now && work.user_id == User.current.id
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
else
link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "作业截止后不可修改作品", :target => '_blank'
end
end
end
end
@ -4483,6 +4584,8 @@ def get_reply_by_type type, reply_id
reply = JournalsForMessage.find reply_id
when 'Memo'
reply = Memo.find reply_id
when 'Challenge'
reply = Discuss.find reply_id
end
reply
end
@ -4614,47 +4717,47 @@ def sortby_time_countcommon_hassticky topics,sortstr
tmpIndex = 0
tmpTopics.each_with_index do |topic,index|
if topic.sticky == 0
if tStart == -1
if (index != tmpTopics.count-1) && (topic[:infocount] == tmpTopics[index+1][:infocount])
tStart = index
end
if topic.sticky == 0
if tStart == -1
if (index != tmpTopics.count-1) && (topic[:infocount] == tmpTopics[index+1][:infocount])
tStart = index
end
else
if ((topic[:infocount] == tmpTopics[index-1][:infocount]) && ((index != tmpTopics.count-1) && (topic[:infocount] == tmpTopics[index+1][:infocount])))
tEnd = index
else
if ((topic[:infocount] == tmpTopics[index-1][:infocount]) && ((index != tmpTopics.count-1) && (topic[:infocount] == tmpTopics[index+1][:infocount])))
if (topic[:infocount] == tmpTopics[index-1][:infocount])
tEnd = index
else
if (topic[:infocount] == tmpTopics[index-1][:infocount])
tEnd = index
end
if tEnd > tStart
for i in tStart..tEnd
tmpTopics_1[tmpIndex] = tmpTopics[i]
tmpIndex = tmpIndex + 1
end
if sortstr == "created_at"
tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:created_at].to_i <=> x[:created_at].to_i }
elsif sortstr == "created_on"
tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:created_on].to_i <=> x[:created_on].to_i }
elsif sortstr == "updated_at"
tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:updated_at].to_i <=> x[:updated_at].to_i }
elsif sortstr == "updated_on"
tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:updated_on].to_i <=> x[:updated_on].to_i }
end
tmpIndex = 0
for i in tStart..tEnd
tmpTopics[i] = tmpTopics_1[tmpIndex]
tmpIndex = tmpIndex + 1
end
end
tStart = -1
tEnd = -1
tmpTopics_1 = []
tmpIndex = 0
end
if tEnd > tStart
for i in tStart..tEnd
tmpTopics_1[tmpIndex] = tmpTopics[i]
tmpIndex = tmpIndex + 1
end
if sortstr == "created_at"
tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:created_at].to_i <=> x[:created_at].to_i }
elsif sortstr == "created_on"
tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:created_on].to_i <=> x[:created_on].to_i }
elsif sortstr == "updated_at"
tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:updated_at].to_i <=> x[:updated_at].to_i }
elsif sortstr == "updated_on"
tmpTopics_1 = tmpTopics_1.sort{|x,y| y[:updated_on].to_i <=> x[:updated_on].to_i }
end
tmpIndex = 0
for i in tStart..tEnd
tmpTopics[i] = tmpTopics_1[tmpIndex]
tmpIndex = tmpIndex + 1
end
end
tStart = -1
tEnd = -1
tmpTopics_1 = []
tmpIndex = 0
end
end
end
end
return tmpTopics
end
@ -4749,25 +4852,34 @@ def get_work_index(hw,is_teacher)
return index
end
def get_ex_index(exercise, course, is_teacher)
if is_teacher
exercises = course.exercises.order("created_at asc")
else
exercises = course.exercises.where("exercise_status > 0").order("created_at asc")
end
ex_ids = exercises.map{|ex| ex.id} if !exercises.blank?
index = ex_ids.index(exercise.id)
return index
end
def get_hw_index(hw,is_teacher,type=0)
homework_commons = hw.course.homework_commons
Rails.logger.info("----------------------------------------------"+hw.course.to_s)
if is_teacher
if type != 0
homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("created_at asc")
homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("publish_time desc")
else
homeworks = homework_commons.order("created_at asc")
homeworks = homework_commons.order("publish_time desc")
end
else
if type != 0
homeworks = homework_commons.where("homework_commons.homework_type = #{type} and publish_time <= '#{Time.now}'").order("created_at asc")
homeworks = homework_commons.where("homework_commons.homework_type = #{type} and publish_time <= '#{Time.now}'").order("publish_time desc")
else
homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc")
homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("publish_time desc")
end
end
Rails.logger.info("----------------------------------------------"+homeworks.count.to_s)
hw_ids = homeworks.map{|hw| hw.id} if !homeworks.blank?
index = hw_ids.index(hw.id)
index = hw_ids.length - 1 - hw_ids.index(hw.id)
return index
end
@ -4895,17 +5007,17 @@ def create_works_list homework
unless homework.course.nil?
students = homework.course.student
if !students.empty? && homework.student_works.empty?
name = homework.name
name_str = name + "的作品提交"
str = ""
students.each do |student|
if str != ""
str += ","
name = homework.name
name_str = name + "的作品提交"
str = ""
students.each do |student|
if str != ""
str += ","
end
str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')"
end
str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')"
end
sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
end
@ -5283,10 +5395,10 @@ def quote_homework_bank homework, course
)
end
homework.homework_bank_samples.each_with_index do |homework_test|
new_homework.homework_samples << HomeworkSample.new(
input: homework_test.input,
output: homework_test.output
)
new_homework.homework_samples << HomeworkSample.new(
input: homework_test.input,
output: homework_test.output
)
end
end

View File

@ -12,6 +12,15 @@ module CoursesHelper
#AllPeople = StudentRoles+TeacherRoles
## return people count
def student_course_homework_score course, user
homework_ids = course.homework_commons.where("homework_type in (1, 4) and publish_time < '#{Time.now}'").map(&:id)
score = 0
user.student_works.where(:homework_common_id => homework_ids).each do |work|
score = score + work.work_score if work.work_score
end
format("%.1f",score)
end
# 学生的发布资源数
def student_course_resource_num course, user
num = course.attachments.where(:author_id => user.id).count

View File

@ -0,0 +1,2 @@
module DebatesHelper
end

View File

@ -1,6 +1,44 @@
# encoding: utf-8
module ExerciseHelper
def un_commit_num exercise
course = exercise.course
exercise.exercise_users.where(:commit_status => 0, :user_id => course.student.map(&:student_id)).count
end
def has_commit_num exercise
course = exercise.course
exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id)).count
end
def un_comment_num exercise
course = exercise.course
exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id), :subjective_score => -1).count
end
def has_comment_num exercise
course = exercise.course
exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id)).count - exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id), :subjective_score => -1).count
end
def answer_is_correct eq, user
is_correct = false
case eq.question_type
when 1
answer = get_user_answer(eq, user)
standard_answer = get_user_standard_answer(eq, user)
is_correct = !answer.empty? && !standard_answer.empty? && answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id
when 2
standard_answer = get_user_standard_answer(eq, user)
is_correct = !standard_answer.empty? && get_mulscore(eq, user).to_i == standard_answer.first.exercise_choice_id
when 3
answer = get_user_answer(eq, user)
standard_answer = get_user_standard_answer(eq, user)
is_correct = !answer.empty? && !standard_answer.empty? && standard_answer.include?(answer.first.answer_text)
end
is_correct
end
# 单选
def sigle_selection_standard_answer(params)
size = params.ord - 96
@ -160,6 +198,17 @@ module ExerciseHelper
uncomplete_question
end
def question_commit_status question, user
status = ""
case question.question_type
when 3, 4
get_anwser_vote_text(question.id,user.id) == "" ? status = "未答" : status = ""
when 1, 2
get_user_answer(question,user).empty? ? status = "未答" : status = ""
end
status
end
#获取文本题答案
def get_anwser_vote_text(question_id,user_id)
pv = ExerciseAnswer.find_by_exercise_question_id_and_user_id(question_id,user_id)

View File

@ -16,4 +16,5 @@ module OwnerTypeHelper
STUDENTWORK = 15
HOMEWORKBANK = 16
SUBJECT = 17
EXERCISEQUESTION = 18
end

View File

@ -85,18 +85,6 @@ module StudentWorkHelper
str
end
# 作品列表的提交状态
def list_work_status status
case status
when 0
str = "未提交"
when 1
str = "<span class='color-light-green'>按时提交</span>"
when 2
str = "<span class='color-orange'>延时提交</span>"
end
end
# 作品的助教评分模式
def ta_score_mode homework
mode = homework.homework_detail_manual.ta_mode == 1 ? '平均' : '复审'
@ -152,13 +140,13 @@ module StudentWorkHelper
end
end
#获取学生作品的评分记录:同一个教师或教辅只显示未隐藏的评分
#获取学生作品的评分记录:同一个教师或教辅只显示未隐藏的评分、匿评多次评分只取最新一条
def student_work_score_record work
# sql = "SELECT MAX(id) id FROM student_works_scores WHERE (reviewer_role = 2 OR reviewer_role = 1) AND score IS NOT NULL AND is_hidden = 0 AND student_work_id = #{work.id} GROUP BY user_id"
# tea_ts_ids = StudentWorksScore.find_by_sql sql
# tea_ts_ids = tea_ts_ids.empty? ? "(-1)" : "(" + tea_ts_ids.map{|tea| tea.id}.join(",") + ")"
# scores = work.student_works_scores.where("score IS NULL or reviewer_role = 3 or id in #{tea_ts_ids}").order("updated_at desc")
scores = work.student_works_scores.where(:is_hidden => false).order("created_at desc")
sql = "SELECT MAX(id) id FROM student_works_scores WHERE reviewer_role = 3 AND score IS NOT NULL AND is_hidden = 0 AND student_work_id = #{work.id} GROUP BY user_id"
st_ts_ids = StudentWorksScore.find_by_sql sql
st_ts_ids = st_ts_ids.empty? ? "(-1)" : "(" + st_ts_ids.map{|tea| tea.id}.join(",") + ")"
scores = work.student_works_scores.where("is_hidden = 0 and(reviewer_role = 1 or reviewer_role = 2 or id in #{st_ts_ids})").order("updated_at desc")
#scores = work.student_works_scores.where(:is_hidden => false).order("created_at desc")
return scores
end

View File

@ -3,4 +3,21 @@ module SubjectsHelper
shixuns = Shixun.where(:id => subject.stage_shixuns.map(&:shixun_id))
co_users = User.where(:id => shixuns.map(&:user_id)).where("id != #{subject.user_id}")
end
def subject_data subject
result = {}
subject_choices = 0
subject_shixuns = 0
subject_score = 0
subject.stage_shixuns.each do |stage_shixun|
shixun = stage_shixun.shixun
subject_choices += shixun.challenges.where(:st => [1, 2]).count
subject_shixuns += shixun.challenges.where(:st => 0).count
subject_score += shixun.shixun_score
end
result[:subject_choices] = subject_choices
result[:subject_shixuns] = subject_shixuns
result[:subject_score] = subject_score
result
end
end

View File

@ -2,6 +2,5 @@
class ApplyAction < ActiveRecord::Base
default_scope :order => 'updated_at desc'
attr_accessible :container_id, :container_type, :dealer_id, :reason, :user_id, :status, :apply_reason
belongs_to :user
end

View File

@ -7,7 +7,7 @@ class ChallengeChoose < ActiveRecord::Base
has_many :challenge_tags, :dependent => :destroy
has_many :challenge_questions, :dependent => :destroy
has_one :choose_outputs, :dependent => :destroy
has_many :outputs, :dependent => :destroy
#has_many :outputs, :dependent => :destroy
validates_presence_of :subject

View File

@ -7,4 +7,12 @@ class Discuss < ActiveRecord::Base
acts_as_tree :foreign_key => 'parent_id'
belongs_to :dis, :polymorphic => true
validates_presence_of :dis, :user, :content
def creator_user
User.find(self.user_id)
end
def content_detail
self.content
end
end

View File

@ -1,3 +1,4 @@
#encoding: utf-8
class ExerciseQuestion < ActiveRecord::Base
include Redmine::SafeAttributes
@ -5,4 +6,17 @@ class ExerciseQuestion < ActiveRecord::Base
has_many :exercise_choices, :order => "#{ExerciseChoice.table_name}.choice_position",:dependent => :destroy
has_many :exercise_answers, :dependent => :destroy
has_many :exercise_standard_answers, :dependent => :destroy
def question_type_name
case self.question_type
when 1
"单选题"
when 2
"多选题"
when 3
"填空题"
when 4
"简答题"
end
end
end

View File

@ -69,12 +69,12 @@ class Game < ActiveRecord::Base
def choose_correct_num
num = 0
self.challenge.challenge_chooses.each do |choose|
outputs = Output.where(:game_id => self.id, :test_set_position => choose.position).first
if outputs.nil?
num = nil
else
num += (outputs.result ? 1 : 0)
outputs = self.outputs.where(:query_index => (self.query_index - 1))
if outputs.blank?
num = nil
else
outputs.each do |output|
num += output.result ? 1 : 0
end
end
return num

View File

@ -11,7 +11,7 @@ class Memo < ActiveRecord::Base
# 若是主题帖,则内容可以是空
#validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
validates_length_of :subject, maximum: 50
validates_length_of :content, maximum: 30000
validate :cannot_reply_to_locked_topic, :on => :create

View File

@ -54,6 +54,18 @@ class Myshixun < ActiveRecord::Base
score
end
def total_gold
score = 0
self.games.each do |game|
if game.status == 2
total_gold =game.answer_open? ? -game.challenge.score.to_i : game.final_score.to_i
score += total_gold
end
end
score
end
# id 转换成 identifier
def to_param
identifier

View File

@ -4,5 +4,5 @@ class Output < ActiveRecord::Base
# compile_success 1 表示程序未报错,有正常输出, 0.表示程序抛异常了,报错!
default_scope :order => 'query_index desc'
belongs_to :game
belongs_to :challenge_choose
#belongs_to :challenge_choose
end

View File

@ -1,6 +1,6 @@
class School < ActiveRecord::Base
default_scope :order => 'created_at desc'
attr_accessible :name, :province, :pinyin, :city, :address, :logo_link
attr_accessible :name, :province, :pinyin, :city, :address, :logo_link,:auto_users_trial,:shool_code
has_many :courses
has_many :departments, :dependent => :destroy

View File

@ -10,7 +10,7 @@ class StudentsForCourse < ActiveRecord::Base
validates_uniqueness_of :student_id, :scope => :course_id
after_destroy :delete_student_works, :delete_course_homework_statistic
after_create :recovery_student_works, :create_student_works
after_create :recovery_student_works, :create_student_works, :create_exercise_users
#退出班级或删除学生时隐藏学生的作品
def delete_student_works
@ -58,6 +58,27 @@ class StudentsForCourse < ActiveRecord::Base
end
end
# 加入班级时创建已发布试卷的作品
def create_exercise_users
course = self.course
str = ""
exercises = course.exercises.where("exercise_status > 1")
if exercises.count != 0
exercises.each do |ex|
if ex.exercise_users.where("user_id = #{self.student_id}").count == 0
if str != ""
str += ","
end
str += "(#{ex.id},#{self.student_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
end
if str != ""
sql = "insert into exercise_users (exercise_id, user_id, commit_status, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
end
#加入班级时创建一条记录
def create_course_homework_statistic
# if CourseHomeworkStatistics.where(:user_id => self.student_id, :course_id => self.course_id).count == 0

19
app/models/tiding.rb Normal file
View File

@ -0,0 +1,19 @@
# 使用请了解以下描述,不清楚请@Hjqreturn
#
# user_id: 信息接收人
# trigger_user_id: 信息的触发者具体情况可能有所不同。eg产生消息的用户ID处理消息的用户ID等
# container_id消息实体的ID。egissue的id
# container_type消息实体的类型。eg:“Issue""Board"
# parent_container_id消息实体的父实体消息的id是为了生成url时使用避免反复查数据库。egmessage中的board 的id
# parent_container_type消息实体的父实体消息类型便于分类。eg“Message""Board"
# belong_container_id消息实体所属的实体ID。egproject_idcourse_idorganization_id
# belong_container_type消息实体所属的实体类型。eg“Project”“Course”,"Shixun"
# status消息实体的状态。eg“已处理”“未处理”
# viewed消息是否已读。eg1 -> 已读; 0 -> 未读
#
class Tiding < ActiveRecord::Base
attr_accessible :belong_container_id, :belong_container_type, :container_id, :container_type, :parent_container_id,
:parent_container_type, :status, :trigger_user_id, :user_id, :viewed
end

View File

@ -593,7 +593,7 @@ class CoursesService
#多个角色加入课程
def join_course_roles params,current_user
course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code]
course = Course.find_by_invite_code(params[:invite_code].strip) if params[:invite_code]
go_coursegroup_flag = 0
course_id = 0

View File

@ -16,7 +16,7 @@
<div class="avatar-upload">
<input class="avatar-src" name="avatar_src" type="hidden">
<input class="avatar-data" name="avatar_data" type="hidden">
<a href="javascript:void(0);" class="task-btn task-btn-blue ml5" type="button" onClick="$('input[id=avatarInput]').click();">本地上传</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml5" type="button" onClick="$('input[id=avatarInput]').click();">本地上传</a>
<span id="avatar-name"></span>
<input class="avatar-input" style="display:none;" id="avatarInput" name="avatar_file" type="file">
<input type="hidden" id="source_id" value="<%= @user.id %>"/>
@ -100,7 +100,7 @@
testend = teststr.match(/[^\\]+\.[^\(]+/i); //直接完整文件名的
filename.innerHTML = testend;
$(filename).css("color", '#333');
$(".avatar-save").removeClass("task-btn-grey").addClass("task-btn-blue");
$(".avatar-save").removeClass("task-btn-grey").addClass("task-btn-orange");
$(".avatar-save").on("click", save_avatar);
}

View File

@ -4,7 +4,7 @@
<% if @user.phone.blank? %>
<li class="font-14 mt10 color-grey"><i class="fa fa-exclamation-circle color-orange mr5"></i>未绑定</li>
<li class="font-14 mt10">&nbsp;</li>
<li><a href="<%= change_or_bind_path(:type => 'phone') %>" class="task-btn task-btn-blue">绑定</a></li>
<li><a href="<%= change_or_bind_path(:type => 'phone') %>" class="task-btn task-btn-orange">绑定</a></li>
<% else %>
<li class="font-14 mt10 color-grey"><i class="fa fa-check-circle color-light-green mr5"></i>已绑定</li>
<li class="font-14 mt10 t_l color-grey">您绑定的手机:<%= @user.user_phone %></li>
@ -16,7 +16,7 @@
<% if @user.mail.blank? %>
<li class="font-14 mt10 color-grey"><i class="fa fa-exclamation-circle color-orange mr5"></i>未绑定</li>
<li class="font-14 mt10">&nbsp;</li>
<li><a href="<%= change_or_bind_path(:type => 'mail') %>" class="task-btn task-btn-blue">绑定</a></li>
<li><a href="<%= change_or_bind_path(:type => 'mail') %>" class="task-btn task-btn-orange">绑定</a></li>
<% else %>
<li class="font-14 mt10 color-grey"><i class="fa fa-check-circle color-light-green mr5"></i>已绑定</li>
<li class="font-14 mt10 t_l color-grey">您绑定的邮箱:<%= @user.user_mail %></li>
@ -27,7 +27,7 @@
<!--<li class="font-20"><i class="fa fa-wechat color-grey font-16 mr5"></i>微信绑定</li>-->
<!--<li class="font-14 mt10 color-grey"><i class="fa fa-exclamation-circle color-orange mr5"></i>未绑定</li>-->
<!--<li class="font-14 mt10">&nbsp;</li>-->
<!--<li><a href="#" class=" task-btn task-btn-blue">绑定</a></li>-->
<!--<li><a href="#" class=" task-btn task-btn-orange">绑定</a></li>-->
<!--</ul>-->
<!--<ul class="panel-user-setting-ul clearfix">-->

View File

@ -36,7 +36,7 @@
<input type="text" class="task-form-90 task-height-40 panel-box-sizing fl edu-form-noborder" placeholder="我得说点儿什么最多200个字符">
</li>
<li class="clearfix">
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="submit_reject_reason('<%= apply_user.id %>', this);" >确定</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" onclick="submit_reject_reason('<%= apply_user.id %>', this);" >确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="hide_reject_reason(this);" >取消</a>
</li>
</div>

View File

@ -1,15 +1,15 @@
<% if activity.attachments.any? %>
<% activity.attachments.each do |attachment| %>
<li class="color-grey">
<a href="javascript:void(0)" class="link-color-grey">
<a href="javascript:void(0)" class="color-grey">
<i class="fa fa-folder" aria-hidden="true"></i>
<%= link_to_short_attachment attachment,:length=> 58, :class => 'link-color-grey', :download => true %>
<%= link_to_short_attachment attachment,:length=> 58, :class => 'color-grey', :download => true %>
<span class="color-grey">(
<%= number_to_human_size attachment.filesize %>)
</span>
<% user_name = attachment.author.show_real_name.empty? ? attachment.author : attachment.author.show_real_name %>
<span title="<%= user_name %>">
<%= link_to h(truncate(user_name, length: 15, omission: '...')),user_path(attachment.author),:class => "link-color-grey" %>,
<%= link_to h(truncate(user_name, length: 15, omission: '...')),user_path(attachment.author),:class => "color-grey" %>,
<%= format_time(attachment.created_on) %>
</span>
</a>

View File

@ -1,7 +1,7 @@
<div class="with85 fl">
<div class="ml15 user_bg_shadow bor-grey-e clearfix">
<div class="clearfix pt10 pb10 pl15 pr15 bor-bottom-greyE">
<p class="color-grey3 fl font-16">帖子列表</p><span class="btn-cir btn-cir-grey ml5 mt5 fl"><%= @all_count %></span>
<p class="color-grey3 fl font-16">帖子列表</p><!--<span class="btn-cir btn-cir-grey ml5 mt5 fl"><%#= @all_count %></span>-->
<% if User.current.logged? %>
<a href="<%= new_board_message_path(@board.id) %>" class="white-btn orange-btn fr">+ 我要发布</a>
<% end %>

View File

@ -4,8 +4,10 @@
<%= render :partial => "challenges/choose_tab" %>
</div>
<div class="fr option_item_con">
<a href="javascript:void(0)" class="mr10 white-btn green-btn white_bg addoption-btn mt5">+&nbsp;单选题</a>
<a href="javascript:void(0)" class="white-btn green-btn white_bg addoption-btn mt5">+&nbsp;多选题</a>
<% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %>
<a href="javascript:void(0)" class="mr10 white-btn green-btn white_bg addoption-btn mt5">+&nbsp;单选题</a>
<a href="javascript:void(0)" class="white-btn green-btn white_bg addoption-btn mt5">+&nbsp;多选题</a>
<% end %>
</div>
</ul>
<div id="task_content" class="task-pm-box mh550 user_bg_shadow">
@ -79,8 +81,6 @@
}
}
$(".stage-part-2").find(".nav_option li").eq(length-1).after(html);
$.ajax({

View File

@ -5,8 +5,8 @@
<span class="btn-cir btn-cir-grey ml10 mt12 fl"><%= @challenges.count %></span>
<% end %>
<% if User.current.manager_of_shixun?(@shixun) && @shixun.status == 0 %>
<a href="<%= new_shixun_challenge_path(@shixun, :st => 0) %>" class="shixun-task-btn task-btn-green fr mt5">+实践任务</a>
<a href="<%= new_shixun_challenge_path(@shixun, :st => 1) %>" class="shixun-task-btn task-btn-green fr mr10 mt5">+选择题任务</a>
<a href="<%= new_shixun_challenge_path(@shixun, :st => 0) %>" class="shixun-task-btn task-btn-green fr mt5" data-tip-down="新增代码编辑类型任务">+实践任务</a>
<a href="<%= new_shixun_challenge_path(@shixun, :st => 1) %>" class="shixun-task-btn task-btn-green fr mr10 mt5" data-tip-down="新增选择题类型的任务">+选择题任务</a>
<!-- <a href="<%#= new_shixun_challenge_path(@shixun, :st => 2) %>" class="shixun-task-btn task-btn-green fr mr10 mt5">+单选任务</a>-->
<!--<a href="<%#= new_shixun_challenge_path(@shixun, :st => 0) %>" class="shixun-task-btn task-btn-green fr mr5" style="margin: 5px 0;">新建阶段</a>-->
<% end %>
@ -19,7 +19,7 @@
<% if challenge.st == 0 %>
<i class="fa fa-code font-16 color_white" data-tip-down="实践任务"></i>
<% else %>
<i class="fa fa-th-list color_white" data-tip-down="选任务"></i>
<i class="fa fa-th-list color_white" data-tip-down="选择题任务"></i>
<% end%>
</span>
<!-- <i class="fa fa-dot-circle-o font-18 color-green mr10"></i>-->
@ -71,7 +71,7 @@
<% when 2 %>
已完成&nbsp;&nbsp;<a href='<%= operation_shixun_path(@shixun, :myshixun_id => challenge.current_user_game.try(:myshixun)) %>' data-remote="true"><i data-tip-down='已解决' class='fa fa-check-circle fr font-24 color-light-green w20_center' ></i></a>
<% when 3,nil %>
未开始&nbsp;&nbsp;<a><i data-tip-down='请先完成前序关卡。无法点击' class='fa fa-play-circle fr font-24 color-grey w20_center' ></i></a>
未开始&nbsp;&nbsp;<a><i data-tip-down='请先完成前序关卡' class='fa fa-play-circle fr font-24 color-grey w20_center' ></i></a>
<% end %>
</span>
<% end %>

View File

@ -3,7 +3,7 @@
<div id="evaluating_show" class="<%= @challenge.evaluation_way == 0 ? "undis" : "" %>">
<div class="clearfix mb20">
<p class="fr">
<% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %>
<% if User.current.manager_of_shixun?(@shixun) %>
<a href="javascript:void(0);" class="shixun-task-btn task-btn-green fr" id="edit_task_pass">编辑</a>
<% end %>
</p>

View File

@ -18,12 +18,15 @@
<div id="shixun_form">
<li class="clearfix">
<label class="panel-form-label fl"><span class="c_red mr5">*</span>文件路径:</label>
<%= f.text_field :path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "进入实训后将默认打开该文件src/test/welcome.java", :maxlength => "256" %>
<%= f.text_field :path, :class => "panel-form-width-690 panel-box-sizing fl", :id => "shixun_file_path", :no_label => true, :placeholder => "进入实训后将默认打开该文件src/test/welcome.java", :maxlength => "256" %>
<!--<input id="shixun_file_path" class="panel-form-width-690 panel-box-sizing fl">-->
<span style="display: none" class="c_red ml95" id="challenge_file_path">文件路径不能为空</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl"><span class="c_red mr5">*</span>执行文件:</label>
<%= f.text_field :exec_path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "输入关卡需要执行的文件路径src/test/main.java", :maxlength => "256" %>
<%= f.text_field :exec_path, :class => "panel-form-width-690 panel-box-sizing fl",:id => "shixun_file_path_play", :no_label => true, :placeholder => "输入关卡需要执行的文件路径src/test/main.java", :maxlength => "256" %>
<span style="display: none" class="c_red ml95" id="challenge_execfile_path">执行文件不能为空</span>
</li>
<li class="clearfix">
@ -100,6 +103,24 @@
bt.LEFT_DELIMITER = '<!';
bt.RIGHT_DELIMITER = '!>';
// 获取版本库路径
$("#shixun_file_path").on('click', function (e) {
file_path();
$(this).addClass("change");
});
$("#shixun_file_path_play").on('click', function (e) {
file_path();
$(this).addClass("change");
});
function file_path(){
data = 0;
$.ajax({
url: '<%= search_file_list_shixun_path(@shixun) %>',
dataType: "script"
});
}
$("#shixun_form").on('click', 'a.test_icon_add', function () {
var html = bt('t:test-answer-list', null);
$(this).parent().parent('.clearfix').after(html);
@ -155,8 +176,8 @@
$(inputs_labels[j]).html("组" + (j + 1));
}
});
});
// 判断测试集是否锁定, 0未锁定1锁定
function test_set_whether_lock(){
var lock = document.getElementsByName("test_set[lock][]");

View File

@ -349,6 +349,7 @@
var lens = contents.length;
for(var i = 0; i < lens; i++){
if($(contents[i]).val().trim() == ""){
$(contents[i]).focus();
return true;
}
}
@ -358,6 +359,7 @@
// 判断选择题选择答案的个数
function judge_choice_answer(){
var answer = document.getElementsByName("choice[answer][]");
var contents = document.getElementsByName("question[cnt][]");
var lens = answer.length;
var num = 0;
for(var i= 0; i < lens; i++){
@ -365,6 +367,7 @@
num += 1;
}
}
$(contents[0]).focus();
return num;
}
@ -438,6 +441,7 @@
if(st == "1"){
if(judge_choice_contents()) {
error.html("选项内容不能为空").show();
}else if(choice_num() < 2){
error.html("单选题选项不能少于2个").show();
}else if(judge_choice_answer() == 0){

View File

@ -3,8 +3,11 @@
<div class="white_bg">
<div class="panel-form">
<li class="clearfix pr30">
<a href="<%= edit_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.id, :index => @index) %>" data-remote="true" class="task-btn task-btn-green fr">编辑</a>
<a href="<%= destroy_challenge_choose_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.id) %>" data-method="delete" class="task-btn fr mr10 deloption-btn">删除</a>
<% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %>
<a href="<%= edit_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.id, :index => @index) %>" data-remote="true" class="task-btn task-btn-green fr">编辑</a>
<a href="javascript:void(0);" onclick="delete_confirm_box_3('<%= destroy_challenge_choose_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.id) %>', '您是否确定删除?')" class="task-btn fr mr10 deloption-btn">删除</a>
<% end %>
</li>
<li class="clearfix">
<label class="panel-form-label fl">题干:&nbsp;&nbsp;</label>

View File

@ -46,6 +46,28 @@
<script type="text/javascript">
$(function() {
document.onkeydown = function(event) {
var target, code, tag;
if (!event) {
event = window.event; //针对ie浏览器
target = event.srcElement;
code = event.keyCode;
if (code == 13) {
tag = target.tagName;
if (tag == "INPUT") { return true; }
else { return false; }
}
}
else {
target = event.target; //针对遵循w3c标准的浏览器如Firefox
code = event.keyCode;
if (code == 13) {
tag = target.tagName;
if (tag == "INPUT") { return false; }
else { return true; }
}
}
};
taskpass_editormd = editormd("challenge_task_pass", {
width : "89.6%",
height : 600,

View File

@ -56,9 +56,11 @@
<li class="fl <%= @tab == 3 ? "check_nav" : "" %>">
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 3) %>" class="color-black">参考答案</a>
</li>
<li class="fl <%= @tab == 6 ? "check_nav" : "" %>">
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 6) %>" class="color-black">预备知识</a>
</li>
<% unless @challenge.ready_knowledge.blank? %>
<li class="fl <%= @tab == 6 ? "check_nav" : "" %>">
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 6) %>" class="color-black">背景知识</a>
</li>
<% end %>
<li class="fl <%= @tab == 4 ? "check_nav" : "" %>">
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 4) %>" class="color-black">评分设置</a>
</li>
@ -83,7 +85,7 @@
</div>
</div>
<% else %>
<%= render :partial => "choose_type" %>
<%= render :partial => "choose_type" %>
<% end %>
</div>
<div class="save-tip">

View File

@ -8,7 +8,7 @@
</style>
<div class="task-pm-content">
<% if @shixun.status == 1 && (User.current.manager_of_shixun?(@shixun) || User.current.admin?) %>
<div class="alert alert-orange mb15 mt15">正在等待管理员的审核。如果需要重新编辑评测设置,请先撤销发布 </div>
<div class="alert alert-orange mb15 mt15">正在等待管理员的审核。在审核通过前,可以随时撤销发布 </div>
<% end %>
<div class="task-pm-box mt30 box_bg_shandow">
<div class="panel-header">

View File

@ -1,56 +1,56 @@
<div class="mt10">
<span id="attachments_fields" class="attachments_fields">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
<%= link_to('&nbsp;'.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}" %>
</span>
<div class="cl"></div>
<% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= 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;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
<%= link_to('&nbsp;'.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}" %>
</span>
<div class="cl"></div>
<% end %>
<% end %>
</span>
<%= 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),
:lebel_file_uploding => l(:lebel_file_uploding),
:delete_all_files => l(:text_are_you_sure_all)
} %>
</div>
<div class="cl"></div>
<div class="mt5 fl">
<!-- , user_import_resource_user_path(User.current.id,:homework_id=>container.id) -->
<a href="javascript:void(0);" id="upload_file_local" class="AnnexBtn fl mt3 mr15" onclick="$('#_file').click();" title="请选择文件上传">上传附件</a>
</div>
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<div class="mt10">
<span id="attachments_fields" class="attachments_fields">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
<%= link_to('&nbsp;'.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}" %>
</span>
<div class="cl"></div>
<% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= 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;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
<%= link_to('&nbsp;'.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}" %>
</span>
<div class="cl"></div>
<% end %>
<% end %>
</span>
<%= 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),
:lebel_file_uploding => l(:lebel_file_uploding),
:delete_all_files => l(:text_are_you_sure_all)
} %>
</div>
<div class="cl"></div>
<div class="mt5 fl">
<!-- , user_import_resource_user_path(User.current.id,:homework_id=>container.id) -->
<a href="javascript:void(0);" id="upload_file_local" class="AnnexBtn fl mt3 mr15" onclick="$('#_file').click();" data-tip-down="请选择文件上传">上传附件</a>
</div>
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<% end %>

View File

@ -10,8 +10,8 @@
<p class="task-popup-text-center font-16" id="compare-tips-1">代码查重已完成,点击查看结果</p>
</div>
<div class="task-popup-submit clearfix" style="width: 174px;">
<a href="javascript:void(0);" class="task-btn task-btn-blue fl" onclick = "compare_code_btn(<%=homework.id%>,<%=courseid%>)">重新查重</a>
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick = "see_last_compare_code(<%=courseid%>,<%=homework.id%>)">查看结果</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange fl" onclick = "compare_code_btn(<%=homework.id%>,<%=courseid%>)">重新查重</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" onclick = "see_last_compare_code(<%=courseid%>,<%=homework.id%>)">查看结果</a>
</div>
</div>

View File

@ -10,7 +10,7 @@
<p class="task-popup-text-center font-16"><%=des%></p>
</div>
<div class="task-popup-sure clearfix">
<a href="javascript:void(0);" class="task-btn task-btn-blue" onclick="yes_btn(<%=status%>,<%=courseid%>,<%=homework.id%>)">确定</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange" onclick="yes_btn(<%=status%>,<%=courseid%>,<%=homework.id%>)">确定</a>
</div>
</div>

View File

@ -1,15 +1,90 @@
<div class="homepageRightBanner user_bg_shadow bor-grey-e mb10" style="width:973px;" >
<div class="NewsBannerName">
<%= get_acts_list_type @type %>
<div class="homepageRightBanner user_bg_shadow bor-grey-e mb10" style="width:1003px;padding: 0px" >
<div class="clearfix padding10">
<div class="NewsBannerName" style="width: 100px">
<%= get_acts_list_type @type %>
</div>
<div class="fl mt3">
<%= link_to "全部", {:controller => "courses", :action => "show", :type => nil}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type.nil? ? 'active' : ''} fl"%>
<%= link_to "普通作业", {:controller => "courses", :action => "show", :type => "common_homework"}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type == 'common_homework' ? 'active' : ''} fl"%>
<%= link_to "实训作业", {:controller => "courses", :action => "show", :type => "shixun_homework"}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type == 'shixun_homework' ? 'active' : ''} fl"%>
<%= link_to "资源", {:controller => "courses", :action => "show", :type => "attachment"}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type == 'attachment' ? 'active' : ''} fl"%>
<%= link_to "讨论", {:controller => "courses", :action => "show", :type => "message"}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type == 'message' ? 'active' : ''} fl"%>
<%#= link_to "成员管理", {:controller => "courses", :action => "show", :type => "message"}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type == 'message' ? 'active' : ''} fl"%>
</div>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
<div class="fr activities_btn">
<% if false %>
<li class="activities_item">
<%= link_to '成员管理', members_course_path(@course),:class => "color-orange03" %>
<% apply_count = CourseMessage.where(:course_id => @course.id,:course_message_type => 'JoinCourseRequest', :status => 0).count %>
<% if apply_count > 0 %>
<span class="ml10" style="cursor: pointer"><a href="<%= members_course_path(@course) %>" class="edu-cir-orange" data-tip-down="有<%= apply_count %>名助教或教师申请加入课堂,请审批"><%= apply_count %></a></span>
<% end %>
</li>
<% end %>
<div class="ml10 pr edu-position-hidebox mr10">
<span class="mr8 color-orange03">新建</span><i class="fa fa-sort-down fl fr mt3 color-orange03"></i>
<ul class="edu-position-hide undis" id="all_status_list" style="top:29px;">
<li style="text-align:center;">
<%= link_to '普通作业'.html_safe, new_homework_common_path(:course => @course.id, :homework_type => 1),:class => "color-grey" %>
</li>
<li style="text-align:center;">
<%= link_to '实训作业'.html_safe, shixuns_homework_common_index_path(:course => @course.id),:class => "color-grey", :remote => true %>
</li>
<li style="text-align:center;">
<%= link_to '试&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;卷'.html_safe, new_exercise_path(:course_id => @course.id),:class => "color-grey" %>
</li>
<li style="text-align:center;">
<a class="color-grey" onclick="course_files_upload();" style="cursor: pointer">资&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;源</a>
</li>
<li style="text-align:center;">
<% course_board = @course.boards.where("parent_id is NULL").first %>
<%= link_to '帖&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;子'.html_safe.html_safe, new_board_message_path(:board_id => course_board.id),:class => "color-grey" %>
</li>
</ul>
</div>
</div>
<% end %>
</div>
<div class="fr mt3">
<%= link_to "全部", {:controller => "courses", :action => "show", :type => nil}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type.nil? ? 'active' : ''} fl"%>
<%= link_to "普通作业", {:controller => "courses", :action => "show", :type => "common_homework"}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type == 'common_homework' ? 'active' : ''} fl"%>
<%= link_to "实训作业", {:controller => "courses", :action => "show", :type => "shixun_homework"}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type == 'shixun_homework' ? 'active' : ''} fl"%>
<%= link_to "资源", {:controller => "courses", :action => "show", :type => "attachment"}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type == 'attachment' ? 'active' : ''} fl"%>
<%= link_to "讨论", {:controller => "courses", :action => "show", :type => "message"}, :remote => true, :class =>"edu-filter-cir-grey mr15 font-12 #{@type == 'message' ? 'active' : ''} fl"%>
</div>
<% if false %>
<!--TO成员管理-->
<div class="resources mt10 user_bg_shadow bor-grey-e">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<a href="/images/avatars/User/15739?1501123240" alt="用户头像"><img alt="0" class="bor-radius-all" height="50" src="/images/avatars/User/0" width="50"></a>
</div>
<div class="homepagePostDes">
<div class="homepagePostTitle break_word">
<a href="javascript:void(0)" class="color-grey3 fl">蔡世申请加入课堂</a>
<span class="post_status_btn post_btn_red ml5 mt5">待处理</span>
<span class="post_status_btn post_btn_green ml5 mt5">已处理</span>
<a class="fr white-btn orange-btn">同意</a>
<a class="fr white-btn orange-btn mr10">拒绝</a>
</div>
<div class="homepagePostTo break_word clearfix" style="margin-bottom:10px">
<a href="/users/DSuperFunGuy" class="newsBlue mr15 color-grey-b">蔡世</a>
TO
<a href="/courses/792/files" class="newsBlue ml15 color-grey-b">成员管理</a>
</div>
<div class="fl"><span>提交时间:2017-09-28 15:44</span></div>
<div class="fr">
<span class="mr20">胡莎莎<span class="color-light-green">&nbsp;已同意</span><span class="color-red">&nbsp;已拒绝</span></span>
<span>处理时间:2017-09-28 15:44</span>
</div>
</div>
<div class="cl"></div>
</div>
</div>
<% end %>
<%= render :partial => 'courses/course_activity', :locals => {:course_activities => @course_activities,:page => 0,:type => @type} %>
<script>
$(function(){
$(".edu-dropdown").hover(function(){
$(this).find(".edu-dropdown-menu").show();
},function(){
$(this).find(".edu-dropdown-menu").hide();
})
})
</script>

View File

@ -2,7 +2,8 @@
<div class="searchFor fr" style="margin-top: -3px">
<div class="searchCon">
<input type="text" class="searchinput" name="search" value="<%= @search %>" placeholder="请输入课堂名称的关键字进行搜索" style="background: none;"/>
<i class="fa fa-close mr5 color-dark-grey" onclick="colse_searchbox();" title="搜索"></i>
<!--<i class="fa fa-close mr5 color-dark-grey" onclick="colse_searchbox();" title="搜索"></i>-->
<span class="search_close" onclick="colse_searchbox();" data-tip-down="清除">×</span>
</div>
<i class="fa fa-search mr5 color-dark-grey search_icon" onclick="$('#search_syllabuses_name').submit();" style="margin:10px" data-tip-down="搜索"></i>
</div>

View File

@ -28,7 +28,7 @@
</li>
<p id="none_checked_notice" class="color-red none f12" style="margin-left: 54px;">请至少选择一个身份</p>
<li class="clearfix mt10">
<a href="javascript:void(0);" class="task-btn task-btn-blue fr mr60" onclick="submit_join_course();">确定</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange fr mr60" onclick="submit_join_course();">确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="hideModal()">取消</a>
</li>
</ul>

View File

@ -15,7 +15,7 @@
</div>
<ul class="task-index-head-info clearfix">
<li><span class="color-orange font-bd" id="all_syllabuses"><%= @syllabuses_num %></span><br/><span >全部</span></li>
<li><span class="color-orange font-bd" id="my_syllabuses"><%= @create_syllabuses_count + @join_syllabuses_count %></span><br/><span>我的课堂</span></li>
<li><span class="color-orange font-bd" id="my_syllabuses"><%= @my_courses_count %></span><br/><span>我的课堂</span></li>
<%= link_to "+&nbsp;新建".html_safe, new_course_path, :class => "fr font-16 white-btn orange-btn mt10" %>
<%= link_to "+&nbsp;加入课堂".html_safe, join_private_courses_courses_path, :remote => true, :method => "post", :class => "fr mr30 font-16 white-btn orange-btn mt10" %>
<!-- <li><span class="color-orange font-bd"><%#= @create_syllabuses_count %></span><br/><span>你已创建</span></li>-->

View File

@ -10,7 +10,7 @@
<div class="con-content">
<%= labelled_form_for @course do |f| %>
<ul>
<li class="clearfix pt20">
<li class="clearfix pt20 mb110">
<label class="panel-form-label label fl color-dark-grey"><span class="color-orange mr5">*</span>课程名称&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="pr fl with75">
<input type="text" name="course[course_list]" autocomplete="off" style="width: 100%;" id="new_course_list" class="task task-height-40 panel-box-sizing fl color-grey" maxlength="100" placeholder="例如:数据结构">
@ -19,6 +19,18 @@
</div>
<div class="cl"></div>
<span class="color-orange fl none" id="new_course_syllabus_notice" style="margin-left:25%;"><i class="fa fa-exclamation-circle mr5" ></i>请先输入课程</span>
<div class="tusi" style="left:108% ">
<div class="entry">
<em></em>
<span class="after"></span>
<p class="color-grey mt10" style="height: 26px;line-height: 26px;">注意:只需要填写课程的全称即可</p>
<p class="color-grey ml50" style="height: 26px;line-height: 26px;margin-left: 35px;"><i class="fa fa-check-circle color-light-green mr5"></i>正确示例:数据结构</p>
<p class="color-grey" style="height: 26px;line-height: 26px;margin-left: 35px;"><i class="fa fa-times-circle color-orange mr5"></i>错误示例数据结构2017本部</p>
<p class="color-grey" style="height: 26px;line-height: 26px;margin-left: 35px;"><i class="fa fa-times-circle color-orange mr5"></i>错误示例数据结构2017秋季</p>
<p class="color-grey" style="height: 26px;line-height: 26px;margin-left: 35px;"><i class="fa fa-times-circle color-orange mr5"></i>错误示例数据结构2017电子商务1班</p>
</div>
</div>
</li>
<li class="pt20 clearfix mb40">
<label class="panel-form-label label fl color-dark-grey"><span class="color-orange mr5">*</span>课堂名称&nbsp;&nbsp;&nbsp;&nbsp;</label>
@ -72,7 +84,7 @@
</li>
<li class=" clearfix pb20">
<label class="panel-form-label label fl">&nbsp;&nbsp;&nbsp;&nbsp;</label>
<a href="javascript:void(0);" class="task-btn task-btn-blue fl mr20" onclick="submit_new_course();">保存</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange fl mr20" onclick="submit_new_course();">保存</a>
<%= link_to '取消', courses_path, :class => 'task-btn fl' %>
</li>
</ul>

View File

@ -79,7 +79,7 @@
</li>
<li class="mt20 clearfix pb20">
<label class="panel-form-label label fl">&nbsp;&nbsp;</label>
<a href="javascript:void(0);" class="task-btn task-btn-blue fl mr20" onclick="submit_edit_course(<%= @course.id%>);">保存</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange fl mr20" onclick="submit_edit_course(<%= @course.id%>);">保存</a>
<%= link_to '取消', course_path(@course), :class => 'task-btn fl ' %>
</li>
</ul>

View File

@ -26,9 +26,9 @@
</div>
<input id="choose_student_ids" name="choose_student_ids" type="hidden" value="">
<p style="width:520px;" class="ml10">
<p style="width:520px;background: #f7f9fd;height: 25px">
<input id="all_student_select" type="checkbox" name="all_student_select" class="fl mt7 mr5 magic-checkbox" value="">
<label for="all_student_select">
<label for="all_student_select" class="ml10">
<span class="span1 edu-name-dark edu-txt-w140 task-hide font-bd" style="text-align: center">姓名</span>
<span class="span2 ml10 edu-txt-w140 task-hide font-bd" style="text-align: center">学号</span>
<span class="span3 ml10 edu-txt-w140 task-hide font-bd" style="text-align: center">用户ID</span>

View File

@ -20,9 +20,9 @@
</div>
<input id="choose_student_ids" name="choose_student_ids" type="hidden" value="">
<p style="width:520px;" class="ml10">
<p style="width:520px;background: #f7f9fd;height: 25px">
<input id="all_student_select" type="checkbox" name="all_student_select" class="fl mt7 mr5 magic-checkbox" value="">
<label for="all_student_select">
<label for="all_student_select" class="ml10">
<span class="span1 edu-name-dark edu-txt-w140 task-hide font-bd" style="text-align: center">姓名</span>
<span class="span2 ml10 edu-txt-w140 task-hide font-bd" style="text-align: center">学号</span>
<span class="span3 ml10 edu-txt-w140 task-hide font-bd" style="text-align: center">用户ID</span>
@ -35,7 +35,7 @@
</div>
<div class="right fl">
<h4 class="font-16 mt95">角色:</h4>
<h4 class="font-16 mt100">角色:</h4>
<ul class="pl20 pb20">
<li>
<label>
@ -51,8 +51,8 @@
</li>
</ul>
<a href="javascript:void(0);" class="pop_close task-btn mb10" style="margin-top: 164px;">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-blue" style="margin-top: 164px;" onclick="submit_add_teacher_form()">确定</a>
<a href="javascript:void(0);" class="pop_close task-btn" style="margin-top: 197px;">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange" style="margin-top: 197px;" onclick="submit_add_teacher_form()">确定</a>
</div>
<% end %>
</div>

View File

@ -9,14 +9,14 @@
</li>
<% if @no_group_count > 0 %>
<li data-option="noclass" data-course-id="<%= @course.id %>">
<p class="p1"><span>未分班</span><em class="setting_noGroup_student_count"><%= @no_group_count %></em></p>
<p class="p1"><span class = "ml15">未分班</span><em class="setting_noGroup_student_count"><%= @no_group_count %></em></p>
</li>
<% end %>
<% unless @course.course_groups.empty? %>
<% @course.course_groups.each do |group| %>
<li data-option="hasclass" data-group-id="<%= group.id %>" data-course-id="<%= @course.id %>" class="setting_group_<%= group.id %>">
<p class="p1">
<span><%= group.name %></span>
<span class = "ml15"><%= group.name %></span>
<em><%= group.members.count %></em>
<!--<i class="fa fa-bars" aria-hidden="true"></i>-->
</p>
@ -31,7 +31,7 @@
<script>
<% unless @course.course_groups.empty? %>
<% @course.course_groups.each do |group| %>
if($(".setting_group_<%= group.id %> span").width() == 115){
if($(".setting_group_<%= group.id %> span").width() == 96){
$(".setting_group_<%= group.id %> p").attr("data-tip-left","<%= group.name %>");
}
<% end %>

View File

@ -40,8 +40,9 @@
<% end %>
<div class="edu-find fr mr40 with30 pr">
<div class="edu-find-input">
<input type="text" class="task-form-100 panel-box-sizing" placeholder="输入姓名、学号进行搜索" value="<%= @search %>" id="all_student_list_search"/>
<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>
<input type="text" class="with100 panel-box-sizing" placeholder="输入姓名、学号进行搜索" value="<%= @search %>" id="all_student_list_search"/>
<!--<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>-->
<span class="edu-close" onclick="colse_searchbox();" data-tip-down="关闭">×</span>
</div>
<a href="javascript:void(0);" onclick="submit_all_student_list_search('<%= @course.id %>');" class="edu-open font-16 color-grey "><i class="fa fa-search"></i></a>
</div>

View File

@ -6,14 +6,14 @@
</li>
<% if @no_group_count > 0 %>
<li data-option="noclass" data-course-id="<%= @course.id %>">
<p class="p1"><span>未分班</span><em class="setting_noGroup_student_count"><%= @no_group_count %></em></p>
<p class="p1"><span class = "ml15">未分班</span><em class="setting_noGroup_student_count"><%= @no_group_count %></em></p>
</li>
<% end %>
<% unless @course.course_groups.empty? %>
<% @course.course_groups.each do |group| %>
<li data-option="hasclass" data-group-id="<%= group.id %>" data-course-id="<%= @course.id %>" class="setting_group_<%= group.id %>">
<p class="p1">
<span><%= group.name %></span>
<span class = "ml15"><%= group.name %></span>
<em><%= group.members.count %></em>
</p>
</li>
@ -23,7 +23,7 @@
<script>
<% unless @course.course_groups.empty? %>
<% @course.course_groups.each do |group| %>
if($(".setting_group_<%= group.id %> span").width() == 115){
if($(".setting_group_<%= group.id %> span").width() == 96){
$(".setting_group_<%= group.id %> p").attr("data-tip-left","<%= group.name %>");
}
<% end %>

View File

@ -28,7 +28,7 @@
</div>
<% end %>
<span class="color-orange fl none" id="change_manager_notice"><i class="fa fa-exclamation-circle mr5" ></i>请选择一个教师</span>
<a href="javascript:void(0);" onclick="submit_change_manager_form();" class="task-btn task-btn-blue fr">确定</a>
<a href="javascript:void(0);" onclick="submit_change_manager_form();" class="task-btn task-btn-orange fr">确定</a>
<a href="javascript:void(0);" class="pop_close task-btn fr mr10">取消</a>
<div class="cl"></div>
</div>

View File

@ -15,7 +15,7 @@
<% end %>
</div>
<div class="task-popup-submit02 clearfix" style="width:120px;">
<a href="javascript:void(0);" id="choose_course_group_submit" class="task-btn task-btn-blue fr sure">确定</a>
<a href="javascript:void(0);" id="choose_course_group_submit" class="task-btn task-btn-orange fr sure">确定</a>
<a href="javascript:void(0);" class="pop_close task-btn fr mr10 cancel">取消</a>
</div>
</div>

View File

@ -9,14 +9,14 @@
</li>
<% if @no_group_count > 0 %>
<li data-option="noclass" data-course-id="<%= @course.id %>">
<p class="p1"><span>未分班</span><em class="setting_noGroup_student_count"><%= @no_group_count %></em></p>
<p class="p1"><span class = "ml15">未分班</span><em class="setting_noGroup_student_count"><%= @no_group_count %></em></p>
</li>
<% end %>
<% unless @course.course_groups.empty? %>
<% @course.course_groups.each do |group| %>
<li class="<%= @group.id == group.id ? 'sheet' : '' %>" data-option="hasclass" data-group-id="<%= group.id %>" data-course-id="<%= @course.id %>" class="setting_group_<%= group.id %>" id = "setting_group_<%= group.id %>" >
<p class="p1">
<span><%= group.name %></span>
<span class = "ml15"><%= group.name %></span>
<em><%= group.members.count %></em>
<!--<i class="fa fa-bars" aria-hidden="true"></i>-->
</p>
@ -31,7 +31,7 @@
<script>
<% unless @course.course_groups.empty? %>
<% @course.course_groups.each do |group| %>
if($("#setting_group_<%= group.id %> span").width() == 115){
if($("#setting_group_<%= group.id %> span").width() == 96){
$("#setting_group_<%= group.id %> p").attr("data-tip-left","<%= group.name %>");
}
<% end %>

View File

@ -34,8 +34,9 @@
<% end %>
<div class="edu-find fr mr40 with30 pr">
<div class="edu-find-input">
<input type="text" class="task-form-100 panel-box-sizing" placeholder="输入姓名、学号进行搜索" value="<%= @search %>" id="has_group_student_list_search"/>
<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>
<input type="text" class="with100 panel-box-sizing" placeholder="输入姓名、学号进行搜索" value="<%= @search %>" id="has_group_student_list_search"/>
<!--<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>-->
<span class="edu-close" onclick="colse_searchbox();" data-tip-down="关闭">×</span>
</div>
<a href="javascript:void(0);" onclick="submit_has_group_student_search('<%= @course.id %>', '<%= @group.id %>');" class="edu-open font-16 color-grey "><i class="fa fa-search"></i></a>
</div>

View File

@ -20,7 +20,7 @@
<div class="cl"></div>
<span id="upload_file_count_notice" class="fl c_red none"></span>
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" style="margin-right: 27px;" id="submit_resource" onclick="submit_course_resource();hideModal();">确定</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" style="margin-right: 27px;" id="submit_resource" onclick="submit_course_resource();hideModal();">确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="$('#datetimepicker_mask').datetimepicker('destroy');hideModal();">取消</a>
<div class="cl"></div>
<% end %>

View File

@ -29,7 +29,7 @@
<% end %>
</form>
</ul>
<a href="javascript:void(0);" class="task-btn task-btn-blue fl" onclick="$('#update_position').submit();" >保存</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange fl" onclick="$('#update_position').submit();" >保存</a>
<a href="javascript:void(0);" class="task-btn fl ml10" >取消</a>
<div class="cl"></div>
<script>
@ -84,7 +84,7 @@
'<input type="text" style="width:300px;" class="task task-height-40 panel-box-sizing fl color-grey" id="subtopic_name">' +
'<div class="cl"></div>' +
'</div>' +
'<a href="javascript:void(0);" onclick="create_subtopic();" class="task-btn task-btn-blue fr">确定</a>' +
'<a href="javascript:void(0);" onclick="create_subtopic();" class="task-btn task-btn-orange fr">确定</a>' +
'<a href="javascript:void(0);" onclick="hideModal();" class="task-btn fr mr10">取消</a>'+
'</div>'+
'</div>'

View File

@ -9,13 +9,13 @@
<p class="p1"><span>全部学生</span><em class="setting_all_student_count"><%= @student_count %></em></p>
</li>
<li class="sheet" data-option="noclass" data-course-id="<%= @course.id %>">
<p class="p1"><span>未分班</span><em class="setting_noGroup_student_count"><%= @no_group_count %></em></p>
<p class="p1" ><span class = "ml15">未分班</span><em class="setting_noGroup_student_count"><%= @no_group_count %></em></p>
</li>
<% unless @course.course_groups.empty? %>
<% @course.course_groups.each do |group| %>
<li data-option="hasclass" data-group-id="<%= group.id %>" data-course-id="<%= @course.id %>" class="setting_group_<%= group.id %>">
<p class="p1">
<span><%= group.name %></span>
<span class = "ml15"><%= group.name %></span>
<em><%= group.members.count %></em>
<!--<i class="fa fa-bars" aria-hidden="true"></i>-->
</p>
@ -31,7 +31,7 @@
<script>
<% unless @course.course_groups.empty? %>
<% @course.course_groups.each do |group| %>
if($(".setting_group_<%= group.id %> span").width() == 115){
if($(".setting_group_<%= group.id %> span").width() == 96){
$(".setting_group_<%= group.id %> p").attr("data-tip-left","<%= group.name %>");
}
<% end %>

View File

@ -20,8 +20,9 @@
<% end %>
<div class="edu-find fr mr40 with30 pr">
<div class="edu-find-input">
<input type="text" class="task-form-100 panel-box-sizing" placeholder="输入姓名、学号进行搜索" value="<%= @search %>" id="no_group_student_list_search"/>
<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>
<input type="text" class="with100 panel-box-sizing" placeholder="输入姓名、学号进行搜索" value="<%= @search %>" id="no_group_student_list_search"/>
<!--<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>-->
<span class="edu-close" onclick="colse_searchbox();" data-tip-down="关闭">×</span>
</div>
<a href="javascript:void(0);" onclick="submit_no_group_student_search('<%= @course.id %>');" class="edu-open font-16 color-grey "><i class="fa fa-search"></i></a>
</div>

View File

@ -7,7 +7,8 @@
<!--<i class="fa fa-check-square-o color-blue blue fl" style="display:none;" aria-hidden="true"></i>-->
<input id="add_student_<%= user.id %>" type="checkbox" class="fl mt7 mr5 magic-checkbox" name="membership[user_ids][]" value="<%= user.id %>">
<label for="add_student_<%= user.id %>" style="top:0px">
<a href="<%= user_path(user) %>" target="_blank" class="task-hide span1 edu-name-dark edu-txt-w140"><%= user.show_real_name %>(<%= user.login %>)</a>
<!--(<%#= user.login %>)-->
<a href="<%= user_path(user) %>" target="_blank" class="task-hide span1 edu-name-dark edu-txt-w140" style="text-align: center"><%= user.show_real_name %></a>
<span class="span2 ml10 edu-txt-w140 task-hide" style="text-align: center"><%= user.user_extensions.try(:student_id) %></span>
<span class="span3 ml10 edu-txt-w140 task-hide" style="text-align: center"><%= user.login %></span>
</label>
@ -31,7 +32,7 @@
<div class="cl"></div>
</div>
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" style="" onclick="submit_add_student_form()">确定</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" style="" onclick="submit_add_student_form()">确定</a>
<a href="javascript:void(0);" class="pop_close task-btn fr mr10" onclick="hideModal();">取消</a>
</div>

View File

@ -7,7 +7,8 @@
<!--<i class="fa fa-check-square-o color-blue blue fl" style="display:none;" aria-hidden="true"></i>-->
<input id="add_student_<%= user.id %>" type="checkbox" class="fl mt7 mr5 magic-checkbox" name="membership[user_ids][]" value="<%= user.id %>">
<label for="add_student_<%= user.id %>" style="top:0px">
<a href="<%= user_path(user) %>" target="_blank" class="task-hide span1 edu-name-dark edu-txt-w140"><%= user.show_real_name %>(<%= user.login %>)</a>
<!--(<%#= user.login %>)-->
<a href="<%= user_path(user) %>" target="_blank" class="task-hide span1 edu-name-dark edu-txt-w140" style="text-align: center"><%= user.show_real_name %></a>
<span class="span2 ml10 edu-txt-w140 task-hide" style="text-align: center"><%= user.user_extensions.try(:student_id) %></span>
<span class="span3 ml10 edu-txt-w140 task-hide" style="text-align: center"><%= user.login %></span>
</label>

View File

@ -1,7 +1,7 @@
<table class="edu-pop-table color-grey3 edu-txt-center table-pa5 interval-td" style="border:none;" cellspacing="0" cellpadding="0" >
<thead>
<tr>
<th>
<th width="10%">
<span class="selectjoin fl open-select ml15" id="allselect">
<% unless is_teacher %>
序号
@ -11,13 +11,14 @@
<% end %>
</span>
</th>
<th>用户ID</th>
<th>姓名</th>
<th>学号</th>
<th>分班</th>
<th>发布资源</th>
<th>发布帖子</th>
<th>回复评论</th>
<th width="14%">用户ID</th>
<th width="10%">姓名</th>
<th width="12%">学号</th>
<th width="10%">分班</th>
<th width="13%" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis">作业成绩</th>
<th width="10%">发布资源</th>
<th width="10%">发布帖子</th>
<th width="10%">回复评论</th>
<!--<th>操作</th>-->
</tr>
</thead>
@ -40,6 +41,7 @@
<td><%= link_to user.show_real_name, user_path(user), :class => 'edu-txt-w140 task-hide mt5 alink-name', :target => '_blank' %></td>
<td><span class="edu-txt-w140 task-hide mt5"><%= user.user_extensions ? user.user_extensions.student_id : '' %></span></td>
<td><%= member.course_group_id == 0 ? '未分班' : member.course_group.name %></td>
<td><%= student_course_homework_score @course, user %></td><!--作业成绩-->
<td><%= student_course_resource_num @course, user %></td>
<td><%= student_course_message_num @course, user %></td>
<td><%= student_course_reply_num @course, user %></td>

View File

@ -8,20 +8,24 @@
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="homepageRight mt0 " style="width:85%; float:left;">
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
<ul class="with100 mb20 ml15 clearfix df activities_btn font-16" style="width:1003px;">
<li><%= link_to '成员管理', members_course_path(@course),:class => "color-orange03" %>
<% apply_count = CourseMessage.where(:course_id => @course.id,:course_message_type => 'JoinCourseRequest', :status => 0).count %>
<% if apply_count > 0 %>
<span class="ml10" style="cursor: pointer"><a href="<%= members_course_path(@course) %>" class="edu-cir-orange" data-tip-down="有<%= apply_count %>名助教或教师申请加入课堂,请审批"><%= apply_count %></a></span>
<% end %>
</li>
<li><%= link_to '+&nbsp;发布普通作业'.html_safe, new_homework_common_path(:course => @course.id, :homework_type => 1),:class => "color-orange03" %></li>
<li><%= link_to '+&nbsp;发布实训作业'.html_safe, shixuns_homework_common_index_path(:course => @course.id),:class => "color-orange03", :remote => true %></li>
<li><a class="color-orange03" onclick="course_files_upload();" style="cursor: pointer">+&nbsp;发布资源</a></li>
<% course_board = @course.boards.where("parent_id is NULL").first %>
<li><%= link_to '+&nbsp;发布帖子'.html_safe, new_board_message_path(:board_id => course_board.id),:class => "color-orange03" %></li>
</ul>
<% if false %>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
<ul class="with100 mb20 ml15 clearfix df activities_btn font-16" style="width:1003px;">
<% if false %>
<li><%= link_to '成员管理', members_course_path(@course),:class => "color-orange03" %>
<% apply_count = CourseMessage.where(:course_id => @course.id,:course_message_type => 'JoinCourseRequest', :status => 0).count %>
<% if apply_count > 0 %>
<span class="ml10" style="cursor: pointer"><a href="<%= members_course_path(@course) %>" class="edu-cir-orange" data-tip-down="有<%= apply_count %>名助教或教师申请加入课堂,请审批"><%= apply_count %></a></span>
<% end %>
</li>
<% end %>
<li><%= link_to '+&nbsp;发布普通作业'.html_safe, new_homework_common_path(:course => @course.id, :homework_type => 1),:class => "color-orange03" %></li>
<li><%= link_to '+&nbsp;发布实训作业'.html_safe, shixuns_homework_common_index_path(:course => @course.id),:class => "color-orange03", :remote => true %></li>
<li><a class="color-orange03" onclick="course_files_upload();" style="cursor: pointer">+&nbsp;发布资源</a></li>
<% course_board = @course.boards.where("parent_id is NULL").first %>
<li><%= link_to '+&nbsp;发布帖子'.html_safe, new_board_message_path(:board_id => course_board.id),:class => "color-orange03" %></li>
</ul>
<% end %>
<% end %>
<div id="course_activities_content">
<%= render :partial => 'courses/course_activity_content', :locals => {:course_activities => @course_activities} %>

View File

@ -2,14 +2,14 @@
<a href='<%= praise_tread_praise_plus_path({:obj_id => discuss.id,
:obj_type => discuss.class
}) %>' data-remote="true" data-tip-down="点赞" class="fr mt5">
<i class="fa fa-thumbs-up color_Purple_grey"></i>
<i class="fa fa-thumbs-up mr5"></i>赞
<%= discuss.praise_tread_cache ? (discuss.praise_tread_cache.praise_num == 0 ? "" : discuss.praise_tread_cache.praise_num ) : "" %>
</a>
<% else %>
<a href='<%= praise_tread_praise_minus_path({:obj_id => discuss.id,
:obj_type => discuss.class
}) %>' data-remote="true" class="fr mt5" data-tip-down="取消点赞" >
<i class="fa fa-thumbs-up color-light-green"></i>
<i class="fa fa-thumbs-up mr5"></i>赞
<%= discuss.praise_tread_cache ? (discuss.praise_tread_cache.praise_num == 0 ? "" : discuss.praise_tread_cache.praise_num ) : "" %>
</a>
<% end %>

View File

@ -21,48 +21,44 @@
}
</script>
<div class="questionContainer" style="width: 680px;">
<div class="mb10 ur_item">
<label>分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_<%=exercise_question.id %>"><%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
<span class="fr">标准答案:</span>
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<textarea name="question_title" style="width: 625px;" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入单选题的题干" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
</div>
<div class="ur_editor_content">
<ul>
<div id="poll_answers_<%=exercise_question.id%>">
<input style="display: none;" name="exercise_choice" id="exercise_choice_<%=exercise_question.id%>" value="<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>"/>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="ur_item new_answer">
<a class="<%= (index + 1) == exercise_question.exercise_standard_answers.first.exercise_choice_id ? 'question_choice_blue' : 'question_choice_white' %> fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, <%= exercise_question.id %>);"><%=convert_to_char (index+1).to_s %></a>
<input maxlength="200" class="w600" type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<% end %>
<li class="ur_item">
<a class="question_choice_dash fl mr10 choice_btn"><%=convert_to_char (exercise_question.exercise_choices.count+1).to_s %></a>
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 1);'>新建选项</div>
<div class="questionContainer">
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 single_Temp" id="single_Temp">
<div class="clearfix">
<p class="fl mt15 font-16 mb10">单选题</p>
<label class="fr mt15">标准答案:<span class="color-orange current-option" id="question_standard_answer_<%=exercise_question.id %>"><%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span></label>
</div>
<li class="clearfix pr mb20">
<input style="display: none;" name="exercise_choice" id="exercise_choice_<%=exercise_question.id%>" value="<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>"/>
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<textarea name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="panel-form-width2-690 fl panel-box-sizing undis" placeholder="请输入单选题的题干"><%=exercise_question.question_title.html_safe %></textarea>
</li>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice <%= (index + 1) == exercise_question.exercise_standard_answers.first.exercise_choice_id ? 'check-option-bg' : '' %>" name="option_span" data-tip-down="点击设置答案" onclick="selectchoice(this)"><%=convert_to_char (index+1).to_s %></span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name='question_answer[<%=exercise_choice.id %>]' placeholder="请输入选项内容"><%=exercise_choice.choice_text %></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removeSingle(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<div class='cl'></div>
<div class="cl"></div>
<% end %>
<li class="clearfix mb20">
<label class="panel-form-label fl">
<span class="add-option-item fr mr10 color-grey border-dash-orange" name="option_span">D</span>
</label>
<div class="fl panel-box-sizing add-option-input border-dash-orange">
<a title="新增" href="javascript:void(0)" class="option_icon_add" onclick="addSingle(this)">新增选项</a>
</div>
<div class="cl"></div>
</ul>
</li>
<li class="clearfix mb20">
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" class="with10 mr5 pl10 fl panel-box-sizing task-height-40" name="question_score">
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" onclick="edit_poll_question($(this),<%= exercise_question.id %>,1);">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$('#edit_poll_questions_<%=exercise_question.id %>').hide();$('#show_poll_questions_<%=exercise_question.id %>').show();">取消</a>
</p>
</li>
</div>
<div class="ur_editor_footer">
<span class="fl c_red mt10">温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a class="big_blue_btn borderRadius fr" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,1);">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">取消</a>
</div>
<div class="cl"></div>
</div>
<!--编辑单选 end-->
<% end%>
<% end %>

View File

@ -20,51 +20,50 @@
"</li> <div class='cl'></div>");
}
</script>
<div class="questionContainer" style="width: 680px;">
<div class="mb10 ur_item">
<label>分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_<%=exercise_question.id %>"><%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
<span class="fr">标准答案:</span>
<div class="cl"></div>
<div class="questionContainer">
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 multiple_Temp" id="multiple_Temp">
<div class="clearfix">
<p class="fl mt15 font-16 mb10">多选题</p>
<input name="question_type" value="2" type="hidden">
<label class="fr mt15">标准答案:<span class="color-orange current-option"id="question_standard_answer_<%=exercise_question.id %>"><%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span></label>
<input style="display: none;" name="exercise_choice"/>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<li class="clearfix pr mb20">
<input style="display: none;" name="exercise_choice" id="exercise_choice_<%=exercise_question.id%>" value="<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>"/>
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<textarea name="question_title" style="width: 625px;" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入多选题的题干" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
</div>
<textarea name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="panel-form-width2-690 fl panel-box-sizing undis"><%=exercise_question.question_title.html_safe %></textarea>
</li>
<div class="ur_editor_content">
<ul>
<div id="poll_answers_<%=exercise_question.id%>">
<input style="display: none;" name="exercise_choice" id="exercise_choice_<%=exercise_question.id%>" value="<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>"/>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="ur_item new_answer">
<a class="<%= exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s.include?((index+1).to_s) ? 'question_choice_blue' : 'question_choice_white' %> fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, <%= exercise_question.id %>);"><%=convert_to_char (index+1).to_s %></a>
<input maxlength="200" class="w600" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<% end %>
<li class="ur_item">
<a class="question_choice_dash fl mr10 choice_btn"><%=convert_to_char (exercise_question.exercise_choices.count+1).to_s %></a>
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 2);'>新建选项</div>
</li>
<div class="cl"></div>
</div>
</ul>
</div>
<div class="ur_editor_footer">
<span class="fl c_red mt10">温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a class="big_blue_btn borderRadius fr" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,2);">
保存
</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
<%= l(:button_cancel)%>
</a>
</div>
<div class="cl"></div>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="<%= exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s.include?((index+1).to_s) ? 'check-option-bg' : '' %> option-item fr mr10 color-grey select-choice " onclick="selectMul(this)" name="option_spans" data-tip-down="点击设置答案"><%=convert_to_char (index+1).to_s %></span>
</label>
<textarea name='question_answer[<%= exercise_choice.id %>]' class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入选项内容"><%=exercise_choice.choice_text %></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removeMuli(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<div class="cl"></div>
<% end %>
<li class="clearfix mb20">
<label class="panel-form-label fl">
<span class="add-option-item fr mr10 color-grey border-dash-orange" name="option_spans">D</span>
</label>
<div class="fl panel-box-sizing add-option-input border-dash-orange"><a title="新增" href="javascript:void(0)" onclick="addMuli(this)" class="option_icon_add">新增选项</a></div>
</li>
<li class="clearfix mb20">
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" name="question_score" class="with10 mr5 fl pl10 panel-box-sizing task-height-40" />
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" onclick="edit_poll_question($(this),<%= exercise_question.id %>,2);">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$('#edit_poll_questions_<%=exercise_question.id %>').hide();$('#show_poll_questions_<%=exercise_question.id %>').show();">取消</a>
</p>
</li>
</div>
<!--编辑单选 end-->
</div>
<% end%>

View File

@ -1,41 +1,31 @@
<%= form_for @exercise, :remote=>true do |f| %>
<div class="testContainer">
<div>
<input name="exercise[exercise_name]" maxlength="100" id="exercise_name" class="testTitle mb10" type="text" placeholder="测验标题" value="<%=@exercise.exercise_name%>" />
</div>
<label class="fl c_grey f14" style="margin-top: 4px;">截止时间:</label>
<div class="calendar_div fl">
<input type="text" name="exercise[end_time]" id="exercise_end_time" placeholder="截止时间" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d") if exercise.end_time %>"/>
<%= calendar_for('exercise_end_time')%>
</div>
<div class="fl ml15 f14 fontGrey2"><span class="mr5">测验时长:</span><input name="exercise[time]" id="exercise_time" type="text" class="examTime mr5" placeholder="不填即不限时" value="<%=exercise.time if exercise.time!= -1 %>" />分钟</div>
<label class="fl c_grey ml15 f14" style="margin-top: 4px;">发布时间(可选)</label>
<div class="calendar_div fl">
<input type="text" name="exercise[publish_time]" id="exercise_publish_time" placeholder="发布时间(可选)" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil? %>"/>
<%= calendar_for('exercise_publish_time')%>
</div>
<div class="cl"></div>
<textarea class="testDes mt10" name="exercise[exercise_description]" id="exercise_description" placeholder="发布须知:试题类型有选择和填空两种,其中选择题包括单选题和多选题。您可以在此处填写测验相关说明。" ><%=exercise.exercise_description %></textarea>
<div class="ur_editor_footer">
<input type="checkbox" name="question_random" <%= exercise.question_random == 0 ? 'checked' : '' %> id="edit_question_random">
<label for="edit_question_random" class="mt10 mr30">题目不随机打乱</label>
<input type="checkbox" name="choice_random" <%= exercise.choice_random == 0 ? 'checked' : '' %> id="edit_choice_random">
<label for="edit_choice_random" class="mt10 mr30">选项不随机打乱</label>
<input type="checkbox" name="show_result" <%= exercise.show_result == 1 ? 'checked' : '' %> id="edit_show_result">
<label for="edit_show_result" class="mt10">允许学生查看测验结果</label>
<a data-button="ok" onclick="pollsSubmit($(this));" class="big_blue_btn fr borderRadius">保存</a>
<a data-button="cancel" onclick="pollsCancel();" class="big_grey_btn fr borderRadius mr10">取消</a>
</div>
<div class="cl"></div>
<%= form_for(@exercise, :html => {:multipart => true, :id => "exercise_head_form"}, :remote => true) do |f| %>
<div class="ml15 mr15 mb15">
<input class="panel-box-sizing panel-form-width-100" name="exercise[exercise_name]" maxlength="100" id="exercise_name" value="<%= @exercise.try(:exercise_name) %>" placeholder="试卷标题" style="text-align: center;"/>
</div>
<div class="ml15 mr15">
<textarea id="mustBe" name="exercise[exercise_description]" class="panel-box-sizing panel-form-width-100" placeholder="试卷须知共有选择、填空、简答3种题型其中选择题包括单选题和多选题;您可以在此处填写本次试卷答题的相关说明"><%= @exercise.try(:exercise_description) %></textarea>
</div>
<p class="fr">
<a href="javascript:void(0)" onclick="ex_head_submit($(this));" class="fr task-btn mr15 task-btn-orange">保存</a>
<a href="javascript:void(0)" onclick="ex_head_cancel();" class="fr task-btn mr10">取消</a>
</p>
<% end %>
<script type="text/javascript">
function resetHead()
{
$("#exercise_name").val("<%=exercise.exercise_name%>");
$("#exercise_end_time").val("<%= Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d") if exercise.end_time %>");
$("#exercise_time").val("<%=exercise.time if exercise.time!= -1 %>");
$("#exercise_publish_time").val("<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil?%>");
/*$("#exercise_description").text("<%#=exercise.exercise_description.html_safe %>");*/
}
</script>
<script>
$(function(){
$("#exercise_head_edit").on("keydown", "input[name='exercise[exercise_name]']", function(event){
var code;
if (!event) {
event = window.event; //针对ie浏览器
code = event.keyCode;
}
else {
code = event.keyCode;
}
if(code == 13) {
event.preventDefault();
return false;
}
});
});
</script>

View File

@ -7,33 +7,28 @@
}
</script>
<div class="questionContainer" style="width: 680px;">
<div class="mb10 ur_item">
<label class="ml25">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml25">问题:&nbsp;&nbsp;</label>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 answer_Temp" id="answer_Temp">
<p class="fl mt15 font-16 mb10">简答题</p>
<input name="question_type" value="4" type="hidden">
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<textarea name="question_title" style="width: 600px;" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入问答题的题干" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
</div>
<div class="ur_editor_content" id="edit_multi">
<div id="poll_answers_<%=exercise_question.id%>" class="multi_input">
<label name='candiate_items'>参考答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<textarea class="candiate_answer" style="width: 600px; height: 90px;" name="exercise_choice" id="poll_questions_answer_<%=exercise_question.id %>" placeholder="如有参考答案,请输入参考答案" type="text"><%=exercise_question.exercise_standard_answers.empty? ? '' : exercise_question.exercise_standard_answers.first.answer_text %></textarea>
</div>
<div class="cl"></div>
</div>
<div class="ur_editor_footer">
<p class="fl c_red">温馨提示:[问答题]属于主观题需要人工评分,未作答的情况下系统将自动评零分<br><span class="ml60">参考答案作为人工评分时的参考</span></p>
<a class="big_blue_btn borderRadius fr" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,4);">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
<%= l(:button_cancel)%>
</a>
</div>
<div class="cl"></div>
<textarea maxlength="250" class="panel-form-width2-690 fl panel-box-sizing undis" name="question_title" id="poll_questions_title_<%=exercise_question.id %>"><%=exercise_question.question_title.html_safe %></textarea>
</li>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="fr mr10 color-grey" name="option_spans">参考答案</span></label>
<textarea class="fl panel-box-sizing with90 task-height-150 pl5 pt5 candiate_answer" name="exercise_choice" placeholder="如有参考答案,请输入参考答案" id="poll_questions_answer_<%=exercise_question.id %>"><%=exercise_question.exercise_standard_answers.empty? ? '' : exercise_question.exercise_standard_answers.first.answer_text %></textarea>
</li>
<li class="clearfix mb20">
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" name="question_score" class="with10 mr5 pl10 fl panel-box-sizing task-height-40" />
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey" style="display: block;">温馨提示:[简答题]属于主观题需要人工评分,未作答的情况下系统将自动评分</span>
<span class="font-12 color-grey mb10 ml50" style="display: block;">&nbsp;&nbsp;参考答案仅作为人工评分的参考</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" onclick="edit_poll_question($(this),<%= exercise_question.id %>,4);">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$('#edit_poll_questions_<%=exercise_question.id %>').hide();$('#show_poll_questions_<%=exercise_question.id %>').show();">取消</a>
</p>
</li>
</div>
<!--编辑单选 end-->
<% end%>

View File

@ -1,5 +1,6 @@
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
<!--编辑单选start-->
<% if false %>
<script type="text/javascript">
function resetQuestion<%=exercise_question.id%>()
{
@ -18,46 +19,39 @@
"<div class='cl'></div>");
}
</script>
<div class="questionContainer" style="width: 680px;">
<div class="mb10 ur_item">
<label class="ml36">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml36">问题:&nbsp;&nbsp;</label>
<% end %>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 fillin_Temp" id="poll_answers_<%= exercise_question.id %>">
<p class="fl mt15 font-16 mb10">填空题</p>
<li class="clearfix pr mb20">
<input name="question_type" value="3" type="hidden">
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<textarea name="question_title" style="width: 590px;" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入填空题的题干(注意:目前仅支持一个空)" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
</div>
<div class="ur_editor_content" id="edit_single">
<ul>
<div id="poll_answers_<%=exercise_question.id%>">
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案<%=convert_to_chi_num(index+1) %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[<%=exercise_choice.id %>]" placeholder="请输入参考答案" type="text" value="<%=exercise_choice.answer_text %>"/>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this));"></a>
</li>
<div class="cl"></div>
<% end %>
<li class="ur_item">
<div class="dash-block new-question w560" style="margin-left: 82px;" onclick="add_candidate_answer($(this));">新建参考答案</div>
</li>
<div class="cl"></div>
</div>
<textarea maxlength="250" class="panel-form-width2-690 fl panel-box-sizing questionTitle undis" name="question_title" id="poll_questions_title_<%=exercise_question.id %>"><%=exercise_question.question_title.html_safe %></textarea>
</li>
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="fr mr10 color-grey" name="fill_span">答案 <%=convert_to_chi_num(index+1) %></span></label>
<textarea class="candiate_answer panel-form-width2-690 fl panel-box-sizing" name="exercise_choice[<%=exercise_choice.id %>]" placeholder="请输入参考答案(可选)"><%=exercise_choice.answer_text %></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removefill(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">
<span class="fl c_red mt10">温馨提示:[填空题]属于客观题将由系统自动评分,请输入参考答案</span>
<a class="big_blue_btn borderRadius fr" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,3);">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
<%= l(:button_cancel)%>
</a>
</div>
<div class="cl"></div>
<% end %>
<li class="clearfix mb20">
<label class="panel-form-label fl"><span>&nbsp;</span></label>
<div class="fl panel-box-sizing add-option-input border-dash-orange"><a title="新增" href="javascript:void(0)" class="option_fillin_add" onclick="addfill(this)">新增参考答案</a></div>
</li>
<li class="clearfix mb20">
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" name="question_score" class="with10 mr5 fl pl10 panel-box-sizing task-height-40">
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[填空题]属于客观题将由系统自动评分,请设置标准答案</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange"onclick="edit_poll_question($(this),<%= exercise_question.id %>,3);">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$('#edit_poll_questions_<%=exercise_question.id %>').hide();$('#show_poll_questions_<%=exercise_question.id %>').show();">取消</a>
</p>
</li>
</div>
<!--编辑单选 end-->
<% end%>
<% end %>

View File

@ -0,0 +1,258 @@
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20" id="exercise_head">
<div class="<%= is_edit ? '' : 'none' %>" id="exercise_head_show">
<%= render :partial => 'show_head', :locals => {:exercise => @exercise} %>
</div>
<div class="<%= is_edit ? 'none' : '' %>" id="exercise_head_edit">
<% if is_edit %>
<%= render :partial => 'edit_head', :locals => {:exercise => @exercise} %>
<% else %>
<%= render :partial => 'new_head', :locals => {:exercise => @exercise} %>
<% end %>
</div>
</div>
<div id="total_questions_score">
<%= render :partial => "exercise/total_questions_score" %>
</div>
<div id="exercise_question_list">
<% if is_edit %>
<%= render :partial => "exercise/exercise_content" %>
<% end %>
</div>
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20" id="new_exercise_question">
<%= render :partial => "exercise/new_question" %>
</div>
<div id="new_poll_question">
</div>
<script id="t:set-option-list" type="text/html">
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" name="option_span" onclick="selectchoice(this)" data-tip-down="点击设置答案">A</span></label>
<input type="hidden" name="choice[answer][]">
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question_answer[]" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removeSingle(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
</script>
<script id="t:set-option-lists" type="text/html">
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" onclick="selectMul(this)" name="option_spans" data-tip-down="点击设置答案">A</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question_answer[]" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removeMuli(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
</script>
<script id="t:set-fillin-lists" type="text/html">
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="fr mr10 color-grey" name="fill_span">答案 2</span></label>
<textarea class="candiate_answer panel-form-width2-690 fl panel-box-sizing" name="exercise_choice[]" placeholder="请输入参考答案(可选)"></textarea>
<a title="移除" href="javascript:void(0)" onclick="removefill(this)" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
</script>
<script>
/*填空题操作*/
function addfill(item){
var bt = baidu.template;
bt.LEFT_DELIMITER = '<!';
bt.RIGHT_DELIMITER = '!>';
var html = bt('t:set-fillin-lists', null);
$(item).parent().parent('.clearfix').before(html);
$(item).parent().parent('.clearfix').prev().find('textarea').attr("name", "exercise_choice["+new Date().getTime()+"]");
var inputs = document.getElementsByName("exercise_choice[]");
var inputs_spans=$(item).parents(".fillin_Temp").find("li span[name='fill_span']");
//var inputs_spans = document.getElementsByName("fill_span");
for (var j = 0; j < inputs_spans.length; j++) {
var countChar=convert_to_chi_num(j+1);
$(inputs_spans[j]).html("答案 "+countChar);
}
// for (var i = 0; i < inputs.length; i++) {
// autoTextarea(inputs[i], 0, 140);
// }
$(inputs[inputs.length - 1]).focus();
}
function convert_to_chi_num(num){
var toChar="";
switch(num){
case 1:
return toChar="一";
break;
case 2:
return toChar="二";
break;
case 3:
return toChar="三";
break;
case 4:
return toChar="四";
break;
case 5:
return toChar="五";
break;
case 6:
return toChar="六";
break;
case 7:
return toChar="七";
break;
case 8:
return toChar="八";
break;
case 9:
return toChar="九";
break;
}
}
function removefill(item){
var temp=$(item).parents(".fillin_Temp");
$(item).parents('li').remove();
var inputs_spans=temp.find("li span[name='fill_span']");
//var inputs_spans = document.getElementsByName("fill_span");
for (var j = 0; j < parseInt(inputs_spans.length); j++) {
var countChar=convert_to_chi_num(j+1);
$(inputs_spans[j]).html("答案 "+countChar);
}
}
/*选择题操作*/
function removeMuli(item){
var temp=$(item).parents("li").siblings("div").find(".current-option");
var count=0;
var exercise_choice = $(item).parents(".multiple_Temp").find("input[name='exercise_choice']");
var muil=$(item).parents(".multiple_Temp").find(".check-option-bg");
var pare=$(item).parents(".multiple_Temp");
if($(item).parents("li").find("label span").hasClass("check-option-bg")){
count++;
}
$(item).parents('li').remove();
var inputs_spans=pare.find("li span[name='option_spans']");
//var inputs_spans = document.getElementsByName("option_spans");
for (var j = 0; j < parseInt(inputs_spans.length)-count; j++) {
if(j >= 0 && j <= 26){
if(j >= 0 && j <= 26){
$(inputs_spans[j]).html(String.fromCharCode(65 + j));
}
}
}
temp.html("");
if(parseInt(muil.length)-count>0){
for(var i=0;i<parseInt(muil.length)-count;i++){
temp.html(temp.html()+muil.eq(i).html());
}
exercise_choice.val(temp.html());
}else{
exercise_choice.val('');
temp.html("请点击正确选项");
}
}
function addMuli(item){
var bt = baidu.template;
bt.LEFT_DELIMITER = '<!';
bt.RIGHT_DELIMITER = '!>';
var html = bt('t:set-option-lists', null);
$(item).parent().parent('.clearfix').before(html);
$(item).parent().parent('.clearfix').prev().find('textarea').attr("name", "question_answer["+new Date().getTime()+"]");
var inputs = document.getElementsByName("question_answer[]");
var inputs_spans=$(item).parents(".multiple_Temp").find("li span[name='option_spans']");
//var inputs_spans = document.getElementsByName("option_spans");
for (var j = 0; j < inputs_spans.length; j++) {
if(j >= 0 && j <= 26){
$(inputs_spans[j]).html(String.fromCharCode(65 + j));
}
}
$(inputs[inputs.length - 1]).focus();
}
function selectMul(item){
var temp=$(item).parents(".multiple_Temp");
var exercise_choice = $(temp).find("input[name='exercise_choice']");
temp.find("li").removeClass("check-option-bg");
$(item).toggleClass("check-option-bg");
temp.find(".current-option").html("");
if(temp.find(".check-option-bg").length>0){
for(var i=0;i<temp.find(".check-option-bg").length;i++){
temp.find(".current-option").html(temp.find(".current-option").html()+temp.find(".check-option-bg").eq(i).html());
}
exercise_choice.val(temp.find(".current-option").html());
}else{
temp.find(".current-option").html("请点击正确选项");
exercise_choice.val('');
}
}
/*单选题操作*/
function addSingle(item){
var bt = baidu.template;
bt.LEFT_DELIMITER = '<!';
bt.RIGHT_DELIMITER = '!>';
var html = bt('t:set-option-list', null);
$(item).parent().parent('.clearfix').before(html);
$(item).parent().parent('.clearfix').prev().find('textarea').attr("name", "question_answer["+new Date().getTime()+"]");
var inputs = document.getElementsByName("question_answer[]");
var inputs_spans=$(item).parents(".single_Temp").find("li span[name='option_span']");
//var inputs_spans = document.getElementsByName("option_span");
for (var j = 0; j < inputs_spans.length; j++) {
if(j >= 0 && j <= 26){
$(inputs_spans[j]).html(String.fromCharCode(65 + j));
}
}
$(inputs[inputs.length - 1]).focus();
}
function removeSingle(item){
var temp=$(item).parents("li").siblings("div").find(".current-option");
var exercise_choice = $(item).parents(".single_Temp").find("input[name='exercise_choice']");
var singl=$(item).parents(".single_Temp").find(".check-option-bg");
var pare=$(item).parents(".single_Temp");
temp.html("");
var count=0;
if($(item).parents("li").find("label span").hasClass("check-option-bg")){
count++;
}
$(item).parents('li').remove();
var inputs_spans=pare.find("li span[name='option_span']");
//var inputs_spans = document.getElementsByName("option_span");
for (var j = 0; j < parseInt(inputs_spans.length)-count; j++) {
if(j >= 0 && j <= 26){
if(j >= 0 && j <= 26){
$(inputs_spans[j]).html(String.fromCharCode(65 + j));
}
}
}
if(parseInt(singl.length)-count>0){
for(var i=0;i<parseInt(singl.length)-count;i++){
temp.html(temp.html()+singl.eq(i).html());
}
exercise_choice.val(temp.html());
}else{
temp.html("请点击正确选项");
exercise_choice.val('');
}
}
function selectchoice(item){
var temp=$(item).parents(".single_Temp");
var exercise_choice = $(temp).find("input[name='exercise_choice']");
$(temp).find("li span").removeClass("check-option-bg");
$(item).toggleClass("check-option-bg");
temp.find(".current-option").html("");
if(temp.find(".check-option-bg").length>0){
for(var i=0;i<temp.find(".check-option-bg").length;i++){
temp.find(".current-option").html(temp.find(".current-option").html()+temp.find(".check-option-bg").eq(i).html());
}
exercise_choice.val(temp.find(".current-option").html());
}else{
temp.find(".current-option").html("请点击正确选项");
exercise_choice.val('');
}
}
</script>

View File

@ -1,56 +1,34 @@
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
<% multi_question_list = exercise.exercise_questions.where("question_type=4") %>
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单选题</h3>
<% mc_question_list.each_with_index do |exercise_question, index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (index + 1) == mc_question_list.count ? '' : 'border_b' %>">
<%= render :partial => 'show_MC', :locals => {:exercise_question => exercise_question} %>
</div>
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
<%= render :partial => 'edit_MC', :locals => {:exercise_question => exercise_question} %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多选题</h3>
<% mcq_question_list.each_with_index do |exercise_question, index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (index + 1) == mcq_question_list.count ? '' : 'border_b' %>">
<%= render :partial => 'show_MCQ', :locals => {:exercise_question => exercise_question} %>
</div>
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
<%= render :partial => 'edit_MCQ', :locals => {:exercise_question => exercise_question} %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">填空题</h3>
<% single_question_list.each_with_index do |exercise_question, index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (index + 1) == single_question_list.count ? '' : 'border_b' %>">
<%= render :partial => 'show_single', :locals => {:exercise_question => exercise_question} %>
</div>
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
<%= render :partial => 'edit_single', :locals => {:exercise_question => exercise_question} %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">问答题</h3>
<% multi_question_list.each_with_index do |exercise_question, index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (index + 1) == multi_question_list.count ? '' : 'border_b' %>">
<%= render :partial => 'show_multi', :locals => {:exercise_question => exercise_question} %>
</div>
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
<%= render :partial => 'edit_multi', :locals => {:exercise_question => exercise_question} %>
</div>
</div>
<% end %>
</div>
<% @exercise.exercise_questions.each do |eq| %>
<div id='poll_questions_<%= eq.id %>'>
<% case eq.question_type %>
<% when 1 %>
<div id='show_poll_questions_<%= eq.id %>'>
<%= render :partial => 'show_MC', :locals => {:exercise_question => eq} %>
</div>
<div id='edit_poll_questions_<%= eq.id %>' style='display: none;'>
<%= render :partial => 'edit_MC', :locals => {:exercise_question => eq} %>
</div>
<% when 2 %>
<div id='show_poll_questions_<%= eq.id %>'>
<%= render :partial => 'show_MCQ', :locals => {:exercise_question => eq} %>
</div>
<div id='edit_poll_questions_<%= eq.id %>' style='display: none;'>
<%= render :partial => 'edit_MCQ', :locals => {:exercise_question => eq} %>
</div>
<% when 3 %>
<div id='show_poll_questions_<%= eq.id %>'>
<%= render :partial => 'show_single', :locals => {:exercise_question => eq} %>
</div>
<div id='edit_poll_questions_<%= eq.id %>' style='display: none;'>
<%= render :partial => 'edit_single', :locals => {:exercise_question => eq} %>
</div>
<% when 4 %>
<div id='show_poll_questions_<%= eq.id %>'>
<%= render :partial => 'show_multi', :locals => {:exercise_question => eq} %>
</div>
<div id='edit_poll_questions_<%= eq.id %>' style='display: none;'>
<%= render :partial => 'edit_multi', :locals => {:exercise_question => eq} %>
</div>
<% end %>
</div>
<% end %>

View File

@ -0,0 +1,22 @@
<p class="fl task-form-60 mt3 ml15" id="exercise_index_tab">
<a href="<%= exercise_index_path(:course_id => @course.id, :search => @search) %>" class="<%= @type.nil? ? "active" : "" %> edu-filter-cir-grey mr5 font-12 fl" data-remote="true">全部</a>
<% if @is_teacher %>
<a href="<%= exercise_index_path(:course_id => @course.id, :search => @search, :type => 1) %>" class="<%= @type == '1' ? "active" : "" %> edu-filter-cir-grey mr5 font-12 fl" data-remote="true">未发布</a>
<% end %>
<a href="<%= exercise_index_path(:course_id => @course.id, :search => @search, :type => 2) %>" class="<%= @type == '2' ? "active" : "" %> edu-filter-cir-grey mr5 font-12 fl" data-remote="true">提交中</a>
<a href="<%= exercise_index_path(:course_id => @course.id, :search => @search, :type => 3) %>" class="<%= @type == '3' ? "active" : "" %> edu-filter-cir-grey mr5 font-12 fl" data-remote="true">已截止</a>
<!--<a href="javascript:void(0)" class=" edu-filter-cir-grey mr5 font-12 fl" data-remote="true">评阅中</a>-->
<!--<a href="javascript:void(0)" class=" edu-filter-cir-grey mr5 font-12 fl" data-remote="true">已结束</a>-->
</p>
<div id="search_div" class="edu-position fr task-form-30 mr15" style="padding: 0px">
<%= form_tag(exercise_index_path(:course_id => @course.id, :type => @type), :remote => true , :method => 'get', :id => 'exercise_search_form') do %>
<div class="edu-find fr with95 mr20 pr">
<div class="edu-find-input">
<input type="text" class="with100 panel-box-sizing" name="search" placeholder="输入试卷名称进行搜索" value="<%= @search %>" id="exercise_name_search">
<!--<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>-->
<span class="edu-close" onclick="colse_searchbox();" data-tip-down="关闭">×</span>
</div>
<a href="javascript:void(0);" onclick="$('#exercise_search_form').submit();" class="edu-open font-16 color-grey "><i class="fa fa-search"></i></a>
</div>
<% end %>
</div>

View File

@ -0,0 +1,356 @@
<% edit_mode = @is_new && @is_teacher %>
<div id="homework_publish_setting">
<!--发布设置-->
<div>
<div class="<%= edit_mode ? 'none' : '' %>" id="show_exercise_setting">
<div class="bor-bottom-greyE pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt5">发布设置</p>
<% if @is_teacher %>
<a href="javascript:void(0);" class="white-btn orange-btn fr mr15 mt15" title="编辑" onclick="show_ex_edit_setting();">编辑</a>
<% end %>
</div>
<div class="ml30 mr30">
<div class="clearfix">
<ul>
<li class="clearfix mb15 edu-position pl30">
<label class="panel-form-label fl mr10">发布时间</label>
<input type="text" class="disabled-bg fl task-form-15 task-height-40 panel-box-sizing" value="<%= format_time @exercise.publish_time %>" disabled>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px; width:405px;">
<em></em>
<span></span>
<p>发布之前,学生不会收到试卷</p>
</div>
</li>
<li class="clearfix mb15 edu-position pl30">
<label class=" panel-form-label fl mr10">截止时间</label>
<input type="text" class="disabled-bg fl task-form-15 task-height-40 panel-box-sizing" id="show_end_time" value="<%= format_time @exercise.end_time %>" disabled>
<div class="cl"></div>
</li>
<!--<li class="clearfix mb15 edu-position pl30">-->
<!--<label class=" panel-form-label fl mr10">结束时间</label>-->
<!--<input type="text" class="disabled-bg fl task-form-15 task-height-40 panel-box-sizing" id="show_archive_time" value="" disabled="">-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>结束之后,系统自动归档试卷</p>-->
<!--</div>-->
<!--</li>-->
</ul>
</div>
</div>
</div>
<div class="bor-bottom-greyE pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt10">答题设置</p>
</div>
<div class="ml30 mr30" style="padding-bottom:20px;">
<div class="clearfix">
<ul>
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">答题时长</label>-->
<!--<input type="text" value="<%#= @exercise.time.to_i == -1 ? '' : @exercise.time %>" disabled class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg">-->
<!--<label class="fl mt8 ml5">分钟</label>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>答题时长不填写,则表示不限时长</p>-->
<!--<p>学生答题时间即使没有超过答题时长的限制</p>-->
<!--<p>但是已到截止时间点,则系统自动为正在答题的学生提交试卷</p>-->
<!--</div>-->
<!--</li>-->
<li class="clearfix mb20 edu-position pl30">
<label class="panel-form-label fl mr10">答题显示</label>
<input class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_1" disabled type="checkbox" <%= @exercise.question_random == 1 ? 'checked' : '' %>>
<label class="fl" for="dt_1">题目顺序随机打乱</label>
<span class="fl color-grey mt5">(选中则学生答题时,题目顺序按照题型随机显示)</span>
<div class="cl"></div>
<input class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_2" disabled type="checkbox" <%= @exercise.choice_random == 1 ? 'checked' : '' %>>
<label class="fl" for="dt_2" style="margin-left: 11%;">选项顺序随机打乱</label>
<span class="fl color-grey mt5">(选中则学生答题时,选项顺序随机显示)</span>
</li>
</ul>
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">补交答题</label>-->
<!--<input id="edit_allow_late_1" disabled="" class="magic-radio fl" type="radio" name="homework_allow_late" value="1">-->
<!--<label for="edit_allow_late_1" class="fl mr30">允许</label>-->
<!--<input id="edit_allow_late_0" disabled="" class="magic-radio fl" type="radio" name="homework_allow_late" value="0" checked="">-->
<!--<label for="edit_allow_late_0" class="fl">禁止</label>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>允许补交,则在补交截止日期之前,未答题的学生可以补交答题</p>-->
<!--<p>但是在发布截止日期~补交截止时间内才答题的学生,将被扣迟交分</p>-->
<!--</div>-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">截止时间</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg" disabled="" placeholder="5">-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">迟交扣分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg" disabled="" placeholder="5">-->
<!--</li>-->
<!--</ul>-->
</div>
</div>
</div>
<div class="bor-bottom-greyE pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt10">公开设置</p>
</div>
<div class="ml30 mr30 mb15">
<div class="clearfix">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input class="magic-checkbox fl mt5 magic-checkbox_show" type="checkbox" disabled <%= @exercise.score_open ? 'checked' : '' %>>
<label class="fl">公开成绩</label>
<span class="fl color-grey">(选中则在截止时间之后对班级学生公开所有成员的成绩,否则不公开)</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input class="magic-checkbox fl mt5 magic-checkbox_show" type="checkbox" disabled <%= @exercise.answer_open ? 'checked' : '' %>>
<label class="fl">公开答案</label>
<span class="fl color-grey">(选中则在截止时间之后对班级学生公开试卷题目的答案,否则不公开)</span>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="<%= edit_mode ? '' : 'none' %>" id="edit_exercise_setting">
<%= form_tag(ex_setting_exercise_path(@exercise), :method => "post", :id => 'exercise_setting_form') do |f| %>
<div class="bor-bottom-greyE pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt5">发布设置</p>
</div>
<div class="ml30 mr30">
<div class="clearfix">
<ul>
<li class="clearfix mb15 edu-position pl30">
<label class="panel-form-label fl mr10">发布时间</label>
<input type="text" name="exercise_publish_time" readonly value="<%= format_time @exercise.publish_time %>" <%= @exercise.try(:exercise_status) > 1 ? 'disabled' : '' %> class="fl task-form-15 task-height-40 panel-box-sizing <%= @exercise.try(:exercise_status) > 1 ? 'disabled-bg' : '' %>" placeholder="请选择发布时间">
<span class="color-orange fl ml20 mt5 none" id="exercise_publish_time_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px; width:405px;">
<em></em>
<span></span>
<p>发布之前,学生不会收到试卷</p>
</div>
</li>
<li class="clearfix mb15 edu-position pl30">
<label class="panel-form-label fl mr10">截止时间</label>
<input type="text" name="exercise_end_time" readonly value="<%= format_time @exercise.end_time %>" <%= @exercise.try(:exercise_status) == 3 ? 'disabled' : '' %> class="fl task-form-15 task-height-40 panel-box-sizing <%= @exercise.try(:exercise_status) == 3 ? 'disabled-bg' : '' %>" placeholder="请选择截止时间">
<span class="color-orange fl ml20 mt5 none" id="exercise_end_time_notice">
<i class="fa fa-exclamation-circle mr5 color-orange"></i>
</span>
<span class="color-orange fl mt5 none">不能早于发布时间</span>
</li>
<!--<li class="clearfix mb15 edu-position pl30">-->
<!--<label class=" panel-form-label fl mr10">结束时间</label>-->
<!--<input type="text" name="homework_archive_time" readonly="" value="" class=" fl task-form-15 task-height-40 panel-box-sizing" placeholder="请选择结束时间">-->
<!--<span class="color-orange fl ml20 mt5 none" id="homework_archive_time_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>结束之后,系统自动归档试卷</p>-->
<!--</div>-->
<!--</li>-->
</ul>
</div>
</div>
</div>
<div class="bor-bottom-greyE pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt10">答题设置</p>
</div>
<div class="ml30 mr30" style="padding-bottom:20px;">
<div class="clearfix">
<ul>
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">答题时长</label>-->
<!--<input type="text" name="time" <%#= @exercise.try(:exercise_status) == 3 ? 'disabled' : '' %> value="<%#= @exercise.time.to_i == -1 ? '' : @exercise.time %>" class="fl task-form-15 task-height-40 panel-box-sizing">-->
<!--<label class="fl mt8 ml5">分钟</label>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>答题时长不填写,则表示不限时长</p>-->
<!--<p>学生答题时间即使没有超过答题时长的限制</p>-->
<!--<p>但是已到截止时间点,则系统自动为正在答题的学生提交试卷</p>-->
<!--</div>-->
<!--</li>-->
<li class="clearfix mb20 edu-position pl30">
<label class="panel-form-label fl mr10">答题显示</label>
<input name="question_random" <%= @exercise.try(:exercise_status) == 3 ? 'disabled' : '' %> class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_3" type="checkbox" <%= @exercise.question_random == 1 ? 'checked' : '' %>>
<label class="fl" for="dt_3">题目顺序随机打乱</label>
<span class="fl color-grey mt5">(选中则学生答题时,题目顺序按照题型随机显示)</span>
<div class="cl"></div>
<input name="choice_random" <%= @exercise.try(:exercise_status) == 3 ? 'disabled' : '' %> class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_4" type="checkbox" <%= @exercise.choice_random == 1 ? 'checked' : '' %>>
<label class="fl" for="dt_4" style="margin-left: 11%;">选项顺序随机打乱</label>
<span class="fl color-grey mt5">(选中则学生答题时,选项顺序随机显示)</span>
</li>
</ul>
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">补交答题</label>-->
<!--<input id="edit_allow_late_2" class="magic-radio fl" type="radio" name="homework_allow_late_1" value="1">-->
<!--<label for="edit_allow_late_2" class="fl mr30 mt3">允许</label>-->
<!--<input id="edit_allow_late_3" class="magic-radio fl" type="radio" name="homework_allow_late_1" value="0" checked="">-->
<!--<label for="edit_allow_late_3" class="fl mt3">禁止</label>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>允许补交,则在补交截止日期之前,未答题的学生可以补交答题</p>-->
<!--<p>但是在发布截止日期~补交截止时间内才答题的学生,将被扣迟交分</p>-->
<!--</div>-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">截止时间</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="5">-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">迟交扣分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="5">-->
<!--</li>-->
<!--</ul>-->
</div>
</div>
</div>
<div class="pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt10">公开设置</p>
</div>
<div class="ml30 mr30">
<div class="clearfix">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input name="score_open" class="magic-checkbox fl magic-checkbox_show" type="checkbox" id="public_scroe" <%= @exercise.score_open ? 'checked' : '' %>>
<label class="fl" for="public_scroe" style="top:0px">公开成绩</label>
<span class="fl color-grey">(选中则在截止时间之后对班级学生公开所有成员的成绩,否则不公开)</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input name="answer_open" class="magic-checkbox fl magic-checkbox_show" type="checkbox" id="public_answer" <%= @exercise.answer_open ? 'checked' : '' %>>
<label class="fl" for="public_answer" style="top:0px">公开答案</label>
<span class="fl color-grey">(选中则在截止时间之后对班级学生公开试卷题目的答案,否则不公开)</span>
</li>
</ul>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!--主观题评分设置-->
<!--<div class="bor-bottom-greyE pt10 pb10 pr10">-->
<!--<div class="none" id="show_late_setting">-->
<!--<div class="clearfix mb15">-->
<!--<p class="ml15 fl font-16 mt10">主观题评分设置</p>-->
<!--</div>-->
<!--<div class="ml30 mr30" style="padding-bottom:20px;">-->
<!--<div class="clearfix">-->
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">助教评分</label>-->
<!--<input class="magic-radio fl mt5 magic-checkbox_show" id="zg_1" name="zg[]_1" disabled="" type="radio" checked="">-->
<!--<label class="fl" for="zg_1">普通模式</label>-->
<!--<span class="fl color-grey mt5">(选中则取各助教最终评分的平均分)</span>-->
<!--<div class="cl"></div>-->
<!--<input class="magic-radio fl mt5 magic-checkbox_show" id="zg_2" name="zg[]_1" disabled="" type="radio">-->
<!--<label class="fl" for="zg_2" style="margin-left: 11%;">复审模式</label>-->
<!--<span class="fl color-grey mt5">(选中则只取最终次的助教评分)</span>-->
<!--</li>-->
<!--</ul>-->
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">最终成绩</label>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>计算说明</p>-->
<!--<p class="mb10">教师评分*其百分比+助教评分+其百分比+迟交扣分</p>-->
<!--<p>注意</p>-->
<!--<p>非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到另外</p><p>的评分选项上。例如教师评分60% + 助教评分40% 学生A没有得到</p><p>教师评分则最终成绩将按照助教评分100% 进行计算 </p>-->
<!--</div>-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">教师评分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg" disabled="" placeholder="5">-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">助教评分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg" disabled="" placeholder="5">-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="" id="edit_late_setting">-->
<!--<div class="clearfix mb15">-->
<!--<p class="ml15 fl font-16 mt10">主观题评分设置</p>-->
<!--</div>-->
<!--<div class="ml30 mr30" style="padding-bottom:20px;">-->
<!--<div class="clearfix">-->
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">助教评分</label>-->
<!--<input class="magic-radio fl mt5 magic-checkbox_show" id="zg_3" name="zg[]_2" type="radio" checked="">-->
<!--<label class="fl" for="zg_3">普通模式</label>-->
<!--<span class="fl color-grey mt5">(选中则取各助教最终评分的平均分)</span>-->
<!--<div class="cl"></div>-->
<!--<input class="magic-radio fl mt5 magic-checkbox_show" id="zg_4" name="zg[]_2" type="radio" checked="">-->
<!--<label class="fl" for="zg_4" style="margin-left: 11%;">复审模式</label>-->
<!--<span class="fl color-grey mt5">(选中则只取最终次的助教评分)</span>-->
<!--</li>-->
<!--</ul>-->
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">最终成绩</label>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>计算说明</p>-->
<!--<p class="mb10">教师评分*其百分比+助教评分*其百分比-迟交扣分</p>-->
<!--<p>注意</p>-->
<!--<p>非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到另外</p><p>的评分选项上。例如教师评分60% + 助教评分40% 学生A没有得到</p><p>教师评分则最终成绩将按照助教评分100% 进行计算 </p>-->
<!--</div>-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">教师评分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="5">-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">助教评分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="5">-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="clearfix mt15 mb15 mr15 pr10 <%= edit_mode ? '' : 'none' %>" id="exam_setting_submit_block">
<a href="javascript:void(0);" onclick="ex_setting_form_submit();" class="task-btn task-btn-orange fr">保存</a>
<a href="javascript:void(0);" onclick="s_op_confirm_box('<%= student_exercise_list_exercise_path(@exercise) %>', '修改的内容将全部丢失<br/>是否确认取消保存')" class="task-btn fr mr10">取消</a>
</div>
</div>

View File

@ -3,7 +3,7 @@
$("#RSide").removeAttr("id");
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
$("#Container").css("width","1000px");
var end_time = <%=exercise.end_time.to_i%>;
var end_time = <%=@exercise.end_time.to_i%>;
getTime(end_time);
/*start_time = new Date();
start_time.setFullYear(<%#=exercise_user.start_at.year%>);
@ -42,323 +42,239 @@
//}
}
</script>
<div class="homepageRight mt0 ml10">
<div class="resources">
<div class="testStatus"><!--头部显示 start-->
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
<div id="start_time" style="display: none"><%=exercise_user.start_at %></div>
<div class="fontGrey2">
<span class="mr100">开始时间:<%=Time.parse(h(exercise_user.start_at)).strftime("%Y-%m-%d %H:%M:%S")%></span>
<span class="mr100">截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S")%></span>
<% unless exercise.time == -1 %>
<span class="fr">测验时长:<%=exercise.time %>分钟</span>
<% end %>
<!--
<span class="fr">剩余时长:<span class="c_red" id="rest_hours"></span>&nbsp;小时&nbsp;<span class="c_red" id="rest_minutes"></span>&nbsp;分钟&nbsp;<span class="c_red" id="rest_seconds"></span>&nbsp;秒</span>
-->
</div>
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre>
<div class="cl"></div>
</div>
<% current_score = get_current_score exercise %>
<div id="total_questions_score" style="display: <%= exercise.exercise_questions.count != 0 ? '' : 'none' %>">
<%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => exercise, :current_score => current_score} %>
</div>
<div class="edu-class-container edu-position">
<p class="mb10 font-14">
<i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to @course.name, course_path(@course) %> &gt; <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> &gt; <%= link_to @exercise.exercise_name, student_exercise_list_exercise_path(@exercise) %> &gt; <%= @exercise_user.user.show_real_name %>
</p>
<div class="edu-con-top clearfix user_bg_shadow bor-grey-e mb20">
<p class="ml15 fl color-grey3">
<% unless @exercise.is_public %>
<i class="fa fa-lock color-grey fl mt8 mr15 font-18"></i>
<% end %>
<%= @exercise.exercise_name %>
</p>
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
<% multi_question_list = exercise.exercise_questions.where("question_type=4") %>
<% if exercise.question_random == 1 %>
<% mc_question_list = mc_question_list.shuffle %>
<% mcq_question_list = mcq_question_list.shuffle %>
<% single_question_list = single_question_list.shuffle %>
<% multi_question_list =multi_question_list.shuffle %>
<% end %>
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单选题</h3>
<% mc_question_list.each_with_index do |exercise_question, list_index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mc_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div class="exercise_inputs">
<table class="" style="width:100%;">
<tbody>
<% exercise_choices = exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %>
<% exercise_choices.each_with_index do |exercise_choice,index| %>
<tr>
<td>
<label>
<script>
function click_<%= exercise_choice.id %>(obj)
{
$.ajax({
type: "post",
url: "<%= commit_answer_exercise_path(exercise) %>",
data: {
exercise_choice_id: <%= exercise_choice.id %>,
exercise_question_id: <%= exercise_question.id %>
},
success: function (data) {
var dataObj = eval(data);
if(dataObj.text == "ok")
{
obj.checked = true;
$("#question_answer_span_<%= exercise_question.id %>").addClass("bg_blue");
}
else
{
obj.checked = false;
}
},
error: function () {
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<%= radio_button "exercise",exercise_question.id.to_s+"exercise_choice_id",exercise_choice.id,:class=>"ur_radio",:onclick =>"click_#{exercise_choice.id}(this);return false;",:checked => answer_be_selected?(exercise_choice,User.current),:disabled => !@can_edit_excercise %>
<%= convert_to_char((index+1).to_s)%>&nbsp;&nbsp;<%= exercise_choice.choice_text%>
</label>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多选题</h3>
<% mcq_question_list.each_with_index do |exercise_question,list_index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mcq_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div class="exercise_inputs">
<table class="" style="width:100%;">
<tbody>
<% exercise_choices = exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %>
<% exercise_choices.each_with_index do |exercise_choice,index| %>
<tr>
<td>
<label>
<script>
function click_<%= exercise_choice.id %>(obj)
{
$.ajax({
type: "post",
url: "<%= commit_answer_exercise_path(exercise) %>",
data: {
exercise_choice_id: <%= exercise_choice.id %>,
exercise_question_id: <%= exercise_question.id %>
},
success: function (data) {
var dataObj = eval(data);
if(dataObj.text == "ok")
{
obj.checked = true;
}
else
{
obj.checked = false;
}
if(dataObj.is_answer)
{
$("#question_answer_span_<%= exercise_question.id %>").addClass("bg_blue");
}
else
{
$("#question_answer_span_<%= exercise_question.id %>").removeClass("bg_blue");
}
},
error: function () {
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<input class="ur_radio" type="checkbox" onclick="click_<%= exercise_choice.id %>(this);return false;" <%= answer_be_selected?(exercise_choice,User.current) ? "checked":"" %> <%= @can_edit_excercise?"":"disabled=disabled" %> >
<%= convert_to_char((index+1).to_s)%>&nbsp;&nbsp;<%= exercise_choice.choice_text%>
</label>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div><!--多选题显示 end-->
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">填空题</h3>
<% single_question_list.each_with_index do |exercise_question, list_index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == single_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div>
<script>
function onblur_<%= exercise_question.id %>(obj)
{
$(window).unbind('beforeunload');
$.ajax({
type: "post",
url: "<%= commit_answer_exercise_path(exercise) %>",
data: {
exercise_question_id: <%= exercise_question.id %>,
answer_text: $(obj).val().trim()
},
success: function (data) {
var dataObj = eval(data);
obj.value = dataObj.text;
if(dataObj.text != ""){
$("#question_answer_span_<%= exercise_question.id %>").addClass("bg_blue");
} else{
$("#question_answer_span_<%= exercise_question.id %>").removeClass("bg_blue");
}
},
error: function () {
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %>" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>>
</div>
</div>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">问答题</h3>
<% multi_question_list.each_with_index do |exercise_question, list_index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == multi_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div>
<script>
function onblur_<%= exercise_question.id %>(obj)
{
$(window).unbind('beforeunload');
$.ajax({
type: "post",
url: "<%= commit_answer_exercise_path(exercise) %>",
data: {
exercise_question_id: <%= exercise_question.id %>,
answer_text: $(obj).val().trim()
},
success: function (data) {
var dataObj = eval(data);
obj.text = dataObj.text;
if(dataObj.text != ""){
$("#question_answer_span_<%= exercise_question.id %>").addClass("bg_blue");
} else{
$("#question_answer_span_<%= exercise_question.id %>").removeClass("bg_blue");
}
},
error: function () {
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<textarea style="width: 693px; height: 90px; line-height: 30px; border: 1px solid #CBCBCB;" name="exercise_choice" placeholder="在此填入答案" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>><%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %></textarea>
</div>
</div>
</div>
</div>
<% end %>
</div>
<div class="testStatus">
<p class="f14 fontGrey3">答题情况</p>
<div class="mt5">
<span class="f14 mr10 fl">单选题:</span>
<% mc_question_list.each_with_index do |exercise_question, list_index| %>
<span id="question_answer_span_<%= exercise_question.id %>" class="fl mr10 question_answer_span <%= User.current.exercise_answer.where(:exercise_question_id => exercise_question.id).count > 0 ? 'bg_blue' : '' %>"><%= list_index + 1 %></span>
<% end %>
<div class="cl"></div>
</div>
<div class="mt5">
<span class="f14 mr10 fl">多选题:</span>
<% mcq_question_list.each_with_index do |exercise_question, list_index| %>
<span id="question_answer_span_<%= exercise_question.id %>" class="fl mr10 question_answer_span <%= User.current.exercise_answer.where(:exercise_question_id => exercise_question.id).count > 0 ? 'bg_blue' : '' %>"><%= list_index + 1 %></span>
<% end %>
<div class="cl"></div>
</div>
<div class="mt5">
<span class="f14 mr10 fl">填空题:</span>
<% single_question_list.each_with_index do |exercise_question, list_index| %>
<span id="question_answer_span_<%= exercise_question.id %>" class="fl mr10 question_answer_span <%= User.current.exercise_answer.where(:exercise_question_id => exercise_question.id).count > 0 ? 'bg_blue' : '' %>"><%= list_index + 1 %></span>
<% end %>
<div class="cl"></div>
</div>
<div class="mt5">
<span class="f14 mr10 fl">问答题:</span>
<% multi_question_list.each_with_index do |exercise_question, list_index| %>
<span id="question_answer_span_<%= exercise_question.id %>" class="fl mr10 question_answer_span <%= User.current.exercise_answer.where(:exercise_question_id => exercise_question.id).count > 0 ? 'bg_blue' : '' %>"><%= list_index + 1 %></span>
<% end %>
<div class="cl"></div>
</div>
</div>
<div class="ur_buttons">
<a href="javascript:void(0)" onclick="commit_exercise_f();" class="btn_blue_64_width" style="margin-left:105px;">马上提交</a>
</div>
<div class="cl"></div>
<!--contentbox end-->
<span class="fr mr15 mt3 color-grey"><%= format_time @exercise_user.start_at %> 开始答题</span>
</div>
<!--RSide end-->
<% if !@exercise.try(:exercise_description).nil? && @exercise.try(:exercise_description) != "" %>
<div class="edu-con-top font-14 color-grey clearfix user_bg_shadow bor-grey-e mb20">
<pre class="exercise_que_title pl15 pr15"><%= @exercise.try(:exercise_description).html_safe%></pre>
</div>
<% end %>
<div id="total_questions_score">
<%= render :partial => "exercise/total_questions_score" %>
</div>
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20">
<div class="clearfix pl15">
<span class="checkstatus_box_small post_btn_white mt10" style="border: 1px solid #CCCCCC;"></span><span class="fl mr20 font-12 mt3">已答</span>
<span class="checkstatus_box_small post_btn_grey mt10"></span><span class="fl mr20 font-12 mt3">未答</span>
</div>
<% if @exercise.question_random == 1 %>
<% question_list = @exercise.exercise_questions.shuffle %>
<% else %>
<% question_list = @exercise.exercise_questions %>
<% end %>
<div class="clearfix ml15 mt10 mb15">
<% question_list.each_with_index do |eq, index| %>
<a href="#mao<%= index + 1 %>" style="cursor:pointer" id="ex_commit_status_<%= eq.id %>" class="checkstatus_box_big <%= User.current.exercise_answer.where(:exercise_question_id => eq.id).count > 0 ? 'post_btn_white' : 'post_btn_grey' %>"><%= index + 1 %></a>
<% end %>
</div>
</div>
<div class="clearfix">
<% question_list.each_with_index do |exercise_question, i| %>
<div class="question_item_con font-14 user_bg_shadow bor-grey-e mb20 pt15">
<div class="clearfix pl15 pr15">
<p class="fl font-15" id="mao<%=i+1 %>">第<%= i + 1 %>题:<span class="color-orange03 ml10">[<%= exercise_question.question_type_name %>]</span><span class="ml10"><%= exercise_question.question_score %></span>分</p>
</div>
<div class="pl15 pr15 justify"><%= exercise_question.question_title.html_safe %></div>
<% case exercise_question.question_type %>
<% when 1 %>
<div class="pl15 pr15 mb15">
<% exercise_choices = @exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %>
<% exercise_choices.each_with_index do |exercise_choice,index| %>
<li class="clearfix">
<script>
function click_<%= exercise_choice.id %>(obj)
{
$.ajax({
type: "post",
url: "<%= commit_answer_exercise_path(@exercise) %>",
data: {
exercise_choice_id: <%= exercise_choice.id %>,
exercise_question_id: <%= exercise_question.id %>
},
success: function (data) {
var dataObj = eval(data);
if(dataObj.text == "ok")
{
obj.checked = true;
$("#ex_commit_status_<%= exercise_question.id %>").removeClass("post_btn_grey").addClass("post_btn_white");
}
else
{
obj.checked = false;
}
},
error: function () {
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<input name="exercise_choice_<%= exercise_question.id %>" class="magic-radio fl mt5 magic-checkbox_show" id="exercise_<%= exercise_choice.id %>_exercise_choice_id" onclick="click_<%= exercise_choice.id %>(this);return false;" type="radio" <%= !@can_edit_excercise ? "disabled" : "" %> <%= answer_be_selected?(exercise_choice,User.current) ? "checked" : "" %>>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id"><%= convert_to_char((index+1).to_s)%>&nbsp;&nbsp;<%= exercise_choice.choice_text%></label>
</li>
<% end %>
</div>
<% when 2 %>
<div class="pl15 pr15 mb15">
<% exercise_choices = @exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %>
<% exercise_choices.each_with_index do |exercise_choice,index| %>
<li class="clearfix">
<script>
function click_<%= exercise_choice.id %>(obj)
{
$.ajax({
type: "post",
url: "<%= commit_answer_exercise_path(@exercise) %>",
data: {
exercise_choice_id: <%= exercise_choice.id %>,
exercise_question_id: <%= exercise_question.id %>
},
success: function (data) {
var dataObj = eval(data);
if(dataObj.text == "ok")
{
obj.checked = true;
}
else
{
obj.checked = false;
}
if(dataObj.is_answer)
{
$("#ex_commit_status_<%= exercise_question.id %>").removeClass("post_btn_grey").addClass("post_btn_white");
}
else
{
$("#ex_commit_status_<%= exercise_question.id %>").removeClass("post_btn_white").addClass("post_btn_grey");
}
},
error: function () {
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<input name="exercise_choice_<%= exercise_question.id %>" class="magic-checkbox fl mt5 magic-checkbox_show" id="exercise_<%= exercise_choice.id %>_exercise_choice_id" onclick="click_<%= exercise_choice.id %>(this);return false;" type="checkbox" <%= !@can_edit_excercise ? "disabled" : "" %> <%= answer_be_selected?(exercise_choice,User.current) ? "checked" : "" %>>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id"><%= convert_to_char((index+1).to_s)%>&nbsp;&nbsp;<%= exercise_choice.choice_text%></label>
</li>
<% end %>
</div>
<% when 3 %>
<div class="ml15 mr15 mb15 mt10">
<script>
function onblur_<%= exercise_question.id %>(obj)
{
$(window).unbind('beforeunload');
$.ajax({
type: "post",
url: "<%= commit_answer_exercise_path(@exercise) %>",
data: {
exercise_question_id: <%= exercise_question.id %>,
answer_text: $(obj).val().trim()
},
success: function (data) {
var dataObj = eval(data);
obj.value = dataObj.text;
if(dataObj.text != ""){
$("#ex_commit_status_<%= exercise_question.id %>").removeClass("post_btn_grey").addClass("post_btn_white");
} else{
$("#ex_commit_status_<%= exercise_question.id %>").removeClass("post_btn_white").addClass("post_btn_grey");
}
},
error: function () {
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<textarea placeholder="在此填入答案" class="pl15 task-height-40 with100" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>><%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %></textarea>
</div>
<% when 4 %>
<div class="ml15 mr15 mb15 mt10">
<script>
function onblur_<%= exercise_question.id %>(obj)
{
$(window).unbind('beforeunload');
$.ajax({
type: "post",
url: "<%= commit_answer_exercise_path(@exercise) %>",
data: {
exercise_question_id: <%= exercise_question.id %>,
answer_text: $(obj).val().trim()
},
success: function (data) {
var dataObj = eval(data);
obj.text = dataObj.text;
if(dataObj.text != ""){
$("#ex_commit_status_<%= exercise_question.id %>").removeClass("post_btn_grey").addClass("post_btn_white");
} else{
$("#ex_commit_status_<%= exercise_question.id %>").removeClass("post_btn_white").addClass("post_btn_grey");
}
},
error: function () {
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<textarea class="task-height-150 with100 pl15" name="exercise_choice" placeholder="在此填入答案" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>><%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %></textarea>
</div>
<% end %>
</div>
<% end %>
</div>
<% if @can_edit_excercise %>
<div class="">
<p class="fr mb20">
<a href="javascript:void(0)" style="width: 50px;" onclick="commit_exercise_f();" class="task-btn task-btn-orange">交卷</a>
</p>
</div>
<% end %>
</div>
<script>
function commit_exercise_f(){
var str = "";
$.ajax({
type: "get",
url: "<%= get_student_uncomplete_question_exercise_path(exercise) %>",
url: "<%= get_student_uncomplete_question_exercise_path(@exercise) %>",
data: {},
success: function (data) {
var dataObj = eval(data);
if(dataObj.time_limit){
if(dataObj.uncomplete_count == 0){
str = "截止日期前您还可以继续答题<br/>是否确定提交";
str = "你是否确认提交?<br/>提交确定后将无法再修改答题";
} else{
str = "您还有 " + dataObj.uncomplete_count + " 题没有完成,截止日期前您还可以继续答题<br/>是否确定提交";
str = "你是否确认提交?<br/>还有 " + dataObj.uncomplete_count + " 题未答,提交确定后将无法再修改答题<br/>";
}
} else{
if(dataObj.uncomplete_count == 0){
str = "提交后将不能继续答题<br/>是否确定提交";
str = "你是否确认提交?<br/>提交确定后将无法再修改答题";
} else{
str = "您还有 " + dataObj.uncomplete_count + " 题没有完成,提交后将不能继续答题<br/>是否确定提交";
str = "你是否确认提交?<br/>还有 " + dataObj.uncomplete_count + " 题未答,提交确定后将无法再修改答题<br/>";
}
}
var htmlvalue = '<div id="muban_popup_box" style="width:380px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14 fontGrey7">' + str + '</p><div class="cl"></div><a href="<%= commit_exercise_exercise_path(exercise) %>" class="fr sy_btn_blue mt20" data-remote="true" style="margin-right: 132px;">确定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt20 mr10" onclick="hideModal();">取消</a></div></div>';
pop_box_new(htmlvalue, 380, 140);
delete_confirm_box('<%= commit_exercise_exercise_path(@exercise) %>', str);
},
error: function () {
long_notice_box("网络异常,提交失败,请确认网络正常连接后再提交。");

View File

@ -1,256 +1,197 @@
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
$("#Container").css("width","1000px");
});
</script>
<div class="homepageRight mt0 ml10">
<div class="resources">
<div class="testStatus"><!--头部显示 start-->
<h1 class="ur_page_title text_c" id="polls_name_h"><%= exercise.exercise_name%></h1>
<div class="fontGrey2">
<span class="mr100">开始时间:<%=Time.parse(h(exercise_user.start_at)).strftime("%Y-%m-%d %H:%M:%S") %></span>
<span class="mr100">截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S")%></span>
<% unless exercise.time == -1 %>
<span class="fr">测验时长:<%=exercise.time %>分钟</span>
<style>
.ui-slider {
position: relative;
width: 100px;
float: left;
margin-right: 20px;
margin-left: 7px;
height: 14px;
margin-top: 12px;
background: #e2e2e2;}
</style>
<div class="edu-class-container edu-position">
<p class="mb10 font-14">
<i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to @course.name, course_path(@course) %> &gt; <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> &gt; <%= link_to @exercise.exercise_name, student_exercise_list_exercise_path(@exercise) %> &gt; <%= @exercise_user.user.show_real_name %>
</p>
<div class="edu-con-top clearfix user_bg_shadow bor-grey-e mb20">
<p class="ml15 fl color-grey3">
<% unless @exercise.is_public %>
<i class="fa fa-lock color-grey fl mt8 mr15 font-18"></i>
<% end %>
<%= @exercise.exercise_name %>
</p>
<%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %>
</div>
<% if !@exercise.try(:exercise_description).nil? && @exercise.try(:exercise_description) != "" %>
<div class="edu-con-top font-14 color-grey clearfix user_bg_shadow bor-grey-e mb20">
<pre class="exercise_que_title pl15 pr15"><%= @exercise.try(:exercise_description).html_safe%></pre>
</div>
<% end %>
<div id="total_questions_score">
<%= render :partial => "exercise/total_questions_score" %>
</div>
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20">
<div class="clearfix">
<span class="fl ml15 mr20 font-15">客观题</span>
<span class="checkstatus_box_small post_btn_green mt10"></span><span class="fl mr20 font-12 mt3">正确</span>
<span class="checkstatus_box_small post_btn_red mt10"></span><span class="fl font-12 mt3">错误</span>
<p class="mr15 mt3 fr color-grey font-14">总分:<span class="color-light-green" id="exercise_user_score"><%= @exercise_user.score.nil? ? "--" : format("%.1f",@exercise_user.score)%></span>分</p>
</div>
<div class="clearfix ml80 mt10 mb5">
<% @exercise.exercise_questions.where(:question_type => [1, 2, 3]).each_with_index do |eq, index| %>
<% is_correct = answer_is_correct(eq, user) %>
<a href="#mao<%= eq.question_number%>" style="cursor:pointer" class="checkstatus_box_big color_white <%= is_correct ? 'post_btn_green' : 'post_btn_red' %>"><%= eq.question_number %></a>
<% end %>
</div>
<div class="clearfix">
<span class="fl ml15 mr20 font-15">主观题</span>
<span class="checkstatus_box_small post_btn_white mt10" style="border: 1px solid #CCCCCC;"></span><span class="fl mr20 font-12 mt3">已评</span>
<span class="checkstatus_box_small post_btn_grey mt10"></span><span class="fl font-12 mt3">未评</span>
</div>
<div class="clearfix ml80 mt10 mb15">
<% @exercise.exercise_questions.where(:question_type => 4).each_with_index do |eq, index| %>
<% ea = User.current.exercise_answer.where(:exercise_question_id => eq.id).first %>
<a href="#mao<%= eq.question_number%>" style="cursor:pointer" id="ex_comment_status_<%= eq.id %>" class="checkstatus_box_big <%= (ea && ea.score != -1) ? 'post_btn_white' : 'post_btn_grey' %>"><%= eq.question_number %></a>
<% end %>
</div>
</div>
<div class="clearfix">
<% @exercise.exercise_questions.each_with_index do |exercise_question, i| %>
<div class="question_item_con font-14 user_bg_shadow bor-grey-e mb20 pt15">
<div class="clearfix pl15 pr15">
<p class="fl font-15" id="mao<%= exercise_question.question_number %>">第<%= exercise_question.question_number %>题:<span class="color-orange03 ml10">[<%= exercise_question.question_type_name %>]</span><span class="ml10"><%= exercise_question.question_score %>分</span><span class="ml10 color-red"><%= question_commit_status exercise_question, @exercise_user.user %></span></p>
<% if exercise_question.question_type != 4 %>
<% is_correct = answer_is_correct(exercise_question, user) %>
<p class="fr"><span class="<%= is_correct ? 'color-light-green' : 'color-red' %> mr3"><i class="mr5 fa <%= is_correct ? 'fa-check' : 'fa-close' %> font-14"></i><%= is_correct ? exercise_question.question_score : 0 %></span>分</p>
<% else %>
<% answer = get_user_answer(exercise_question, user)%>
<p class="fr" id="multi_q_score_<%= exercise_question.id %>"><span class="<%= answer.empty? ? 'color-red' : (answer.first.score == -1 || answer.first.score == 0 ? "color-red" : "color-light-green") %> mr3"><%= answer.empty? ? 0 : (answer.first.score == -1 ? "未批" : answer.first.score) %></span><%= answer.empty? ? "分" : (answer.first.score == -1 ? "" : "分") %></p>
<% end %>
<%# time = exercise_user.end_at - exercise_user.start_at %>
</div>
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre>
<div class="cl"></div>
</div>
<div>
<div class="fl mb5">得分:<span class="c_red" id="exercise_user_score"><%=exercise_user.score %></span>分</div>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,exercise.course) || (exercise.exercise_status == 3 && exercise.show_result == 1) %>
<%= link_to '返回统计结果>>',student_exercise_list_exercise_path(exercise.id,:course_id => exercise.course.id) , :class => "fr linkBlue" %>
<% end %>
</div>
<div class="cl"></div>
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
<% multi_question_list = exercise.exercise_questions.where("question_type=4") %>
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单选题</h3>
<% mc_question_list.each_with_index do |exercise_question, list_index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mc_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
<div>
<span class="fl lh27">第<%= exercise_question.question_number%>题.&nbsp;&nbsp;<%= exercise_question.question_score %>分&nbsp;&nbsp;
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
<div class="fr" id="menu_div_<%= exercise_question.id %>">
<% answer = get_user_answer(exercise_question, user)%>
<% standard_answer = get_user_standard_answer(exercise_question, user)%>
<% is_correct = !answer.empty? && !standard_answer.empty? && answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id %>
<div class="fr">
得分:<div class="c_red fr mr10 ml10"><%= is_correct ? exercise_question.question_score : 0 %></div>
</div>
<span class="fr mt-4 f16 mr20"><i class="<%= is_correct ? 'icon-ok c_green' : 'icon-remove c_red' %>"></i></span>
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
</div>
<div class="cl"></div>
<div class="exercise_inputs">
<table class="" style="width:100%;">
<tbody>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<tr>
<td>
<label>
<%= radio_button "exercise",exercise_question.id.to_s+"exercise_choice_id",exercise_choice.id,:class=>"ur_radio",:checked => answer_be_selected?(exercise_choice,user),:disabled => !@can_edit_excercise %>
<%= convert_to_char((index+1).to_s)%>&nbsp;&nbsp;<%= exercise_choice.choice_text%>
</label>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="pl15 pr15 justify"><%= exercise_question.question_title.html_safe %></div>
<% case exercise_question.question_type %>
<% when 1 %>
<div class="pl15 pr15 mb15">
<% exercise_choices = exercise_question.exercise_choices.reorder("choice_position") %>
<% exercise_choices.each_with_index do |exercise_choice,index| %>
<li class="clearfix">
<input name="exercise_choice_<%= exercise_question.id %>" class="magic-radio fl mt5 magic-checkbox_show" id="exercise_<%= exercise_choice.id %>_exercise_choice_id" type="radio" disabled <%= answer_be_selected?(exercise_choice,user) ? "checked" : "" %>>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id"><%= convert_to_char((index+1).to_s)%>&nbsp;&nbsp;<%= exercise_choice.choice_text%></label>
</li>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多选题</h3>
<% mcq_question_list.each_with_index do |exercise_question, list_index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mcq_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
<div>
<span class="fl lh27">第<%= exercise_question.question_number%>题.&nbsp;&nbsp;<%= exercise_question.question_score %>分&nbsp;&nbsp;
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
<div class="fr" id="menu_div_<%= exercise_question.id %>">
<% answer = get_user_answer(exercise_question, user)%>
<% standard_answer = get_user_standard_answer(exercise_question, user)%>
<% is_correct = !standard_answer.empty? && get_mulscore(exercise_question, user).to_i == standard_answer.first.exercise_choice_id %>
<div class="fr">
得分:<div class="c_red fr mr10 ml10"><%= is_correct ? exercise_question.question_score : 0 %></div>
</div>
<span class="fr mt-4 f16 mr20"><i class="<%= is_correct ? 'icon-ok c_green' : 'icon-remove c_red' %>"></i></span>
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<% if @is_teacher || @exercise.answer_open %>
<div class="pl15 pr15 pt10 pb10 bor-top-greyE">
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
</div>
<div class="cl"></div>
<div class="exercise_inputs">
<table class="" style="width:100%;">
<tbody>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<tr>
<td>
<label>
<input class="ur_radio" type="checkbox" <%= answer_be_selected?(exercise_choice,user) ? "checked":"" %> <%= @can_edit_excercise?"":"disabled=disabled" %> >
<%= convert_to_char((index+1).to_s)%>&nbsp;&nbsp;<%= exercise_choice.choice_text%>
</label>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div><!--多选题显示 end-->
<% end %>
<% when 2 %>
<div class="pl15 pr15 mb15">
<% exercise_choices = exercise_question.exercise_choices.reorder("choice_position") %>
<% exercise_choices.each_with_index do |exercise_choice,index| %>
<li class="clearfix">
<input name="exercise_choice_<%= exercise_question.id %>" class="magic-checkbox fl mt5 magic-checkbox_show" id="exercise_<%= exercise_choice.id %>_exercise_choice_id" type="checkbox" disabled <%= answer_be_selected?(exercise_choice,user) ? "checked" : "" %>>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id"><%= convert_to_char((index+1).to_s)%>&nbsp;&nbsp;<%= exercise_choice.choice_text%></label>
</li>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">填空题</h3>
<% single_question_list.each_with_index do |exercise_question,list_index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == single_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
<div>
<span class="fl lh27">第<%= exercise_question.question_number%>题.&nbsp;&nbsp;<%= exercise_question.question_score %>分</span>
<div class="fr" id="menu_div_<%= exercise_question.id %>">
<% answer = get_user_answer(exercise_question, user)%>
<% standard_answer = get_user_standard_answer(exercise_question, user)%>
<% is_correct = !answer.empty? && !standard_answer.empty? && standard_answer.include?(answer.first.answer_text) %>
<div class="fr">
得分:<div class="c_red fr mr10 ml10"><%= is_correct ? exercise_question.question_score : 0 %></div>
</div>
<span class="fr mt-4 f16 mr20"><i class="<%= is_correct ? 'icon-ok c_green' : 'icon-remove c_red' %>"></i></span>
</div>
<div class="cl"></div>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
<% if @is_teacher || @exercise.answer_open %>
<div class=" pl15 pr15 pt10 pb10 bor-top-greyE">
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
</div>
<div class="cl"></div>
<div class="mb10">
<% end %>
<% when 3 %>
<% unless get_anwser_vote_text(exercise_question.id,user.id) == "" %>
<pre class="exercise_que_title pl15 write_answer"><%= get_anwser_vote_text(exercise_question.id,user.id).html_safe %></pre>
<% end %>
<% if @is_teacher || @exercise.answer_open %>
<div class=" pl15 pr15 pt10 pb10 bor-top-greyE">
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
参考答案<%= convert_to_chi_num(index+1) %><%= exercise_choice.answer_text%><br />
<p>候选答案<%= convert_to_chi_num(index+1) %><%= exercise_choice.answer_text%></p>
<% end %>
</div>
<div>
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,user.id).html_safe %>" <%= @can_edit_excercise?"":"disabled=disabled" %>>
<% end %>
<% when 4 %>
<% unless get_anwser_vote_text(exercise_question.id,user.id) == "" %>
<pre class="exercise_que_title pl15 write_answer"><%= get_anwser_vote_text(exercise_question.id,user.id).html_safe %></pre>
<% end %>
<% if exercise_question.exercise_standard_answers.count > 0 && (@is_teacher || @exercise.answer_open) %>
<div class="clearfix bor-top-greyE">
<a href="javascript:void(0)" class="fr color-orange05 mb5 mr15 hide_answer">隐藏参考答案</a>
</div>
</div>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">问答题</h3>
<% multi_question_list.each_with_index do |exercise_question, list_index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == multi_question_list.count ? '' : 'border_b' %>">
<div>
<div class="exercise_title">
<div>
<span class="fl lh27">第<%= exercise_question.question_number%>题.&nbsp;&nbsp;<%= exercise_question.question_score %>分</span>
<div class="fr" id="menu_div_<%= exercise_question.id %>">
<% answer = get_user_answer(exercise_question, user)%>
<div class="fr">
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,exercise.course) %>
得分:
<% if answer.empty? %>
<div id="exercise_question_score_<%= exercise_question.id %>" title="未答题系统自动打0分" class="c_red fr mr10 ml10">
0
</div>
<% else %>
<div id="exercise_question_score_<%= exercise_question.id %>" title="双击批阅" ondblclick="edit_question_score('<%= exercise_question.id %>', <%= exercise_question.question_score %>, <%= exercise_user.user_id %>)" class="c_red fr mr10 ml10">
<%= answer.first.score == -1 ? "双击批阅" : answer.first.score %>
</div>
<% end %>
<% else %>
得分:<div class="c_red fr mr10 ml10"><%= answer.empty? ? 0 : (answer.first.score == -1 ? "未批" : answer.first.score) %></div>
<% end %>
</div>
</div>
<div class="cl"></div>
<div class="clearfix bor-top-greyE padding15 answer_con">
<p>参考答案</p>
<pre class="exercise_que_title"><%= exercise_question.exercise_standard_answers.first.answer_text%></pre>
</div>
<% end %>
<% if !answer.empty? && @is_teacher %>
<div class="clearfix padding15 bor-top-greyE">
<div class="with85 fl">
<label class="fl color-grey mt5"> 评分&nbsp;&nbsp;</label>
<input type="number" class="fl task-form-10 task-height-40 panel-box-sizing" name="score" id="multi_score_<%= exercise_question.id %>" value="<%= answer.first.score %>" min="-1" max="<%= exercise_question.question_score %>" size="4" data-units="dollars" />
<span class="ml5 fl mt5">分</span>
<span id="score_notice_span_<%= exercise_question.id %>" class="ml5 fl mt5 color-red" style="display: none;">未评分</span>
</div>
<div class="with15 fr mt10">
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" onclick="save_multi_score(<%= exercise_question.id %>, <%= exercise_question.question_score %>, <%= @exercise_user.user_id %>)">保存</a>
</div>
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
</div>
<div class="cl"></div>
<% if exercise_question.exercise_standard_answers.count > 0 %>
<div class="mb10">
参考答案:<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise_question.exercise_standard_answers.first.answer_text%></pre>
</div>
<% end %>
<div>
<textarea style="width: 693px; height: 90px; line-height: 30px; border: 1px solid #CBCBCB; color: #888888;" name="exercise_choice" placeholder="在此填入答案" <%= @can_edit_excercise?"":"disabled=disabled" %>><%= get_anwser_vote_text(exercise_question.id,exercise_user.user_id).html_safe %></textarea>
</div>
</div>
</div>
</div>
<% end %>
</div>
<div class="cl"></div>
<!--contentbox end-->
</div>
<!--RSide end-->
<% end %>
<% end %>
</div>
<% end %>
</div>
</div>
<script>
// 在线测验的主观题打分
function edit_question_score(id, score, user_id){
$("#exercise_question_score_"+id).html("<input type='text' id='edit_score_input' onblur='edit_question_score_submit(this, "+ id +", "+ score +", "+ user_id +")' class='score_input' placeholder='0-"+ score +"'></input>");
}
function edit_question_score_submit(obj, id, score, user_id){
$.ajax({
type: "post",
url: "<%= edit_question_score_exercise_path(exercise) %>",
data: {
exercise_question_id: id,
user_id: user_id,
score: $(obj).val().trim()
},
success: function (data) {
var dataObj = eval(data);
if(dataObj.status == 2){
$("#ajax_notice_p").html("请输入0-"+score);
$("#ajax-notice").css('top', $(window).scrollTop()+200);
$("#ajax-notice").show();
} else if(dataObj.status == 1){
$("#exercise_question_score_"+id).html(dataObj.score);
$("#exercise_user_score").html(dataObj.total_score);
$("#ajax_notice_p").html("分数已保存");
$("#ajax-notice").css('top', $(window).scrollTop()+200);
$("#ajax-notice").show();
}
setTimeout(function(){
$("#ajax-notice").hide();
},2000);
},
error: function () {
long_notice_box("网路异常,请重新批阅。");
}
$(function(){
$(".hide_answer").live("click",function(){
$(this).parent().siblings(".answer_con").slideToggle(500);
});
$('input[name="score"]').peSlider({range: 'min'});
});
// 在线测验的主观题打分
function save_multi_score(id, score, user_id){
if($("#multi_score_"+id).val().trim() == "" || $("#multi_score_"+id).val().trim() == "-1"){
$("#score_notice_span_"+id).html("请输入0-"+score+"之间的数值");
} else{
$.ajax({
type: "post",
url: "<%= edit_question_score_exercise_path(@exercise) %>",
data: {
exercise_question_id: id,
user_id: user_id,
score: $("#multi_score_"+id).val().trim()
},
success: function (data) {
var dataObj = eval(data);
if(dataObj.status == 2){
$("#score_notice_span_"+id).html("请输入0-"+score+"之间的数值");
} else if(dataObj.status == 1){
var spn_class = dataObj.score == 0 ? 'color-red' : 'color-light-green'
$("#multi_q_score_"+id).html("<span class='" + spn_class + " mr3'>"+dataObj.score+ "</span>分");
$("#exercise_user_score").html(dataObj.total_score);
$("#ex_comment_status_"+id).removeClass("post_btn_grey").addClass("post_btn_white");
$("#ajax_notice_p").html("分数已保存");
$("#ajax-notice").css('top', $(window).scrollTop()+400);
$("#ajax-notice").show();
}
setTimeout(function(){
$("#ajax-notice").hide();
},2000);
},
error: function () {
long_notice_box("网路异常,请重新批阅。");
}
});
}
}
</script>

View File

@ -1,28 +1,82 @@
<div class="polls_head" style="width:980px;">
<h2>所有试卷
<span><%= @obj_count%></span>
</h2>
<% if @is_teacher%>
<%= link_to "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %>
<%= link_to "导入试卷", other_exercise_exercise_index_path(:course_id => @course.id), :remote=>true,:class => "newbtn"%>
<% end%>
</div>
<div class="cl"></div>
<div id="polls_list" class="polls_list">
<% if @exercises.count != 0 %>
<% @exercises.each_with_index do |exercise,index|%>
<ul id="exercises_<%= exercise.id %>" class="exercise_list_div" onmouseover="$('#exercise_opr_<%=exercise.id %>').show();" onmouseout="$('#exercise_opr_<%=exercise.id %>').hide();">
<%= render :partial => 'exercise', :locals => {:exercise => exercise,:index => index} %>
</ul>
<div class="cl"></div>
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>
</div><!--列表end-->
<% if @exercises.count != 0 %>
<div class="mh550">
<% @exercises.each do |exercise| %>
<div class="clearfix edu-class-con-list pr">
<div class="fl ml15 task-form-90 ">
<span class="fl mr10 mt3 color-grey3"># <%= get_ex_index(exercise, @course, @is_teacher) + 1 %></span>
<%= link_to exercise.exercise_name, student_exercise_list_exercise_path(exercise), :class => "edu-class-inner-list fl color-grey3" %>
<% unless exercise.is_public %>
<i id="exercise_public_icon_<%= exercise.id %>" class="fa fa-lock color-grey fl mt8 ml15 font-18"></i>
<% end %>
<% ex_curr_status = exercise_curr_time exercise %>
<% if ex_curr_status[:status] != "" %>
<span class="edu-filter-btn <%= homework_status_color ex_curr_status[:status] %> ml10 fl mt3"><%= ex_curr_status[:status] %></span>
<% end %>
<div class="cl"></div>
<p class="color-grey font-12 mt20">
<span>创建于<%=time_from_now exercise.created_at %></span>
<span class="ml25">更新于<%=time_from_now exercise.updated_at %></span>
<% if exercise.try(:exercise_status) > 1 %>
<% if @is_teacher %>
<span class="ml50">
<%= link_to exercise.exercise_users.where("commit_status = 1").count, student_exercise_list_exercise_path(exercise, :ex_status => ['1']), :class => "color-orange05 mr3", :target =>"_blank" %>
已答</span>
<span class="ml50">
<%= link_to (exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count), student_exercise_list_exercise_path(exercise, :ex_status => ['0']), :class => "color-orange05 mr3", :target =>"_blank" %>
未答</span>
<%# count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %>
<span class="ml50">
<%= link_to un_commit_num(exercise), student_exercise_list_exercise_path(exercise, :ex_comment => ['0']), :class => "color-orange05 mr3", :target =>"_blank" %>
未评</span>
<% else %>
<span class="ml50">
<%= link_to exercise.exercise_users.where("commit_status = 1").count, student_exercise_list_exercise_path(exercise), :class => "color-orange05 mr3", :target =>"_blank" %>
已答</span>
<span class="ml50">
<%= link_to (exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count), student_exercise_list_exercise_path(exercise), :class => "color-orange05 mr3", :target =>"_blank" %>
未答</span>
<% end %>
<% end %>
<% if exercise.try(:exercise_status) == 1 && exercise.publish_time %>
<span class="ml50 color-grey">将于&nbsp;<span class="color-orange"><%= format_time(exercise.publish_time).to_s %></span>&nbsp;发布</span>
<% else %>
<span class="ml50 <%= exercise.try(:exercise_status) == 3 ? 'color-grey' : 'color-orange' %>"><%= ex_curr_status[:time] %></span>
<% end %>
</p>
</div>
<% if @is_teacher %>
<div class="fr edu-position edu-position-hidebox mr20 mt5">
<a href="javascript:void(0);"><i class="fa fa-bars font-16"></i></a>
<ul class="edu-position-hide undis">
<% if exercise.exercise_status == 1 %>
<li><%= link_to "编辑", edit_exercise_path(exercise) %></li>
<% end %>
<!--<li><%#= link_to "预览", exercise_path(exercise) %></li>-->
<li><%= link_to "设置", student_exercise_list_exercise_path(exercise, :tab => 3) %></li>
<li><%= link_to "导出成绩", student_exercise_list_exercise_path(exercise.id,:course_id => @course.id, :format => 'xls') %></li>
<% unless exercise.is_public %>
<li id="set_exercise_public_<%= exercise.id %>">
<a href="javascript:void(0);" onclick="delete_confirm_box('<%= set_public_exercise_path(exercise) %>', '您确定要公开吗?<br/>公开后不能重设为私有')">设为公开</a>
</li>
<% end %>
<!--<li><a href="javascript:void(0)">加入题库</a></li>-->
<li><a href="javascript:void(0)" onclick="delete_confirm_box_3('<%= exercise_path(exercise) %>', '删除后,学生的答题情况将全部丢失,无法恢复<br/>确定要删除该试卷吗?')">删除</a></li>
</ul>
</div>
<% end %>
</div>
<% end %>
</div>
<div style="text-align:center;">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<% else %>
<div style="background-color: #fff;padding-bottom: 10px;">
<%= render :partial => "welcome/no_data" %>
</div>
<% end %>

View File

@ -1,70 +1,73 @@
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %>
<label>分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_1">请点击选项</span>
<span class="fr">标准答案:</span>
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="1" type="hidden">
<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</div>
<div class="ur_editor_content">
<ul>
<div>
<input style="display: none;" name="exercise_choice" id="exercise_choice_1"/>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">A</a>
<input maxlength="200" class="w600" type='text' name='question_answer[0]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">B</a>
<input maxlength="200" class="w600" type='text' name='question_answer[1]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">C</a>
<input maxlength="200" class="w600" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">D</a>
<input maxlength="200" class="w600" type='text' name='question_answer[3]' placeholder='输入选项内容'/>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class='cl'></div>
<li class="ur_item">
<a class="question_choice_dash fl mr10 choice_btn">E</a>
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 1);'>新建选项</div>
</li>
<div class='cl'></div>
</div>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">
<span class="fl c_red mt10">温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
</div>
<div class="cl"></div>
</div>
<% if exercise.id %>
<div nhname="new_exercise_mc_q">
<% eq = ExerciseQuestion.new %>
<%= form_for(eq,
:html => {:multipart => true},
:url => create_exercise_question_exercise_path(exercise.id),
:remote => true ) do |f| %>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 single_Temp" id="single_Temp">
<div class="clearfix">
<p class="fl mt15 font-16 mb10">单选题</p>
<input name="question_type" value="1" type="hidden">
<input name="quest_id" id="quest_id" value="0" type="hidden">
<label class="fr mt15">标准答案:<span class="color-orange current-option">请点击正确选项</span></label>
</div>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<!--<textarea name="question_title" id="poll_questions_title" class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入单选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>-->
<textarea id="poll_questions_title" name="question_title" class="panel-form-width2-690 fl panel-box-sizing undis"></textarea>
</li>
<input style="display: none;" name="exercise_choice" id="exercise_choice_1"/>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this)" name="option_span" data-tip-down="点击设置答案">A</span>
</label>
<textarea maxlength="200" name='question_answer[0]' class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removeSingle(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice " onclick="selectchoice(this)" name="option_span" data-tip-down="点击设置答案">B</span>
</label>
<textarea maxlength="200" name='question_answer[1]' class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removeSingle(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice" onclick="selectchoice(this)" name="option_span" data-tip-down="点击设置答案">C</span>
</label>
<textarea maxlength="200" name='question_answer[2]' class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removeSingle(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<li class="clearfix mb20">
<label class="panel-form-label fl">
<span class="add-option-item fr mr10 color-grey border-dash-orange" name="option_span">D</span>
</label>
<div class="fl panel-box-sizing add-option-input border-dash-orange">
<a title="新增" href="javascript:void(0)" class="option_icon_add" onclick="addSingle(this)">新增选项</a>
</div>
</li>
<li class="clearfix mb20">
<% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %>
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="question_score" value="<%=score %>" type="text" class="with10 mr5 pl10 fl panel-box-sizing task-height-40" name="question_score" />
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$(this).parent().parent().parent().parent().parent().remove();">取消</a>
</p>
</li>
<div class="cl"></div>
</div>
<% end %>
</div>
<% end %>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),1);
add_ex_question($(this),1);
});
});
</script>

View File

@ -1,69 +1,67 @@
<%= form_for(ExerciseQuestion.new,
<% if exercise.id %>
<div nhname="new_exercise_mc_q">
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %>
<label>分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_2">请点击选项</span>
<span class="fr">标准答案:</span>
<div class="cl"></div>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 multiple_Temp" id="multiple_Temp">
<div class="clearfix">
<p class="fl mt15 font-16 mb10">多选题</p>
<input name="question_type" value="2" type="hidden">
<input name="quest_id" id="quest_id" value="0" type="hidden">
<label class="fr mt15">标准答案:<span class="color-orange current-option">请点击正确选项</span></label>
<input style="display: none;" name="exercise_choice" id="exercise_choice_2"/>
</div>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<textarea id="poll_questions_title" name="question_title" class="panel-form-width2-690 fl panel-box-sizing undis"></textarea>
</li>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice " onclick="selectMul(this)" name="option_spans" data-tip-down="点击设置答案">A</span>
</label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question_answer[0]" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removeMuli(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice " onclick="selectMul(this)" name="option_spans" data-tip-down="点击设置答案">B</span>
</label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question_answer[1]" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removeMuli(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice " onclick="selectMul(this)" name="option_spans" data-tip-down="点击设置答案">C</span>
</label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question_answer[2]" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removeMuli(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<li class="clearfix mb20">
<label class="panel-form-label fl">
<span class="add-option-item fr mr10 color-grey border-dash-orange" name="option_spans">D</span>
</label>
<div class="fl panel-box-sizing add-option-input border-dash-orange"><a title="新增" href="javascript:void(0)" onclick="addMuli(this)" class="option_icon_add">新增选项</a></div>
</li>
<li class="clearfix mb20">
<% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %>
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" class="with10 mr5 fl pl10 panel-box-sizing task-height-40" />
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$(this).parent().parent().parent().parent().parent().remove();">取消</a>
</p>
</li>
</div>
<% end %>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="2" type="hidden">
<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</div>
<div class="ur_editor_content">
<ul>
<div>
<input style="display: none;" name="exercise_choice" id="exercise_choice_2"/>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">A</a>
<input maxlength="200" class="w600" type='text' name='question_answer[0]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">B</a>
<input maxlength="200" class="w600" type='text' name='question_answer[1]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">C</a>
<input maxlength="200" class="w600" type='text' name='question_answer[2]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">D</a>
<input maxlength="200" class="w600" type='text' name='question_answer[3]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<a class="question_choice_dash fl mr10 choice_btn">E</a>
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 2);'>新建选项</div>
</li>
<div class='cl'></div>
</div>
</ul>
</div>
<div class="ur_editor_footer">
<span class="fl c_red mt10">温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
</div>
<div class="cl"></div>
</div>
<% end %>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),2);
add_ex_question($(this),2);
});
});
</script>

View File

@ -0,0 +1,17 @@
<%= form_for(@exercise,
:html => {:multipart => true, :id => "exercise_head_form"},
:url => {:controller => 'exercise',
:action => 'create',
:course_id => @course.id
},
:method => :post, :remote => true) do |f| %>
<div class="ml15 mr15 mb15">
<input class="panel-box-sizing panel-form-width-100" name="exercise[exercise_name]" maxlength="100" id="exercise_name" value="<%= @exercise.try(:exercise_name) %>" placeholder="试卷标题" style="text-align: center;"/>
</div>
<div class="ml15 mr15">
<textarea id="mustBe" name="exercise[exercise_description]" class="panel-box-sizing panel-form-width-100" placeholder="试卷须知共有选择、填空、简答3种题型其中选择题包括单选题和多选题;您可以在此处填写本次试卷答题的相关说明"><%= @exercise.try(:exercise_description) %></textarea>
</div>
<p class="fr">
<a href="javascript:void(0)" onclick="ex_head_submit($(this));" class="fr task-btn mr15 task-btn-orange">保存</a>
</p>
<% end %>

View File

@ -1,38 +1,41 @@
<%= form_for(ExerciseQuestion.new,
<% if exercise.id %>
<div nhname="new_exercise_mc_q">
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=4").last.nil? ? "": exercise.exercise_questions.where("question_type=4").last.question_score %>
<label class="ml25">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml25">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="4" type="hidden">
<textarea maxlength="250" style="width: 619px;" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入问答题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</div>
<div class="ur_editor_content" id="new_multi">
<div class="multi_input">
<label name='candiate_items'>参考答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<textarea class="candiate_answer" style="width: 620px; height: 90px;" name="exercise_choice" placeholder="如有参考答案,请输入参考答案" type="text"></textarea>
</div>
<div class="cl"></div>
</div>
<div class="ur_editor_footer">
<p class="fl c_red">温馨提示:[问答题]属于主观题需要人工评分,未作答的情况下系统将自动评零分<br><span class="ml60">参考答案作为人工评分时的参考</span></p>
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
</div>
<div class="cl"></div>
</div>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 answer_Temp" id="answer_Temp">
<p class="fl mt15 font-16 mb10">简答题</p>
<input name="question_type" value="4" type="hidden">
<input name="quest_id" id="quest_id" value="0" type="hidden">
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<textarea id="poll_questions_title" name="question_title" class="panel-form-width2-690 fl panel-box-sizing undis"></textarea>
</li>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="fr mr10 color-grey" name="option_spans">参考答案</span></label>
<textarea class="fl panel-box-sizing with90 task-height-150 pl5 pt5" name="exercise_choice" placeholder="如有参考答案,请输入参考答案"></textarea>
</li>
<li class="clearfix mb20">
<% score = exercise.exercise_questions.where("question_type=4").last.nil? ? "": exercise.exercise_questions.where("question_type=4").last.question_score %>
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" class="with10 mr5 pl10 fl panel-box-sizing task-height-40" />
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey" style="display: block;">温馨提示:[简答题]属于主观题需要人工评分,未作答的情况下系统将自动评分</span>
<span class="font-12 color-grey mb10 ml50" style="display: block;">&nbsp;&nbsp;参考答案仅作为人工评分的参考</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$(this).parent().parent().parent().parent().parent().remove();">取消</a>
</p>
</li>
</div>
<% end %>
</div>
<% end %>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),4);
add_ex_question($(this),4);
});
});
</script>

View File

@ -1,57 +1,152 @@
<ul class="tabs_list">
<li class="tab_item02 mr27"> <a title="单选题" class="tab_icon icon_radio" onclick="add_MC();"> 新建单选题 </a> </li>
<li class="tab_item02 mr27"> <a title="多选题" class=" tab_icon icon_checkbox" onclick="add_MCQ();"> 新建多选题 </a> </li>
<li class="tab_item02 mr27"> <a title="单行主观" class="tab_icon icon_text" onclick="add_single();"> 新建填空题 </a> </li>
<li class="tab_item02 "> <a title="问答题" class="tab_icon icon_text" onclick="add_multi();"> 新建问答题 </a> </li>
</ul>
<div class="cl"></div>
<% content_for :header_tags do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<% end %>
<a href="javascript:void(0);" class="fl mr20 add_item_part" onclick="add_MC();">+&nbsp;单选题</a>
<a href="javascript:void(0);" class="fl mr20 add_item_part" onclick="add_MCQ();">+&nbsp;多选题</a>
<a href="javascript:void(0);" class="fl mr20 add_item_part" onclick="add_single();">+&nbsp;填空题</a>
<a href="javascript:void(0);" class="fl add_item_part" onclick="add_multi();">+&nbsp;简答题</a>
<div id="hidden_div_block" class="undis">
<textarea style="display: none" id="hidden_textarea"></textarea>
</div>
<script type="text/javascript">
$(function(){
KindEditor.ready(function(K){
$("#hidden_div_block").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.placeholder = "请输入单选题的题干";
params.textarea = $("#hidden_textarea",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
//new_quetion_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
});
function add_MC(){
var forms = $("form.new_exercise_question");
if($("#polls_head_edit").is(":visible")){
notice_box("请先保存测验标题及测验基本信息。");
if($("#exercise_head_edit").is(":visible")){
notice_box("请先保存试卷标题等信息。");
}else if(forms.length > 0){
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>@exercise}) %>");
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入单选题的题干";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
//div_form = $("div[nhname='new_exercise_mc_q']");
//$(".ke-edit", div_form).css("height","48px");
}
}
function add_MCQ(){
var forms = $("form.new_exercise_question");
if($("#polls_head_edit").is(":visible")){
notice_box("请先保存测验标题及测验基本信息。");
if($("#exercise_head_edit").is(":visible")){
notice_box("请先保存试卷标题等信息。");
}else if(forms.length > 0){
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>@exercise}) %>");
$("#poll_questions_title").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入多选题的题干";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
}
}
function add_single(){
var forms = $("form.new_exercise_question");
if($("#polls_head_edit").is(":visible")){
notice_box("请先保存测验标题及测验基本信息。");
if($("#exercise_head_edit").is(":visible")){
notice_box("请先保存试卷标题等信息。");
}else if(forms.length > 0){
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>@exercise}) %>");
$("#poll_questions_title").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入填空题的题干(注意:目前仅支持一个空)";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
}
}
function add_multi(){
var forms = $("form.new_exercise_question");
if($("#polls_head_edit").is(":visible")){
notice_box("请先保存测验标题及测验基本信息。");
if($("#exercise_head_edit").is(":visible")){
notice_box("请先保存试卷标题等信息。");
}else if(forms.length > 0){
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_multi', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_multi', :locals => {:exercise=>@exercise}) %>");
$("#poll_questions_title").focus();
KindEditor.ready(function(K){
$("div[nhname='new_exercise_mc_q']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
params.placeholder = "请输入简答题的题干";
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[name='question_title']",params.div_form);
if(params.textarea.data('init') == undefined) {
params.editor = init_exercise_quetison_editor(params);
new_quetion_title_editor = params.editor;
params.textarea.data('init', 1);
}
});
});
}
}

View File

@ -1,60 +1,50 @@
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %>
<label class="ml36">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml36">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="3" type="hidden">
<textarea maxlength="250" style="width: 608px;" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入填空题的题干(注意:目前仅支持一个空)" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</div>
<div class="ur_editor_content" id="new_single">
<ul>
<div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[0]" placeholder="请输入参考答案" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
<% if exercise.id %>
<div nhname="new_exercise_mc_q">
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 fillin_Temp" id="fillin_Temp">
<p class="fl mt15 font-16 mb10">填空题</p>
<li class="clearfix pr mb20">
<input name="question_type" value="3" type="hidden">
<input name="quest_id" id="quest_id" value="0" type="hidden">
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<textarea id="poll_questions_title" name="question_title" class="panel-form-width2-690 fl panel-box-sizing undis"></textarea>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案二<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[1]" placeholder="请输入参考答案(选填)" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="fr mr10 color-grey" name="fill_span">答案 一</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="exercise_choice[0]" placeholder="请输入参考答案"></textarea>
<!--<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>-->
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案三<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[2]" placeholder="请输入参考答案(选填)" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="fr mr10 color-grey" name="fill_span">答案 二</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="exercise_choice[1]" placeholder="请输入参考答案(可选)"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove" onclick="removefill(this)"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<div class="dash-block new-question w560" style="margin-left: 82px;" onclick="add_candidate_answer($(this));">新建参考答案</div>
<li class="clearfix mb20">
<label class="panel-form-label fl"><span>&nbsp;</span></label>
<div class="fl panel-box-sizing add-option-input border-dash-orange"><a title="新增" href="javascript:void(0)" class="option_fillin_add" onclick="addfill(this)">新增参考答案</a></div>
</li>
<div class='cl'></div>
</div>
<div class="cl"></div>
</ul>
<li class="clearfix mb20">
<% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %>
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" class="with10 mr5 fl pl10 panel-box-sizing task-height-40"/>
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[填空题]属于客观题将由系统自动评分,请设置标准答案</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-orange" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$(this).parent().parent().parent().parent().parent().remove();">取消</a>
</p>
</li>
</div>
<% end %>
</div>
<div class="ur_editor_footer">
<span class="fl c_red mt10">温馨提示:[填空题]属于客观题将由系统自动评分,请输入参考答案</span>
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
</div>
<div class="cl"></div>
</div>
<% end %>
<script type="text/javascript">
$(function(){
$("#add_new_question").one('click', function(){
add_poll_question($(this),3);
add_ex_question($(this),3);
});
});
</script>

Some files were not shown because too many files have changed in this diff Show More