Compare commits

...

285 Commits

Author SHA1 Message Date
guange 221e70d648 gemfile 更新 2015-03-21 09:28:43 +08:00
alan 0647ea63c8 Signed-off-by: alan <547533434@qq.com> 2014-10-21 15:13:18 +08:00
xianbo 70d5ffd95e Merge tag 'V20140708' of http://repository.trustie.net/xianbo/trustie2
升级权限功能、wiki、gtilab前的相对稳定版
2014-07-11 10:13:50 +08:00
nwb dd396a6da2 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-07 16:27:49 +08:00
nwb 8b2199e28c 新建竞赛时的日期判断优化 2014-07-07 15:01:10 +08:00
nwb ae32b310cd 新建竞赛时的日期信息提醒变更 2014-07-07 14:39:44 +08:00
nwb 431b4541c3 新建竞赛时奖励设置为不能为空 2014-07-07 14:37:32 +08:00
nwb b4ee106ce9 竞赛搜索项为空时给出提示 2014-07-07 14:31:21 +08:00
nwb bc179fbc39 右上角菜单增加二级菜单 2014-07-07 13:41:44 +08:00
nwb 633c4278d8 修改课程列表视图 2014-07-07 10:12:07 +08:00
nwb 0471446ac8 新增、修改缺陷发送邮件的缺陷编写优化 2014-07-07 10:07:50 +08:00
nwb beeb707347 用户未登陆时首页不提示“该学校未开设任何课程” 2014-07-07 09:37:45 +08:00
nwb 5f18b1a38c Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-05 15:11:57 +08:00
z9hang f5b69be967 新建贴吧描述为空不能新建、搜索空内容添加提示 2014-07-05 14:43:15 +08:00
nwb fb8e97ff61 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/views/projects/show.html.erb
2014-07-05 13:51:41 +08:00
nwb eb15edd5ff 1.添加文档
2.邮件中缺陷序号计算机制优化
2.项目、课程动态优化
2014-07-05 13:31:32 +08:00
z9hang 5c93442c79 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-05 11:44:21 +08:00
z9hang 01da0852e3 新建贴吧错误提示修改 2014-07-05 11:44:05 +08:00
sw 6365d01051 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-05 11:21:27 +08:00
sw f1b8b7caed t 2014-07-05 11:20:59 +08:00
z9hang 470f40db82 去除绝对网址 2014-07-05 11:00:01 +08:00
z9hang 011d161f8f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-05 09:49:57 +08:00
yanxd db28ecd883 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-05 09:40:11 +08:00
yanxd 2fa9a4855c 最后创建人信息的正确显示(+去掉了乱78糟的table套table)
div-class内标明activity-title等,内嵌css属性等没有问题再移动出html文件
2014-07-05 09:39:58 +08:00
nwb efbffa7436 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-05 09:34:34 +08:00
nwb c927bb6fd6 首页课程列表修改 2014-07-05 09:33:52 +08:00
z9hang 8c65e1ac03 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-04 16:56:26 +08:00
z9hang c709545809 提交后点击版本库才刷新项目积分问题(尚需测试) 2014-07-04 16:55:59 +08:00
sw 8b389776a1 打开缺陷列表改为从新建窗口打开 2014-07-04 16:14:11 +08:00
sw 65c25feabb 修复项目的缺陷模块改版之后,新增缺陷界面找不到的问题 2014-07-04 16:00:18 +08:00
nwb fd25f42e61 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-04 15:41:38 +08:00
nwb 2395ee4b1d 留言发送邮件优化 2014-07-04 15:41:26 +08:00
sw eac725a0f4 修改作业、用户、课程界面中相关学校的链接 2014-07-04 15:21:56 +08:00
sw 698870ddee Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-04 14:48:06 +08:00
sw 71b17cd98e 1 2014-07-04 14:47:38 +08:00
yanxd 8ccc39ae71 首页更多报错 2014-07-04 14:43:57 +08:00
nwb b6ebbab830 项目版本库名称限定优化 2014-07-04 14:19:34 +08:00
sw 62bcccedea 新建作业时给必填项添加*号 2014-07-04 14:04:31 +08:00
sw bc9f1e5a01 1.修改软件创客中每个用户内容显示不一致的BUG
2.去掉用户项目列表最后一个项目后的逗号
2014-07-04 13:59:08 +08:00
nwb 164d4f9e78 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-04 13:39:34 +08:00
nwb b42605accd Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-04 13:38:50 +08:00
nwb 864ef17941 清理课程状态表,修正同一课程出现多次的BUG 2014-07-04 13:38:34 +08:00
sw b492ead0c0 修改学校链接 2014-07-04 11:51:26 +08:00
sw a1920ca54c Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-04 11:31:09 +08:00
yanxd 36c90f1dfd 取不到学校,再拿id直接空指针 2014-07-04 11:30:41 +08:00
sw 0e0b8fb8d8 历史数据中当课程名称字段为空时从项目列表里获取名称 2014-07-04 11:30:22 +08:00
sw 1e6693cdcf 1.取消软件创客界面2个个人得分显示
2.修复软件创客界面用户参与课程显示不正确的BUG
3.添加获取用户参与的未过期的项目列表
2014-07-04 11:26:37 +08:00
yanxd d54f37e630 个人动态,判断留言人逻辑有误 2014-07-04 11:15:58 +08:00
nwb 3a7065bb2d Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-04 11:12:27 +08:00
nwb ff8994fc9d Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-04 11:11:38 +08:00
nwb 08a6dec39d 课程讨论区回复时主题只读 2014-07-04 11:11:27 +08:00
sw 2506e8e50d Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-04 10:30:14 +08:00
sw 108866b8ba 1 2014-07-04 10:29:31 +08:00
sw 016ef25019 1.注释无效代码
2.修改软件总包列表分页统一使用@bid_count
2014-07-04 10:22:35 +08:00
z9hang d525220aca Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-04 10:10:41 +08:00
z9hang 2dd249a105 修正发帖不填主题报错问题,修正发帖内容为空可成功发布bug、修改主页贴吧动态里回帖数字颜色、修改昵称字符为不超过25个 2014-07-04 10:10:20 +08:00
nwb dc0180988f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-04 09:10:36 +08:00
nwb d001b4416a 1.优化课程首页
2.优化课程首页搜索逻辑
2014-07-04 09:10:17 +08:00
yanxd 81327e48aa Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-04 09:02:54 +08:00
yanxd 8420163c29 doc/(git workflow
update rmagick Installation
2014-07-04 09:02:33 +08:00
sw 7acf73c4ca 修复未登陆用户进入学校主页列表出错的问题 2014-07-04 08:42:00 +08:00
sw fd1f3b45c9 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-03 18:21:18 +08:00
nwb 6e53796aa9 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-03 18:21:17 +08:00
sw f86e889c23 修复学校列表链接 2014-07-03 18:20:16 +08:00
nwb 42a602a9bc 修改首页 2014-07-03 18:20:03 +08:00
sw 2bdb0e20e9 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/views/welcome/course.html.erb
2014-07-03 18:14:44 +08:00
sw 3e185c3a4b 修改学校链接 2014-07-03 18:11:10 +08:00
nwb 1a666900c0 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-03 17:30:45 +08:00
nwb 98ba57b819 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-03 17:28:20 +08:00
nwb 4d25ec1623 1.添加课程垃圾数据清理迁移文件
2.课程首页逻辑更改
2014-07-03 17:28:13 +08:00
sw b42d742c06 1.增加我的学校链接
2.修改当我的学校未开设课程时报出的BUG
2014-07-03 17:25:51 +08:00
yanxd 271af6ead5 Merge branch 'szzh' into develop 2014-07-03 17:23:29 +08:00
yanxd 0e2b7ba362 tag search fix 2014-07-03 17:22:48 +08:00
sw fe4e1cc175 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-03 16:41:48 +08:00
nwb a03cdf272e Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-03 16:17:01 +08:00
nwb 9f7951a22c 修改BUG 2014-07-03 16:16:21 +08:00
nwb 41ff47b839 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-03 16:08:36 +08:00
nwb 52ddee2b2f 界面优化 2014-07-03 16:07:30 +08:00
nwb bc50390a2e Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-03 15:51:49 +08:00
nwb 5c0b1f3a47 修改界面 2014-07-03 15:51:18 +08:00
sw 740f6a19ec 项目名称唯一 2014-07-03 15:50:36 +08:00
nwb 8564f7a904 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-03 15:46:51 +08:00
nwb 8d22ccd23a 修改BUG 2014-07-03 15:45:50 +08:00
sw 5abee0a06c Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-03 15:41:15 +08:00
nwb 39b4bd37d4 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-03 15:31:43 +08:00
nwb b928eb6ed8 修改课程首页“更多”链接错误 2014-07-03 15:30:52 +08:00
nwb ae8093c400 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-03 15:26:26 +08:00
nwb 2a6cbe28f0 修正课程首页错误 2014-07-03 15:24:06 +08:00
sw 3c7e680b1b Merge remote-tracking branch 'origin/szzh' into szzh 2014-07-03 10:33:35 +08:00
nwb 41999e64b7 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-03 10:14:12 +08:00
nwb 2d9e0d507e Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-03 10:12:46 +08:00
nwb 31e338f1e5 修正http://127.0.0.1:3000/?course.trustie.net链接跳转问题 2014-07-03 10:12:30 +08:00
sw 967c377191 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-03 10:09:25 +08:00
yanxd 10a844c67f 合并导致的,任务列表分页错误 2014-07-03 10:06:57 +08:00
yanxd f664ec10b4 Merge branch 'szzh' into develop
Conflicts:
	app/views/bids/_bid_homework_show.html.erb
2014-07-03 09:07:09 +08:00
yanxd 663634b9da Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2 into develop 2014-07-03 09:03:17 +08:00
z9hang 050a780b50 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-02 17:07:10 +08:00
z9hang 6f5d6c382b 给用户留言的回复若为查看计入新留言数 2014-07-02 17:06:34 +08:00
nwb 70dc5e2b49 去除主版本库标识允许为空的设置 2014-07-02 15:10:33 +08:00
nwb 898ecb443a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-02 14:59:02 +08:00
nwb e8705bccb1 修改文件上传界面样式 2014-07-02 14:58:52 +08:00
z9hang fe3861c1d7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-02 11:33:00 +08:00
z9hang 54a2fb8a9c 主页项目得分与项目页面的项目得分保持一致 2014-07-02 11:32:49 +08:00
nwb fb0597ab4a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-02 09:11:56 +08:00
nwb 2b855badf9 修正课程资源库关联已有资源功能 2014-07-02 09:11:45 +08:00
yanxd e1d9d6ab45 tag查询崩溃 2014-07-01 18:20:30 +08:00
xianbo 830e2d4fb4 隐藏 站长统计 2014-07-01 18:18:25 +08:00
sw 063460f119 tt 2014-07-01 17:49:12 +08:00
z9hang cc2862ae0f 修正缺陷不能踩自己提示错误 2014-07-01 17:21:16 +08:00
z9hang 8b0f155be7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-01 17:13:08 +08:00
z9hang d34ab220cc 登录名区分大小写 2014-07-01 17:12:48 +08:00
nwb 138211efba Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-01 16:56:33 +08:00
nwb e94ed86ead 部分BUG修正 2014-07-01 16:56:23 +08:00
z9hang 37acecae61 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-01 16:33:26 +08:00
z9hang 2e38f66899 搜索用户修改为按昵称搜索 2014-07-01 16:31:40 +08:00
nwb cf00942261 更新迁移文件 2014-07-01 16:19:42 +08:00
nwb 7881a3f20f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-01 15:29:44 +08:00
nwb 993ac23a36 课程各数据迁移时不再做验证,以兼容老数据 2014-07-01 15:29:16 +08:00
z9hang a7fa444f9e 修正项目个人得分问题:统计时只计算项目成员,user_grade表user_id和project_id联合不重复验证,user_grade分数部位负验证 2014-07-01 15:19:08 +08:00
sw 4470f0dd73 添加作业时增加教师评分所占比例设置 2014-07-01 11:53:55 +08:00
z9hang 0f9c098df9 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-01 10:31:54 +08:00
z9hang 0bcc0beaf1 修复留言计分 2014-07-01 10:31:44 +08:00
sw 12b6525cc6 t 2014-07-01 10:29:37 +08:00
sw bb86ef4612 修复获取作业列表时课程老师参数获取不正确的问题 2014-07-01 09:23:49 +08:00
sw bc434a82a4 Merge remote-tracking branch 'origin/szzh' into szzh
Conflicts:
	db/schema.rb
2014-07-01 09:23:16 +08:00
z9hang 33c883146a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-01 09:16:17 +08:00
z9hang 4906bad7d2 修正进项目报错异常 2014-07-01 09:15:53 +08:00
sw 98d2c144ae 修改时间排序为升序排序 2014-06-30 17:52:01 +08:00
nwb 671eaa8d45 测试 2014-06-30 17:49:55 +08:00
sw d03718e30f 修复新评分规则下按分数排序不正确的问题 2014-06-30 17:44:29 +08:00
nwb 6141cc56e6 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-30 17:26:25 +08:00
nwb e863c30352 部分BUG修正 2014-06-30 17:26:11 +08:00
z9hang 9a8c5ebecc 个人得分规则显示
留言回复未加分bug修改
2014-06-30 16:19:28 +08:00
sw f6d9bfc91d 修改新建作业时传递参数 2014-06-30 11:15:52 +08:00
sw be2faea15b Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/controllers/bids_controller.rb
	app/views/courses/new_homework.html.erb
2014-06-30 11:15:25 +08:00
linchun 79f68c2231 Merge branch 'szzh' into develop 2014-06-28 08:51:23 +08:00
nwb 25a3114a5a 老师的学生列表显示为真实姓名 2014-06-27 16:44:53 +08:00
nwb 917288c84c 修正课程讨论区、课程通知等创建时BUG修正 2014-06-27 15:58:41 +08:00
sw 3f8f141107 修复 创建作业时,由于输入参数错误导致保存失败后,再次输入错误参数会报错。如再次输入参数正确,会进入一个空白页面 的BUG 2014-06-27 15:35:55 +08:00
nwb 99c9f81aea BUG修正 2014-06-27 15:26:42 +08:00
nwb 1a4ee62853 修正课程错误信息显示2遍的问题 2014-06-27 14:17:21 +08:00
nwb ad97066a45 课程名称有效性判断 2014-06-27 11:42:45 +08:00
nwb c0f0e294e5 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-27 11:25:00 +08:00
nwb beeab518e8 课程动态中留言链接BUG修复 2014-06-27 11:24:48 +08:00
z9hang 0717148a0a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-27 11:15:20 +08:00
z9hang bc587f3e7d 屏蔽个人分数实时刷新功能
修复个人分数计分异常
2014-06-27 11:15:10 +08:00
nwb 3565b9da88 修正用户课程界面关闭、重启课程,数据刷新不及时的问题 2014-06-27 10:50:23 +08:00
sw 09d79ae4e0 添加作业增加默认日期为当前时间的下一天 2014-06-27 10:10:30 +08:00
sw 745727b8e7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-26 17:55:18 +08:00
z9hang d57688413e Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-26 17:55:21 +08:00
z9hang 74603e1256 解决直接访问ajax链接地址报错问题 2014-06-26 17:55:01 +08:00
sw 08bfb8e80a 修复教师评分后星星显示不正常的BUG 2014-06-26 17:49:23 +08:00
nwb 33baf88886 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-26 17:47:40 +08:00
nwb 38baa247bf BUG修正 2014-06-26 17:47:27 +08:00
sw 12b16f0bb6 1.修复作业界面点击所属任务链接出错的BUG
2.点击所属任务返回作业列表界面
2014-06-26 16:47:49 +08:00
z9hang 2501f31ef1 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-06-26 15:15:46 +08:00
z9hang 7399e1aca2 添加项目个人得分统计功能 2014-06-26 15:05:24 +08:00
sw 392dc0c365 增加访问作业显示列表的权限 2014-06-26 14:58:59 +08:00
sw dbd5c49246 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-26 14:48:31 +08:00
nwb a115edea9d 修改课程标签页选中状态 2014-06-26 14:47:29 +08:00
sw 91180f922a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-26 14:45:44 +08:00
sw ed9b97f987 增加访问作业显示列表的权限 2014-06-26 14:42:32 +08:00
nwb 9ae5f59a29 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-26 11:43:13 +08:00
nwb f8e5c2358a 学生角色添加回复讨论区权限 2014-06-26 11:43:03 +08:00
sw 56ce9e8bdb Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-26 11:41:10 +08:00
sw c4b2c47dc7 调整作业显示样式 2014-06-26 11:40:54 +08:00
sw 12087f40c7 1.当作业未选定项目时,项目得分为灰色的N/A,选定了项目,项目得分为橘色的分数
2.当无人对作业进行互评、综评时,作业的互评、综评得分为灰色的N/A,有人进行评分则为橘色的分数
3.简化代码
2014-06-26 11:22:48 +08:00
nwb b4af75f289 部分界面优化 2014-06-26 11:15:06 +08:00
sw 7702b746c6 修复作业显示界面,提交作业按钮不显示的问题 2014-06-26 10:55:50 +08:00
nwb f4aa817f42 修改合并后首页出错的问题 2014-06-26 10:01:44 +08:00
nwb 88c3347f7c 修正合并分支后的创建课程错误 2014-06-26 09:15:56 +08:00
nwb 7425178419 Merge branch 'CourseModify' into szzh
Conflicts:
	app/views/layouts/base_courses.html.erb
	app/views/layouts/base_homework.html.erb
	app/views/projects/_course.html.erb
	db/schema.rb
	lib/redmine/activity/fetcher.rb
2014-06-26 08:53:16 +08:00
nwb c5a837c689 修改资源文件测试用例 2014-06-25 16:26:19 +08:00
nwb ff67e3dbfe 更新测试环境搭建文档 2014-06-25 10:40:59 +08:00
nwb 25e30ec604 修改文档 2014-06-25 10:15:30 +08:00
nwb 241b1f2dc6 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-25 09:44:51 +08:00
nwb 1e1ff110fc 添加测试说明文档 2014-06-25 09:44:35 +08:00
z9hang b04992b226 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-24 18:07:14 +08:00
z9hang 57cdb55282 修正get_level方法是用错误
仿照用户得分规则实现项目个人得分
2014-06-24 17:31:39 +08:00
nwb d1b438953a wiki_format更新 2014-06-24 16:26:29 +08:00
nwb 2e38d859fd 添加iamgemarick安装包 2014-06-24 16:25:43 +08:00
nwb d5665c7bb7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-24 15:42:39 +08:00
nwb ae3457e68b 1.添加代码评审(CodeReview)插件
2.添加代码评审插件使用文档
2014-06-24 15:42:28 +08:00
z9hang 02e221eedb 修改:网站中的旧分数显示为新分数 2014-06-24 13:57:51 +08:00
nwb 9e0ae72ab7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-24 09:55:48 +08:00
nwb 91f0b58a7a gem修改 2014-06-24 09:55:41 +08:00
sw c320ede205 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-24 09:24:29 +08:00
linchun ead7fca3f8 fix gemfie 2014-06-23 19:11:58 +08:00
linchun c1e780a0f8 yan 2014-06-23 18:48:57 +08:00
linchun 0c501022fd Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into develop 2014-06-23 18:06:29 +08:00
z9hang dc1bd010f6 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-23 17:59:10 +08:00
nwb e367c03f6e 修正课程作业列表显示BUG 2014-06-23 17:50:45 +08:00
z9hang df89e5e173 去掉多的一个分数显示 2014-06-23 17:49:20 +08:00
nwb 26b92a925f 去掉测试gem 2014-06-23 17:35:12 +08:00
nwb 4536680acc Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-23 17:33:45 +08:00
linchun e602c0f149 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into develop 2014-06-23 17:18:17 +08:00
linchun 7ba723e582 bundle mysql connetion version 2014-06-23 17:16:12 +08:00
nwb 067a2d7841 修改文件未找到界面 2014-06-23 16:13:00 +08:00
nwb ef61e41d48 去掉首页缓存 2014-06-23 16:00:10 +08:00
linchun 9c5066b81c Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into develop
Conflicts:
	app/controllers/account_controller.rb
2014-06-23 15:06:37 +08:00
nwb d233f9fe94 更新文档 2014-06-23 15:00:54 +08:00
sw 91408cc960 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-23 14:59:41 +08:00
nwb d0843861ce Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-23 14:52:48 +08:00
nwb f33dc6bff6 1.修改测试环境搭建文档
2.添加部分测试用例
2014-06-23 14:51:57 +08:00
sw 358d4a53b8 修复未公开项目动态仍在主页最新动态显示的问题 2014-06-23 14:19:01 +08:00
z9hang 773b728828 修改:自己不能踩或顶自己 2014-06-23 11:17:42 +08:00
sw 0dce86d47e 修改首页项目显示为按活跃度排名的前10个项目 2014-06-23 09:42:08 +08:00
z9hang f16bec924c 处理undefined method `update_user_level' for nil:NilClass问题 2014-06-23 09:27:21 +08:00
z9hang 9d9bc76af4 定时刷新分数 2014-06-21 17:06:08 +08:00
z9hang bf91222e76 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-21 16:53:36 +08:00
nwb ab2b6063f1 添加测试环境搭建文档 2014-06-21 16:48:32 +08:00
z9hang 24172c85c8 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-21 16:45:15 +08:00
z9hang f9612ca63f 实时刷新(ajax轮询) 2014-06-21 15:34:10 +08:00
sw 339b5b0296 缺陷编辑页面直接显示,不需要点击留言按钮才显示缺陷编辑页面 2014-06-20 17:14:43 +08:00
sw 05659fa2db 修复注册后在”修改资料“中发现我在注册时选择的”学生“身份和地区信息以及学号信息都没有了,需要重新填写。 2014-06-20 14:45:41 +08:00
z9hang 55b28296a0 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-20 14:04:24 +08:00
z9hang 54d4b957ee 修复竖排的踩顶图标在踩或顶完后变成横排问题 2014-06-20 14:04:11 +08:00
sw 18762e2da7 增加、修改作业时提交项目增加空值选择,即不选定任何关联项目 2014-06-20 13:52:17 +08:00
sw d2376eb0b1 将页面部分jS代码转为JQuary代码 2014-06-20 11:16:08 +08:00
sw d0c9390e91 增加什么是项目链接。点击什么是项目 实现jQuary窗帘效果显示解释 2014-06-20 10:52:34 +08:00
sw 5277eddb95 封装获取一个作业参与人员方法 2014-06-20 09:40:12 +08:00
sw 600ec536b3 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-19 20:15:46 +08:00
sw 989407dad2 12 2014-06-19 20:15:15 +08:00
sw 09eae9e253 1.作业列表增加项目得分显示
2.封装获取指定项目得分的方法,并保留2位有效数字
2014-06-19 20:14:48 +08:00
sw 36fecfc635 1.界面颜色调整
2.得分显示取消“分”字
2014-06-19 19:48:03 +08:00
sw 19530df395 作业附件显示修改 2014-06-19 19:14:51 +08:00
z9hang 2ee5b422fb RolesController.rb移回app/controls 2014-06-19 18:16:55 +08:00
sw 463edeee71 1.修复未开启互评功能作业总评得分计算不正确的问题
2.修复未选择项目新建、修改有误的BUG
2014-06-19 17:49:18 +08:00
sw e43a84ab4b 1.修复作业无关联项目是进入编辑界面报错的问题
2.修复作业综评页面不会及时更新的问题
2014-06-19 17:00:40 +08:00
sw 59e6433938 修复获取当前用户建立项目不正确的问题 2014-06-19 16:52:53 +08:00
z9hang a764888055 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-19 16:05:30 +08:00
z9hang 31049fcf4e 修复同时更新缺陷状态和缺陷完成度时只有缺陷完成度加分及记录分数变化细节,缺陷状态更改操作未加分及记录分数变化细节bug 2014-06-19 15:59:55 +08:00
sw 4d06d26303 优化新建作业页面显示 2014-06-19 15:58:49 +08:00
sw f3f303e6e2 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-19 15:56:07 +08:00
sw ef234d8c50 1.按照新的评分规则修改作业得分
2.修改作业列表显示界面
3.增加获取作业的互评得分、教师评分、最终评分方法
2014-06-19 15:55:42 +08:00
z9hang 9e4dbcc08e 加回学校主页学校的超链接 2014-06-19 15:31:30 +08:00
z9hang 3e37a54a0f 修复竞赛处不能留言问题 2014-06-19 14:44:58 +08:00
z9hang f2cb1390da 修复带pre标签缺陷留言的显示问题 2014-06-19 14:33:57 +08:00
sw d38e009469 取消学号显示,增加参与人员在作业列表的显示 2014-06-19 14:01:18 +08:00
sw 71bb76ff91 作业显示界面页面改造,实现新的页面显示效果 2014-06-19 13:51:39 +08:00
z9hang 9061a77221 修改user.user_score为空问题的解决方式 2014-06-19 10:45:30 +08:00
z9hang 3c89de4c81 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-18 17:35:26 +08:00
z9hang c0d97870d5 项目=》文档 文档提交者添加超链接 2014-06-18 17:35:05 +08:00
sw 2f66296b62 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-18 17:30:42 +08:00
z9hang d2db58050d 修复部分未填工作单位报错问题 2014-06-18 14:21:05 +08:00
sw 8f78177d47 增加数据迁移文件 2014-06-18 11:51:20 +08:00
z9hang 08ba10c32d 添加超链接
已添加的超链接:
学校主页,课程信息中的学校名称
竞赛中项目列表: 参赛人
竞赛中参入竞赛tab页:参赛代表
修改作业界面教师单位不显示问题,并添加超链接
作业界面作业名称添加超链接
软件众包页面:软件众包名称
软件众包页面:关注栏下头像添加链接,参与项目栏:图片添加链接
贴吧帖子:修复 发帖回帖下方 “由xxx在XXX之前添加”中名子未链接问题
2014-06-18 11:42:59 +08:00
sw efb6c1fd19 1.修改、新增作业增加提交项目选项(可以为空)
2.homework_attach与project增加关联关系
2014-06-18 10:07:19 +08:00
sw 872357cdf4 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-18 08:35:11 +08:00
sw 97a4aaf8ab homework_attach增加列project_id及相关数据迁移
编辑作业页面增加选择关联项目,以及数据更新项目的实现
2014-06-17 18:49:21 +08:00
yanxd 8840a11a99 attachments error 2014-06-17 18:38:13 +08:00
yanxd 9b707f2b5a a 2014-06-17 18:03:50 +08:00
z9hang 1cb1eeeb1d 个人主页:姓名、工作单位
课程主页:课程名称、教师单位
项目主页:项目名称
竞赛主页:竞赛名称
主页:课程列=>单位名称
修复部分个人主页报错问题
2014-06-17 17:41:59 +08:00
z9hang ab486aa811 补充user_score_details Model及数据迁移文件 2014-06-17 15:59:34 +08:00
z9hang da3aa7b291 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-17 15:57:40 +08:00
z9hang 50dbe3d04a 添加记录得分变化功能 2014-06-17 15:57:31 +08:00
yanxd b76f1c2b12 管理员用户粉丝列表出错。 2014-06-17 15:16:17 +08:00
yanxd 2000f1ddf6 人物注册地址信息会保存两次的问题。 2014-06-17 14:42:08 +08:00
yanxd 2f724aa23e xss 过滤memo content中的标签 2014-06-17 11:49:24 +08:00
z9hang f9a17241da Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-06-17 09:01:23 +08:00
z9hang 9e53ad67d0 去除个人分数显示的链接 2014-06-17 09:01:09 +08:00
senluo cc39172d87 fix 2014-06-16 21:52:08 +08:00
senluo cde34e42bc Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into develop 2014-06-16 19:42:43 +08:00
yanxd 099577fb59 remove all icon display 2014-06-16 17:51:51 +08:00
z9hang 697a6034b2 新得分显示 2014-06-16 17:50:28 +08:00
yanxd c5d892a214 footer 2014-06-16 08:47:42 +08:00
senluo ac850dd6f6 Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2 into develop 2014-06-13 17:48:25 +08:00
senluo b702411a65 fix contest show lichun 2014-06-13 17:46:58 +08:00
yanxd 579f1d4d31 start align-center 2014-06-13 17:32:05 +08:00
xianbo 0500bb3ea0 fix 2014-05-30 11:21:31 +08:00
xianbo c9e4fdee9d Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2
Conflicts:
	app/helpers/bids_helper.rb
	app/views/bids/_homework_list.html.erb
	app/views/homework_attach/show.html.erb
2014-05-30 11:18:05 +08:00
xianbo d39730ec76 Merge branch 'develop' 2014-05-30 09:29:22 +08:00
xianbo 12b942124e Merge branch 'develop' 2014-05-30 08:36:21 +08:00
xianbo 7a045b6f11 Merge branch 'develop' 2014-05-30 08:30:12 +08:00
t430 d2e4601556 Merge branch 'master' of http://repository.trustie.net/xianbo/trustie2 2014-05-27 17:24:28 +08:00
xianbo 0e603081be Merge branch 'develop' of 10.0.47.245:/home/trustie2 2014-05-27 17:27:44 +08:00
sw a56c200967 1.修复作业留言超过一页条数限制时不会出现换页标签的BUG
2.修改点击作业名称为下载作业,增加互评按钮进入作业互评页面
3.增加判断当前用户是不是指定课程的成员的方法
2014-05-26 09:37:06 +08:00
t430 bb886302de Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2 2014-05-23 17:13:28 +08:00
xianbo 8452987ff9 Merge branch 'competition' of 10.0.47.245:/home/trustie2 2014-05-23 14:25:47 +08:00
xianbo 6f82e12c3d Merge branch 'develop' of 10.0.47.245:/home/trustie2 2014-05-23 14:22:48 +08:00
t430 9a204d0010 Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2 2014-05-23 11:43:16 +08:00
t430 3558c7d20a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 2014-05-23 11:07:01 +08:00
t430 ff2364048a Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2 2014-05-23 11:06:10 +08:00
t430 0ee38dcd9a Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2 2014-05-23 09:27:45 +08:00
xianbo b01a0b4869 Merge remote-tracking branch 'remotes/origin/develop'
Conflicts:
	db/schema.rb
2014-05-21 11:08:18 +08:00
1097 changed files with 83699 additions and 7832 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@
/Gemfile.lock
/db/schema.rb
/Gemfile.lock
/lib/plugins/acts_as_versioned/test/debug.log

23
Gemfile
View File

@ -25,6 +25,15 @@ group :development do
end
end
group :test do
#gem "shoulda", "~> 3.3.2"
gem "shoulda", "> 3.3.2"
gem "mocha", "~> 0.13.3"
gem 'capybara', '~> 2.0.0'
gem 'nokogiri', '< 1.6.0'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
@ -32,7 +41,7 @@ group :assets do
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
@ -42,6 +51,16 @@ group :ldap do
gem "net-ldap", "~> 0.3.1"
end
platforms :mri, :mingw do
group :rmagick do
# RMagick 2 supports ruby 1.9
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# different requirements for the same gem on different platforms
gem "rmagick", ">= 2.0.0"
end
end
# Optional gem for OpenID authentication
group :openid do
gem "ruby-openid", "~> 2.1.4", :require => "openid"
@ -67,7 +86,7 @@ if File.exist?(database_file)
adapters.each do |adapter|
case adapter
when 'mysql2'
gem "mysql2", "~> 0.3.11", :platforms => [:mri, :mingw]
gem "mysql2", "= 0.3.11", :platforms => [:mri, :mingw]
gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
when 'mysql'
gem "mysql", "~> 2.8.1", :platforms => [:mri, :mingw]

View File

@ -52,6 +52,15 @@ GEM
rails (>= 3, < 5)
arel (3.0.2)
builder (3.0.0)
capybara (2.0.3)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 1.0.0)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@ -59,11 +68,11 @@ GEM
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.1)
coffee-script-source (1.7.0)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
execjs (2.0.2)
fastercsv (1.5.0)
ffi (1.9.3-x86-mingw32)
hike (1.2.3)
i18n (0.6.1)
journey (1.0.4)
@ -74,10 +83,14 @@ GEM
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.4)
mime-types (1.23)
mocha (0.13.3)
metaclass (~> 0.0.1)
multi_json (1.7.6)
mysql2 (0.3.11-x86-mingw32)
net-ldap (0.3.1)
nokogiri (1.5.11-x86-mingw32)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
@ -104,15 +117,28 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.4)
rake (10.3.2)
rdoc (3.12.2)
json (~> 1.4)
rmagick (2.13.2)
ruby-openid (2.1.8)
sass (3.2.7)
rubyzip (1.1.4)
sass (3.2.14)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
selenium-webdriver (2.42.0)
childprocess (>= 0.5.0)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0.4)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
shoulda-context (1.2.1)
shoulda-matchers (2.6.1)
activesupport (>= 3.0.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
@ -124,9 +150,12 @@ GEM
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
uglifier (1.0.3)
uglifier (2.4.0)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
json (>= 1.8.0)
websocket (1.0.7)
xpath (1.0.0)
nokogiri (~> 1.3)
PLATFORMS
x86-mingw32
@ -137,17 +166,23 @@ DEPENDENCIES
acts-as-taggable-on (= 2.4.1)
better_errors!
builder (= 3.0.0)
capybara (~> 2.0.0)
coderay (~> 1.0.6)
coffee-rails (~> 3.2.1)
fastercsv (~> 1.5.0)
i18n (~> 0.6.0)
jquery-rails (~> 2.0.2)
mysql2 (~> 0.3.11)
mocha (~> 0.13.3)
mysql2 (= 0.3.11)
net-ldap (~> 0.3.1)
nokogiri (< 1.6.0)
rack-mini-profiler!
rack-openid
rails (= 3.2.13)
rmagick (>= 2.0.0)
ruby-openid (~> 2.1.4)
sass-rails (~> 3.2.3)
seems_rateable!
shoulda (> 3.3.2)
therubyracer
uglifier (>= 1.0.3)

View File

@ -143,15 +143,18 @@ class AccountController < ApplicationController
end
#added by bai
unless @user.id.nil?
ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => params[:no])
unless params[:province].nil? || params[:city].nil?
ue.location = params[:province]
ue.location_city = params[:city]
ue.save
end
if @user.id != nil
ue = @user.user_extensions ||= UserExtensions.new
#ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => )
ue.identity = params[:identity].to_i
ue.technical_title = params[:technical_title]
ue.gender = params[:gender].to_i
ue.user_id = @user.id
ue.student_id = params[:no]
ue.location = params[:province] if params[:province] != nil
ue.location_city = params[:city] if params[:city] != nil
ue.save
end
#end
end
end

View File

@ -94,7 +94,7 @@ class ApplicationController < ActionController::Base
Setting.check_cache
# Find the current user
User.current = find_current_user
logger.info(" Current user: " + (User.current.logged? ? "#{User.current.login} (id=#{User.current.id})" : "anonymous")) if logger
#logger.info(" Current user: " + (User.current.logged? ? "#{User.current.login} (id=#{User.current.id})" : "anonymous")) if logger
end
# Returns the current user or nil if no user is logged in
@ -300,7 +300,7 @@ class ApplicationController < ActionController::Base
render_404
end
#根据course_id找project
#<EFBFBD><EFBFBD><EFBFBD>course_id<EFBFBD><EFBFBD>project
def find_project_by_course_id
@bid = Bid.find params[:course_id]
@project = @bid.courses[0]
@ -354,7 +354,7 @@ class ApplicationController < ActionController::Base
end
#added by nwb
#获取课程
#<EFBFBD><EFBFBD>ȡ<EFBFBD>γ<EFBFBD>
def find_course
@course= Course.find(params[:id])
rescue ActiveRecord::RecordNotFound

View File

@ -59,6 +59,8 @@ class AttachmentsController < ApplicationController
:type => detect_content_type(@attachment),
:disposition => (@attachment.image? ? 'inline' : 'attachment')
end
rescue => e
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
end
#更新资源文件类型
@ -159,7 +161,13 @@ class AttachmentsController < ApplicationController
end
def autocomplete
@project = Project.find_by_id(params[:project_id])
# modify by nwb
if params[:project_id]
@project = Project.find_by_id(params[:project_id])
elsif params[:course_id]
@course = Course.find_by_id(params[:course_id])
end
respond_to do |format|
format.js
end
@ -195,6 +203,35 @@ class AttachmentsController < ApplicationController
end
end
def add_exist_file_to_course
class_id = params[:class_id]
attachments = params[:attachment][:attach]
obj = Course.find_by_id(class_id)
attachments.collect do |attach_id|
ori = Attachment.find_by_id(attach_id)
next if ori.blank?
attach_copied_obj = ori.copy
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj.container = obj
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
@obj = obj
@save_flag = attach_copied_obj.save
@save_message = attach_copied_obj.errors.full_messages
end
respond_to do |format|
format.js
end
rescue NoMethodError
@save_flag = false
@save_message = [] << l(:error_attachment_empty)
respond_to do |format|
format.js
end
end
private
def find_project
@attachment = Attachment.find(params[:id])

View File

@ -25,7 +25,7 @@ class AvatarController < ApplicationController
end
end
end
if @temp_file && (@temp_file.size > 0)
if @temp_file && (@temp_file.size > 0)
diskfile=disk_filename(@source_type,@source_id)
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)")
@ -55,7 +55,7 @@ class AvatarController < ApplicationController
# saved = @avatar.save
begin
f = Magick::ImageList.new(diskfile)
width = 300.0;
width = 300.0
proportion = (width/f[0].columns)
height = (f[0].rows*proportion)
f.resize_to_fill!(width,height)

View File

@ -3,6 +3,7 @@ class BidsController < ApplicationController
#Added by young
menu_item l(:label_homework), :only => [:edit, :udpate]
menu_item :respond
menu_item :course, :only => :show_courseEx
menu_item :project, :only => [:show_project,:show_results, :new_submit_homework]
menu_item :homework_respond, :only => :homework_respond
menu_item :homework_statistics, :only => :homework_statistics
@ -450,78 +451,87 @@ class BidsController < ApplicationController
# 显示作业课程
# add by nwb
def show_courseEx
# flash[:notice] = ""
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
@option = []
@membership.each do |membership|
membership.member_roles.each{|role|
if(role.role_id == 3)
@option << membership.course
end
}
end
@user = @bid.author
@bidding_project = @bid.biding_projects.all
if params[:student_id].present?
@temp = []
@bidding_project.each do |pro|
if pro.project && pro.project.project_status
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
@temp << pro
end
end
@temp
if (User.current.logged? && User.current.member_of_course?(@bid.courses.first))
# flash[:notice] = ""
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
@option = []
@membership.each do |membership|
membership.member_roles.each{|role|
if(role.role_id == 3)
@option << membership.course
end
}
end
@bidding_project = @temp
else
#added by nie
@temp = []
@bidding_project.each do |pro|
if pro.project && pro.project.project_status
@temp << pro
end
@temp
end
if @temp.size > 0
@bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
end
#ended
end
if @bid.homework_type == 1
@homework = HomeworkAttach.new
#@homework_list = @bid.homeworks
#增加作业按评分排序,
@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
@user = @bid.author
@bidding_project = @bid.biding_projects.all
if params[:student_id].present?
@temp = []
@homework_list.each do |pro|
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
@bidding_project.each do |pro|
if pro.project && pro.project.project_status
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
@temp << pro
end
end
@temp
end
@bidding_project = @temp
else
#added by nie
@temp = []
@bidding_project.each do |pro|
if pro.project && pro.project.project_status
@temp << pro
end
@temp
end
@homework_list = @temp
if @temp.size > 0
@bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
end
#ended
end
end
respond_to do |format|
if @bid.reward_type == 3
format.html {
render :layout => 'base_homework'
}
elsif @bid.reward_type == 1
format.html {
render :layout => 'base_bids'
}
else
format.html {
render :layout => 'base_contest'
}
if @bid.homework_type == 1
@homework = HomeworkAttach.new
#@homework_list = @bid.homeworks
#增加作业按评分排序,
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
@homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.author_id}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.author_id}) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY
(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{@bid.proportion * 1.0 / 100} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - @bid.proportion * 1.0 / 100} END) DESC,created_at ASC")
if params[:student_id].present?
@temp = []
@homework_list.each do |pro|
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
@temp << pro
end
@temp
end
@homework_list = @temp
end
end
format.api
respond_to do |format|
if @bid.reward_type == 3
format.html {
render :layout => 'base_homework'
}
elsif @bid.reward_type == 1
format.html {
render :layout => 'base_bids'
}
else
format.html {
render :layout => 'base_contest'
}
end
format.api
end
else
render_403 :message => :notice_not_authorized
end
end
@ -778,6 +788,7 @@ class BidsController < ApplicationController
@bid.name = params[:bid][:name]
@bid.description = params[:bid][:description]
@bid.is_evaluation = params[:bid][:is_evaluation]
@bid.proportion = params[:bid][:proportion]
@bid.reward_type = 3
# @bid.budget = params[:bid][:budget]
@bid.deadline = params[:bid][:deadline]
@ -800,6 +811,10 @@ class BidsController < ApplicationController
@homework = @bid
@course = Course.find_by_id(params[:course_id])
@course_id = @course.id
#respond_to do |format|
# format.html { redirect_to new_homework_course_path(params[:course_id]),:layout => 'base_courses'}
# format.api { render_validation_errors(@bid) }
#end
render file: 'courses/new_homework', layout: 'base_courses'
end
end

View File

@ -26,8 +26,11 @@ class ContestsController < ApplicationController
# @contests = Contest.visible
# @contests ||= []
@offset, @limit = api_offset_and_limit({:limit => 10})
@contests = Contest.visible
@contests = Contest.visible
@contests = @contests.like(params[:name]) if params[:name].present?
if params[:contests_search]
(redirect_to contests_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
end
@contest_count = @contests.count
@contest_pages = Paginator.new @contest_count, @limit, params['page']

View File

@ -5,6 +5,10 @@ class CoursesController < ApplicationController
helper :members
helper :words
menu_item :overview
menu_item :feedback, :only => :feedback
menu_item :homework, :only => :homework
menu_item l(:label_sort_by_time), :only => :index
menu_item l(:label_sort_by_active), :only => :index
menu_item l(:label_sort_by_influence), :only => :index
@ -95,7 +99,8 @@ class CoursesController < ApplicationController
# add by nwb
def search
courses_all = Course.all_course
name = params[:name]
(redirect_to courses_path, :notice => l(:label_sumbit_empty);return) if name.blank?
@courses = courses_all.visible
if params[:name].present?
@courses_all = @courses.like(params[:name])
@ -277,12 +282,11 @@ class CoursesController < ApplicationController
if @school_id == "0" or @school_id.nil?
@courses_all = Course.active.visible.
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id").
where("#{Course.table_name}.course_type = ? ", Course::CourseType_course)
else
@courses_all = Course.active.visible.
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id").
joins(:course_extra).
where("#{Course.table_name}.course_type = ? AND #{Course.table_name}.school_id = ?", Course::CourseType_course, @school_id)
where("#{Course.table_name}.school_id = ?", @school_id)
end
@course_count = @courses_all.count
@ -403,8 +407,7 @@ class CoursesController < ApplicationController
else
@courses_all = Course.active.visible.
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id").
joins(:course_extra).
where("#{Course.table_name}.course_type = ? AND #{Course.table_name}.school_id = ?", Course::CourseType_course, @school_id)
where("#{Course.table_name}.school_id = ?", @school_id)
end
@course_count = @courses_all.count
@ -485,19 +488,10 @@ class CoursesController < ApplicationController
# 新建作业
def new_homework
if (User.current.logged? &&
(User.current.admin? ||
(
!Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? &&
(
Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles &&
( Role.where(id: [3, 4, 7, 9]).size > 0 )
)
)
)
)
@homework = Bid.new
@homework.safe_attributes = params[:bid]
@homework = Bid.new
@homework.proportion
@homework.safe_attributes = params[:bid]
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
render :layout => 'base_courses'
else
render_404
@ -552,22 +546,47 @@ class CoursesController < ApplicationController
end
end
def get_courses
@user = User.current
membership = @user.coursememberships.all
membership.sort! {|older, newer| newer.created_on <=> older.created_on }
@memberships = []
membership.collect { |e|
@memberships.push(e)
}
@memberships_doing = []
@memberships_done = []
now_time = Time.now.year
@memberships.map { |e|
end_time = e.course.get_time.year
isDone = course_endTime_timeout?(e.course)
if isDone
@memberships_done.push e
else
@memberships_doing.push e
end
}
end
def finishcourse
yesterday = Date.today.prev_day.to_time
@course_prefs.endup_time = yesterday
@save_flag = @course_prefs.save
get_courses
respond_to do |format|
format.js
end
end
def restartcourse
day = Time.parse("3000-01-01")
@course_prefs.endup_time = day
@save_flag = @course_prefs.save
get_courses
respond_to do |format|
format.js {

View File

@ -129,6 +129,7 @@ class ForumsController < ApplicationController
format.html { redirect_to @forum, notice: l(:label_forum_create_succ) }
format.json { render json: @forum, status: :created, location: @forum }
else
flash.now[:error] = "#{l :label_forum_create_fail}: #{@forum.errors.full_messages[0]}"
format.html { render action: "new" }
format.json { render json: @forum.errors, status: :unprocessable_entity }
end
@ -165,6 +166,8 @@ class ForumsController < ApplicationController
def search_forum
# @forums = paginateHelper Forum.where("name LIKE '%#{params[:name]}%'")
name = params[:name]
(redirect_to forums_path, :notice => l(:label_sumbit_empty);return) if name.blank?
@offset, @limit = api_offset_and_limit({:limit => 10})
@forums_all = Forum.where("name LIKE '%#{params[:name]}%'")
@forums_count = @forums_all.count

View File

@ -1,4 +1,5 @@
class HomeworkAttachController < ApplicationController
include CoursesHelper
###############################
#判断当前角色权限时需先找到当前操作的project
before_filter :find_course_by_bid_id, :only => [:new]
@ -77,6 +78,15 @@ class HomeworkAttachController < ApplicationController
if bid.homeworks.where("user_id = ?",User.current).count == 0
user_id = params[:user_id]
bid_id = params[:bid_id]
if params[:homework_attach]
if params[:homework_attach][:project_id]
project_id = params[:homework_attach][:project_id]
else
project_id = 0
end
else
project_id = 0
end
sta = 0
name = params[:new_form][:name]
description = params[:new_form][:description]
@ -85,7 +95,8 @@ class HomeworkAttachController < ApplicationController
:state => sta,
:name => name,
:description => description,
:bid_id => bid_id
:bid_id => bid_id,
:project_id => project_id
}
@ -177,8 +188,18 @@ class HomeworkAttachController < ApplicationController
if User.current.admin? || User.current.member_of_course?(course)
name = params[:homework_name]
description = params[:homework_description]
if params[:homework_attach]
if params[:homework_attach][:project_id]
project_id = params[:homework_attach][:project_id]
else
project_id = 0
end
else
project_id = 0
end
@homework.name = name
@homework.description = description
@homework.project_id = project_id
if params[:attachments]
@homework.save_attachments(params[:attachments])
end
@ -237,6 +258,9 @@ class HomeworkAttachController < ApplicationController
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation is not null").order("created_on DESC")
@totle_score = score_for_homework @homework
@teaher_score = teacher_score_for_homework @homework
else
render_403 :message => :notice_not_authorized
end
@ -268,11 +292,24 @@ class HomeworkAttachController < ApplicationController
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation is not null").order("created_on DESC")
@totle_score = score_for_homework @homework
@teaher_score = teacher_score_for_homework @homework
respond_to do |format|
format.js
end
end
#教师综评
def comprehensive_evaluation_jour
@homework = HomeworkAttach.find(params[:jour_id])
@add_jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,params[:is_comprehensive_evaluation]
respond_to do |format|
format.html { redirect_to homework_attach_path @homework }
format.json { head :no_content }
end
end
#获取指定作业的平均得分
def score
#stars_reates = @homework.rates(:quality)

View File

@ -122,7 +122,7 @@ class MembersController < ApplicationController
user_ids = attrs.delete(:user_ids)
user_ids.each do |user_id|
members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)
#user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)
if (params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3")
course_info << CourseInfo.new(:user_id => user_id, :course_id => @course.id)
end

View File

@ -51,7 +51,10 @@ class MemosController < ApplicationController
@memo_new = @memo.dup
@memo = @memo.root # 取出楼主防止输入帖子id让回复作为主贴显示
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
unless @memo.new_record?
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
end
page = params[:page]
if params[:r] && page.nil?
@ -68,10 +71,14 @@ class MemosController < ApplicationController
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all
if @memo.new_record?
format.html { redirect_to back_url, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
else
format.html { render action: :show }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
# format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
format.json { render json: @memo.errors, status: :unprocessable_entity }
end
format.html { render action: :show }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
# format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
format.json { render json: @memo.errors, status: :unprocessable_entity }
end
end
end

View File

@ -68,6 +68,9 @@ class MessagesController < ApplicationController
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
redirect_to board_message_path(@board, @message)
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
end
end
end
@ -84,8 +87,11 @@ class MessagesController < ApplicationController
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments])
render_attachment_warning_if_needed(@reply)
else
#render file: 'messages#show', layout: 'base_courses'
end
redirect_to board_message_path(@board, @topic, :r => @reply)
end
# Edit a message

View File

@ -61,7 +61,7 @@ class MyController < ApplicationController
end
end
@se = @user.user_extensions ||= UserExtensions.new
@se = @user.extensions
@se.school_id = params[:occupation] if params[:occupation]
@se.gender = params[:gender]
@se.location = params[:province] if params[:province]

View File

@ -116,7 +116,7 @@ class NewsController < ApplicationController
flash[:notice] = l(:notice_successful_create)
redirect_to project_news_index_path(@project)
else
layout_file = (@project.project_type == 1) ? 'base_courses' : 'base_projects'
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
end
elsif @course

View File

@ -9,9 +9,12 @@ class PraiseTreadController < ApplicationController
if request.get?
@obj_id = params[:obj_id]
@obj_type = params[:obj_type]
@horizontal = params[:horizontal]
@horizontal = params[:horizontal].downcase == "false" ? false:true
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
praise_tread_plus(@obj_type,@obj_id,1)
unless @obj.author_id == User.current.id
praise_tread_plus(@obj_type,@obj_id,1)
end
end
end
@ -45,9 +48,12 @@ class PraiseTreadController < ApplicationController
if request.get?
@obj_id = params[:obj_id]
@obj_type = params[:obj_type]
@horizontal = params[:horizontal]
@horizontal = params[:horizontal].downcase == "false" ? false:true
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
praise_tread_plus(@obj_type,@obj_id,0)
unless @obj.author_id == User.current.id
praise_tread_plus(@obj_type,@obj_id,0)
end
end
end

View File

@ -42,7 +42,7 @@ class ProjectsController < ApplicationController
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
before_filter :file, :statistics, :watcherlist
before_filter :find_project_repository, :only => [:show]
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
before_filter :memberAccess, only: :member
@ -78,6 +78,14 @@ class ProjectsController < ApplicationController
### added by william
include ActsAsTaggableOn::TagsHelper
def find_project_repository
unless @project.repositories.nil?
@project.repositories.each do |repository|
repository.fetch_changesets if Setting.autofetch_changesets?
end
end
end
def enterprise_course
session[:enterprise_college] = 2
respond_to do |format|
@ -356,19 +364,10 @@ class ProjectsController < ApplicationController
#Added by young
def homework
@offset, @limit = api_offset_and_limit({:limit => 10})
@bids = @project.homeworks.order('deadline DESC')
@bids = @project.homeworks.order('deadline')
@bids = @bids.like(params[:name]) if params[:name].present?
@bid_count = @bids.count
@bid_pages = Paginator.new @bid_count, @limit, params['page']
@offset ||= @bid_pages.reverse_offset
#@bids = @bids.offset(@offset).limit(@limit).all.reverse
unless @offset == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
@bids = @bids.offset(@offset).limit(limit).all.reverse
end
@bids = paginateHelper @bids
render :layout => 'base_courses'
end
@ -915,11 +914,13 @@ class ProjectsController < ApplicationController
# added by bai
def show_projects_score
render :layout => false
end
def issue_score_index
respond_to do |format|
format.js
end
end
def news_score_index

View File

@ -568,7 +568,7 @@ class RepositoriesController < ApplicationController
project = Project.find(params[:id])
if !User.current.member_of?(project)
if project.hidden_repo
render_403
#render_403
end
end
rescue ActiveRecord::RecordNotFound

View File

@ -105,7 +105,7 @@ class SchoolController < ApplicationController
end
options = ""
@school.each do |s|
options << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
options << "<li style = 'width: 33%; float: left'> <a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
end
render :text => options

View File

@ -64,15 +64,18 @@ class TagsController < ApplicationController
@forum_tags_num, @attachments_tags_num, @open_source_projects_num = get_tags_size
# 获取搜索结果
@obj,@obj_pages,@results_count,@users_results,
@obj,
@obj_pages,
@results_count,
@users_results,
@projects_results,
@@courses_results,
@issues_results,
@bids_results,
@forums_results,
@attachments_results,
@contests_tags,
@open_source_projects_results = refresh_results(@obj_id,@obj_flag,@selected_tags)
@forums_results,
attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@obj_flag,@selected_tags)
# 这里是做tag推荐用的 用来生产推荐的tags
unless @obj.nil?
@ -97,14 +100,18 @@ class TagsController < ApplicationController
$related_tags.delete(@tag)
# 获取搜索结果
@obj,@obj_pages,@results_count,@users_results,
@obj,
@obj_pages,
@results_count,
@users_results,
@projects_results,
@@courses_results,
@issues_results,
@bids_results,
@forums_results,
@attachments_results,
@contests_results = refresh_results(@obj_id,@show_flag)
@forums_results,
attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
end
# 删除已选tag
@ -116,14 +123,18 @@ class TagsController < ApplicationController
$selected_tags.delete(@tag)
# 获取搜索结果
@obj,@obj_pages,@results_count,@users_results,
@obj,
@obj_pages,
@results_count,
@users_results,
@projects_results,
@@courses_results,
@issues_results,
@bids_results,
@forums_results,
@attachments_results,
@contests_results = refresh_results(@obj_id,@show_flag)
attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
end
def show_all
@ -256,14 +267,14 @@ class TagsController < ApplicationController
# 获取有某类对象的tag总数
def get_tags_size
@issues_tags_num = Issue.tag_counts.size
@projects_tags_num = Project.tag_counts.size
@users_tags_num = User.tag_counts.size
@bids_tags_num = Bid.tag_counts.size
forum_tags_num = Forum.tag_counts.size
attachment_tags_num = Attachment.tag_counts.size
@open_source_projects_num = OpenSourceProject.tag_counts.size
@contests_tags_num = Contest.tag_counts.size
@issues_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Issue").count
@projects_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Project").count
@users_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"User").count
@bids_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Bid").count
forum_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Forum").count
attachment_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Attachment").count
@open_source_projects_num = ActsAsTaggableOn::Tagging.where(taggable_type:"OpenSourceProject").count
@contests_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Contest").count
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num, @open_source_projects_num
end

View File

@ -32,12 +32,14 @@ class UsersController < ApplicationController
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index]
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score]
#edit has been deleted by huang, 2013-9-23
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index]
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index]
before_filter :auth_user_extension, only: :show
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
@ -50,6 +52,7 @@ class UsersController < ApplicationController
helper :custom_fields
include CustomFieldsHelper
include AvatarHelper
include WordsHelper
# added by liuping 关注
@ -92,7 +95,11 @@ class UsersController < ApplicationController
# added by bai
def show_score
end
def show_new_score
render :layout => false
end
# end
@ -229,7 +236,10 @@ class UsersController < ApplicationController
def user_newfeedback
@jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@jours.update_all(:is_readed => true, :status => false)
@jours.each do |journal|
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
end
@limit = 10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@ -363,7 +373,7 @@ class UsersController < ApplicationController
def search
sort_init 'login', 'asc'
sort_update %w(login firstname lastname mail admin created_on last_login_on)
(redirect_to users_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
case params[:format]
when 'xml', 'json'
@offset, @limit = api_offset_and_limit({:limit => 15})
@ -771,7 +781,30 @@ class UsersController < ApplicationController
end
# end
def topic_new_score_index
end
def project_new_score_index
end
def activity_new_score_index
end
def influence_new_score_index
end
def score_new_index
end
def update_score
@user = User.find(params[:id])
end
private
def find_user

View File

@ -30,6 +30,11 @@ class WelcomeController < ApplicationController
end
def course
if params[:school_id]
@school_id = params[:school_id]
elsif User.current.logged? && User.current.user_extensions.school
@school_id = User.current.user_extensions.school.try(:id)
end
@logoLink ||= logolink()
end
@ -75,8 +80,7 @@ class WelcomeController < ApplicationController
redirect_to projects_search_path(:name => search_condition,
:project_type => Project::ProjectType_project)
when :courses
redirect_to projects_search_path(:name => search_condition,
:project_type => Project::ProjectType_course)
redirect_to courses_search_path(:name => search_condition)
when :users
redirect_to users_search_path(:name => search_condition)
when :users_teacher
@ -84,7 +88,8 @@ class WelcomeController < ApplicationController
when :users_student
redirect_to users_search_path(:name => search_condition, :role => :student)
else
redirect_to home_path, :alert => l(:label_sumbit_empty)
#redirect_to home_path, :alert => l(:label_sumbit_empty)
(redirect_to home_path, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
end
}
end

View File

@ -56,7 +56,8 @@ class WordsController < ApplicationController
reply_user_id = params[:reference_user_id]
reply_id = params[:reference_message_id] # 暂时不实现
content = params[:user_notes]
options = {:user_id => author_id,
options = {:user_id => author_id,
:status => true,
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,

View File

@ -27,7 +27,7 @@ class ZipdownController < ApplicationController
else
logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!"
end
send_file zipfile, :filename => obj.name, :type => detect_content_type(zipfile) if zipfile
send_file zipfile, :filename => obj.name+".zip", :type => detect_content_type(zipfile) if zipfile
#rescue NameError, ActiveRecord::RecordNotFound => e
#logger.error "[ZipDown] ===> #{e}"
@ -39,7 +39,7 @@ class ZipdownController < ApplicationController
homework = HomeworkAttach.find params[:homework]
if homework != nil && (User.current.admin? || User.current.member_of_course?(homework.bid.courses.first))
zipfile = zip_homework_by_user homework
send_file zipfile, :filename => homework.name, :type => detect_content_type(zipfile) if zipfile
send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if zipfile
else
render_403 :message => :notice_not_authorized
end
@ -88,7 +88,7 @@ class ZipdownController < ApplicationController
#length = attach.storage_path.length
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
end
zipping "#{homeattach.user.name.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true
zipping "#{homeattach.user.name.to_s}_#{Time.now.to_i}.zip", homeworks_attach_path, OUTPUT_FOLDER, true
#user_attaches_paths
end

View File

@ -39,7 +39,9 @@ module ApplicationHelper
# REVIEW: 目测menu的机制貌似不是很需要转换再说
def link_class(label)
labels = label.is_a?(Array) ? label : ([] << label)
#a = current_menu_item
labels.include?(current_menu_item) ? 'selected' : ''
end
#Ended by young
# Return true if user is authorized for controller/action, otherwise false
@ -471,7 +473,11 @@ module ApplicationHelper
def principals_check_box_tags_ex(name, principals)
s = ''
principals.each do |principal|
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
if principal.has_attribute?(:userInfo)
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
else
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal}</label>\n"
end
end
s.html_safe
end

View File

@ -115,7 +115,7 @@ module AttachmentsHelper
s = content_tag('div', attachments_check_box_tags('attachment[attach][]', searched_attach), :id => 'attachments')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
link_to text, attachments_autocomplete_path( parameters.merge(:q => params[:q], :format => 'js')), :remote => true }
link_to text, attachments_autocomplete_path( parameters.merge(:project_id=>project.id,:q => params[:q], :format => 'js')), :remote => true }
return s + content_tag('div', content_tag('ul', links), :class => 'pagination')
@ -133,6 +133,35 @@ module AttachmentsHelper
# return searched_attach.to_json
end
# add by nwb
def render_attachments_for_new_course(course, limit=nil)
# 查询条件
params[:q] ||= ""
filename_condition = params[:q].strip
attachAll = Attachment.scoped
# 除去当前课程的所有资源
nobelong_attach = Attachment.where("!(container_type = '#{course.class}' and container_id = #{course.id})") unless course.blank?
# 搜索域确定
domain = course.nil? ? attachAll : nobelong_attach
# 搜索到的资源
searched_attach = domain.where("filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
searched_attach = private_filter searched_attach
searched_attach = paginateHelper(searched_attach, 10)
#testattach = Attachment.public_attachments
s = content_tag('div', attachments_check_box_tags('attachment[attach][]', searched_attach), :id => 'attachments')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
link_to text, attachments_autocomplete_path( parameters.merge(:course_id=>course.id,:q => params[:q], :format => 'js')), :remote => true }
return s + content_tag('div', content_tag('ul', links), :class => 'pagination')
end
def attachments_check_box_tags(name, attachs)
s = ''
attachs.each do |attach|
@ -144,18 +173,22 @@ module AttachmentsHelper
def private_filter resultSet
result = resultSet.to_a.dup
# modify by nwb
#添加对课程资源文件的判断
resultSet.map { |res|
if(res.container.nil? ||
(res.container.class.to_s=="Project" && res.container.is_public == false) ||
(res.container.has_attribute?(:project) && res.container.project.is_public == false) ||
(res.container.has_attribute?(:project) && res.container.project && res.container.project.is_public == false) ||
(res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
false
(res.container.class.to_s=="Course" && res.container.is_public == false) ||
(res.container.has_attribute?(:course) && res.container.course && res.container.course.is_public == false)
)
result.delete(res)
end
}
result
end
include Redmine::Pagination
def paginateHelper obj, pre_size=10
@obj_count = obj.count

View File

@ -0,0 +1,184 @@
#enconding:utf-8
# fq
module BidsHelper
def render_notes(bid, journal, options={})
content = ''
removable = User.current == journal.user || User.current == bid.author
links = []
if !journal.notes.blank?
links << link_to(image_tag('comment.png'),
{:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal},
:remote => true,
:method => 'post',
:title => l(:button_quote)) if options[:reply_links]
if removable
url = {:controller => 'bids',
:action => 'destroy',
:object_id => journal,
:id => bid}
links << ' '
links << link_to(image_tag('delete.png'), url,
:remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete))
end
end
content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty?
content << textilizable(journal.notes)
css_classes = "wiki"
content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
end
def link_to_in_place_notes_editor(text, field_id, url, options={})
onclick = "$.ajax({url: '#{url_for(url)}', type: 'get'}); return false;"
link_to text, '#', options.merge(:onclick => onclick)
end
# this method is used to get all projects that tagged one tag
# added by william
def get_bids_by_tag(tag_name)
Bid.tagged_with(tag_name).order('updated_on desc')
end
#added by huang
def sort_bid_enterprise(state, project_type)
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
when 1
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type)))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs_enterprise")
end
#end
def sort_bid(state, project_type)
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
when 1
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type)))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
end
#huang
def sort_contest(state)
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_active), contest_path(:contest_sort_type => '1')))
content << content_tag('li', link_to(l(:label_sort_by_time), contest_path(:contest_sort_type => '0'), :class=>"selected"), :class=>"selected")
when 1
content << content_tag('li', link_to(l(:label_sort_by_active), contest_path(:contest_sort_type => '1'), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_time), contest_path(:contest_sort_type => '0')))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
end
#end
def course_options_for_select(courses)
# <option value = '0'>#{l(:label_choose_reward)}</option>
html = ''
courses.each do |course|
html << "<option value = #{course.id}>"
html << course.name
html << "</option>"
end
html.html_safe
end
# used to get the reward and handle the value which can be used to display in views
# added by william
def get_prize(b_project)
b_project.get_reward
end
def count_bid_project
bids = Bid.where('parent_id = ?', @bid.id)
@projects = []
for bid in bids
@projects += bid.biding_projects
end
@projects.count
end
def count_bid_user
bids = Bid.where('parent_id = ?', @bid.id)
@users = []
for bid in bids
for project in bid.projects
@users += project.users
end
end
@users.count
end
# 查看学号
def im_watching_student_id? bid
people = []
people << bid.author
case bid.reward_type # 天煞的bid分了三用途里面各种hasmany还不定能用
when Bid::Enterprise
when Bid::Contest
bid.join_in_contests.each do |jic|
people << jic.user
end
when Bid::Homework
# people += bid.courses.first.users.to_a
people += searchTeacherAndAssistant(bid.courses.first).to_a
else
raise 'bids_helper: unknow bid type' # 出了错看这里!不知道的抛异常,省的找不到出错的地方!
end
people.include?(User.current)
end
# 当前用户是否加入了此课程(包括教师)
def is_cur_course_user? bid
people = []
#people << bid.author
course = bid.courses.first
course.members.each do |member|
people << member.user
end
people.include?(User.current)
end
<<<<<<< HEAD
=======
#当前用户是不是指定课程的学生
def is_cur_course_student? course
people = []
course.members.each do |member|
if [5,10].include? member.roles.first.id
people << member.user
end
end
people.include?(User.current)
end
>>>>>>> 8c33cf0afb89556112710759615cbd88bb0326f2
# def select_option_helper option
# tmp = Hash.new
# option.each do |project|
# tmp[project.name] = project.identifier
# end
# tmp
# end
def can_delete_project_homework bind_project,current_user
current_user.id == bind_project.user.id || current_user.admin
end
end

View File

@ -83,6 +83,19 @@ module CoursesHelper
type << option2
end
def proportion_option
type = []
i = 0
while i <= 100
option = []
option << i.to_s + "%"
option << i
type << option
i = i + 10
end
type
end
alias teacherCountOrigin teacherCount
def teacherCount project
@ -243,8 +256,8 @@ module CoursesHelper
people
end
# 截至到2014-03-17 这个是最终的判断课程是否过期的方法
def course_endTime_timeout? project
end_time_str = Course.find_by_extra(project.try(:extra)).try(:endup_time)
def course_endTime_timeout? course
end_time_str = course.try(:endup_time)
begin
cTime = Time.parse(end_time_str.to_s)
rescue TypeError,ArgumentError
@ -303,4 +316,76 @@ module CoursesHelper
def users_for_homework homework
homework.nil? ? [] : (homework.users + [homework.user])
end
#获取指定作业的最终评分
#最终评分 = 学生评分的平均分 * 0.4 +教师评分 * 0.6
def score_for_homework homework
if homework.bid.is_evaluation == 1 || homework.bid.is_evaluation == nil
return format("%.2f",(homework.bid.proportion * 1.0 / 100) * (teacher_score_for_homework(homework).to_f) + (1 - homework.bid.proportion * 1.0 / 100) * (student_score_for_homework(homework).to_f))
else
return teacher_score_for_homework homework
end
end
#获取作业的互评得分
def student_score_for_homework homework
member = searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
student_stars = homework.rates(:quality).where("rater_id <> #{member.user_id}").select("stars")
student_stars_count = 0
student_stars.each do |star|
student_stars_count = student_stars_count + star.stars
end
return format("%.2f",student_stars_count / (student_stars.count == 0 ? 1 : student_stars.count))
end
#获取作业的教师评分
def teacher_score_for_homework homework
member = searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
teacher_stars = homework.rates(:quality).where("rater_id = #{member.user_id}").select("stars").first
return format("%.2f",teacher_stars == nil ? 0 : teacher_stars.stars)
end
#获取指定项目的得分
def project_score project
issue_count = project.issues.count
issue_journal_count = project.issue_changes.count
issue_score = issue_count * 0.2
issue_journal_score = issue_journal_count * 0.1
finall_issue_score = issue_score + issue_journal_score
new_count = project.news.count
new_score = new_count * 0.1
finall_new_score = new_score
document_count = project.documents.count
file_score = document_count * 0.1
finall_file_score = file_score
changeset_count = project.changesets.count
code_submit_score = changeset_count * 0.3
finall_code_submit_score = code_submit_score
board_message_count = 0
project.boards.each do |board|
board_message_count += board.messages_count
end
topic_score = board_message_count * 0.1
#finall_topic_score = topic_score
finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score
format("%.2f",finall_project_score)
end
#获取指定作业的参与人员
#返回结果:张三、李四、王五
def homework_user_of_homework homework,is_teacher
homework_users = ""
homework.users.each do |user|
homework_users = homework_users + (is_teacher ? user.realname : user.name)
if user != homework.users.last
homework_users = homework_users + ""
end
end
return homework_users
end
def get_courses_by_tag(tag_name)
Course.tagged_with(tag_name).order('updated_at desc')
end
end

View File

@ -54,4 +54,24 @@ module HomeworkAttachHelper
raise RuntimeError, 'unknow type, Please input you type into this helper.'
end
end
def user_projects_option
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
memberships = User.current.memberships.all(:conditions => cond)
projects = memberships.map(&:project)
not_have_project = []
not_have_project << "<<NULL>>"
not_have_project << 0
type = []
type << not_have_project
projects.each do |project|
if project != nil
option = []
option << project.name
option << project.id
type << option
end
end
type
end
end

View File

@ -70,7 +70,7 @@ module JournalsHelper
content << textilizable(journal, :notes)
css_classes = "wiki"
css_classes << " editable" if editable
content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes ,:style => "width:580px")
end
def link_to_in_place_notes_editor(text, field_id, url, options={})

View File

@ -247,4 +247,15 @@ module UsersHelper
displayed_flag = %w|index|
!displayed_flag.include?(params['action'])
end
#获取指定用户的未过期的课程列表
def user_courses_list user
result = []
user.coursememberships.map(&:course).each do |course|
if !course_endTime_timeout?(course)
result << course
end
end
return result
end
end

View File

@ -67,6 +67,30 @@ module WatchersHelper
link_to text, url, :remote => true, :method => method, :class => css
end
# add by nwb
# 关注课程
def new_course_watcher_link(objects, user, options=[])
return '' unless user && user.logged?
objects = Array.wrap(objects)
watched = objects.any? {|object| object.watched_by?(user)}
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Contest)))
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
text = @watch_flag ?
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
url = watch_path(
:object_type => objects.first.class.to_s.underscore,
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
)
method = watched ? 'delete' : 'post'
link_to text, url, :remote => true, :method => method, :class => css
end
# added by fq, modify nyan
# Somebody may use option params
def join_in_course(course, user, options=[])

View File

@ -83,7 +83,8 @@ module WelcomeHelper
# # => 前7个项目为新课程后面三个是参与人数最多的
#
# Returns project&courses array
def find_miracle_course(sum=10, max_rate=7, school_id)
# 原来的取课程逻辑
def find_miracle_course_base(sum=10, max_rate=7, school_id)
if User.current.user_extensions.school.nil? and school_id.nil?
Project.active.visible.course_entities.
@ -133,6 +134,51 @@ module WelcomeHelper
# (c1.take(max)+c2).take(sum)
end
#获取课程列表
# add by nwb
def find_miracle_course(sum=10, max_rate=7, school_id)
if User.current.user_extensions.school.nil? and school_id.nil?
Course.active.visible.
joins(:memberships).
group('members.course_id').
reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum
else
if school_id.nil?
Course.active.visible.
joins(:memberships).
where("#{Course.table_name}.school_id = ?", User.current.user_extensions.school.id).
group('members.course_id').
reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum
else
if school_id == "0"
Course.active.visible.
joins(:memberships).
group('members.course_id').
reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum
else
Course.active.visible.
joins(:memberships).
where("#{Course.table_name}.school_id = ?", school_id).
group('members.course_id').
reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum
end
end
end
# else
# Project.active.visible.course_entities.
# joins(:course_extra).
# joins(:memberships).
# where("#{Course.table_name}.school_id = ?", school_id).
# group('members.project_id').
# reorder("courses.time DESC, COUNT(members.project_id) DESC").take sum
# end
# max = sum*(max_rate.to_f/10)
# c1 = find_new_course(sum).to_a.dup
# c2 = find_all_hot_course(sum).to_a.dup
# c2 = c2 - c1
# (c1.take(max)+c2).take(sum)
end
#查找所有学校按每个学校开设课程数量降序排序
#page 分页查询开始条数的编号,从0开始
#limit 分页查询的数量
@ -158,10 +204,11 @@ module WelcomeHelper
end
def find_miracle_project(sum, max_rate)
max = sum*(max_rate.to_f/10)
c1 = find_new_project(sum).to_a.dup
c2 = find_all_hot_project(sum).to_a.dup
(c2.take(sum-max)+c1.take(max)).take(sum)
#max = sum*(max_rate.to_f/10)
#c1 = find_new_project(sum).to_a.dup
#c2 = find_all_hot_project(sum).to_a.dup
#(c2.take(sum-max)+c1.take(max)).take(sum)
find_all_hot_project(sum).to_a.dup
end
def find_new_course limit=15
@ -181,11 +228,18 @@ module WelcomeHelper
sort_course_by_hot limit
end
# modif by nwb
def find_all_new_hot_course limit = 9 ,school_id = 0
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
time_now = Time.new.strftime("%Y");
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%' and #{Project.table_name}.identifier not in
(select extra from courses where school_id = ?)", 1,school_id).order("course_ac_para DESC").limit(limit).all
if school_id
courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <>
?", school_id).order("course_ac_para DESC").limit(limit).all
else
courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL
").order("course_ac_para DESC").limit(limit).all
end
courses
end
def find_all_hot_bid
@ -234,6 +288,7 @@ module WelcomeHelper
def show_grade project
grade = 0
begin
#ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();")#执行存储过程速度慢
grade = project.project_status.grade if project && project.project_status
rescue Exception => e
logger.error "Logger.Error [WelcomeHelper] ===> #{e}"
@ -332,7 +387,7 @@ module WelcomeHelper
end
#取得所有活动
def find_all_activities limit=6
def find_all_activities limit=6
# users = []
# activities = Activity.find_by_sql("select distinct user_id from activities order by id DESC limit #{limit}" )
# activities.each { |activity|

View File

@ -68,6 +68,106 @@ class Attachment < ActiveRecord::Base
before_save :be_user_score # user_score
after_destroy :delete_from_disk
# add by nwb
# 获取所有可公开的资源文件列表
scope :public_attachments, lambda {
#joins(Project.table_name).where("container_type = 'Project' and ")
joins("LEFT JOIN #{Project.table_name} ON #{Attachment.table_name}.container_type='Project' AND #{Project.table_name}.id = #{Attachment.table_name}.container_id and #{Project.table_name}.is_public=1 " +
" LEFT JOIN #{Document.table_name} ON #{Attachment.table_name}.container_type='Project' AND #{Document.table_name}.project_id in "+self.public_project_id +
" LEFT JOIN #{Issue.table_name} ON #{Attachment.table_name}.container_type='Project' AND #{Issue.table_name}.project_id in "+self.public_project_id +
" LEFT JOIN #{Version.table_name} ON #{Attachment.table_name}.container_type='Project' AND #{Version.table_name}.project_id in "+self.public_project_id +
" LEFT JOIN #{WikiPage.table_name} ON #{Attachment.table_name}.container_type='WikiPage' AND #{WikiPage.table_name}.parent_id in "+self.public_wiki_id +
" LEFT JOIN #{Message.table_name} ON #{Attachment.table_name}.container_type='Message' AND #{Message.table_name}.parent_id in "+self.public_board_id +
" LEFT JOIN #{Course.table_name} ON #{Attachment.table_name}.container_type='Course' AND #{Course.table_name}.is_public=1 " +
" LEFT JOIN #{News.table_name} ON #{Attachment.table_name}.container_type='News' AND (#{News.table_name}.project_id in "+self.public_project_id + " OR #{News.table_name}.course_id in " + self.public_course_id + ")" +
" LEFT JOIN #{HomeworkAttach.table_name} ON #{Attachment.table_name}.container_type='HomeworkAttach' AND #{HomeworkAttach.table_name}.bid_id in "+self.public_bid_id)
}
# add by nwb
# 公开的项目id列表
def self.public_project_id
idlist = "("
projects=Project.all_public
count = projects.count
for i in 0...count
project = projects[i]
idlist+="'" + project.id.to_s + "'"
if i != count-1
idlist+=","
end
end
idlist += ")"
idlist
end
# add by nwb
# 公开的课程id列表
def self.public_course_id
idlist = "("
courses=Course.all_public
count = courses.count
for i in 0...count
course = courses[i]
idlist+="'" + course.id.to_s + "'"
if i != count-1
idlist = idlist + ","
end
end
idlist += ")"
idlist
end
# add by nwb
# 公开的wiki id列表
def self.public_wiki_id
idlist = "("
wikis=Wiki.where("project_id in " + public_project_id)
count = wikis.count
for i in 0...count
wiki = wikis[i]
idlist+="'" + wiki.id.to_s + "'"
if i != count-1
idlist = idlist + ","
end
end
idlist += ")"
idlist
end
# add by nwb
# 公开的board id列表
def self.public_board_id
idlist = "("
boards=Board.where("project_id in " + public_project_id + " or course_id in " + public_course_id)
count = boards.count
for i in 0...count
board = boards[i]
idlist+="'" + board.id.to_s + "'"
if i != count-1
idlist = idlist + ","
end
end
idlist += ")"
idlist
end
# add by nwb
# 公开的bid id列表
def self.public_bid_id
idlist = "("
bids=Bid.where("reward_type=3")
count = bids.count
for i in 0...count
bid = bids[i]
idlist+="'" + bid.id.to_s + "'"
if i != count-1
idlist = idlist + ","
end
end
idlist += ")"
idlist
end
# Returns an unsaved copy of the attachment
def copy(attributes=nil)
copy = self.class.new
@ -129,7 +229,7 @@ class Attachment < ActiveRecord::Base
nil
end
def filename=(arg)
def filename=(arg)
write_attribute :filename, sanitize_filename(arg.to_s)
filename
end
@ -179,6 +279,7 @@ class Attachment < ActiveRecord::Base
File.join(self.class.storage_path, disk_directory.to_s, disk_filename.to_s)
end
#标题
def title
title = filename.to_s
if description.present?
@ -383,7 +484,7 @@ class Attachment < ActiveRecord::Base
type = self.container_type
types = %w|Document News Version Project Issue Message WikiPage|
if types.include?(type)
UserScore.project(:push_file, User.current, { attachment_id: self.id })
UserScore.project(:push_file, User.current,self, { attachment_id: self.id })
end
end
end

View File

@ -19,7 +19,7 @@ class Changeset < ActiveRecord::Base
belongs_to :repository
belongs_to :user
after_save :be_user_score # user_score
#after_save :be_user_score # user_score
has_many :filechanges, :class_name => 'Change', :dependent => :delete_all
# fq
@ -63,7 +63,7 @@ class Changeset < ActiveRecord::Base
includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args))
}
after_create :scan_for_issues
after_create :scan_for_issues,:be_user_score # user_score
before_create :before_create_cs
# fq
@ -98,7 +98,9 @@ class Changeset < ActiveRecord::Base
end
def project
repository.project
unless repository.nil?
repository.project
end
end
def author
@ -300,11 +302,9 @@ class Changeset < ActiveRecord::Base
# update user score
def be_user_score
if self.new_record?
UserScore.project(:push_code, self.user, { changeset_id: self.id })
UserScore.project(:push_code, self.user,self, { changeset_id: self.id })
#更新用户等级
self.user.update_user_level
end
UserLevels.update_user_level(self.user)
end
end

View File

@ -24,8 +24,9 @@ class Contest < ActiveRecord::Base
validates_length_of :name, :maximum => NAME_LENGTH_LIMIT
validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT
validates_presence_of :author_id, :name, :deadline
validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/
validates_presence_of :author_id, :name, :budget
#validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/
validates_format_of :deadline, :with =>/^[1-9][0-9]{3}\-0?[1-9]|1[12]\-0?[1-9]|[12]\d|3[01]$/
# validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
validate :validate_user
after_create :act_as_activity

View File

@ -27,15 +27,18 @@ class Course < ActiveRecord::Base
has_many :boards, :dependent => :destroy, :order => "position ASC"
#has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy
has_many :news, :dependent => :destroy, :include => :author
has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy
acts_as_taggable
acts_as_nested_set :order => 'name', :dependent => :destroy
acts_as_attachable :view_permission => :view_files,
:delete_permission => :manage_files
validates_presence_of :password, :term
validates_format_of :class_period, :message => "class period can only digital!", :with =>/^[1-9]\d*$/
validates_presence_of :password, :term,:name
validates_format_of :class_period, :with =>/^[1-9]\d*$/
validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
before_save :self_validate
after_save :create_board_sync
before_destroy :delete_all_members
@ -75,7 +78,7 @@ class Course < ActiveRecord::Base
where(nil)
else
pattern = "%#{arg.to_s.strip.downcase}%"
where("LOWER(extra) LIKE :p OR LOWER(name) LIKE :p ", :p => pattern)
where(" LOWER(name) LIKE :p ", :p => pattern)
end
}
@ -164,10 +167,8 @@ class Course < ActiveRecord::Base
end
#自定义验证
def validate
if !class_period.match([0-9])
errors.add_to_base("class period can only digital")
end
def self_validate
end
# 创建课程讨论区
@ -199,9 +200,11 @@ class Course < ActiveRecord::Base
# 删除课程所有成员
def delete_all_members
me, mr = Member.table_name, MemberRole.table_name
connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.course_id = #{id})")
Member.delete_all(['course_id = ?', id])
if self.members && self.members.count > 0
me, mr = Member.table_name, MemberRole.table_name
connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.course_id = #{id})")
Member.delete_all(['course_id = ?', id])
end
end
def get_endup_time
@ -271,4 +274,8 @@ class Course < ActiveRecord::Base
end
end
#项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题
def name
read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)
end
end

View File

@ -1,3 +1,7 @@
class CourseStatus < ActiveRecord::Base
attr_accessible :changesets_count, :course_ac_para, :course_id, :grade, :watchers_count
belongs_to :course
validates_presence_of :course_id
validates_uniqueness_of :course_id
end

View File

@ -21,7 +21,7 @@ class Document < ActiveRecord::Base
belongs_to :user
belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id"
before_save :be_user_score # user_score
after_create :be_user_score # user_score
acts_as_attachable :delete_permission => :delete_documents
@ -62,8 +62,6 @@ class Document < ActiveRecord::Base
# update user score
def be_user_score
if self.new_record?
UserScore.project(:push_document, self.user, { document_id: self.id })
end
UserScore.project(:push_document, self.user,self,{ document_id: self.id })
end
end

View File

@ -9,7 +9,7 @@ class Forum < ActiveRecord::Base
'memo_count',
'last_memo_id',
'creator_id'
validates_presence_of :name, :creator_id
validates_presence_of :name, :creator_id, :description
validates_length_of :name, maximum: 50
validates_length_of :description, maximum: 255
validates :name, :uniqueness => true

View File

@ -9,6 +9,7 @@ class HomeworkAttach < ActiveRecord::Base
has_many :homework_users, :dependent => :destroy
has_many :users, :through => :homework_users
seems_rateable :allow_update => true, :dimensions => :quality
belongs_to :project
safe_attributes "bid_id",
"user_id"
@ -30,7 +31,7 @@ class HomeworkAttach < ActiveRecord::Base
result
end
def project
def project_for_homework
work = HomeworkForCourse.find_by_bid_id(self.bid_id)
if work
work.project

View File

@ -76,8 +76,8 @@ class Issue < ActiveRecord::Base
attr_reader :current_journal
# fq
after_create :act_as_activity
before_save :be_user_score
after_create :act_as_activity,:be_user_score_new_issue
after_update :be_user_score
# after_create :be_user_score
# end
@ -990,13 +990,9 @@ class Issue < ActiveRecord::Base
end
def to_s
"#{tracker} ##{id}: #{subject}"
"#{tracker} ##{project_index}: #{subject}"
end
# 缺陷在项目中的序号
def inProjectIndex
(self.project.issues.index(self).to_i + 1).to_s
end
# Returns a string of css classes that apply to the issue
def css_classes
@ -1160,9 +1156,22 @@ class Issue < ActiveRecord::Base
"" << self.project.name.to_s <<
"#" << project_index
end
def project_index
(self.project.issues.index(self).to_i + 1).to_s
if self.project.issues.include?(self)
(self.project.issues.index(self).to_i + 1).to_s
else
issue_index = 1
self.project.issues.each do |issue|
if self.id == nil
issue_index = self.project.issues.count +1
break
elsif self.id > issue.id
issue_index = issue_index+1
end
end
issue_index.to_s
end
end
private
@ -1489,14 +1498,19 @@ class Issue < ActiveRecord::Base
# update user score
def be_user_score
if self.new_record?
UserScore.project(:post_issue, User.current, { issue_id: self.id })
elsif self.done_ratio_changed?
UserScore.project(:update_issue_ratio, User.current, { issue_id: self.id })
#缺陷完成度更新
if self.done_ratio_changed?
UserScore.project(:update_issue_ratio, User.current,self,{ issue_id: self.id })
end
#缺陷状态更改
elsif self.status_id_changed?
#协同得分
UserScore.joint(:change_issue_status, User.current,nil, {issue_id: self.id})
if self.status_id_changed?
#协同得分
UserScore.joint(:change_issue_status, User.current,nil,self, {issue_id: self.id})
end
end
#发布缺陷
def be_user_score_new_issue
UserScore.project(:post_issue, User.current,self, { issue_id: self.id })
end
end

View File

@ -29,7 +29,7 @@ class Journal < ActiveRecord::Base
# end
attr_accessor :indice
acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.inProjectIndex}#{status}: #{o.issue.subject}" },
acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.project_index}#{status}: #{o.issue.subject}" },
:description =>:notes,
:author => :user,
:group => :issue,
@ -45,10 +45,10 @@ class Journal < ActiveRecord::Base
before_create :split_private_notes
# fq
after_create :act_as_activity
after_create :act_as_activity,:be_user_score
# end
before_save :be_user_score
#before_save :be_user_score
#before_destroy :down_user_score
scope :visible, lambda {|*args|
@ -158,9 +158,9 @@ class Journal < ActiveRecord::Base
# 更新用户分数 -by zjc
def be_user_score
#新建了缺陷留言且留言不为空,不为空白
if self.new_record? && !self.notes.nil? && self.notes.gsub(' ','') != ''
if !self.notes.nil? && self.notes.gsub(' ','') != ''
#协同得分加分
UserScore.joint(:post_issue, User.current,self.issue.author, { message_id: self.id })
UserScore.joint(:post_issue_message, User.current,self.issue.author,self, { message_id: self.id })
end
end
# 减少用户分数 -by zjc
@ -168,7 +168,7 @@ class Journal < ActiveRecord::Base
#删除有效缺陷留言
if !self.notes.nil? && self.notes.gsub(' ','') != ''
#协同得分减分
UserScore.joint(:delete_issue, User.current,self.issue.author, { message_id: self.id })
UserScore.joint(:delete_issue_message, User.current,self.issue.author, { message_id: self.id })
end
end
end

View File

@ -15,8 +15,8 @@ class JournalsForMessage < ActiveRecord::Base
"m_reply_id" # 回复某留言的留言id(a留言回复了b留言这是b留言的id)
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
belongs_to :project,
:foreign_key => 'jour_id',
belongs_to :project,
:foreign_key => 'jour_id',
:conditions => "#{self.table_name}.jour_type = 'Project' "
belongs_to :course,
:foreign_key => 'jour_id',
@ -33,9 +33,13 @@ class JournalsForMessage < ActiveRecord::Base
:description => Proc.new{|o| o.notes },
:type => Proc.new {|o| o.jour_type },
:url => Proc.new {|o|
(o.jour.kind_of? Project) ? {:controller => 'projects', :action => 'feedback', :id => o.jour, :r => o.id, :anchor => "word_li_#{o.id}"} : {}
}#{:controller => 'documents', :action => 'show', :id => o.id}}
acts_as_activity_provider :author_key => :user_id,
if o.jour.kind_of? Project
{:controller => 'projects', :action => 'feedback', :id => o.jour, :r => o.id, :anchor => "word_li_#{o.id}"}
elsif o.jour.kind_of? Course
{:controller => 'courses', :action => 'feedback', :id => o.jour, :r => o.id, :anchor => "word_li_#{o.id}"}
end
}
acts_as_activity_provider :author_key => :user_id,
:timestamp => "#{self.table_name}.updated_on",
:find_options => {:include => :project }
@ -49,9 +53,9 @@ class JournalsForMessage < ActiveRecord::Base
validates :notes, presence: true
after_create :act_as_activity #huang
after_create :reset_counters!
after_create :reset_counters!,:be_user_score
after_destroy :reset_counters!
before_save :be_user_score
#before_save :be_user_score
#before_destroy :down_user_score
# default_scope { where('m_parent_id IS NULL') }
@ -113,12 +117,21 @@ class JournalsForMessage < ActiveRecord::Base
update_all("m_reply_count = #{count.to_i}", ["id = ?", journals_for_messages.m_parent_id])
end
#如果是在项目中留言则返回该项目否则返回nil - zjc
def project
if self.jour_type == 'Project'
Project.find(self.jour_id)
else
nil
end
end
# 更新用户分数 -by zjc
def be_user_score
#新建了留言回复
if self.new_record? && self.reply_id != 0
if self.reply_id != 0
#协同得分加分
UserScore.joint(:reply_message, User.current,User.find(self.reply_id), { journals_for_messages_id: self.id })
UserScore.joint(:reply_message, User.current,User.find(self.reply_id),self, { journals_for_messages_id: self.id })
end
end
# 更新用户分数 -by zjc

View File

@ -46,6 +46,8 @@ class Mailer < ActionMailer::Base
when :Project
return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
when :Course
course_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
when :Contest
show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
when :User
@ -54,9 +56,10 @@ class Mailer < ActionMailer::Base
Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}"
return -1
end
#如果是直接留言并且留言对象是Project并且Project类型是课程
if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Project && journals_for_message.jour.project_type == 1
project = journals_for_message.jour
# modify by nwb
#如果是直接留言并且留言对象是课程
if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course
course = journals_for_message.jour
@author = journals_for_message.user
#课程的教师
@teachers = searchTeacherAndAssistant journals_for_message.jour
@ -75,7 +78,12 @@ class Mailer < ActionMailer::Base
return -1
end
mail :to => journals_for_message.jour.author.mail, :subject => @title
else
elsif journals_for_message.jour.class.to_s.to_sym == :Contest
if !journals_for_message.jour.author.notify_about? journals_for_message
return -1
end
mail :to => journals_for_message.jour.author.mail, :subject => @title
else
mail :to => @mail.mail, :subject => @title
end
@ -88,8 +96,9 @@ class Mailer < ActionMailer::Base
# issue_add(issue) => Mail::Message object
# Mailer.issue_add(issue).deliver => sends an email to issue recipients
def issue_add(issue)
issue_id = issue.project_index
redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s,
'Issue-Id' => issue_id,
'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id issue
@ -100,7 +109,7 @@ class Mailer < ActionMailer::Base
cc = issue.watcher_recipients - recipients
mail :to => recipients,
:cc => cc,
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
end
# Builds a Mail::Message object used to email recipients of the edited issue.
@ -110,8 +119,9 @@ class Mailer < ActionMailer::Base
# Mailer.issue_edit(journal).deliver => sends an email to issue recipients
def issue_edit(journal)
issue = journal.journalized.reload
issue_id = issue.project_index
redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s,
'Issue-Id' => issue_id.to_s,
'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id journal
@ -120,7 +130,7 @@ class Mailer < ActionMailer::Base
recipients = journal.recipients
# Watchers in cc
cc = journal.watcher_recipients - recipients
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] "
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
s << issue.subject
@issue = issue

View File

@ -3,15 +3,16 @@ class Memo < ActiveRecord::Base
belongs_to :forum
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
validates_presence_of :author_id, :forum_id, :subject
validates_presence_of :author_id, :forum_id, :subject,:content
# 若是主题帖,则内容可以是空
validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
#validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
validates_length_of :subject, maximum: 50
validates_length_of :content, maximum: 3072
validate :cannot_reply_to_locked_topic, :on => :create
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"
acts_as_attachable
has_many :user_score_details, :class_name => 'UserScoreDetails',:as => :score_changeable_obj
belongs_to :last_reply, :class_name => 'Memo', :foreign_key => 'last_reply_id'
# acts_as_searchable :column => ['subject', 'content'],
# #:include => { :forum => :p}
@ -40,13 +41,13 @@ class Memo < ActiveRecord::Base
"parent_id",
"replies_count"
after_create :add_author_as_watcher, :reset_counters!
after_create :add_author_as_watcher, :reset_counters!,:be_user_score
# after_update :update_memos_forum
after_destroy :reset_counters!
# after_create :send_notification
# after_save :plusParentAndForum
# after_destroy :minusParentAndForum
before_save :be_user_score
#before_save :be_user_score
# scope :visible, lambda { |*args|
# includes(:forum => ).where()
# }
@ -145,11 +146,11 @@ class Memo < ActiveRecord::Base
#更新用户分数 -by zjc
def be_user_score
#新建memo且无parent的为发帖
if self.new_record? && self.parent_id.nil?
UserScore.joint(:post_message, User.current,nil, { memo_id: self.id })
if self.parent_id.nil?
UserScore.joint(:post_message, User.current,nil,self ,{ memo_id: self.id })
#新建memo且有parent的为回帖
elsif self.new_record? && !self.parent_id.nil?
UserScore.joint(:reply_posting, User.current,self.parent.author, { memo_id: self.id })
elsif !self.parent_id.nil?
UserScore.joint(:reply_posting, User.current,self.parent.author,self, { memo_id: self.id })
end
end

View File

@ -60,8 +60,8 @@ class Message < ActiveRecord::Base
after_destroy :reset_counters!
# fq
after_create :act_as_activity
before_save :be_user_score
after_create :act_as_activity,:be_user_score
#before_save :be_user_score
#before_destroy :down_user_score
# end
@ -147,11 +147,11 @@ class Message < ActiveRecord::Base
#更新用户分数 -by zjc
def be_user_score
#新建message且无parent的为发帖
if self.new_record? && self.parent_id.nil?
UserScore.joint(:post_message, User.current,nil, { message_id: self.id })
if self.parent_id.nil?
UserScore.joint(:post_message, User.current,nil,self, { message_id: self.id })
#新建message且有parent的为回帖
elsif self.new_record? && !self.parent_id.nil?
UserScore.joint(:reply_posting, User.current,self.parent.author, { message_id: self.id })
elsif !self.parent_id.nil?
UserScore.joint(:reply_posting, User.current,self.parent.author,self, { message_id: self.id })
end
end
#减少用户分数

View File

@ -2,7 +2,7 @@ class PraiseTread < ActiveRecord::Base
attr_accessible :user_id,:praise_tread_object_id,:praise_tread_object_type,:praise_or_tread
belongs_to :user
belongs_to :praise_tread_object, polymorphic: true
before_save :be_user_score
after_create :be_user_score
def self.find_object_by_type_and_id(type,id)
@obj = nil
@ -25,20 +25,30 @@ class PraiseTread < ActiveRecord::Base
return @obj
end
# 获取裁定对象为Message时Message所属的项目或课程
def project
project = nil
if self.praise_tread_object_type == 'Message'
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
project = obj.project
end
project
end
#更新用户分数 - by zjc
def be_user_score
#踩贴吧或讨论区帖子
if self.new_record? && self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Memo' || self.praise_tread_object_type == 'Message')
if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Memo' || self.praise_tread_object_type == 'Message')
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
target_user = obj.author
UserScore.skill(:treaded_by_user, User.current,target_user, { praise_tread_id: self.id })
UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
#顶贴吧或讨论区帖子
elsif self.new_record? && self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Memo' || self.praise_tread_object_type == 'Message')
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Memo' || self.praise_tread_object_type == 'Message')
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
target_user = obj.author
UserScore.skill(:praised_by_user, User.current,target_user,{ praise_tread_id: self.id })
UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
#更新用户等级
target_user.update_user_level
UserLevels.update_user_level(target_user)
end
end
end

View File

@ -30,6 +30,7 @@ class Project < ActiveRecord::Base
# Specific overidden Activities
belongs_to :homework_attach
has_many :time_entry_activities
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
has_many :memberships, :class_name => 'Member'
@ -40,7 +41,7 @@ class Project < ActiveRecord::Base
has_many :principals, :through => :member_principals, :source => :principal
has_many :enabled_modules, :dependent => :delete_all
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
has_many :issues, :dependent => :destroy, :include => [:status, :tracker]
has_many :issues, :dependent => :destroy, :include => [:status, :tracker] , :order => "id ASC"
has_many :issue_changes, :through => :issues, :source => :journals
has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC"
has_many :time_entries, :dependent => :delete_all
@ -112,6 +113,7 @@ class Project < ActiveRecord::Base
validates_presence_of :name, :identifier
validates_uniqueness_of :identifier
validates_uniqueness_of :name
validates_associated :repository, :wiki
# validates_length_of :description, :maximum => 255
validates_length_of :name, :maximum => 255

View File

@ -17,6 +17,6 @@ class ProjectInfo < ActiveRecord::Base
#更新用户等级
def update_user_level
self.user.update_user_level
UserLevels.update_user_level(self.user)
end
end

View File

@ -38,11 +38,11 @@ class Repository < ActiveRecord::Base
validates_length_of :password, :maximum => 255, :allow_nil => true
validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes, underscores but not digits only
validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :allow_blank => true
validates_format_of :identifier, :with => /^[a-zA-Z0-9_\-]+$/, :allow_blank => true
# Checks if the SCM is enabled when creating a repository
validate :repo_create_validation, :on => :create

View File

@ -164,7 +164,7 @@ class User < Principal
# Prevents unauthorized assignments
attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
LOGIN_LENGTH_LIMIT = 60
LOGIN_LENGTH_LIMIT = 25
MAIL_LENGTH_LIMIT = 60
validates_presence_of :login, :firstname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
@ -202,7 +202,8 @@ class User < Principal
where(nil)
else
pattern = "%#{arg.to_s.strip.downcase}%"
where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern)
#where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern)
where(" LOWER(login) LIKE :p ", :p => pattern)
end
}
@ -576,15 +577,16 @@ class User < Principal
# Find a user account by matching the exact login and then a case-insensitive
# version. Exact matches will be given priority.
#通过用户名查找相应的用户,若没有匹配到,则不区分大小写进行查询
#修改:不再匹配不区分大小写情况 -zjc
def self.find_by_login(login)
if login.present?
login = login.to_s
# First look for an exact match
user = where(:login => login).all.detect {|u| u.login == login}
unless user
# Fail over to case-insensitive if none was found
user = where("LOWER(login) = ?", login.downcase).first
end
#unless user
# # Fail over to case-insensitive if none was found
# user = where("LOWER(login) = ?", login.downcase).first
#end
user
end
end
@ -955,63 +957,6 @@ class User < Principal
end
end
#获取user的等级 -by zjc
def get_level
if self.level.nil?
update_user_level
end
self.level.level
end
#更新用户等级 - by zjc
def update_user_level
user_level = self.level.nil? ? UserLevels.new : self.level
user_level.user = self
#判断user的等级
pis = self.project_infos #ProjectInfo.find_all_by_user_id(self.id)
isManager = false;
pis.each do |pi|
#判断是否为项目管理员
if self.allowed_to?({:controller => "projects", :action => "edit"}, pi.project)
isManager = true;
end
end
has_effective_praise_count = false;
self.messages.each do |message|
if message.parent_id.nil?
ptcs = PraiseTreadCache.find_all_by_object_id(message.id)
ptcs.each do |ptc|
if ptc.object_type == 'Message' && ptc.praise_num.to_i > 5
has_effective_praise_count = true
end
end
end
end
if !has_effective_praise_count
self.memos do |memo|
if memo.parent_id.nil?
ptcs = PraiseTreadCache.find_all_by_object_id(memo.id)
ptcs.each do |ptc|
if ptc.object_type == 'Memo' && ptc.praise_num > 5
has_effective_praise_count = true
end
end
end
end
end
if isManager || self.changesets.count > 100
user_level.level = 3
elsif (self.changesets.count > 1 && self.changesets.count <= 100) || has_effective_praise_count
user_level.level = 2
else
user_level.level = 1
end
user_level.save
self.reload
end
protected
def validate_password_length

View File

@ -2,4 +2,37 @@ class UserGrade < ActiveRecord::Base
# attr_accessible :title, :body
attr_accessible :user_id, :project_id, :grade
belongs_to :project
before_save :correct_score
validates_uniqueness_of :user_id, :scope => [:project_id]
#validate :my_validation
#修正分数
#分数小于0时修正为0
#分数大于等于0时不修正 -by zjc
def correct_score
if !self.grade.nil? && self.grade < 0
self.grade = 0
end
end
#def self.exit_user_and_project(user,project)
# unless user.nil? || project.nil?
# if user.class.to_s == 'User' && project.class.to_s == 'Project'
# user_grade = UserGrade.find_by_user_id_and_project_id(user.id,project.id)
# user_grade
# else
# nil
# end
# else
# nil
# end
#end
#def my_validation
# if user_id.nil? || project_id.nil?
# errors[:Base] << "用户和项目不能为空"
# elsif UserGrade.exit_user_and_project(user_id,project_id)
# errors[:Base] << "当前记录已存在"
# end
#end
end

View File

@ -2,4 +2,67 @@
class UserLevels < ActiveRecord::Base
attr_accessible :user_id, :level
belongs_to :user
#获取user的等级 -by zjc
def self.get_level(user)
unless user.nil?
if user.level.nil?
UserLevels.update_user_level(user)
end
user.level.level
end
end
#更新用户的等级 -by zjc
def self.update_user_level(user)
unless user.nil?
user_level = user.level.nil? ? UserLevels.new : user.level
user_level.user = user
#判断user的等级
pis = user.project_infos #ProjectInfo.find_all_by_user_id(self.id)
isManager = false;
pis.each do |pi|
#判断是否为项目管理员
if user.allowed_to?({:controller => "projects", :action => "edit"}, pi.project)
isManager = true;
end
end
has_effective_praise_count = false;
user.messages.each do |message|
if message.parent_id.nil?
ptcs = PraiseTreadCache.find_all_by_object_id(message.id)
ptcs.each do |ptc|
if ptc.object_type == 'Message' && ptc.praise_num.to_i > 5
has_effective_praise_count = true
end
end
end
end
if !has_effective_praise_count
user.memos do |memo|
if memo.parent_id.nil?
ptcs = PraiseTreadCache.find_all_by_object_id(memo.id)
ptcs.each do |ptc|
if ptc.object_type == 'Memo' && ptc.praise_num > 5
has_effective_praise_count = true
end
end
end
end
end
if isManager || user.changesets.count > 100
user_level.level = 3
elsif (user.changesets.count > 1 && user.changesets.count <= 100) || has_effective_praise_count
user_level.level = 2
else
user_level.level = 1
end
user_level.save
user.reload
end
end
end

View File

@ -48,46 +48,79 @@ class UserScore < ActiveRecord::Base
# # => true #当前用户发帖计分操作成功
#
# Returns boolean. 返回积分保存结果
def self.joint(operate, current_user, target_user, options={})
def self.joint(operate, current_user, target_user,obj, options={})
current_user, target_user = get_users(current_user, target_user)
user_score = current_user.user_score_attr
user_grade = nil #项目个人得分
project = obj.project
unless project.nil?
user_grade = UserGrade.find_by_user_id_and_project_id(current_user.id, project.id)
if user_grade.nil?
user_grade = UserGrade.create(:user_id => current_user.id,:project_id => project.id)
end
end
case operate
when :post_message # current_user 发帖了 Add Message
user_score.collaboration = user_score.collaboration.to_i + 2
user_score.save
unless user_grade.nil?
user_grade.grade = user_grade.grade.to_i + 2
user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:score_type => "collaboration",:score_action => "post_message",:user_id => current_user.id,:old_score => user_score.collaboration - 2,:new_score => user_score.collaboration,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} posting a message. options => (#{options.to_s})"
when :delete_message # current_user 发帖了 Delete Message
user_score.collaboration = user_score.collaboration.to_i - 2
user_score.save
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} deleting a message. options => (#{options.to_s})"
when :post_issue # current_user 对 target_user 的缺陷留言了 Add Journal
#when :delete_message # current_user 删帖了 Delete Message
# user_score.collaboration = user_score.collaboration.to_i - 2
# user_score.save
# Rails.logger.info "[UserScore#joint] ===> User: #{current_user} deleting a message. options => (#{options.to_s})"
when :post_issue_message # current_user 对 target_user 的缺陷留言了 Add Journal
user_score.collaboration = user_score.collaboration.to_i + 1
user_score.save
unless user_grade.nil?
user_grade.grade = user_grade.grade.to_i + 1
user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "collaboration",:score_action => "post_issue_message",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} posting a issue. options => (#{options.to_s})"
when :delete_issue # current_user 删除了 对 target_user 的缺陷留言了 Delete Journal
user_score.collaboration = user_score.collaboration.to_i - 1
user_score.save
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} deleting a issue. options => (#{options.to_s})"
#when :delete_issue_message # current_user 删除了 对 target_user 的缺陷留言了 Delete Journal
# user_score.collaboration = user_score.collaboration.to_i - 1
# user_score.save
# Rails.logger.info "[UserScore#joint] ===> User: #{current_user} deleting a issue. options => (#{options.to_s})"
when :change_issue_status # current_user 更改了缺陷的状态 Changed Issue
user_score.collaboration = user_score.collaboration.to_i + 1
user_score.save
unless user_grade.nil?
user_grade.grade = user_grade.grade.to_i + 1
user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id , :score_type => "collaboration",:score_action => "change_issue_status",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} change issue status. options => (#{options.to_s})"
when :reply_message # current_user 对 target_user 留言的回复 Add Journals_for_messages
user_score.collaboration = user_score.collaboration.to_i + 1
user_score.save
unless user_grade.nil?
user_grade.grade = user_grade.grade.to_i + 1
user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "collaboration",:score_action => "reply_message",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} reply message. options => (#{options.to_s})"
when :reply_message_delete # current_user 删除了对 target_user 留言的回复 delete Journals_for_messages
user_score.collaboration = user_score.collaboration.to_i - 1
user_score.save
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} delete reply message. options => (#{options.to_s})"
#when :reply_message_delete # current_user 删除了对 target_user 留言的回复 delete Journals_for_messages
# user_score.collaboration = user_score.collaboration.to_i - 1
# user_score.save
# Rails.logger.info "[UserScore#joint] ===> User: #{current_user} delete reply message. options => (#{options.to_s})"
when :reply_posting # current_user 对 target_user 帖子的回复 Add Message
user_score.collaboration = user_score.collaboration.to_i + 1
user_score.save
unless user_grade.nil?
user_grade.grade = user_grade.grade.to_i + 1
user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "collaboration",:score_action => "reply_posting",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} reply posting. options => (#{options.to_s})"
when :reply_deleting # current_user 删除了 对 target_user 帖子的回复 Delete Message
user_score.collaboration = user_score.collaboration.to_i - 1
user_score.save
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} reply deleting. options => (#{options.to_s})"
#when :reply_deleting # current_user 删除了 对 target_user 帖子的回复 Delete Message
# user_score.collaboration = user_score.collaboration.to_i - 1
# user_score.save
# Rails.logger.info "[UserScore#joint] ===> User: #{current_user} reply deleting. options => (#{options.to_s})"
else
Rails.logger.error "[UserScore#joint] ===> #{operate} is not define."
return false
@ -106,17 +139,19 @@ class UserScore < ActiveRecord::Base
# # => true #当前被关注用户记分成功
#
# Returns boolean. 返回积分保存结果
def self.influence(operate, current_user, target_user, options={})
def self.influence(operate, current_user, target_user,obj, options={})
current_user, target_user = get_users(current_user, target_user)
user_score = target_user.user_score_attr
case operate
when :followed_by # current_user 关注了target_user Add watcher
user_score.influence = user_score.influence.to_i + 2
user_score.save
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "influence",:score_action => "followed_by",:user_id => target_user.id,:old_score => user_score.influence - 2,:new_score => user_score.influence,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.info "[UserScore#influence] ===> User: #{current_user} be followed. options => (#{options.to_s})"
when :cancel_followed # current_uer 取消了对 target_user的关注 delete watcher
user_score.influence = user_score.influence.to_i - 2
user_score.save
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "influence",:score_action => "cancel_followed",:user_id => target_user.id,:old_score => user_score.influence + 2,:new_score => user_score.influence,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.info "[UserScore#influence] ===> User: #{current_user} canceled followed. options => (#{options.to_s})"
else
Rails.logger.error "[UserScore#influence] ===> #{operate} is not define."
@ -136,46 +171,96 @@ class UserScore < ActiveRecord::Base
# # => true #当前current_user对target_user用户帖子的记分成功
#
# Returns boolean. 返回积分保存结果
def self.skill(operate, current_user, target_user, options={})
def self.skill(operate, current_user, target_user,obj, options={})
current_user, target_user = get_users(current_user, target_user)
current_user_score = current_user.user_score_attr
target_user_score = target_user.user_score_attr
current_user_grade = nil #项目个人得分
target_user_grade = nil
project = obj.project
unless project.nil?
current_user_grade = UserGrade.find_by_user_id_and_project_id(current_user.id, project.id)
target_user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
if current_user_grade.nil?
current_user_grade = UserGrade.create(:user_id => current_user.id,:project_id => project.id)
end
if target_user_grade.nil?
target_user_grade = UserGrade.create(:user_id => target_user.id,:project_id => project.id)
end
end
case operate
# when :treading # current_user 踩了 target_user 的帖子
# Rails.logger.info "[UserScore#skill] ===> User: #{current_user} treading #{target_user}'s posting. options => (#{options.to_s})"
when :treaded_by_user # current_user 踩了 target_user 的帖子
current_user_score.skill = current_user_score.skill.to_i - 2 #踩别人的帖子减2分 add praise_tread
current_user_score.save
unless current_user_grade.nil?
current_user_grade.grade = current_user_grade.grade - 2
current_user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => current_user.id,:old_score => current_user_score.skill + 2,:new_score => current_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
if current_user.id == target_user.id
target_user.reload
target_user_score = target_user.user_score_attr
unless target_user_grade.nil?
target_user_grade.reload
end
end
level = current_user.get_level
level = UserLevels.get_level(current_user)
if level == 1
target_user_score.skill = target_user_score.skill.to_i - 2 #帖子被一级会员踩-2分 add praise_tread
target_user_score.save
unless target_user_grade.nil?
target_user_grade.grade = target_user_grade.grade - 2
target_user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => target_user.id,:old_score => target_user_score.skill + 2,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
elsif level == 2
target_user_score.skill = target_user_score.skill.to_i - 4 #帖子被二级会员踩-4分 add praise_tread
target_user_score.save
unless target_user_grade.nil?
target_user_grade.grade = target_user_grade.grade - 4
target_user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => target_user.id,:old_score => target_user_score.skill + 4,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
elsif level == 3
target_user_score.skill = target_user_score.skill.to_i - 6 #帖子被三级会员踩-6分 add praise_tread
target_user_score.save
unless target_user_grade.nil?
target_user_grade.grade = target_user_grade.grade - 6
target_user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => target_user.id,:old_score => target_user_score.skill + 6,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
end
Rails.logger.info "[UserScore#skill] ===> User: #{current_user} treaded_by #{target_user}. options => (#{options.to_s})"
when :praised_by_user # current_user 顶了 target_user 的帖子
level = current_user.get_level
level = UserLevels.get_level(current_user)
if level == 1
target_user_score.skill = target_user_score.skill.to_i + 4 #帖子被一级会员顶+4分 add praise_tread
target_user_score.save
unless target_user_grade.nil?
target_user_grade.grade = target_user_grade.grade + 4
target_user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "praised_by_user",:user_id => target_user.id,:old_score => target_user_score.skill - 4,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
elsif level == 2
target_user_score.skill = target_user_score.skill.to_i + 6 #帖子被二级会员顶+6分 add praise_tread
target_user_score.save
unless target_user_grade.nil?
target_user_grade.grade = target_user_grade.grade + 6
target_user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "praised_by_user",:user_id => target_user.id,:old_score => target_user_score.skill - 6,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
elsif level == 3
target_user_score.skill = target_user_score.skill.to_i + 8 #帖子被三级会员顶+8分 add praise_tread
target_user_score.save
unless target_user_grade.nil?
target_user_grade.grade = target_user_grade.grade + 8
target_user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "praised_by_user",:user_id => target_user.id,:old_score => target_user_score.skill - 8,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
end
Rails.logger.info "[UserScore#skill] ===> User: #{current_user} praised_by #{target_user}. options => (#{options.to_s})"
else
Rails.logger.error "[UserScore#skill] ===> #{operate} is not define."
@ -195,30 +280,63 @@ class UserScore < ActiveRecord::Base
# # => true #当前current_user对项目贡献积分成功
#
# Returns boolean. 返回积分保存结果
def self.project(operate, current_user, options={})
def self.project(operate, current_user,obj, options={})
current_user, target_user = get_users(current_user, nil)
user_score = current_user.try(:user_score_attr)
user_grade = nil #项目个人得分
project = obj.project
unless project.nil?
user_grade = UserGrade.find_by_user_id_and_project_id(current_user.id, project.id)
if user_grade.nil?
user_grade = UserGrade.create(:user_id => current_user.id,:project_id => project.id)
end
end
return false if current_user.nil?
case operate
when :push_code # current_user 提交了代码 changeset
user_score = user_score.active.to_i + 4
user_score.save
unless user_grade.nil?
user_grade.grade = user_grade.grade + 4
user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "push_code",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.debug "[UserScore#project] ===> User: [#{current_user.id},#{current_user.name}] pushed code one time. options => (#{options.to_s})"
when :push_document # current_user
when :push_document # current_user 提交了文档 document
user_score.active = user_score.active.to_i + 4
user_score.save
unless user_grade.nil?
user_grade.grade = user_grade.grade + 4
user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "push_document",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.debug "[UserScore#project] ===> User: [#{current_user.id},#{current_user.name}] pushed a document. options => (#{options.to_s})"
when :push_file # current_user
when :push_file # current_user 提交了附件 attachment
user_score.active = user_score.active.to_i + 4
user_score.save
unless user_grade.nil?
user_grade.grade = user_grade.grade + 4
user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "push_file",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.debug "[UserScore#project] ===> User: [#{current_user.id},#{current_user.name}] pushed a file. options => (#{options.to_s})"
when :update_issue_ratio # current_user
when :update_issue_ratio # current_user 更新了缺陷完成度 issue
user_score.active = user_score.active.to_i + 2
user_score.save
unless user_grade.nil?
user_grade.grade = user_grade.grade + 2
user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "update_issue_ratio",:user_id => current_user.id,:old_score => user_score.active - 2,:new_score => user_score.active,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.debug "[UserScore#project] ===> User: [#{current_user.id},#{current_user.name}] updated issue ratio. options => (#{options.to_s})"
when :post_issue # current_user
when :post_issue # current_user 发布了缺陷 issue
user_score.active = user_score.active.to_i + 4
user_score.save
unless user_grade.nil?
user_grade.grade = user_grade.grade + 4
user_grade.save
end
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "post_issue",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
Rails.logger.debug "[UserScore#project] ===> User: [#{current_user.id},#{current_user.name}] posting issue. options => (#{options.to_s})"
else
Rails.logger.error "[UserScore#project] ===> #{operate} is not define."
@ -228,6 +346,44 @@ class UserScore < ActiveRecord::Base
Rails.logger.error "[UserScore#project] ===> Exception: #{e}."
end
#获取用户的user_score
def self.score(user)
if user.user_score.nil?
us = UserScore.new
us.user_id = user.id
us.save
us
else
user.user_score
end
end
#计算总得分
def total_score
score = self.influence.to_i + self.skill.to_i + self.collaboration.to_i + self.active.to_i
score
end
#创建分数改变记录 -by zjc
def self.create_score_changed_details(attributes)
if attributes.is_a? Hash
usd = UserScoreDetails.new
usd.current_user_id =attributes[:current_user_id]
usd.target_user_id = attributes[:target_user_id]
usd.score_type = attributes[:score_type]
usd.score_action = attributes[:score_action]
usd.user_id = attributes[:user_id]
usd.old_score = attributes[:old_score]
usd.new_score = attributes[:new_score]
usd.current_user_level = attributes[:current_user_level]
usd.target_user_level = attributes[:target_user_level]
#usd.score_changeable_obj = attributes[:score_changeable_obj]
usd.score_changeable_obj_id = attributes[:score_changeable_obj_id]
usd.score_changeable_obj_type = attributes[:score_changeable_obj_type]
usd.save
end
end
private
def self.get_users(current_user, target_user)

View File

@ -0,0 +1,4 @@
class UserScoreDetails < ActiveRecord::Base
attr_accessible :current_user_id, :current_user_level, :new_score, :old_score, :score_action, :score_changeable_obj_id, :score_changeable_obj_type, :score_type, :target_user_id, :target_user_level, :user_id
belongs_to :score_changeable_obj,:polymorphic => true
end

View File

@ -22,7 +22,7 @@ class Watcher < ActiveRecord::Base
has_one :project_status
has_one :users_status
#end
before_save :be_user_score
after_create :be_user_score
before_destroy :down_user_score
validates_presence_of :user
@ -76,9 +76,9 @@ class Watcher < ActiveRecord::Base
# 更新用户分数 -by zjc
def be_user_score
#添加了关注
if self.new_record? && self.watchable_type == 'Principal'
if self.watchable_type == 'Principal'
#影响力得分
UserScore.influence(:followed_by, self.user,self.watchable, { watcher_id: self.id })
UserScore.influence(:followed_by, self.user,self.watchable,self, { watcher_id: self.id })
end
end
@ -86,7 +86,7 @@ class Watcher < ActiveRecord::Base
def down_user_score
#取消关注
if self.watchable_type == 'Principal'
UserScore.influence(:cancel_followed, self.user,self.watchable, { watcher_id: self.id })
UserScore.influence(:cancel_followed, self.user,self.watchable,self, { watcher_id: self.id })
end
end

View File

@ -24,7 +24,8 @@
<% end %>
<% end %>
<% if options[:author] %>
<span class="author"><%= h(attachment.author) %>, <%= format_time(attachment.created_on) %></span>
<!-- modified by zjc author添加超链接 -->
<span class="author"><%= link_to h(attachment.author),user_path(attachment.author) %>, <%= format_time(attachment.created_on) %></span>
<% end %>
</p>
<% end %>

View File

@ -0,0 +1,17 @@
<% if @save_flag %>
window.location.reload();
<% else %>
// alert('添加文件失败:\n<%=@save_message[0]%>');
$('#ajax-modal').html('<h3 class="title">添加文件失败</h3><%=@save_message.join(', ')%>');
var el = $('#ajax-modal').first();
var title = el.find('h3.title').text();
el.dialog({
width: '200px',
modal: true,
resizable: false,
dialogClass: 'modal',
title: title
});
<% end %>

View File

@ -1,2 +1,7 @@
$('#relation_file_form').show();
<% if @project%>
$('#relation_file').html('<%=render_attachments_for_new_project(@project, nil)%>');
<% elsif @course%>
$('#relation_file').html('<%=render_attachments_for_new_course(@course, nil)%>');
<% end%>

View File

@ -42,17 +42,17 @@
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
</div>
</span>
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
<span><%= l(:button_upload_photo) %></span>
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
<span><%= l(:button_upload_photo) %></span>
</a>
<span class="add_avatar" style="margin-left: -55px;width: 70px">
<span class="add_avatar" style="margin-left: -55px;width: 70px">
<%= file_field_tag 'avatar[image]',
:id => nil,
:class => 'file_selector',
:style => 'width:70px;',#added by young
:size => "1",
:multiple => false,
:onchange => 'addInputAvatar(this);',
:onchange => 'addInputAvatar(this);',
: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)),
@ -61,7 +61,7 @@
:description_placeholder => nil ,# l(:label_optional_description)
:source_type => source.class.to_s,
:source_id => source.id.to_s
} %>
} %>
</span>
</div>
<% content_for :header_tags do %>

View File

@ -0,0 +1,24 @@
<table style="width: 200px;table-layout: fixed" >
<tr>
<% count = 0 %>
<% for attachment in attachments %>
<% if attachments.count == 1 %>
<td title="<%= attachment.filename%>" style="width: 200px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= render :partial => 'attachment', :locals => {:attachment => attachment} %>
</td>
<% elsif attachments.count == 2 %>
<td title="<%= attachment.filename%>" style="width: 100px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= render :partial => 'attachment', :locals => {:attachment => attachment} %>
</td>
<% else %>
<td title="<%= attachment.filename%>" style="width: 66px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<% if count == 3 %>
<% break %>
<% end %>
<%= render :partial => 'attachment', :locals => {:attachment => attachment} %>
<% count = count +1 %>
</td>
<% end %>
<% end %>
</tr>
</table>

View File

@ -0,0 +1,6 @@
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments', :action => 'show',
:id => attachment, :filename => attachment.filename,:style => "width:50px"%>
<% end %>

View File

@ -15,7 +15,7 @@
<span style="float: right">
<% if(User.current.logged? && (!Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)) %>
<%# 提交作业按钮 %>
<!--<%= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@course) %>-->
<!--<%#= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@course) %>-->
<% cur_user_homework = cur_user_homework_for_bid(bid) %>
<% if cur_user_homework!= nil && cur_user_homework.count == 0 %>
<%= link_to l(:label_commit_homework),new_homework_attach_path(bid) %>
@ -41,19 +41,19 @@
</tr>
<tr>
<td colspan="2"><span class="font_lighter">
<% @bidding_project = bid.biding_projects.all
@temp = []
@bidding_project.each do |pro|
<% bidding_project = bid.biding_projects.all
temp = []
bidding_project.each do |pro|
if pro.project && pro.project.project_status
@temp << pro
temp << pro
end
@temp
temp
end
%>
<% if bid.homework_type == 1%>
<%= l(:label_x_homework_project, :count => bid.homeworks.count) %>(<strong><%= link_to bid.homeworks.count, course_for_bid_path(bid.id) %></strong>)
<% else %>
<%= l(:label_x_homework_project, :count => @temp.count) %>(<strong><%= link_to @temp.count, course_for_bid_path(bid.id) %></strong>)
<%= l(:label_x_homework_project, :count => temp.count) %>(<strong><%= link_to temp.count, course_for_bid_path(bid.id) %></strong>)
<% end %></span>
<span class="font_lighter"><%= l(:label_x_responses, :count => bid.commit) %>(<strong><%= link_to bid.commit, respond_path(bid) %></strong>)</span>
<span style="float: right">
@ -70,11 +70,11 @@
</td>
</tr>
<tr>
<td colspan="2"> <% if bid.reward_type.nil? or bid.reward_type == 1 %> <strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_call_bonus) %>&nbsp;<%= l(:label_RMB_sign) %>
<%= bid.budget%></span></strong> <% elsif bid.reward_type == 2 %> <strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= bid.budget%></span></strong>
<td colspan="2"> <% if bid.reward_type.nil? or bid.reward_type == 1 %> <strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: '微软雅黑'"><%= l(:label_call_bonus) %>&nbsp;<%= l(:label_RMB_sign) %>
<%= bid.budget%></span></strong> <% elsif bid.reward_type == 2 %> <strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family:' 微软雅黑'"><%= bid.budget%></span></strong>
<% else %>
<% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%></strong></td> --></td>
<% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%#= l(:label_price) %><%#= l(:label_RMB_sign) %><%#= bid.budget%></strong></td> --></td>
</tr>
<tr>
<td colspan="2" width="580px" ><span class="font_description">
@ -83,18 +83,18 @@
</span></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"><span> <%= l(:label_create_time) %> :&nbsp; <%=format_time bid.created_on %></span><span style="float: right"> <%= l(:field_deadline) %> :&nbsp; <%=bid.deadline %></span></td>
<td></td>
</tr>
<td style="text-align: left">
<span class="font_lighter">
<%= l(:label_create_time) %> :&nbsp; <%=format_time bid.created_on %></span><span style="float: right"> <%= l(:field_deadline) %> :&nbsp; <%=bid.deadline %>
</span></td>
<td></td>
</tr>
</table></td>
</tr>
</table>
<% end %>
<% end %>
<div class="pagination">
<ul>
<%= pagination_links_full bid_pages %>
<ul>
<%= pagination_links_full bid_pages %>
</div>

View File

@ -13,7 +13,34 @@
<td width="500">
<table border="0">
<tr>
<td> <% if bid.reward_type.nil? or bid.reward_type == 1%> <strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_call_bonus) %>&nbsp;<%= l(:label_RMB_sign) %><%= bid.budget%></span></strong> <% elsif bid.reward_type == 2%> <strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= bid.budget%></span></strong> <% else %> <!-- <strong><%= l(:label_bids_reward_method) %><span style="color: #00aa83;font-family: 14px; font-family: 微软雅黑"><%= l(:label_bids_credit) %>&nbsp;<%= bid.budget%>&nbsp;<%= l(:label_bids_credit_number) %></span></strong> --> <% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%></strong></td> --></td>
<td>
<% if bid.reward_type.nil? or bid.reward_type == 1%>
<strong>
<%= l(:label_bids_reward_method) %>
<span style="color: #ed8924;font-family: 14px; font-family: '微软雅黑'">
<%= l(:label_call_bonus) %>&nbsp;
<%= l(:label_RMB_sign) %>
<%= bid.budget%>
</span>
</strong>
<% elsif bid.reward_type == 2%>
<strong>
<%= l(:label_bids_reward_method) %>
<span style="color: #15bccf;font-family: 14px; font-family: '微软雅黑'"><%= bid.budget%></span>
</strong>
<% else %> <!-- <strong>
<%#= l(:label_bids_reward_method) %>
<span style="color: #00aa83;font-family: 14px; font-family: 微软雅黑">
<%#= l(:label_bids_credit) %>&nbsp;
<%#= bid.budget%>&nbsp;
<%#= l(:label_bids_credit_number) %>
</span></strong> -->
<% end %>
<!-- <td style="color: rgb(255, 0, 0);">
<strong>
<%#= l(:label_price) %>
<%#= l(:label_RMB_sign) %>
<%#= bid.budget%></strong></td> --></td>
</tr>
<% if bid.reward_type == 3 %>
<tr>
@ -60,6 +87,6 @@
<div class="pagination">
<ul>
<%= pagination_links_full bid_pages %>
<ul>
</ul>
</div>

View File

@ -21,22 +21,48 @@
$.globalEval(submit_homework());
return false;
}
function show()
{
$("#what_is_project_div").slideToggle();
}
</script>
</div>
<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? &&
(Member.where('user_id = ? and project_id = ?', User.current.id,
@bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) && cur_user_homework_for_bid(@bid).count == 0 %>
<% if User.current.logged? && User.current.member_of_course?(@bid.courses.first) && cur_user_homework_for_bid(@bid).count == 0 && is_cur_course_student(@bid.courses.first) %>
<div class='icon icon-add'>
<!-- <%= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %> -->
<%= link_to l(:label_course_new_homework),new_homework_attach_path %>
<%#= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %>
<%= link_to l(:label_course_new_homework),new_homework_attach_path %><strong style="color: #a9a9a9">&nbsp;&nbsp;(每一个作业都可以是一个精美的作品)</strong>
</div>
<% end %>
<% if @homework_list.empty? %>
<div class="font_lighter_sidebar" style="padding-left: 10px">
暂无学生提交作业!
</div>
<% end %>
<table style="width: 100%">
<tr>
<td style="width: 50%">
<% if @homework_list.empty? %>
<div class="font_lighter_sidebar" style="padding-left: 10px;">
<span>暂无学生提交作业!</span>
</div>
<% end %>
</td>
<td style="width: 50%">
<div class="font_lighter_sidebar" style="padding-left: 200px;">
<strong><a href="#" onclick="show()" style="color:#919294;">什么是项目?</a></strong>
</div>
</td>
</tr>
<tr>
<td style="width: 50%">
</td>
<td style="width: 50%">
<div id = "what_is_project_div" style="display: none">
<p>项目是一种由用户创建的基于网络的协作空间,能够为个人或小组提供分布式的协同交流和资料管理等方面的支持。</p>
<p>项目托管平台:<%= link_to Setting.protocol + "://" + Setting.host_name + "/", home_path %> </p>
<%= link_to "我要创建项目",new_project_path(course: 0, project_type: 0), :target => '_blank'%>
</div>
</td>
</tr>
</table>
<div id='bidding_project_list'>
<%= render :partial => 'homework_list', :locals => {:homework => @homework_list} %>

View File

@ -1,6 +1,6 @@
<!-- fq -->
<% is_student = is_cur_course_student(@bid.courses.first) %>
<% is_teacher = is_course_teacher User.current,@bid.courses.first %>
<% is_teacher = is_course_teacher(User.current,@bid.courses.first) %>
<!-- 当is_evaluation为1或者null(null主要是为了兼容前面数据)时代表启用互评功能2表示未启用 -->
<% is_evaluation = @bid.is_evaluation == 1 || @bid.is_evaluation == nil %>
<%= form_tag(:controller => 'bids', :action => "show_courseEx", :method => :get) do %>
@ -8,18 +8,19 @@
<table width="100%" valign="center">
<tr>
<td ><span style="margin-left:0px"><%= l(:label_task_plural)%>(<%= @homework_list.count%>)</span>
<%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if(
<%#= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if(
User.current.admin? ||
!(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) ||
(Rails.env.development?) %>
</td>
</td>
<td align="right">
<div class="project-search">
<% if is_teacher %>
<%= text_field_tag 'student_id', params[:student_id], :size => 30 %>
<%= submit_tag l(:label_search_by_student_id), :class => "small", :name => nil %>
<% end %>
</div></td>
<div class="project-search">
<% if is_teacher %>
<%= text_field_tag 'student_id', params[:student_id], :size => 30 %>
<%= submit_tag l(:label_search_by_student_id), :class => "small", :name => nil %>
<% end %>
</div>
</td>
</tr>
</table>
</div>
@ -28,76 +29,121 @@
<% @homework_list.each do |homework|%>
<table width="660px" border="0" align="center" id="homework_attach_<%= homework.id %>" >
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>
<td>
<table width="580px" border="0">
<tr>
<td style="width: 300px;">
&nbsp;&nbsp;<strong>作业&nbsp;&nbsp; :</strong>&nbsp;
<% if homework.name == nil || homework.name == "" %>
<% attachments = homework.attachments.map %>
<% for attachment in attachments %>
<% if attachments.count > 1 %>
<% homework_filename = attachment.filename + "等" + attachments.count.to_s + "个文件" %>
<% else %>
<% homework_filename = attachment.filename %>
<% end %>
<% end %>
<% else %>
<% homework_filename = homework.name %>
<td style="vertical-align: top;width: 70px" >
<table style="text-align: center;width: 100%;table-layout: fixed">
<tr>
<td title="<%= homework.user.name %>"><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>
</tr>
<tr>
<td title="<%= homework.user.name %>">
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><strong>
<%= link_to (is_teacher ? homework.user.realname : homework.user ), user_path(homework.user),{:style => "color:#727272"} %>
</strong></p>
</td>
</tr>
<tr>
<td>
<% if (users_for_homework(homework).include?(User.current) || is_teacher) %>
<%= link_to l(:button_edit), edit_homework_attach_path(homework) %>
<% if homework.user == User.current || is_teacher %>
<%= link_to(l(:label_bid_respond_delete), homework,
method: :delete, :confirm => l(:text_are_you_sure)) %>
<% end %>
<strong>
<% if is_evaluation || is_teacher%>
<%= link_to homework_filename, :controller => "zipdown", :action => "download_user_homework",:homework => homework%>
<% else %>
<%= homework_filename %>
<% end %>
</strong>
</td>
<td style="vertical-align: top">
<% if is_student %>
<% if is_evaluation %>
<%= link_to "互评>>" , homework_attach_path(homework)%>
<% else %>
<%= link_to "查看详细" , homework_attach_path(homework)%>
<% end %>
<% else %>
<% if is_teacher %>
<%= link_to "综评>>" , homework_attach_path(homework)%>
<% end %>
<% end %>
</td>
</tr>
<tr>
<td colspan="1" valign="top" style="width: 300px">&nbsp;
<strong>发布人:&nbsp; <%= link_to ( is_teacher ? homework.user.realname : homework.user ), user_path(homework.user)%></strong>
</td>
<td>
<strong>作业评分:</strong>
<% end %>
</td>
</tr>
</table>
<span></span>
</td>
<td colspan="2">
<table width="580px" border="0" style="table-layout: fixed">
<tr>
<td style="width: 300px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<strong>作品名称:</strong>&nbsp;
<% if homework.name == nil || homework.name == "" %>
<% homework_filename = homework.user.name + "提交的作业" %>
<% else %>
<% homework_filename = homework.name %>
<% end %>
<strong title="<%=homework_filename%>">
<%= link_to homework_filename , homework_attach_path(homework)%>
</strong>
</td>
<td style="vertical-align: top;width: 200px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<strong>合作成员:&nbsp;</strong>
<% homework_users = homework_user_of_homework(homework,is_teacher) %>
<% if homework.users.count == 0 %>
<% else %>
<span title="<%= homework_users%>"><%= homework_users %></span>
<% end %>
</td>
<td rowspan="4" style="text-align: center;vertical-align: middle;width: 30px">
<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.created_at.to_s) %>
<span class="required">迟交</span>
<% end %>
</td>
</tr>
<%= format("%.2f", homework.rate_averages.first.try(:avg).to_f ) %>
</td>
<td valign="top" align="right">
<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.created_at.to_s) %>
<span class="required">迟交</span>
<% end %>
</td>
</tr>
<tr>
<td>
<strong>开发项目</strong>:&nbsp;
<% if homework.project != nil %>
<%= link_to homework.project.name,project_path(homework.project.id)%>
<% else %>
暂无
<% end %>
</td>
<td>
<strong>项目得分:&nbsp;
<span style="color: <%= homework.project.nil? ? "#727272" : "#EC6300"%>;">
<%= homework.project.nil? ? "N/A" : project_score(homework.project) %>
</span>
</strong>
</td>
</tr>
<tr>
<td>
<strong>提交文件:&nbsp;
<% if is_evaluation || is_teacher%>
<%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework%>
<% else %>
<span class="required">未开启互评功能作业不允许下载</span>
<% end %>
</strong>
</td>
<td>
<strong>互评得分:&nbsp;
<% student_homework_score = student_score_for_homework(homework) %>
<span style="color:<%= student_homework_score == "0.00"? "#727272" : "#EC6300"%>;">
<% score = student_homework_score == "0.00"? "N/A" : student_homework_score %>
<%= score %>
</span>&nbsp;&nbsp;
<% if is_evaluation && is_student && (!users_for_homework(homework).include? User.current)%>
<%= link_to "学生互评>>",homework_attach_path(homework) %>
<% end %>
</strong>
</td>
</tr>
<tr>
<td valign="top">&nbsp;
<% if User.current.member_of?(@bid.courses.first) %>
<strong><%= l(:label_bidding_user_studentcode) %>&nbsp; &nbsp;<%= homework.user.student_id%></strong>
<% end %>
</td>
<td>
<% if (users_for_homework(homework).include?(User.current) || is_teacher) %>
<%= link_to l(:button_edit), edit_homework_attach_path(homework) %>
<% if homework.user == User.current || is_teacher %>
<%= link_to(l(:label_bid_respond_delete), homework,
method: :delete, :confirm => l(:text_are_you_sure)) %>
<% end %>
<% end %>
</td>
<td style="vertical-align: top;width: 200px;">
<% if is_evaluation || is_teacher%>
<%= render :partial => 'app_link', :locals => {:attachments => homework.attachments} %>
<% end %>
</td>
<td>
<strong>终评得分:&nbsp;
<% totle_homework_score = score_for_homework(homework) %>
<span style="color:<%= totle_homework_score == "0.00"? "#727272" : "#EC6300"%> ;">
<% score = totle_homework_score == "0.00"? "N/A" : totle_homework_score %>
<%= score %>
</span>&nbsp;&nbsp;
<% if is_teacher %>
<%= link_to "教师评分>>",homework_attach_path(homework) %>
<% end %>
</strong>
</td>
</tr>
</table>
</td>

View File

@ -32,13 +32,13 @@
<!-- <div class="pagination" style="border-bottom: 1px solid rgb(223,223,223); width: 95%; margin-left: 2%; margin-top: 15px" >
<ul style="margin-right:0px">
<li>
<%= link_to l(:label_sort_by_time), calls_path(:bid_sort_type => '0') %>
<%#= link_to l(:label_sort_by_time), calls_path(:bid_sort_type => '0') %>
</li>
<li>
<%= link_to l(:label_sort_by_active), calls_path(:bid_sort_type => '1') %>
<%#= link_to l(:label_sort_by_active), calls_path(:bid_sort_type => '1') %>
</li>
<!-- <li>
<%= link_to l(:label_sort_by_influence), calls_path(:bid_sort_type => '2') %>
<%#= link_to l(:label_sort_by_influence), calls_path(:bid_sort_type => '2') %>
</li> -->
<!-- </ul>
</div> -->

View File

@ -2,7 +2,7 @@
<div style="margin-left: 20px;">
<span class="portrait"><%= image_tag(url_to_avatar(@bid.author), :class => "avatar")%></span>
<span class="body">
<h3><%= link_to(@bid.author.lastname+@bid.author.firstname, user_path(@bid.author))%><%= @bid.name %></h3>
<h3><%= link_to(@bid.author.lastname+@bid.author.firstname, user_path(@bid.author))%><%= link_to(@bid.name,respond_path(@bid)) %></h3>
<% if @bid.reward_type.nil? or @bid.reward_type == 1%>
<p>
<strong><%= l(:label_bids_reward_method) %><span class="bonus"><%= l(:label_call_bonus) %>&nbsp; <%= l(:label_RMB_sign) %><%= @bid.budget %></span></strong>

View File

@ -76,7 +76,8 @@
<strong>
<%= l(:label_contest_user) %>
<% unless c_project.user.nil? %>
<%= c_project.user.lastname %><%= c_project.user.firstname %>
<!-- modified by zjc 添加超链接 -->
<%= link_to c_project.user.lastname + c_project.user.firstname,user_path(c_project.user) %>
<% end %>
</strong>

View File

@ -15,7 +15,7 @@
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
</div>
</td>
</tr>

View File

@ -259,7 +259,10 @@
<span><strong><%= l(:label_attendingcontest_time) %>
</strong><%= format_time c_project.created_at %></span>
<span style="padding-left: 240px"><strong><%= l(:label_attendingcontest_spoksman) %>
</strong><%= c_project.user.name %></span>
<!-- modified by zjc 添加超链接 -->
<% unless c_project.nil? || c_project.user.nil? %>
</strong><%= link_to c_project.user.name,user_path(c_project.user) %></span>
<% end %>
</div>
<div style="padding-left: 68px">
@ -293,13 +296,17 @@
<span><strong><%= l(:label_attendingcontest_time) %>
</strong><%= format_time c_softapplication.created_at %></span>
<span style="padding-left: 240px"><strong><%= l(:label_attendingcontest_spoksman) %>
</strong><%= c_softapplication.softapplication.user.name %></span>
<!-- modified by zjc 添加超链接 -->
<% unless c_softapplication.nil? || c_softapplication.softapplication.nil? || c_softapplication.softapplication.user.nil? %>
</strong><%= link_to c_softapplication.softapplication.user.name,user_path(c_softapplication.softapplication.user) %></span>
<% end %>
</div>
<!--获奖及教师评奖-->
<div style="padding-left: 18px; padding-bottom: 5px">
<% score = c_softapplication.softapplication.average(:quality).try(:avg).try(:round, 2).to_f %>
<span style="padding-left: 50px"><strong><%= l(:label_final_scores) %>
</strong></span><span style="color: red"><%= c_softapplication.softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s %>
</strong></span><span style="color: red"><%= format("%.2f" , score) %>
分</span>
<span style="padding-left: 334px">
<td>

View File

@ -17,9 +17,9 @@
<% @admin = @course.course_infos%>
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
<!-- <%= @admin.first.user.user_extensions.occupation %> -->
<%# unless @course.course_extra.school.nil? %>
<%= @course.teacher.user_extensions.school.try(:name) %>
<%# end %>
<% unless @course.teacher.user_extensions.school.nil? %>
<%= link_to @course.teacher.user_extensions.school.try(:name), school_course_list_path(@course.teacher.user_extensions.school) %>
<% end %>
<% end %>
</p>
<p >

View File

@ -18,7 +18,6 @@
<% object = [] %>
<% object << 'course' %>
<% object << 'course' %>
<%= error_messages_for object %>
@ -94,7 +93,8 @@
<option value = '2014'>2014</option>
<option value = '2015'>2015</option>
<option value = '2016'>2016</option>
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<option value = '2017'>2017</option>".html_safe %></td></tr></table>
</p>
<% elsif @course.time == 2009 %>
<p><table><tr><td class="info" align="right" style="width: 86px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
@ -237,7 +237,8 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% end %>
<% end %></td>
<% end %>
</td>
<td>
<% unless @course.nil? %>
<% if @course.term == l(:label_spring) %>
@ -277,7 +278,8 @@
<% end %>
<% end %></td></tr></table></p>
<% end %></td></tr></table>
</p>
<!-- end -->
@ -292,12 +294,12 @@
<!-- <p style="margin-left:-10px;"><%= m.text_field :password, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> -->
<!-- <p style="margin-left:-10px;"><%#= m.text_field :password, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> -->
<p style="margin-left:-10px;"><label for="course[course]_password" style="font-size: 13px;" ><%=l(:label_new_course_password)%><span class="required"> *</span></label><input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%=@course.password %>" size="60" name="course[password]"></p>
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
<% end %>
<!-- <p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p> -->
<!-- <p style="margin-left:-10px;padding-right: 20px;"><%#= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p> -->
<p style="margin-left:-20px;padding-right: 20px;"><label for="course_description" style="font-size: 13px;"><%=l(:label_new_course_description)%></label><span class="jstEditor"><textarea id="course_description" class="wiki-edit" style="font-size:small;width:490px;margin-left:10px;" rows="8" name="course[description]" cols="40" ><%=@course.description%></textarea></span></p>

View File

@ -25,14 +25,17 @@
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %></p>
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %></p>
<!-- <p><%= select_tag 'bid_reward_type', "<option value = '0'>#{l(:label_choose_reward)}</option><option value = '1'>#{l(:label_money)}</option><option value = '3'>#{l(:label_bids_credit)}</option><option value = '2'>#{l(:label_reward_1)}</option>".html_safe,
<!-- <p><%#= select_tag 'bid_reward_type', "<option value = '0'>#{l(:label_choose_reward)}</option><option value = '1'>#{l(:label_money)}</option><option value = '3'>#{l(:label_bids_credit)}</option><option value = '2'>#{l(:label_reward_1)}</option>".html_safe,
:onChange => "show('bid_reward_type', 'bid_budget', '"+l(:label_bids_reward_what)+"','"+l(:label_bids_new_money)+"','"+l(:label_bids_new_credit)+"','"+l(:label_bids_new_content)+"')" %>
<%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
<%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
</p> -->
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%>
<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}") %><%= calendar_for('bid_deadline')%>
</p>
<p><%= f.select :is_evaluation, is_evaluation_option %>
</p>
<p><%= f.select :proportion, proportion_option %>
</p>
<p><%= hidden_field_tag 'course_id', @course.id %>
</p>
<fieldset><legend><%= l(:label_attachment_plural) %></legend>

View File

@ -6,7 +6,11 @@
<%= content_tag "p", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %>
<% end %>
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :class => 'avatar')) %>
<%= content_tag "div", link_to(member.user.name, user_path(member.user)), :class => "nomargin avatar_name" %>
<% if @canShowCode %>
<%= content_tag "div", link_to(member.user.show_name, user_path(member.user)), :class => "nomargin avatar_name" %>
<% else %>
<%= content_tag "div", link_to(member.user.name, user_path(member.user)), :class => "nomargin avatar_name" %>
<% end %>
<!--teacher's code disapeared moified by huang-->
<% unless member.user.user_extensions.identity ==0 %>

View File

@ -1,8 +1,12 @@
<% if @save_flag %>
<% if Rails.env.development? %>
console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>');
<% end %>
$('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>")
<% if Rails.env.development? %>
console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>');
<% end %>
$('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user,
:memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>")
$('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>")
<% else %>
alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。');
alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。');
<% end %>

View File

@ -6,7 +6,7 @@
<%= form_tag(:controller => 'courses', :action => 'search', :method => :get) do %>
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_course_practice) %></td>
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_course_all) %></td>
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td rowspan="2">
<% if User.current.logged?%>
@ -24,8 +24,8 @@
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/course", :controller => 'courses', :action => 'index', :course_type => 1 %> </a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'index', :course_type => 1 %></td>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index' %> </a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_all), :controller => 'courses', :action => 'index' %></td>
</tr>
</table>
<% end %>

View File

@ -1,6 +1,6 @@
<h3><%=l(:label_course_new_homework)%></h3>
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework'} do |f| %>
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<div class="box tabular">
<%= render :partial => 'homework_form', :locals => { :f => f } %>
<%= submit_tag l(:button_create), :class => "enterprise" %>

View File

@ -22,7 +22,7 @@
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/courses", :controller => 'courses', :action => 'index'%> </a></td>
<td style="padding-left: 8px"><a><%= link_to request.host() + "/courses", :controller => 'courses', :action => 'index'%> </a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'index' %></td>
</tr>
</table>

View File

@ -11,7 +11,7 @@
<div>
<table class="underline-evreycontent" style="font-size: 14px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(e.event_author), :class => "avatar")%></td>
<td colspan="2" valign="top" width="50"><%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %></td>
<td>
<table width="580px" border="0">
<tr>
@ -19,29 +19,37 @@
<strong> <%= h(e.event_title) if @course.nil? || (e.course != nil && @course.id != e.course.id) %></strong>
<span class="font_lighter">
<% if @canShowRealName %>
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>(<%= link_to_user(e.event_author,@canShowRealName) if e.respond_to?(:event_author) %>)
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
(<%= link_to_user(e.event_author, @canShowRealName) if e.respond_to?(:event_author) %>
)
<% else %>
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
<% end %>
<%= l(:label_new_activity) %> </span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url %>
</td>
</tr>
<tr>
<td colspan="2" width="580px" >
<td colspan="2" width="580px">
<p class="info-break">
<%= h(truncate(strip_tags(e.event_description).gsub(/&nbsp;/,' '), length: 30, omission:'...')) %>
<%= h(truncate(strip_tags(e.event_description).gsub(/&nbsp;/, ' '), length: 30, omission: '...')) %>
</p></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"> <%= l :label_activity_time %>&nbsp; <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %></span></td>
<td align="left"><span class="font_lighter"> <%= l :label_activity_time %>
&nbsp; <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %></span>
</td>
<% if e.event_type == "issue" %>
<td align="right"><span> <%= link_to l(:label_find_all_comments), issue_path(e) %> </span><span class="font_lighter"><%= l(:label_comments_count, :count => e.journals.count)%></span></td>
<td align="right">
<span> <%= link_to l(:label_find_all_comments), issue_path(e.id) %> </span><span class="font_lighter"><%= l(:label_comments_count, :count => e.journals.count) %></span>
</td>
<% end %>
</tr>
</table></td>
</table>
</td>
</tr>
</table>
</div>
@ -49,60 +57,47 @@
<% end %>
</div>
<!-- Added by Longjun 在最后一页显示创建信息 -->
<% if format_date(day) == format_date(@date_to - @days) %>
<h1>Test</h1>
<div >
<table width="660">
<tr>
<td><%= image_tag(url_to_avatar(@user), :class => "avatar") %></td>
<td colspan="2">
<table width="580">
<tr>
<td > <%= link_to (h @user.try(:name)), user_path(@user) if @user %> <%= l(:label_user_create_project) %> <%= link_to @course.name %><strong> !</strong></td>
</tr>
<tr>
<td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@course.created_on) %>
</table></td>
</tr>
</table>
</div>
<% end %>
<% end -%>
<div class="pagination">
<ul>
<%= pagination_links_full @events_pages%>
</ul>
</div>
</div>
<% else %>
<div class="font_description">
<table width="660">
<tr>
<td><%= image_tag(url_to_avatar(@user), :class => "avatar") %></td>
<td colspan="2">
<table width="580">
<tr>
<td >
<%
#判断是否显示真名
if @canShowRealName
%>
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>(<%= link_to (h @user.try(:realname)), user_path(@user) if @user %>)
<% else %>
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>
<% end %>
<%= l(:label_user_create_project) %> <%= link_to @course.name %><strong> !</strong></td>
</tr>
<tr>
<td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@course.created_at) %>
</table></td>
</tr>
</table>
</div>
<% end %>
<div class="font_description">
<table width="660">
<tr>
<td><%= image_tag(url_to_avatar(@user), :class => "avatar") %></td>
<td colspan="2">
<table width="580">
<tr>
<td>
<%
#判断是否显示真名
if @canShowRealName
%>
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>
(<%= link_to (h @user.try(:realname)), user_path(@user) if @user %>)
<% else %>
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>
<% end %>
<%= l(:label_user_create_project) %> <%= link_to @course.name %>
<strong> !</strong></td>
</tr>
<tr>
<td class="font_lighter" style="float: right"><%= l :label_create_time %>
: <%= format_time(@course.created_at) %>
</table>
</td>
</tr>
</table>
</div>
<div class="pagination">
<ul>
<%= pagination_links_full @events_pages %>
</ul>
</div>

View File

@ -40,7 +40,7 @@
<%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %>
<% end -%>
<%= form_tag attach_relation_path(:format => 'js'),
<%= form_tag course_attach_relation_path(:format => 'js'),
method: :post,
remote: true,
id: "relation_file_form",

View File

@ -13,18 +13,25 @@
<%= select_tag "version_id", content_tag('option', '') +
options_from_collection_for_select(versions, "id", "name"), {style: 'width:100px'} %>
</td>
<% if attachmenttypes.any? %>
<td><%= l(:attachment_type) %></label></td>
<td>
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName", 2), {style: 'width:100px'} %>
</td>
<% end %>
<% else %>
<td><p></p></td> <td></td>
<p>
<% if attachmenttypes.any? %>
<%= l(:attachment_type) %></label>
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName", 2), {style: 'width:100px'} %>
<% end %>
</p>
<% end %>
<% if attachmenttypes.any? %>
<td><%= l(:attachment_type) %></label></td>
<td>
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName", 2), {style: 'width:100px'} %>
</td>
<% end %>
</tr>
</table>

View File

@ -3,15 +3,15 @@
<div id="share_new" style = "width: 500px; margin:0 auto; " >
<%= labelled_form_for(@forum) do |f| %>
<% if @forum.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@forum.errors.count, "error") %> prohibited this forum from being saved:</h2>
<!--<div id="error_explanation">
<h2><#%= pluralize(@forum.errors.count, "error") %> prohibited this forum from being saved:</h2>
<ul>
<% @forum.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
<#% @forum.errors.full_messages.each do |msg| %>
<li><#%= msg %></li>
<#% end %>
</ul>
</div>
</div> -->
<% end %>
<div class="actions" style="margin:10px">
<div class="field">

View File

@ -3,17 +3,17 @@
<h3><%=l(:label_memo_new)%></h3>
<% if User.current.logged? %>
<%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
<% if @memo.errors.any? %>
<!--<#% if @memo.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:</h2>
<h2><#%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:</h2>
<ul>
<% @memo.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
<#% @memo.errors.full_messages.each do |msg| %>
<li><#%= msg %></li>
<#% end %>
</ul>
</div>
<% end %>
<#% end %> -->
<div class="actions" style="max-width:680px">
<p><%= f.text_field :subject, :required => true%></p>
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p>

View File

@ -143,7 +143,7 @@ body table tr td span6 {
<td><p >在桌面上点击鼠标右键选择TortoiseGit的Settings进行设置</p></td>
</tr>
<tr>
<td align="left">Name和Email是用来设置自己的用户名和联系方式的user.name和user.email必须填写这些将在版本库提交时用到,<span5> 其中的name和email要和forge.trustie.net上的登陆名和邮箱保持一致</span5>
<td align="left">Name和Email是用来设置自己的用户名和联系方式的user.name和user.email必须填写这些将在版本库提交时用到,<span5> 其中的name和email要和<%= Setting.host_name %>上的登陆名和邮箱保持一致</span5>
,方便代码贡献统计 )。 </td>
</tr>
<tr>
@ -313,7 +313,7 @@ body table tr td span6 {
<td><p ><span>$git&nbsp;config&nbsp;--global&nbsp;user.name&nbsp;&#8220;your_name&#8221;</span></p>
<p><span>$git&nbsp;config&nbsp;--global&nbsp;user.email&nbsp;&#8220;your_email&#8221;&nbsp;</span> </p>
<p>Name和Email是用来设置自己的用户名和联系方式的user.name和user.email必须填写这些将在版本库提交时用到,
<span5> 其中的name和email要和forge.trustie.net上的登陆名和密码保持一致</span5>
<span5> 其中的name和email要和<%= Setting.host_name %>上的登陆名和密码保持一致</span5>
,方便代码贡献统计 )。</p></td>
</tr>

View File

@ -143,7 +143,7 @@ body table tr td span6 {
<table width="900" border="0">
<tr>
<td><p>Right-click on the desktop and select the &quot;Settings&quot; in the &quot;TortoiseGit&quot;</p>
<p>User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository, <span5> the name and email must be the same with login name and email you registed in the forge.trustie.net</span5>
<p>User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository, <span5> the name and email must be the same with login name and email you registed in the <%= Setting.host_name %></span5>
). </p>
<p>Then you can customize the &quot;Context Menu&quot;:</p>
<p>Please check the &quot;<span>Clone</span>&quot;,&quot;<span>Sync</span>&quot; and &quot;<span>Commit</span>&quot; options in the &quot;<span>Context Menu</span>&quot;,</p>
@ -306,7 +306,7 @@ body table tr td span6 {
<td><p><span>$git config --global user.name &ldquo;your_name&rdquo;M</span></p>
<p><span>$git config --global user.email &ldquo;your_email&rdquo;</span> </p>
<p>User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository,
<span5> the name and email must be the same with login name and email you registed in the forge.trustie.net</span5>
<span5> the name and email must be the same with login name and email you registed in the <%= Setting.host_name %></span5>
). </p></td>
</tr>
</table>

View File

@ -1,23 +1,9 @@
<% is_teacher = is_course_teacher User.current,homework.bid.courses.first %>
<% if comprehensive_evaluation != nil && comprehensive_evaluation.count > 0 %>
<% stars = homework.rates(:quality).where("rater_id = #{comprehensive_evaluation.first.user.id}").select("stars").first %>
<div style="height: 100px; padding-bottom: 10px">
<div style="font-size: 15px">
<strong>作业综评:</strong>
<span class="user" style="font-size: 15px">
<div data-kls="HomeworkAttach" data-id="2" data-dimension="quality" data-average="3.25" class="rateable div_inline jDisabled"
style="height: 15px; width: 100px; overflow: hidden; z-index: 1; position: relative;">
<% if stars != nil %>
<div class="jRatingColor" style="width: <%=stars.stars * 2 * 10 %>%;"></div>
<% else %>
<div class="jRatingColor" style="width: 0px;"></div>
<% end %>
<div class="jRatingAverage" style="width: 0px; top: -20px;"></div>
<div class="jStar" style="width: 115px; height: 20px; top: -40px;
background: url('/images/seems_rateable/stars.png') repeat-x scroll 0% 0% transparent;">
</div>
</div>
</span>
<%= render :partial => 'show_score', locals: {:stars => teaher_score} %>
</div>
<div style="font-size: 14px;">
<div style="margin-left: 20px;margin-bottom: 10px;margin-top: 10px;"> <%= comprehensive_evaluation.first.notes%> </div>
@ -31,7 +17,7 @@
</div>
<%= render :partial => 'evaluation', :locals => {:homework => homework} %>
<div>
<%= render :partial => 'addjour', :locals => {:homework_attach => homework, :sta => 0,:is_comprehensive_evaluation => 1} %>
<%= render :partial => 'evaluation_add_jour', :locals => {:homework_attach => homework, :sta => 0,:is_comprehensive_evaluation => 1} %>
</div>
</div>
<% else %>

View File

@ -0,0 +1,93 @@
<style>
input[type="submit"].bid_btn {
vertical-align: middle;
width: 60px;/*modified by ming*/
height: 25px;
line-height: 19px;
font-size: 14px;
color: rgb(0, 0, 0);
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
/*margin-right: -4px;*/
}
input[type="button"].bid_btn {
width: 60px;/*modified by ming*/
height: 25px;
line-height: 19px;
font-size: 14px;
color: rgb(0, 0, 0);
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
margin-right: -2px;
}
textarea:focus {
border: #d5dee9 1px solid;
}
</style>
<script type="text/javascript" language="javascript">
function clearInfo(id, content) {
var text = $('#' + id);
if (text.val() == content) {
$('#' + id).val('');
}
}
function showInfo(id, content) {
var text = $('#' + id);
if (text.val() == '') {
$('#' + id).val(content);
}
}
</script>
<%= form_for('new_form', :method => :post,
:url => {:controller => 'homework_attach',
:action => 'comprehensive_evaluation_jour',
:jour_id => homework_attach.id,
:is_comprehensive_evaluation => is_comprehensive_evaluation,
:sta => sta}) do |f|%>
<div id = 'pre_show'>
<%= render :partial => 'words/pre_show', :locals => {:content => @content} %>
</div>
<% if User.current.logged? %>
<table border="0" width="525px" align="center" >
<tr>
<td><%= f.text_area 'user_message', :rows => 3, :cols => 65, :value => "#{l(:label_leave_a_message)}",
:onfocus => "clearInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
:onblur => "showInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
:style => "resize: none;", :class => 'noline'%></td>
</tr>
</table>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<table border="0" width="525px" align="center">
<tr>
<td align="right"> <%= submit_tag l(:button_leave_meassge),
:name => nil , :class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :class => "enterprise",
:onclick => "clearMessage('new_form_user_message');",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
</tr>
</table>
<% else %>
<div style="font-size: 14px;margin:10px;text-align: center">
<%= l(:label_user_login_tips) %>
<%= link_to l(:label_user_login_new), signin_path %>
</div>
<% end %>
<% end %>

View File

@ -0,0 +1,14 @@
<span class="user" style="font-size: 15px">
<div data-kls="HomeworkAttach" data-id="2" data-dimension="quality" data-average="3.25" class="rateable div_inline jDisabled"
style="height: 15px; width: 100px; overflow: hidden; z-index: 1; position: relative;">
<% if stars != nil %>
<div class="jRatingColor" style="width: <%=stars.to_f * 20 %>%;"></div>
<% else %>
<div class="jRatingColor" style="width: 0px;"></div>
<% end %>
<div class="jRatingAverage" style="width: 0px; top: -20px;"></div>
<div class="jStar" style="width: 115px; height: 20px; top: -40px;
background: url('/images/seems_rateable/stars.png') repeat-x scroll 0% 0% transparent;">
</div>
</div>
</span>

View File

@ -1,6 +1,6 @@
<% if @add_jour.is_comprehensive_evaluation == 1 %>
$('#comprehensive_evaluation').html('<%= escape_javascript(render(:partial => 'comprehensive_evaluation',
:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework} )) %>');
:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework,:teaher_score => @teaher_score} )) %>');
<% else %>
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false,:homework => @homework} )) %>');
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');

View File

@ -1,10 +1,10 @@
<script type="text/javascript">
function switchTab(ProTag) {
var display_index = 3 - ProTag;
document.getElementById("tab" + ProTag).className = "selected";
document.getElementById("tab" + display_index).className = "";
document.getElementById("content" + ProTag).style.display = "";
document.getElementById("content" + display_index).style.display = "none";
$("#tab" + ProTag).attr("class","selected");
$("#tab" + display_index).attr("class","");
$("#content" + ProTag).show();
$("#content" + display_index).hide();
}
</script>
@ -42,11 +42,22 @@
<div class="box" id="content1">
<%= form_for(@homework) do |f|%>
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong>标 题:</strong>
<strong>标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题&nbsp;<span style="color: red">*</span></strong>&nbsp;
<%= f.text_field :name, :required => true, :name => "homework_name", :size => 60, :style => "width:490px;"%>
</p>
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong style="vertical-align: top">描 述:</strong>
<strong>提交项目&nbsp;&nbsp;</strong>
<% if @homework.project.nil? %>
<%= f.select :project_id, options_for_select(user_projects_option),:name => "project_id", :required => true%>
<% else %>
<%= f.select :project_id, options_for_select(user_projects_option,@homework.project.id),:name => "project_id", :required => true%>
<% end %>
<%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target => '_blank' %>
<p class="font_lighter" style="padding-left:120px;clear:left;">提交项目可以为空</p>
</p>
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong style="vertical-align: top">描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述&nbsp;&nbsp;</strong>&nbsp;
<span style="margin-left:-10px;padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :name => "homework_description", :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
</span>

View File

@ -23,11 +23,17 @@
:bid_id => @bid
}) do |f|%>
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong>标</strong>
<strong>标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题&nbsp;<span style="color: red">*</span></strong>
<%= f.text_field "name", :required => true, :size => 60, :style => "width:490px;" %>
</p>
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong style="vertical-align: top">描 述:</strong>
<strong>提交项目&nbsp;&nbsp;</strong>
<%= f.select :project_id, options_for_select(user_projects_option),:name => "project_id", :required => true, :style => "width:490px;"%>
<%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target => '_blank' %>
<p class="font_lighter" style="padding-left:120px;clear:left;">提交项目可以为空</p>
</p>
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong style="vertical-align: top">描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述&nbsp;&nbsp;</strong>
<span style="margin-left:-10px;padding-right: 20px;">
<%= f.text_area "description", :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
</span>

View File

@ -24,7 +24,7 @@
发布人员:<%= link_to @homework.user, user_path(@homework.user)%>
</td>
<td style="width: 240px; word-wrap: break-word; word-break: break-all">
所属任务:<%= link_to(@homework.bid.name, project_for_bid_path(@homework.bid))%>
所属任务:<%= link_to(@homework.bid.name, course_for_bid_path(@homework.bid))%>
</td>
</tr>
<tr>
@ -49,7 +49,7 @@
</tr>
<tr>
<td style=" padding-left: 40px">平均评分:
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
<%= render :partial => 'show_score', :locals => {:stars => @totle_score} %>
</td>
<td style="width: 240px; word-wrap: break-word; word-break: break-all">发布时间:<%=format_time @homework.created_at %></td>
</tr>
@ -110,17 +110,12 @@
</div>
</div>
<div style="float: left; padding-left: 100px; padding-top:35px ">
<% score = @homework.average(:quality).try(:avg).try(:round, 2).to_s %>
<div style="text-align: center">最终得分</div>
<div style="padding-top: 1px; font-size: 15px; color: blue;text-align: center">
<% if score == "" %>
0分
<% else %>
<%= score %>分
<% end %>
<%= @totle_score %>分
</div>
<div style="padding-top: 3px">
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
<%= render :partial => 'show_score', :locals => {:stars => @totle_score} %>
</div>
</div>
<div style="float: left; padding-left: 100px; padding-top:35px ">
@ -137,7 +132,7 @@
<!-- 作业综评 -->
<div id="comprehensive_evaluation">
<%= render :partial => 'comprehensive_evaluation', :locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework} %>
<%= render :partial => 'comprehensive_evaluation', :locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score} %>
</div>
<div class="underline-contests_one"></div>

View File

@ -14,5 +14,5 @@
<%= watcher_link(@issue, User.current) %>
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %>
<%= link_to l(:button_delete), issue_path(@issue), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %>
<%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %>
</div>

View File

@ -28,11 +28,12 @@
<ul class="issue_list">
<% unless issue.author.nil? || issue.author.name == "Anonymous" %>
<ul class="list-group-item-meta">
<span> <%= link_to issue.author.name, user_path(issue.author), :class => "bid_user_u" %></span><%= l(:label_post_on)%> <% a = [] %>
<span> <%= link_to issue.author.name, user_path(issue.author), :class => "bid_user_u" %></span>
<%= l(:label_post_on)%> <% a = [] %>
<% a << column_content[1] %>
<%# a << "##{column_content[0]}" << "(#{raw column_content[2]}):" << column_content[4] %>
<% a << "#{issue.source_from}" << "(#{raw column_content[2]}):" << column_content[4] %>
<%= link_to a.join(' '), issue_path(issue), :class => "issue-link" %>
<%= link_to a.join(' '), issue_path(issue.id), :class => "issue-link" , :target =>"_blank"%>
</ul>
<% end -%>
<ul class="list-group-item-meta">
@ -46,7 +47,7 @@
<% end %>
<%= l(:label_updated_time_on, format_date(issue.updated_on)).html_safe %>
<div class="find-comment-class">
<span><%= link_to l(:label_find_all_comments), issue_path(issue) %></span><%= l(:label_comments_count, :count => issue.journals.all.count) %>
<span><%= link_to l(:label_find_all_comments), issue_path(issue.id) %></span><%= l(:label_comments_count, :count => issue.journals.all.count) %>
</div>
</ul>
</ul>

View File

@ -12,12 +12,12 @@
<tr id="issue-<%= h(issue.id) %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %>">
<td class="id">
<%= check_box_tag("ids[]", issue.id, false, :style => 'display:none;', :id => nil) %>
<%= link_to issue.id, issue_path(issue) %>
<%= link_to issue.id, issue_path(issue.id) %>
</td>
<td class="project"><%= link_to_project(issue.project) %></td>
<td class="tracker"><%=h issue.tracker %></td>
<td class="subject">
<%= link_to truncate(issue.subject, :length => 60), issue_path(issue) %> (<%=h issue.status %>)
<%= link_to truncate(issue.subject, :length => 60), issue_path(issue.id) %> (<%=h issue.status %>)
</td>
</tr>
<% end %>

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