Compare commits

...

727 Commits

Author SHA1 Message Date
alan 304effa8e4 pull competition branch
Signed-off-by: alan <547533434@qq.com>
2014-09-04 09:17:59 +08:00
z9hang a2f14bc0b2 #1073 发布课程通知要点两次才能提交成功bug,原因:js的失去焦点事件和点击事件冲突,解决方法:鼠标移到提交按钮时使提交按钮获得焦点 2014-09-01 17:56:12 +08:00
z9hang e0cdcc0211 课程讨论区发帖,添加附件,admin帐户删除附件报错,原因:判断attachment的containers是否为课程的时候少判断了课程讨论区的附件这种情况,解决:加上该判断。问题2 #1002 forge网站的主页项目列表登录前和登陆后,显示的不一样。 解决方法:项目列表、课程列表中的私有项目、私有课程添加私有标志 2014-09-01 15:24:48 +08:00
z9hang 5cb1683332 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-29 17:31:22 +08:00
nwb 801025d967 添加测试用例 2014-08-29 16:56:59 +08:00
z9hang 54ed41e483 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-29 16:52:27 +08:00
z9hang a47b1eee47 发布作业后的附件不可擦看问题 2014-08-29 15:54:52 +08:00
nwb dec77da33c Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-29 15:28:45 +08:00
nwb c8e895ec74 优化用户头像逻辑 2014-08-29 15:28:32 +08:00
sw 24a0f3e774 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-29 15:07:34 +08:00
sw c743f58104 “我的课程” 讨论区中 讨论内容框没有名字,且是否为必须没有提示 #1524 2014-08-29 15:07:08 +08:00
z9hang 8fc9e65e66 wiki编辑控件粘贴进去的截图不能显示问题 2014-08-29 14:54:29 +08:00
z9hang acfd8837bb Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-29 11:47:44 +08:00
z9hang 59fadeacf6 wiki=》历史=》追溯不换行问题 2014-08-29 11:45:37 +08:00
sw bfb29ea14c Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-29 11:40:25 +08:00
sw d8e04ae974 1.项目添加、修改新闻增加js验证 2014-08-29 11:40:00 +08:00
z9hang e3a7d365ea 评审任务移动到显眼位置 2014-08-29 11:21:45 +08:00
sw b50dac6a36 修复项目资源排序无效的BUG 2014-08-29 10:17:31 +08:00
sw dcde828e64 1.个人主页--关注、粉丝,即使关注者、粉丝没有参加项目、课程,显示为“参与了0个项目/课程” #1211
2 修复个人主页关注、粉丝参与课程列表不正确的BUG
2014-08-29 09:40:57 +08:00
sw 3919d0fd48 修复缺陷查询不可用的BUG 2014-08-28 17:51:41 +08:00
sw fbb19480f5 修复火狐不兼容自动换行的问题 2014-08-28 17:30:08 +08:00
sw 2f1b6386f6 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-28 16:52:47 +08:00
sw c614734768 #1508 修复课程、项目列表中,点击标签的更多按钮,报错的BUG 2014-08-28 16:18:25 +08:00
z9hang e8cde5f1cd Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-28 15:41:14 +08:00
z9hang 4711e638eb 复制有附件的缺陷报错问题(屏蔽掉复制附件的功能) 2014-08-28 15:40:34 +08:00
sw 56a0ec336a 修复缺陷列表描述过长被掩盖的BUG #1145 2014-08-28 14:55:25 +08:00
sw 594d3364ac Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-28 14:39:48 +08:00
sw bcb9e8688c 界面注释 2014-08-28 14:39:09 +08:00
nwb 51b21000a7 版本库标识限定为全局唯一 2014-08-28 14:35:42 +08:00
sw 82b23da54b 创建作业增加js验证 2014-08-28 14:05:48 +08:00
nwb bdeb2e5947 启用项目的wiki编辑动态 2014-08-28 14:02:14 +08:00
nwb 19be668221 1.修正RImagic保存gif格式图片问题
2.修正课程动态显示问题
2014-08-28 11:52:02 +08:00
sw c7caa08c70 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-28 11:06:42 +08:00
sw 5afcb73624 1.修改中英提示
2.修改查看差别页面会超出界面的BUG
2014-08-28 11:06:01 +08:00
z9hang f0db3e1b4a 添加负积分修正为0的说明 2014-08-28 10:20:08 +08:00
sw a77b07a99b 修改资源排序 2014-08-27 17:53:57 +08:00
z9hang d256b2d336 缺陷查询布局问题 2014-08-27 15:59:02 +08:00
z9hang 8e6ed35497 点击添加标签输入焦点却在搜索框问题(两个输入框用了同一个id,修改添加标签的文本框的id) 2014-08-27 15:19:18 +08:00
z9hang 060759774b 课程、项目中资源切换资源类型时弹出error问题(原因:1.未新建分页对象(从某个类型切回全部),2.资源类型信息丢失) 2014-08-27 15:00:26 +08:00
z9hang 42285ce44d 积分少于2分时不能踩人 2014-08-27 12:00:00 +08:00
sw 97f8aedd13 修复用户动态首页描述不正确的问题 2014-08-27 11:31:18 +08:00
z9hang e1672fd0e0 讨论区帖子数统计错误问题 2014-08-27 10:20:08 +08:00
z9hang 62aa1d0ed5 提交迁移文件。。 2014-08-26 17:46:28 +08:00
sw c6b189a846 wiki显示未对非汉字类型进行自动换行处理 #1486 2014-08-26 17:46:21 +08:00
sw 79e83b9a85 编辑帖子时,主题显示超出边框 #1490 2014-08-26 16:44:56 +08:00
sw 30cbbb5a2a 引用回帖显示超出边框 #1491 2014-08-26 16:39:12 +08:00
z9hang cb8b0e0f41 admin页面中问题追踪项相关错误(课程、项目分离此处代码未改导致的问题)、项目列表中项目提交次数改为从数据库中读取(运行bundle exec rake project_score:calculate统计项目提交次数) 2014-08-26 16:07:17 +08:00
sw eb5d1c9efe 修复项目动态首页文明名过长超出页面的BUG 2014-08-26 10:44:44 +08:00
z9hang e63be10680 去除显示项目列表的存储过程调用(刷新项目提交次数已移至changeset对象创建之后) 2014-08-25 15:18:52 +08:00
z9hang 74ba4384b1 1、去除不用了的旧的积分代码。2、将刷新提交次数功能修改(原来是在显示项目或个人信息的页面之前调用repository.fetch_changesets刷新changeset,修改为创建changeset对象后马上调用repository.fetch_changesets方法刷新changeset对象,注意:尚需测试) 2014-08-25 14:47:27 +08:00
z9hang ddc8da99e4 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-25 09:16:05 +08:00
z9hang d16b54a1ea 域名跳转问题、提交代码后版本库不能访问问题 2014-08-25 09:15:38 +08:00
linhk 9f3392eba8 删除主留言时确认删除的提示信息 2014-08-23 16:41:07 +08:00
chenmin 87f8e90f25 1、多余标签删除 2014-08-23 16:11:03 +08:00
zhanghaitao 51f1841d78 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-23 15:52:32 +08:00
zhanghaitao 0e84982203 开始日期、计划完成日期不合法已发异常判断修改 2014-08-23 15:47:42 +08:00
linhk 4d583b08c7 ‘新增评审’按钮显示添加权限过滤 2014-08-23 15:33:39 +08:00
zhanghaitao b1048074ef #1072 发布作业:截止日期不能手动输入修改 2014-08-23 15:19:12 +08:00
zhanghaitao 5b85aa0961 限制日期控件的不可编辑性,解决输入不正确日期返回异常的问题 2014-08-23 14:42:58 +08:00
zhanghaitao 2be1ac0dbd 修改日期选择控件当日操作日期不可以选择的Bug 2014-08-23 14:20:39 +08:00
sw 889af8be5f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/views/courses/_course_form.html.erb
2014-08-23 13:52:49 +08:00
z9hang afc5a05ed8 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-23 11:10:11 +08:00
z9hang 38c5c86a39 日期选择器不能用问题 2014-08-23 10:58:07 +08:00
linhk 9bcd06b315 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-23 10:09:55 +08:00
linhk 37920d36c9 公共贴吧主题自动分行 2014-08-23 10:09:36 +08:00
sw 7ec103e135 #1457 修复课程开课日期无法修改的BUG
优化选择开课时间代码
2014-08-23 09:21:03 +08:00
chenmin c1da351ea0 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-23 09:19:17 +08:00
chenmin 9f54df232b 修复个人主页点击粉丝或者关注时,如果粉丝参加的课程和项目为0的bug; 2014-08-23 09:19:05 +08:00
linhk fa90219a52 在没有“我的课程”菜单项时"我的项目”显示子页显示位置错误的Bug 2014-08-22 17:24:06 +08:00
sw 4998420410 修复修改密码时,错误信息在其他页面会提示的BUG 2014-08-22 16:52:47 +08:00
sw bbb38d381d Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 14:52:32 +08:00
sw 2a7b9025b6 修复课程、项目上传资源关联资源时,查询出结果超出浏览器边界的问题 2014-08-22 14:47:11 +08:00
zhanghaitao 25affe30b0 #1059 软件创客” 修改用户资料中的用户单位页面的样式调整 2014-08-22 14:38:16 +08:00
zhanghaitao 00b38dc792 页面显示默认边框取消 2014-08-22 14:20:45 +08:00
zhanghaitao c046ad011c 页面显示修改 2014-08-22 14:17:20 +08:00
sw fe14c1e427 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 14:12:49 +08:00
zhanghaitao 167a819a84 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 13:44:00 +08:00
zhanghaitao 08a6e9af1a 边框显示问题修改 2014-08-22 13:43:48 +08:00
sw c6a19209f4 修复课程、项目无法上传资源的问题 2014-08-22 12:32:16 +08:00
sw d608d092da Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 11:59:08 +08:00
z9hang 969b8a2d3e Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 11:58:31 +08:00
z9hang d1d2dd0e4b undefined m_coumt问题修正 2014-08-22 11:58:12 +08:00
chenmin 9e419876a9 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 11:53:59 +08:00
chenmin f3807461d9 修复课程新建帖子的bug 2014-08-22 11:53:49 +08:00
sw e1e8942dc7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 11:50:10 +08:00
z9hang b96a08a200 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 11:27:33 +08:00
z9hang 27e15e6a9a 部分项目提交次数显示不正确问题 2014-08-22 11:27:01 +08:00
sw f41d3f8b6a 修改作业显示真实名字不正确的问题 2014-08-22 11:24:25 +08:00
linhk e900e6d6fd 解决查看文本页面内容未换行Bug
修改文本页面行号样式居上
修改新增评审在没有的时候引发的Bug
2014-08-22 11:04:32 +08:00
chenmin 08cde8a142 修复课程讨论区自己发布的帖子没有编辑功能的问题;
修复课程讨论区回复和编辑帖子内容附件的显示bug
2014-08-22 10:46:38 +08:00
chenmin 880f2057ac Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 10:41:03 +08:00
chenmin 9da85bb5a3 修复回复和编辑项目帖子时都显示帖子附件的bug; 2014-08-22 10:40:43 +08:00
sw 273c932acf Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 10:30:39 +08:00
zhanghaitao 74d98e9bac Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 10:20:42 +08:00
zhanghaitao 0d93783764 #1047 修复作品下载--内容超出右边框 2014-08-22 10:20:30 +08:00
linhk 6253f281bc 新增评审任务位置更改 2014-08-22 09:56:03 +08:00
zhanghaitao 3279fda3e5 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-22 09:38:22 +08:00
zhanghaitao b635a6b3c5 1.添加工作台分页处理操作
2.分页处理路由函数添加
2014-08-22 09:38:07 +08:00
sw 589c6d37db 取消日期编辑框可手动输入的问题 #1045 2014-08-22 09:20:03 +08:00
chenmin 554d744929 修复项目和课程讨论区所有帖子显示页面各帖子内容没对齐的bug; 2014-08-22 09:18:45 +08:00
chenmin d2bd1cc261 修复课程讨论区帖子主题问题,修复主题后面空白过多的问题; 2014-08-22 09:00:15 +08:00
sw 1498f5c20b 1.修改课程通知时按钮状态
2.新建作业描述不正确
2014-08-22 08:57:00 +08:00
chenmin c4fff8a8ac 项目讨论区帖子主题过长显示优化;
讨论区主题下方存在虚线bug修复;
2014-08-22 08:41:06 +08:00
sw 123353fd8f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-21 17:32:34 +08:00
linhk 0635932187 用户个人主页项目链接错误修改 2014-08-21 17:31:36 +08:00
sw 337ca5fb93 修复用户留言取消按钮描述不正确的问题 2014-08-21 17:14:30 +08:00
z9hang 9d23e6a8be 添加竞赛通知标题长度限制 2014-08-21 17:09:35 +08:00
linhk aa4b8c2da9 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-21 16:56:22 +08:00
linhk b30bfd073c 1 2014-08-21 16:55:46 +08:00
z9hang 85a95262fe 项目得分细节中文档得分点击无反应问题 2014-08-21 16:01:24 +08:00
sw 234a781342 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-21 15:41:23 +08:00
sw 4e49da836e 1.课程通知添加、修改填写字段时字段限制实时提示
2.修改通知时填写字段超出限制长度报错的修复
3.注释无效代码
2014-08-21 15:40:21 +08:00
z9hang 644cfe6c21 项目成员列表按得分排序 2014-08-21 15:22:29 +08:00
z9hang 9ae553bace Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-21 14:57:05 +08:00
z9hang 5482ba3207 后台统计所有用户分数算法优化 2014-08-21 14:56:44 +08:00
sw 38188804a1 课程修改通知时标题不正确的问题 2014-08-21 14:46:14 +08:00
sw a690fd79cf 课程修改通知时标题不正确的问题 2014-08-21 14:43:29 +08:00
sw 50e1f41345 #1307修复作业列表真实姓名只显示名不显示姓的BUG 2014-08-21 11:16:40 +08:00
chenmin cbd3610bf4 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-21 10:51:05 +08:00
chenmin e303a3789a 修复创新竞赛资源搜索页面系统支持过长遮住其他标签的bug 2014-08-21 10:50:53 +08:00
sw e112bb2803 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-21 10:38:35 +08:00
sw 16d86a1fbd 课程、项目模块增加分页功能 2014-08-21 10:37:53 +08:00
sw 3343e1c413 #1203
修复代码评审快速链接新建ISSUE时报错的BUG
2014-08-21 10:24:23 +08:00
chenmin 532cb23141 修复标签和内容之间空白太多的问题; 2014-08-21 10:19:46 +08:00
chenmin 3a2754eb27 修复查看单个竞赛页面的竞赛详细信息被遮住的bug; 2014-08-21 10:16:01 +08:00
sw 8932633b23 Merge remote-tracking branch 'origin/szzh' into szzh 2014-08-21 09:56:14 +08:00
chenmin 142d413544 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-21 09:22:57 +08:00
chenmin a328a934c8 修复查看单个竞赛页面的删除、编辑竞赛标签的显示bug; 2014-08-21 09:22:34 +08:00
luguo 075b43f836 解决版权符号问题 2014-08-21 09:18:10 +08:00
linhk 66dfa1ce4f 解决删除项目主留言分页Url错误和页数错误的Bug 2014-08-21 08:58:48 +08:00
luguo cc08cdc140 解决我的课程下面的课程描述带格式显示不正常。 2014-08-20 17:16:14 +08:00
sw 136c991060 #1413
修复资源名称过长,在课程动态首页会超出边界的问题
2014-08-20 16:28:04 +08:00
sw c13eeee56d 1.修改页面描述错误
2.注释错误代码
2014-08-20 15:51:35 +08:00
zhanghaitao 8f83c63c79 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-20 14:55:44 +08:00
zhanghaitao 9bd22b1b99 1.#1011 当添加资源标签为多个时,“新增”按钮被掩盖的问题解决
2.课程标签设置JS添加
2014-08-20 14:55:32 +08:00
chenmin 86e377a228 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-20 11:40:14 +08:00
chenmin 73537a30cb 修复资源上传人不能下载项目讨论区非公开资源的问题 2014-08-20 11:39:41 +08:00
linhk 507235cd69 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-20 10:51:08 +08:00
linhk 4c57136a1d 项目留言删除功能 2014-08-20 10:50:29 +08:00
sw f396a45e1f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-20 10:47:42 +08:00
sw fae3c45920 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-20 10:46:50 +08:00
zhanghaitao 337f0ec270 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-20 09:42:15 +08:00
zhanghaitao 4905511060 #课程起止时间显示Bug的修改 2014-08-20 09:42:01 +08:00
chenmin 80bd535b4f 课程讨论区回复帖子的内容增加删除附件功能;
增加可以编辑自己回复内容的功能;
2014-08-20 09:30:26 +08:00
z9hang 1e234a9adf 优化积分计算速度问题 2014-08-19 17:03:26 +08:00
linhk a0a8868c24 个人主页的课程项目tab页显示优化 2014-08-19 15:44:02 +08:00
linhk 5e600380c7 课程实践平台课程名称与学校调换 2014-08-19 15:10:04 +08:00
linhk 97707ea44a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-19 14:20:54 +08:00
sw 7b00008721 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-19 14:04:43 +08:00
chenmin c042add122 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-18 17:44:48 +08:00
chenmin bfe0299d40 修复部分帖子内容显示超出边框的bug 2014-08-18 17:44:37 +08:00
linhk 4252e52d1d 公共贴吧下载文件异常 2014-08-18 17:33:37 +08:00
z9hang 9039755fc5 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-18 17:15:43 +08:00
z9hang ed3e9e3a03 项目成员列表积分计算的初步优化(降低访问速度) 2014-08-18 17:14:31 +08:00
sw 5fb1b220e5 #1369 修复查看作业列表错误的BUG 2014-08-18 16:46:34 +08:00
chenmin e181f0ed4d 添加贴吧帖子存在性判断 2014-08-18 16:12:22 +08:00
chenmin 4ed9b13f0b 修复点击某些贴吧提示数据不存在的404page not found bug 2014-08-18 15:53:25 +08:00
linhk 3239ab12e9 项目添加评审按钮修改 2014-08-18 15:33:22 +08:00
sw a7e066add8 修复项目得分无法显示详细信息的BUG 2014-08-18 14:15:22 +08:00
sw 90e65825db 修复界面中英文问题 2014-08-18 14:00:43 +08:00
sw 012791e44d Merge remote-tracking branch 'origin/szzh' into szzh 2014-08-18 11:09:40 +08:00
zhanghaitao 13becbefb2 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/views/projects/show.html.erb
2014-08-18 11:09:54 +08:00
sw 5a7aabd7cf #1357
1.注释无效代码
2.修改wiki、DTS测试logo不见的BUG
2014-08-18 10:16:34 +08:00
sw 1cd00f55fb Merge remote-tracking branch 'origin/szzh' into szzh 2014-08-18 10:14:29 +08:00
zhanghaitao 13717dc3a3 缺陷界面选项功能的屏蔽;私有缺陷的显示条件修改 2014-08-18 09:57:10 +08:00
z9hang fac973db20 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-18 09:29:38 +08:00
z9hang 7e00890667 项目工具集部分工具图标缺失问题 2014-08-16 17:14:04 +08:00
linhk ecae8d1f35 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-16 17:02:58 +08:00
linhk 4f0817a146 项目--文档--文件--代码评审 中用户头像显示错误 2014-08-16 17:02:37 +08:00
z9hang 378c06379e 项目文档得分计算错误问题 2014-08-16 16:28:35 +08:00
sw 3d6ee127cb Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-16 16:15:47 +08:00
sw f4fd1b1133 修改创建竞赛时提示描述不正确的问题 2014-08-16 16:13:39 +08:00
linhk 6b66a205b3 项目--代码评审 显示已关闭的评审功能不可用 2014-08-16 15:18:46 +08:00
z9hang c77a1fc2ef Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-16 15:08:38 +08:00
z9hang a3fb08817c 分数不能为0、更新readme 2014-08-16 15:08:14 +08:00
sw 2b12654796 Merge branch 'szzh' into develop 2014-08-16 13:33:07 +08:00
sw 0d398fdc17 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-16 13:31:03 +08:00
sw 9688a73aa1 1.新建竞赛作品增加js验证
2.修复上传图片一次超过2张,上传失败的BUG
2014-08-16 13:30:38 +08:00
z9hang 6f5df31d14 去掉多出来的图片 2014-08-16 13:23:50 +08:00
z9hang 12434e22c5 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-16 13:22:46 +08:00
z9hang 4cea972e56 micro版图片丢失问题 2014-08-16 13:22:28 +08:00
sw 8d03068ce2 Merge remote-tracking branch 'origin/szzh' into szzh 2014-08-16 11:37:06 +08:00
linhk fcaeb86687 项目‘课程 添加成员显示Bug修改 2014-08-16 10:49:27 +08:00
z9hang dfae970d1c Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-16 09:16:40 +08:00
z9hang 746022506d 用户列表排序问题、项目得分不一致问题 2014-08-15 17:43:10 +08:00
chenmin ace256bea1 修复竞赛模块用户留言挡住右边图标的问题 2014-08-15 16:06:41 +08:00
chenmin bd56286b4e 配置课程学时太长bug修复; 2014-08-15 15:58:12 +08:00
chenmin a420a41b78 单个帖子主题超出问题修复; 2014-08-15 15:12:26 +08:00
chenmin e44ece80f6 项目讨论区贴子主题超出边界bug处理 2014-08-15 14:45:04 +08:00
sw ae61ccaca9 修改动态首页显示样式 2014-08-15 14:42:28 +08:00
z9hang 2b6a376d31 修复数据库为初始状态时会出现的部分bug、去除部分连接的域名 2014-08-15 14:30:01 +08:00
chenmin 19c5ebf450 修复贴吧标签有删除标识后删除失败的bug;
修复删除后没刷新的bug;
2014-08-15 14:07:13 +08:00
chenmin 05ed41615e Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-15 11:23:53 +08:00
chenmin 33b5f821c4 修复贴吧标签不能删除的bug 2014-08-15 11:21:11 +08:00
z9hang af869deb8e Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-15 08:55:12 +08:00
z9hang 7b14be7310 错误提示页面导航栏丢失问题、新建问题跟踪red_project_scores问题 2014-08-15 08:54:19 +08:00
sw e923fd1e5b 1.注释代码 2014-08-15 08:38:02 +08:00
sw b92f385202 #1309 项目缺陷项目下拉框固定宽度 2014-08-14 16:40:12 +08:00
sw 5f559fcb67 #1309 项目缺陷项目下拉框固定宽度 2014-08-14 16:39:07 +08:00
sw 4a0f11dfce #1130 项目讨论区回复对非汉字自动换行 2014-08-14 16:33:43 +08:00
zhanghaitao 20f183799f #828 删除上传的文件不可用修复 2014-08-14 16:19:40 +08:00
zhanghaitao 4d870ca9e5 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-14 15:58:42 +08:00
zhanghaitao 9ac53e5a0b 点击用户名出异常修改 2014-08-14 15:58:32 +08:00
sw 46ba7f6a7b Merge branch 'szzh' into develop 2014-08-14 15:55:43 +08:00
sw fb50defbec 修复按钮回去不正确的问题 2014-08-14 15:54:03 +08:00
zhanghaitao 1b4b21fc19 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-14 15:47:46 +08:00
zhanghaitao 0215c96ec9 错误修改 2014-08-14 15:47:36 +08:00
sw 2a831136ae Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-14 15:16:20 +08:00
sw daeab7ef64 1.修改新建、修改贴吧时描述编辑框
2.增加字段长度限定的提示
3.修改帖子内容展示
2014-08-14 15:15:52 +08:00
zhanghaitao 36004913c6 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-14 15:11:25 +08:00
zhanghaitao 43cfcce44e #826 :资源标签不能删除Bug修复 2014-08-14 15:11:14 +08:00
sw 14a436a310 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-14 14:38:41 +08:00
sw 445d29d036 1.修改新建帖子的长度上限设置,设置为2G
2.修改新建贴吧时贴吧的描述字段类型
2014-08-14 14:38:18 +08:00
sw 08115c9de4 1.修复文本格式化报错的问题
2.修改作业留言清除按钮描述不正确的问题
2014-08-14 14:11:02 +08:00
zhanghaitao e18129c935 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-14 11:37:15 +08:00
zhanghaitao d21bda87a7 #938 下拉框任选某项,点击“查询”发生异常问题解决 2014-08-14 11:37:03 +08:00
chenmin 4acf5f3f06 添加文件提示页面元素变量处理 2014-08-14 11:09:34 +08:00
sw 79c6722aad Merge remote-tracking branch 'origin/szzh' into szzh 2014-08-14 10:54:52 +08:00
sw f99543ab4b #1294
1.修改缺陷列表中缺陷描述样式
2.修改缺陷、日历查询时,Closed->关闭于,角色成员减少学生、老师、助教等3个角色
2014-08-14 10:54:42 +08:00
chenmin 87ada7c0d5 资源搜索页面下载文件改为中文提示;
使用中文后显示乱码问题修改;
2014-08-14 10:52:34 +08:00
chenmin 86cb7d13d5 新建竞赛通知bug修复 2014-08-14 10:24:01 +08:00
chenmin 3b87f86267 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-14 09:56:36 +08:00
chenmin 027bd1ace6 修复参加竞赛页面显示错误 2014-08-14 09:56:22 +08:00
zhanghaitao a4441bca37 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-14 09:43:11 +08:00
zhanghaitao 9d0f759a71 #939 项目动态旗帜时间的修改 2014-08-14 09:42:58 +08:00
sw 22bbf45269 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-13 18:06:33 +08:00
sw df0c1e5917 修复缺陷标题超出界面的问题 2014-08-13 17:37:00 +08:00
chenmin bd97356090 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-13 17:35:27 +08:00
chenmin e12a540061 项目日历页面描述错误修改; 2014-08-13 17:34:20 +08:00
z9hang b8acd13f25 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-13 17:14:01 +08:00
chenmin 361e48fea8 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-13 17:08:57 +08:00
sw 8c59abc070 #1279 修改搜索提示 2014-08-13 16:55:42 +08:00
sw 440395f26f #1290 修改admin配置管理--用户列表--项目列表界面以及相关功能问题 2014-08-13 16:52:07 +08:00
z9hang e65487d527 项目成员个人得分显示 2014-08-13 16:50:32 +08:00
zhanghaitao bc6ad5d416 #936 输入文档标题非汉族显示bug修复 2014-08-13 16:45:50 +08:00
zhanghaitao ce7d91d164 #932 输入主题为非汉字类型且字数较多时,显示超出边框Bug修改 2014-08-13 16:29:26 +08:00
sw a7e22a7379 修复admin用户列表界面,查询结果显示不正常的问题 2014-08-13 16:10:47 +08:00
sw f2f06a9d28 调整管理员用户配置界面,表格样式 2014-08-13 16:06:40 +08:00
z9hang c833c4ac62 readme修改 2014-08-13 15:59:54 +08:00
z9hang 14026d0e0b 个人得分细节显示 2014-08-13 15:59:19 +08:00
zhanghaitao 88aa66b15b Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-13 15:38:20 +08:00
zhanghaitao 4934c8c801 # 页面返回异常处理 2014-08-13 15:37:28 +08:00
sw a54676c583 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-08-13 15:24:38 +08:00
sw 0e35967433 修改wiki编辑页面初始化高度 2014-08-13 15:19:05 +08:00
sw 582ccd2ecf 添加wiki插件,修改项目讨论区模块回去格式化字符串不正确的BUG 2014-08-13 14:45:10 +08:00
z9hang 56aa2fb8dc Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-08-13 11:21:37 +08:00
z9hang caed78327a 积分计算修改 2014-08-13 11:17:22 +08:00
sw ef6f239182 增加课程资源分离出来相关表数据迁移 2014-08-12 15:02:55 +08:00
chenmin ecccbf1cf7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-12 14:19:30 +08:00
sw 0064018a37 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-12 11:35:53 +08:00
sw 339a06007c 增加课程资源分离出来相关表 2014-08-12 11:31:42 +08:00
sw 835ef97510 wiki编辑页面插件更新 2014-08-12 11:22:37 +08:00
zhanghaitao 7b3468718f #898 引用回帖不转义的问题 2014-08-12 10:24:27 +08:00
zhanghaitao 64f6175f22 1.#912 admin管理配置窗口:项目列表、用户列表界面的文字超出显示框的修改 2014-08-11 17:06:45 +08:00
chenmin f6f1bddaff Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-11 17:06:24 +08:00
chenmin 50e172a25a 删除课程留言前增加提示 2014-08-11 16:51:45 +08:00
zhanghaitao d7bfdc8de4 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-11 16:39:35 +08:00
zhanghaitao b9ee7fe00d 1.#878 缺陷输入计划完成时间小于开始时时间修改
2.修改时间选择的最小默认值
2014-08-11 16:39:18 +08:00
sw 0c597d23a2 Merge branch 'szzh' into develop 2014-08-11 15:09:25 +08:00
sw 33855f721d 优化课程首页效率 2014-08-11 15:07:56 +08:00
sw f7635370d7 优化课程首页效率 2014-08-11 14:49:58 +08:00
sw 8724b79296 清理页面代码 2014-08-11 13:37:54 +08:00
sw 8c6160f496 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-11 09:19:20 +08:00
chenmin e3ab21e409 修复当登陆的用户的学校没有课程时的课程列表显示bug 2014-08-11 09:19:40 +08:00
linhk 044bba4d0d Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-08 16:44:00 +08:00
linhk 0028c11426 退出项目功能 2014-08-08 16:43:34 +08:00
sw ea0b7ef3f1 Merge branch 'szzh' into develop 2014-08-08 16:42:41 +08:00
sw 6ab17a2bf7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-08 16:41:36 +08:00
sw db826a71ff Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-08 16:19:58 +08:00
chenmin 6037421c7d 修复没有课程的学校显示bug 2014-08-08 15:45:06 +08:00
chenmin dd64f13e49 课程列表空行bug 2014-08-08 15:37:26 +08:00
sw 006d1eac8f Merge remote-tracking branch 'origin/szzh' into szzh 2014-08-08 15:34:44 +08:00
z9hang 87f6f81279 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-08 15:09:48 +08:00
z9hang f8c6b66119 修改密码处导航丢失问题 2014-08-08 15:09:32 +08:00
z9hang 683cd9f918 个人积分修改 2014-08-08 13:47:02 +08:00
sw b5e8b12806 修改密码页面查询按钮改为确定 2014-08-08 11:32:15 +08:00
linhk 3d76b26e26 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-08 09:31:42 +08:00
linhk 70a1839e74 英文界面-用户下拉菜单(我的课程、项目、编辑资料)显示问题 2014-08-08 09:30:48 +08:00
zhanghaitao dbe8456fd5 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-07 17:56:49 +08:00
zhanghaitao eac85b338f 标示错误修改 2014-08-07 17:56:29 +08:00
linhk 192bc8d89c Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-07 17:16:26 +08:00
linhk cb4869fd20 解决新建版本库名长255个字符时异常
解决版本库名长时,界面显示错误
2014-08-07 17:16:00 +08:00
zhanghaitao 019a1d4cba Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-07 16:41:46 +08:00
zhanghaitao d9a9867f96 #815 中英文显示问题修改 2014-08-07 16:41:31 +08:00
chenmin f2f7dfaf12 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-07 16:21:00 +08:00
chenmin d087c52314 课程动态为空判断 2014-08-07 16:20:46 +08:00
linhk af683f917d 解决新建版本库名非法类型成功新建 2014-08-07 16:09:50 +08:00
linhk 5e8eda6a40 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-07 15:58:37 +08:00
linhk 387d482059 解决用户注册无地区、身份可注册成功 2014-08-07 15:58:00 +08:00
zhanghaitao 4c71af51f4 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-07 15:54:22 +08:00
zhanghaitao f3fe5d918e #832 状态联动问题的解决 2014-08-07 15:54:05 +08:00
sw 7179943f8b Merge branch 'szzh' into develop 2014-08-07 14:37:28 +08:00
sw 78343effaf em.yml还原 2014-08-07 14:36:28 +08:00
sw 08821b9391 Merge branch 'szzh' into develop 2014-08-07 14:03:06 +08:00
linhk b545c5034d Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	config/locales/en.yml
2014-08-07 12:02:55 +08:00
z9hang 96fa28f70d Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-07 11:36:08 +08:00
sw b0b3f257a4 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-07 11:31:39 +08:00
sw dac4042ee9 ttt 2014-08-07 11:31:24 +08:00
z9hang 722a568466 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-07 11:29:38 +08:00
z9hang 56a06c4a04 修复git说明页面导航丢失问题
修改个人得分
2014-08-07 11:28:58 +08:00
zhanghaitao 45cc3ddb9b #873提示信息修改 2014-08-07 11:23:01 +08:00
zhanghaitao 68a86c5e5d #873 #829问题修改 2014-08-07 11:20:24 +08:00
z9hang eacc0fdf53 修复编辑作业提交时的bug
修改个人得分
2014-08-07 10:45:56 +08:00
sw 34af8053cc Merge remote-tracking branch 'origin/szzh' into szzh 2014-08-07 09:23:28 +08:00
linhk 0c00754057 解决谷歌浏览器再上传相同文件时不可用 2014-08-07 09:13:01 +08:00
z9hang 17e6f0ee4f 部分私有的项目提交次数显示问题 2014-08-07 08:51:19 +08:00
z9hang c6271e2aa9 修复由项目积分改动引起的一个页面无法查看bug、添加项目得分统计任务 2014-08-06 16:02:26 +08:00
linhk f173db4c9d 英文版用户注册页面身份下拉框显示错误的Bug 2014-08-06 15:58:38 +08:00
sw a4199e4c54 修改错误代码 2014-08-06 15:39:06 +08:00
sw 22335b23a6 修复新建账号申请项目时在申请列表无法显示的BUG #1180 2014-08-06 15:10:53 +08:00
z9hang 0eca547ec5 修复两个导航栏丢失问题、版本库=》查看差别,没有对应的文件或修订版本时报错问题 2014-08-06 15:03:43 +08:00
linhk 23c9d5381e 注册界面失败填写信息继续保留
修改注册见面企业提交失败姓、名内容错误Bug
2014-08-06 14:41:22 +08:00
z9hang 05186c8590 项目积分存数据库
有项目积分引起的系列bug
2014-08-06 11:46:38 +08:00
z9hang 1ca6447478 修复项目缺陷、新闻、讨论区等页面无法查看bug 2014-08-05 17:31:05 +08:00
linhk d8964d81a8 用户注册lastname超长报错 2014-08-05 17:13:50 +08:00
z9hang b4be18ab9d Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/controllers/files_controller.rb
2014-08-05 16:41:23 +08:00
z9hang 7907edf168 更新项目得分规则
调整项目列表显示样式
2014-08-05 16:39:33 +08:00
sw c155ebdfd7 Merge remote-tracking branch 'origin/szzh' into szzh 2014-08-05 15:38:01 +08:00
chenmin fbe3e535b4 修复课程资源排序bug
修复课程动态时间段约束bug
2014-08-05 15:23:01 +08:00
linhk 3862f857f7 解决当帖子回复条件为空排列次序错误 2014-08-05 14:02:39 +08:00
chenmin 8b217735c3 1029 修复部分课程资源排序不可用问题 2014-08-05 12:00:39 +08:00
z9hang 2c77d1b4cf 访问资源库问题 2014-08-05 11:10:41 +08:00
linhk 65174ad8ef 项目--wiki--重定向/重命名:“重”字被掩盖 2014-08-05 09:19:05 +08:00
linhk f8d7aeebac Merge remote-tracking branch 'origin/szzh' into szzh 2014-08-05 08:49:28 +08:00
chenmin 226d19b912 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-04 17:36:44 +08:00
sw 37e5bdee22 修复某些课程动态内容为空的BUG #1128 2014-08-04 17:36:07 +08:00
chenmin 8c8127c8d9 1016 修复课程显示界面空行问题; 2014-08-04 17:36:04 +08:00
z9hang 426ea23d6e 回复帖子内容为空时报错问题 2014-08-04 17:30:29 +08:00
sw 5f3ab0322b 修改竞赛上传图片提示 #1127 2014-08-04 16:04:36 +08:00
sw 94f6e871b1 修改新建用户时企业名不是英文且提示错误的BUG #1130 2014-08-04 15:49:23 +08:00
sw 8b3b1bdcfa 取消编辑参赛作品时注意提示 2014-08-04 15:36:19 +08:00
sw 9cb026ed39 增加竞赛删除评论的功能 2014-08-04 15:01:39 +08:00
z9hang 80b2a2dc45 修正公共贴吧新建帖子问题
修正课程列表错误
2014-08-04 12:23:20 +08:00
linhk 653c505471 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-04 09:39:14 +08:00
sw 209c1aeaab Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-02 17:06:39 +08:00
sw 69f7f97bf8 修复个人动态主页缺陷描述超出页面的BUG 2014-08-02 17:05:56 +08:00
zhanghaitao 01ab676622 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-02 15:17:21 +08:00
zhanghaitao 5a5ac28833 用户列表显示修改 2014-08-02 15:16:51 +08:00
linhk 25cfb7aa71 解决谷歌浏览器新建版本库文本框会默认填写缓存内容的问题 2014-08-02 14:43:05 +08:00
linchun ab2d92315e fix plugin ckeditor db migration 2014-08-01 22:29:52 +08:00
z9hang ff02c4f9f2 修正课程显示老师、学生人数与课程中老师、学生数量不一致问题
修正学校主页课程推荐中显示的课程人数与课程总人数不一致问题
2014-08-01 17:43:06 +08:00
sw c5a7497910 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-01 17:36:50 +08:00
sw 63cfa9b35a 取消打包下载的ajax 2014-08-01 16:14:00 +08:00
z9hang c78047ae98 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-01 16:01:33 +08:00
z9hang acb41158e7 错误提示页面导航栏添加
登陆时自动忽略登陆名前后空格
2014-08-01 16:01:16 +08:00
nwb 204ced9490 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-01 16:00:06 +08:00
nwb 5a2d0ce649 issue#1077 新建竞赛的奖金换行显示,长度约束 2014-08-01 15:52:18 +08:00
linhk 54a246b6e6 中国高校搜索文本Enter快捷操作 2014-08-01 15:46:05 +08:00
z9hang 0d46c63c54 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-08-01 14:55:55 +08:00
z9hang 087105ad9e 贴吧长串数字不换行问题 2014-08-01 14:55:25 +08:00
sw aa0caff077 修改部分项目讨论区描述仍为课程讨论区的描述 2014-08-01 14:37:44 +08:00
sw 9e5f7e6fc6 取消主页加入课程链接 2014-08-01 14:36:41 +08:00
z9hang 2505cb30c4 贴吧描述不换行问题 2014-08-01 14:31:51 +08:00
z9hang 2ad51d7afe 修改引用的留言为不能修改 2014-08-01 14:08:38 +08:00
zhanghaitao c1519984de Issue#1091,文本显示修改 2014-08-01 13:56:12 +08:00
sw b8f27b51c0 取消主页加入课程链接 2014-08-01 11:37:14 +08:00
sw d66dc65cca Merge branch 'szzh' into develop 2014-07-31 17:27:01 +08:00
sw d5ac443f90 修复竞赛列表搜索结果不正确的BUG 2014-07-31 17:02:30 +08:00
sw 8b80d99a70 修复资源标记搜索不正确的BUG issues#1089 2014-07-31 14:39:18 +08:00
sw 2c689b6399 删除竞赛时删除竞赛下所有作品 2014-07-31 14:02:25 +08:00
sw 7b32debb92 修复谷歌浏览器用户列表翻到第5页后角色信息和翻页列表在同一行的BUG 2014-07-31 13:55:22 +08:00
sw 5564ca063b 整理迁移文件,修改迁移文件运行错误 2014-07-31 13:40:02 +08:00
sw a9fad79c8d Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-31 11:35:50 +08:00
sw bb6be3ed8a 修改html错误 2014-07-31 11:35:16 +08:00
z9hang 27feeee03f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-31 10:21:33 +08:00
z9hang 8a9e2b47ad 调用存储过程刷新项目提交次数 2014-07-31 10:21:11 +08:00
sw a3cbcdad51 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-31 10:13:51 +08:00
sw f0cee20f11 tt 2014-07-31 09:52:52 +08:00
sw 41d983e904 取消过期缺陷邮件的发送(很有问题)!!! 2014-07-31 09:45:46 +08:00
z9hang 321712bd94 更新readme 2014-07-31 09:08:47 +08:00
z9hang 290d9b1973 课程首页课程名过长导致个别信息显示不全问题 2014-07-30 16:31:59 +08:00
z9hang cb6c95c632 课程列表提示框里有html标签问题 2014-07-30 16:03:23 +08:00
sw 31e8ad98ae 1.修复竞赛作品每次修改之后,都会吧图片清空的BUG
2.修改删除竞赛作品图片功能
2014-07-30 15:48:13 +08:00
z9hang 4dc2a23f9d Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-30 15:31:23 +08:00
z9hang 03b212e363 首页定制,是否显示课程,竞赛 2014-07-30 15:26:55 +08:00
sw 1f4943483e 1.现在竞赛作品名称、开发人员、开发环境的长度
2.修复竞赛作品一上传的图片,编辑时资源列表不显示的问题
2014-07-30 13:52:55 +08:00
sw 01ea6238a4 修复竞赛通知描述过长时报错的BUG 2014-07-30 10:48:33 +08:00
yanxd 281c48c0b3 . 2014-07-30 10:18:49 +08:00
z9hang 847bb35906 修正谷歌浏览器贴吧图标偏移问题 2014-07-30 10:00:07 +08:00
z9hang 583bdd7a54 调整贴吧编辑按钮样式 2014-07-30 09:37:49 +08:00
z9hang 5800cf5fff 修正登陆错误 2014-07-30 08:58:28 +08:00
z9hang 952fcce0de Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-29 18:04:45 +08:00
z9hang c60188038e 得分机制修改 2014-07-29 18:04:35 +08:00
sw 28606f030d 修复搜索参赛作品结果翻页跳转不正确的BUG 2014-07-29 17:55:14 +08:00
sw c4aa9aadbe Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-29 17:47:37 +08:00
sw b05e112a3f 1.修改邮件服务器配置
2.查询竞赛作品在js中提交,增加搜索条件是不是为空的判断
3.查询结果取消按照时间/活跃度排序功能
2014-07-29 17:47:20 +08:00
sw 3119d9a9aa 增加竞赛作品的搜索功能 2014-07-29 17:35:22 +08:00
nwb 81b77bc870 文件删除修改 2014-07-29 16:14:49 +08:00
sw c1bbd8a535 对于设置了完成日期的缺陷,到日期还没解决,给相关人员发一个通知邮件 2014-07-29 14:29:59 +08:00
yanxd 233f041cc5 . 2014-07-29 12:05:24 +08:00
sw e7503237f1 Merge remote-tracking branch 'origin/szzh' into szzh 2014-07-29 11:16:14 +08:00
z9hang d8fcf8eb9b Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-29 10:07:02 +08:00
z9hang 225e3c396a 个人得相关分方法添加 2014-07-29 10:06:48 +08:00
sw 52dcc6d1a1 讨论区帖子添加回复时,取消修改帖子的更新时间。项目最新动态只显示最新的回复,不将帖子创建重复显示 2014-07-29 09:16:11 +08:00
nwb d6876fabc1 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-29 08:36:46 +08:00
nwb 1156387161 “文件密级”改为“是否公开” 2014-07-29 08:36:30 +08:00
sw e344f16f5c Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-28 17:50:13 +08:00
sw 2141fcc3ca 将是否启用DTS测试移入项目模块配置 2014-07-28 17:49:28 +08:00
nwb 9da116c0e3 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-28 17:14:20 +08:00
nwb cb4efd914e 修正项目文档删除BUG 2014-07-28 17:14:02 +08:00
yanxd f18e828632 usercontroller#test 2014-07-28 15:37:26 +08:00
yanxd bf9a992399 活跃度排序不一致 2014-07-28 15:37:26 +08:00
z9hang 0d0fb7052e Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-28 15:16:37 +08:00
sw a39672dd14 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-28 15:09:14 +08:00
z9hang 90a35fa24a 竞赛、课程首页,贴吧动态名字过长显示问题
课程、项目编辑贴子导航丢失问题
2014-07-28 15:06:54 +08:00
sw 18ddb8604b 取消参赛作品名称、描述的字数限制 2014-07-28 14:58:01 +08:00
nwb 2c79a51e48 优化文件读取编码解析 2014-07-28 14:43:38 +08:00
z9hang 9bf8abd03b Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-28 13:53:57 +08:00
z9hang a4ecccc048 修复贴吧动态中昵称过长回复被挤到不正确位置bug 2014-07-28 13:53:39 +08:00
nwb 1b589bf562 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-28 11:30:02 +08:00
nwb 74de064cca 1.文件删除权限判断优化
2.课程通知附件删除BUG修改
2014-07-28 11:29:55 +08:00
yanxd a8ed4272cc ckeditor: 描述中网址后面带有换行,projects列表出错 2014-07-28 11:03:39 +08:00
nwb f8328727cd Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-28 10:46:15 +08:00
nwb dfdc58719a 课程主留言添加删除功能 2014-07-28 10:46:05 +08:00
z9hang 1daec14ab5 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-28 10:38:23 +08:00
z9hang 8871652e01 添加首页定制,设置是否显示"我的课程"功能 2014-07-28 10:37:22 +08:00
sw cc215e6c7b 修复个人动态图片显示不准确的问题 2014-07-28 09:47:11 +08:00
nwb ef62fc1fac 修正缺陷搜索缺陷编号显示问题 2014-07-28 09:46:19 +08:00
nwb f36ccad76a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-28 09:23:47 +08:00
nwb 9c9778d433 项目的“资料下载”改为“作品下载” 2014-07-28 09:23:40 +08:00
yanxd 979d6dd067 dts_test. controller ===> model 2014-07-28 09:22:52 +08:00
nwb 983cdebbb6 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-28 09:18:45 +08:00
nwb 00cf448bda 用户动态兼容空留言 2014-07-28 09:18:24 +08:00
yanxd 4fae105b96 project testing. 2014-07-25 17:43:19 +08:00
nwb f052d0d461 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-25 17:37:07 +08:00
nwb 1922593fee Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-25 17:36:35 +08:00
z9hang a1e06991d5 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-25 17:36:11 +08:00
nwb f8a59220e3 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-25 17:08:01 +08:00
z9hang 97531960da 首页定制添加剂修改图片大小功能 2014-07-25 16:05:33 +08:00
sw 43efd63dda Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-25 15:42:01 +08:00
sw 758541250f 插件数据增加迁移文件,确保数据库数据正确 2014-07-25 15:41:21 +08:00
nwb 560ee0a2fc 数据库文件 2014-07-25 15:24:55 +08:00
sw b5b246f098 修复个性签名未自动换行的问题 2014-07-25 15:12:24 +08:00
nwb c0ac9924e7 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-25 15:09:56 +08:00
nwb 2a4daf04f9 删除资源文件修改 2014-07-25 15:09:29 +08:00
sw ea322d6177 修复项目提交时间字的长度过长时会换行的BUG 2014-07-25 14:51:10 +08:00
nwb 1257e67380 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-25 14:06:59 +08:00
nwb 6531bf5195 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-25 14:05:40 +08:00
nwb 735d7f2c1f 文件下载权限判断优化 2014-07-25 14:05:25 +08:00
z9hang 2c08f39001 修改首页简介样式 2014-07-25 14:02:23 +08:00
z9hang d6a425849a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-25 13:38:20 +08:00
z9hang 34626e03a4 调整主页显示图片大小 2014-07-25 13:37:49 +08:00
z9hang 5a0d76c1e0 竞赛通知发布完成 2014-07-25 11:51:52 +08:00
z9hang 673ffb1819 提交次数刷新问题 2014-07-25 11:31:16 +08:00
nwb 2bfc7aa93f Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-25 11:12:08 +08:00
sw 70003c8374 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/controllers/zipdown_controller.rb
2014-07-25 11:10:45 +08:00
sw 6d5f72326f 增加定时任务 2014-07-25 11:09:47 +08:00
z9hang 42f0c49093 作业打包下载错误提示页无导航问题 2014-07-25 11:08:16 +08:00
z9hang 7eb1a76734 修改编辑贴吧无导航栏、提交失败无提示bug 2014-07-25 10:42:56 +08:00
z9hang 138d90a887 添加数据迁移文件 2014-07-25 10:09:38 +08:00
z9hang ca52de614d 修正错误 2014-07-25 10:07:14 +08:00
z9hang 3b54def1c7 首页定制修改 2014-07-25 10:01:02 +08:00
z9hang 6ad3a1128e Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-25 09:19:47 +08:00
z9hang f83336aed0 修改首页定制中热门项目排序方式的实现 2014-07-25 09:19:29 +08:00
z9hang 4542b9e21a 积分修改 2014-07-24 18:05:37 +08:00
yanxd 6a14676248 remove pry 2014-07-24 17:24:30 +08:00
yanxd 1755d7a790 issues controller & unit testing, word log print. 2014-07-24 17:23:46 +08:00
sw ec41054008 将configuration.yml从版本库删除 2014-07-24 16:26:19 +08:00
sw 37802e81de 修复CKEditor插件显示不正确的问题 2014-07-24 14:03:43 +08:00
nwb 0d7bedeb0d 测试提交 2014-07-24 11:30:12 +08:00
nwb 8b0b31f749 附件下载更新 2014-07-24 11:20:33 +08:00
sw 1b503f3b6d Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-24 11:15:51 +08:00
nwb 0fc2e3be21 修改BUG 2014-07-24 10:43:19 +08:00
nwb d59ab02db8 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-24 10:40:02 +08:00
nwb 990dc3cbff 修改项目文档显示 2014-07-24 10:39:42 +08:00
sw dd589c4811 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-24 08:50:44 +08:00
z9hang 6b441760c4 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-23 17:57:34 +08:00
z9hang 80b5871756 竞赛首页定制中添加编辑通知通告的编辑框并存入数据库
添加新的表记录个人得分相关细节,及各种得分更新方法
2014-07-23 17:56:15 +08:00
yanxd f1a2effbd2 . 2014-07-23 14:57:58 +08:00
yanxd 9c3ff51633 remove useless navbar method called 2014-07-23 11:03:43 +08:00
sw da05ce5d61 t 2014-07-23 10:40:53 +08:00
yanxd 9be52f6cf7 testing doc. 2014-07-23 09:32:41 +08:00
z9hang fb6cd2e9d8 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-23 09:25:17 +08:00
z9hang 0b6168c7fd 添加竞赛首页发布通知通告相关代码
项目个人得分去除小数点
2014-07-23 09:24:26 +08:00
sw a7debdae98 格式化代码 2014-07-23 09:16:06 +08:00
nwb 0a06e2033f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-23 08:43:36 +08:00
nwb 5d22bc5510 文件上传修改 2014-07-23 08:43:23 +08:00
yanxd ee95d9b115 user_activity page 2014-07-22 17:57:11 +08:00
yanxd 18d096f0d8 删除项目,竞赛表project_id会置空,projecting_softapplications模型不知道干嘛用,此表也不存在 2014-07-22 17:40:32 +08:00
yanxd cccbd941ce 用户删除,管理界面用户去排序,删除后跳转,去无效参数 2014-07-22 17:17:42 +08:00
nwb f22a39fbfa Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-22 16:56:34 +08:00
nwb a5d829b95e 1.优化课程通知模块
2.优化文件上传
2014-07-22 16:49:32 +08:00
z9hang 41ea3a1baf Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-22 16:00:11 +08:00
z9hang dee09aad75 修复导航bug 2014-07-22 15:59:35 +08:00
nwb 8f74241eda Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-22 15:05:27 +08:00
nwb 095cb7fc32 加强对chrome浏览器文件上传的支持 2014-07-22 15:02:58 +08:00
sw c2ff861fba 1.当作业文件列表为空时报403错提示改为alert提示
2.异常捕获代码后给出js提示:暂时不能下载此文件
2014-07-22 14:29:45 +08:00
sw 47ae398748 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-22 13:49:25 +08:00
sw de17a84061 增加异常捕获,当作业未找到相应文件时,跳到文件未找到页面(不报500错误) 2014-07-22 13:48:30 +08:00
nwb 42c2f6c2ee 更改项目文档按作者排序 2014-07-22 13:47:05 +08:00
sw 7e0210dd9d Merge remote-tracking branch 'origin/szzh' into szzh 2014-07-22 13:35:26 +08:00
sw e5547b953e 增加教师功能用户打包下载所有作业的功能 2014-07-22 13:35:10 +08:00
nwb 3ba8ba010d Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-22 10:52:21 +08:00
nwb 09f13409de Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-22 10:51:12 +08:00
nwb 840a7b337b 添加课程资源内容类型更新脚本 2014-07-22 10:50:58 +08:00
sw d9b9b2152f 增加教师功能用户打包下载所有作业的功能 2014-07-22 09:56:29 +08:00
nwb 68be9c25b8 Merge remote-tracking branch 'remotes/origin/szzh' into develop
Conflicts:
	app/views/welcome/contest.html.erb
2014-07-22 09:52:16 +08:00
sw 58c3e98a21 Merge remote-tracking branch 'origin/szzh' into szzh 2014-07-22 09:44:24 +08:00
sw ab55043880 修复当作业附件列表为空时,点击打包下载会报500错的BUG 2014-07-22 09:42:41 +08:00
yanxd 87671e9d73 base footer merge bug. 2014-07-22 09:39:27 +08:00
nwb 5954ba1788 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-22 09:32:54 +08:00
nwb cf11cac0ad 项目文档权限判断优化 2014-07-22 09:32:46 +08:00
yanxd 8496d6e0d2 删除project多余导致删除项目失败的关联关系 2014-07-22 09:17:21 +08:00
yanxd edee2b2327 删掉welcome没用的方法 2014-07-22 09:17:21 +08:00
nwb 67dfd72845 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-22 09:15:28 +08:00
nwb 518edeac68 项目文档浏览BUG修改 2014-07-22 09:15:19 +08:00
z9hang 513fd32ec5 修复查看个人动态无权限bug 2014-07-22 09:11:37 +08:00
z9hang 221aef4a7f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-22 08:53:24 +08:00
z9hang 3e79dd6e32 竞赛通知鼠标悬停
导航丢失问题
2014-07-22 08:53:14 +08:00
nwb b49344107c 用户动态权限判定修改 2014-07-22 08:51:35 +08:00
nwb aebae800dd 竞赛首页修改 2014-07-22 08:37:07 +08:00
nwb 79eac39dc2 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-21 17:50:51 +08:00
sw 6e954d314f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-21 17:45:01 +08:00
sw bfda30ee80 1.增加修改竞赛作品页面作品类型、关联项目的默认选择 2014-07-21 17:44:14 +08:00
nwb feaea8375e 优化资源下载界面 2014-07-21 17:33:13 +08:00
nwb 774eed0dbf 优化公开资源的下载权限判断 2014-07-21 17:29:30 +08:00
sw b1251db30c 1.修改竞赛作品时增加作品类别下拉框选择
2.修改竞赛作品时增加获取选择其他时作品类别
2014-07-21 17:23:45 +08:00
nwb 5e462f1ae7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-21 17:00:36 +08:00
nwb 51e4d00691 课程回复后编辑框隐藏 2014-07-21 17:00:27 +08:00
sw c8aaa2776c 1.作品类别增加其他选项,当用户选择其他时,显示一编辑框用于用户输入其作品所属类别
2.添加竞赛支持自定义类别
2014-07-21 16:59:00 +08:00
yanxd fb138d1593 remove user_activities path, 3path bug. 2014-07-21 16:41:11 +08:00
nwb 222959d1da Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-21 16:19:54 +08:00
nwb 27fda1f938 竞赛首页修改 2014-07-21 16:19:45 +08:00
yanxd 04ec6ff27a course model validations testing. 2014-07-21 15:50:40 +08:00
yanxd 472b61fefe 删除了不能通过的测试,修改user_activities。所有原路由测试可以通过。 2014-07-21 15:49:23 +08:00
nwb aea41ba997 修改竞赛首页搜索功能 2014-07-21 15:45:00 +08:00
sw 890bc7459d 修改项目列表页面当管理人员过多时,显示更多。点击更多按钮,跳转到该项目的成员列表页面 2014-07-21 15:31:15 +08:00
nwb 5adac1a32a 课程讨论区回复内容为空时提示 2014-07-21 15:15:10 +08:00
nwb 35ab3a2c7d Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-21 13:53:45 +08:00
nwb d8d8473811 优化课程列表成员数计算 2014-07-21 13:52:23 +08:00
nwb 3a249e7196 修正课程通知编辑BUG 2014-07-21 13:40:38 +08:00
nwb ec71e8eeeb Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-21 13:37:48 +08:00
nwb c7f80effb7 修正课程讨论区删除帖子BUG 2014-07-21 13:37:36 +08:00
z9hang 5e4571d6af 修复部分页面导航丢失问题 2014-07-21 11:14:17 +08:00
nwb 2a8929b90f Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-21 10:11:36 +08:00
z9hang f273b60f32 更新ReadMe.txt 2014-07-19 17:04:44 +08:00
z9hang 162a4cfa84 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-19 16:53:02 +08:00
z9hang 0322258386 去掉一个参加竞赛中多出来的项目创建 2014-07-19 16:52:43 +08:00
z9hang 376ba1d793 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/views/contests/show_attendingcontest.html.erb
	db/schema.rb
2014-07-19 16:48:14 +08:00
sw 8db6b50a65 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/helpers/courses_helper.rb
2014-07-19 16:47:05 +08:00
sw e24323147d 修复项目描述过长不会自动换行的BUG 2014-07-19 16:45:27 +08:00
z9hang 5c0e3e96cc 修复不分页面导航栏缺失问题、修复部分域名错误问题、添加修复FirstPage表数据的迁移文件 2014-07-19 16:41:29 +08:00
sw ba66cde840 1.优化作业显示界面加载效率
2.修复获取作业的互评得分、综评得分、教师评分不准确的问题
2014-07-19 16:38:29 +08:00
nwb bda9921fb0 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-19 15:58:37 +08:00
nwb 49aa3a994e 学时不允许为空 2014-07-19 15:58:11 +08:00
nwb 0922715301 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-19 14:41:30 +08:00
sw 6186ff343e 去除无效的标签 2014-07-19 14:31:25 +08:00
nwb 4259d9c282 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-19 13:28:07 +08:00
sw fdfba199f3 修复评奖位置不正确的问题 2014-07-19 13:22:23 +08:00
sw 93d8fd31a0 增加作品分类下拉框 2014-07-19 13:16:29 +08:00
sw 64f025fe70 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/views/contests/show_attendingcontest.html.erb
2014-07-19 13:16:11 +08:00
sw 71ffdb9164 作品分类在下拉列表框中选择 2014-07-19 13:13:46 +08:00
nwb 206aeeccfb 优化2级菜单效果 2014-07-19 11:39:09 +08:00
sw 79c76d26c8 创建作品分类表,并插入部分数据 2014-07-19 11:35:43 +08:00
nwb f20f0aaa45 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-19 11:11:58 +08:00
nwb 60fa473608 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-19 10:59:30 +08:00
nwb 6bced5106e 调整课程列表视图 2014-07-19 10:55:46 +08:00
sw 9fe4c9f8a2 修改竞赛作品列表显示样式与创建作品样式 2014-07-19 10:44:23 +08:00
z9hang 599a277af3 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-19 10:36:24 +08:00
z9hang 74ff5d505d 修改加入竞赛创建项目链接域名不正确问题 2014-07-19 10:36:11 +08:00
nwb e1edb46ba2 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/models/course.rb
2014-07-19 09:42:46 +08:00
nwb 908254b911 项目、竞赛首页描述优化,鼠标悬停显示内容优化 2014-07-19 09:39:48 +08:00
yanxd f5efaac93a lunchun 2014-07-18 17:17:06 +08:00
yanxd 6af11fea68 course class period 2014-07-18 17:10:41 +08:00
z9hang 40d8ec6c6e Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-18 16:58:25 +08:00
z9hang 4bd083b059 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/views/users/show.html.erb
2014-07-18 16:56:00 +08:00
sw 6a42ce143b Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-18 16:53:35 +08:00
z9hang b44b488807 导航栏调整 2014-07-18 16:51:41 +08:00
nwb 6780167674 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-18 16:45:58 +08:00
nwb 0e0da39113 修改BUG 2014-07-18 16:44:40 +08:00
sw 9f02003bb9 用户课程列表增加自动换行 2014-07-18 16:42:18 +08:00
nwb 955cf619b8 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-18 16:42:01 +08:00
nwb 0e9a15aad5 短描述修改 2014-07-18 16:41:55 +08:00
sw 41983833d7 用户项目列表增加自动换行 2014-07-18 16:40:57 +08:00
z9hang bd43ef5d61 网站两边空白颜色调整、网站导航栏调整、admin账户新建用户bug修复 2014-07-18 16:39:39 +08:00
sw e0f5708038 修改错误 2014-07-18 16:21:20 +08:00
yanxd 3f6a298eb4 test.course.model 2014-07-18 15:58:37 +08:00
sw 999a252f7b 修改软件创客搜索结果显示样式 2014-07-18 15:47:48 +08:00
nwb 5087f90a26 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-18 15:33:56 +08:00
nwb 3b9245d143 隐藏新建竞赛作品时的作品类型 2014-07-18 15:33:47 +08:00
sw 0f3c2ff558 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-18 15:00:21 +08:00
nwb 0443f2085e 修改首页问题 2014-07-18 15:00:03 +08:00
nwb bc50d5f469 允许上传空文件 2014-07-18 14:35:44 +08:00
sw 46c7a4bb9f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-18 14:15:52 +08:00
sw 4a04d47c3c commit 2014-07-18 14:15:30 +08:00
nwb b655f0c7b0 Merge remote-tracking branch 'remotes/origin/szzh' into develop 2014-07-18 13:50:30 +08:00
nwb 29618d6a72 竞赛界面调整 2014-07-18 13:48:45 +08:00
nwb c443de5873 去掉课程名称验证 2014-07-18 11:49:47 +08:00
nwb 5272a90227 修改人数显示 2014-07-18 11:35:05 +08:00
nwb 7898bc1dd7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-18 11:25:16 +08:00
nwb 046142f437 优化students_for_courses表相关逻辑 2014-07-18 11:25:04 +08:00
yanxd df848ca756 print tag exception, course name valid test. 2014-07-18 11:08:36 +08:00
sw 5838b3e47d 不选择新闻时,取消"添加新闻"按钮的显示。不选择问题跟踪时,取消“新建问题”和“自定义查询”按钮的显示,不选择讨论区时,取消“发布新帖”按钮的显示 2014-07-18 10:54:22 +08:00
z9hang 057447f810 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-18 10:49:38 +08:00
nwb a4d06fbb12 课程成员设置为只能使用单一权限 2014-07-18 10:29:49 +08:00
sw 6f858795ef 项目模块配置未选中wiki时,取消左侧项目工具集的WIKI显示 2014-07-18 10:24:49 +08:00
sw bcaaa02bed 取消已完成课程在软件创客列表的显示 2014-07-18 10:01:54 +08:00
nwb b7c4f87a8f Merge remote-tracking branch 'remotes/origin/szzh' into develop
Conflicts:
	app/views/welcome/index.html.erb
2014-07-18 09:57:47 +08:00
nwb 6968039c87 修改课程学生计算函数 2014-07-18 09:55:10 +08:00
z9hang 036f8a3870 user.trustie.net域名下的用户列表课程项目链接跳转域名不正确 2014-07-18 09:46:11 +08:00
nwb 28543e3288 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-18 09:21:21 +08:00
nwb 8eac756ac7 1.项目首页的描述更改,不再限制项目描述字数
2.竞赛首页的描述更改,不再限制竞赛描述字数
2014-07-18 09:21:09 +08:00
yanxd 164ec645ee boards created frequently, css file file EOF. 2014-07-18 09:20:16 +08:00
z9hang 5b7fc4048a user.trustie.net域名下课程主页导航栏多个课程实践菜单
页面跳转时域名不正确问题重新修正
2014-07-18 09:11:02 +08:00
sw 6379dd704a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-18 08:51:56 +08:00
sw b81b5fc42c Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/views/layouts/_base_footer.html.erb
	app/views/welcome/index.html.erb
2014-07-18 08:36:55 +08:00
z9hang 0f4933240b Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-17 18:10:42 +08:00
z9hang 7c3a81735c user。trustie.net域名下跳转到项目页面时主域名没变bug(尚需测试)
user.trustie.net域名下主导航栏多一个项目托管菜单问题
2014-07-17 18:10:32 +08:00
yanxd 355d452472 63 tests, 93 assertions, 2 failures, 24 errors, 0 pendings, 0 omissions, 0 notifications 2014-07-17 17:13:14 +08:00
nwb ed00adb3ba 优化下载权限判断 2014-07-17 17:06:54 +08:00
nwb 3b1b057f0a 课程描述自动换行 2014-07-17 16:56:45 +08:00
nwb 634ef8df5f 界面修改 2014-07-17 16:11:32 +08:00
nwb baf181f1d7 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-17 16:06:26 +08:00
nwb f4d6696d2e 优化资源搜索界面 2014-07-17 16:06:10 +08:00
yanxd 2554e9fc5b code review function test: 106 tests, 89 assertions, 0 failures, 36 errors 2014-07-17 15:17:37 +08:00
nwb 02b4029e8c 资源文件下载界面调整 2014-07-17 15:05:49 +08:00
nwb 615b3ac2ac 课程界面调整 2014-07-17 14:32:07 +08:00
nwb 6a65b2a84b 去掉测试代码 2014-07-17 10:52:01 +08:00
nwb 0dc2466539 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-17 09:55:52 +08:00
nwb b60a0ddf59 1.添加给gitlab项目新增用户及赋权限接口
2.添加给gitlab项目删除用户接口
2014-07-17 09:55:40 +08:00
yanxd 12fb6bf5ca . 2014-07-17 09:52:56 +08:00
nwb 63e855725f Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-17 09:10:38 +08:00
nwb a58a747cfa 屏蔽用户界面的关注需求功能 2014-07-17 09:10:29 +08:00
yanxd 4eee70a845 course new/created test 2014-07-16 17:46:17 +08:00
nwb b34a8d6166 项目搜索优化 2014-07-16 17:25:47 +08:00
nwb 3d8571b59e 1.实现新增gitlab用户接口
2.实现删除gitlab用户接口
2014-07-16 16:50:28 +08:00
nwb 1f5d792783 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-16 15:52:52 +08:00
nwb 6dcc50e60b 添加gitlab创建项目(版本库)接口 2014-07-16 15:52:41 +08:00
z9hang 8d181c4e93 迁移文件出错问题 2014-07-16 15:32:27 +08:00
z9hang 2cab9f7895 热门项目排序添加空值判断,默认按活跃度排序 2014-07-16 15:24:56 +08:00
z9hang ab05bf6f36 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-16 15:16:20 +08:00
z9hang 494d3af9a4 修复贴吧分页问题 2014-07-16 15:16:10 +08:00
nwb 36ab954cf9 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-16 15:05:57 +08:00
nwb 297fe9a3f4 添加gitlab远程登录接口 2014-07-16 15:05:16 +08:00
yanxd 386aa1adc3 . 2014-07-16 14:35:54 +08:00
z9hang d9e04bab0a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-16 14:22:37 +08:00
z9hang cc4bf3b328 添加超级管理员控制首页热门项目排序问题 2014-07-16 14:22:12 +08:00
nwb 62af03debd Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-16 10:36:32 +08:00
nwb ca7ad03a05 1.优化课程动态信息
2.优化项目动态信息
2014-07-16 10:36:22 +08:00
sw 4825c5287e Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-16 10:15:43 +08:00
z9hang fbc4cd1cf1 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	Gemfile.lock
2014-07-16 09:54:03 +08:00
nwb 3254c4a237 修正二级菜单名称显示问题 2014-07-16 09:45:39 +08:00
z9hang 3cda9294fd 注释未能安装的gem 2014-07-16 09:40:18 +08:00
nwb 13a3725b06 BUG修改 2014-07-16 09:28:12 +08:00
sw f8d3d60b27 tttttttt 2014-07-16 08:53:14 +08:00
sw 62e24eda1c ttt 2014-07-15 17:53:07 +08:00
sw e303009917 格式化代码 2014-07-15 17:49:28 +08:00
z9hang 53ff6ea335 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-15 16:16:13 +08:00
z9hang 6a45a0287d 添加删除图片功能,修复用户修改资料界面form.quene undefine的js错误(导致加载中不消失的原因) 2014-07-15 16:13:50 +08:00
sw 121ffa0342 修改缺陷时增加跟踪者的删除和增加功能 2014-07-15 15:09:52 +08:00
sw b142953a4b 1.创建项目增加功能:是否启动DTS测试,默认为不启用。根据用户选择,决定左侧DTS测试工具选项是否在该项目内显示 2014-07-15 10:28:49 +08:00
yanxd 37d0560b70 test test 2014-07-15 10:27:24 +08:00
sw bff1319c5e 去除课程数据兼容代码 2014-07-15 09:53:03 +08:00
sw 61ba2c47ee 1.修改历史数据中作业为项目时作业显示列表未改变的问题
2.修改作业列表关联项目过长,增加省略号显示和鼠标移动到相应位置的气泡显示
2014-07-15 09:43:13 +08:00
nwb ba3d1755d4 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-14 16:51:34 +08:00
nwb e6b80de3b5 rmagick调整为仅test需要安装 2014-07-14 16:51:18 +08:00
yanxd ec2384f110 自动化测试框架 2014-07-14 16:36:56 +08:00
sw 8f8fb79a63 1.软件创客搜索功能修改表单提交为在js中提交
2.增加判断搜索条件是不是为空
2014-07-14 16:29:59 +08:00
z9hang cf339edb6c 添加首页定制的非空验证,长度验证 2014-07-14 16:12:58 +08:00
yanxd 14f1ad63d2 自动化测试环境 2014-07-14 16:11:38 +08:00
sw 90e28518f2 增加学校列表查询时,如查询条件为空,增加提示 2014-07-14 15:45:38 +08:00
nwb 1da147684a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-14 15:15:56 +08:00
nwb 2a1a051362 课程资源文件密级BUG修正 2014-07-14 15:15:28 +08:00
sw ef95835bc6 修复当前用户为超级管理员时,创建项目后,在个人信息的参与项目栏内无该项目的记录 2014-07-14 14:49:05 +08:00
sw 31245f6fb2 修复软件创客列表中某些用户的用户名显示不为超链接(未激活账户) 2014-07-14 13:55:22 +08:00
sw b704a44dfb Merge remote-tracking branch 'origin/szzh' into szzh 2014-07-14 13:54:14 +08:00
sw 7a9b5156c9 修复软件创客列表当用户姓名比较长时,用户姓名会被个人得分覆盖掉的BUG 2014-07-14 11:46:52 +08:00
nwb 0950ac2329 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-14 11:32:01 +08:00
nwb 0031f90c64 1.课程动态中的私有的资源、文档进行权限判断
2.项目动态中的私有的资源、文档进行权限判断
2014-07-14 11:31:24 +08:00
z9hang 3aab1b172c 修正执行数据迁移时的‘page_type=’ undefine错误 2014-07-14 11:28:29 +08:00
nwb 87b623bc51 1.文档添加密级设置
2.新建文档、修改文档视图修改
2014-07-14 10:44:07 +08:00
yanxd fd5747f4dc test 3-framework 2014-07-14 10:27:54 +08:00
z9hang 98ddd6940d 修正错误 2014-07-14 09:31:55 +08:00
z9hang f44c715cfb Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-14 09:18:46 +08:00
z9hang 6b6fd2906f 竞赛列表。贴吧列表的非空判断
数据迁移报错问题修改
2014-07-14 09:18:31 +08:00
sw 59a5541e45 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-11 14:52:15 +08:00
sw 9da70f9a20 调整项目列表样式 2014-07-11 14:51:33 +08:00
sw 9472a7eb5c 未登录时取消显示我的学校按钮 2014-07-11 13:41:05 +08:00
z9hang e1c7aaa220 冲突编辑 2014-07-11 11:53:31 +08:00
z9hang fcdfeae326 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	db/schema.rb
2014-07-11 11:45:46 +08:00
z9hang 3dfcc90574 课程、竞赛首页定制
超级管理员账户中首页定制界面优化
2014-07-11 11:41:54 +08:00
nwb 1d4dad22ad Merge commit '6d698cb5d8fa00faf3cb59a1c657c419bd2da6d5' into develop
Conflicts:
	ReadMe.txt
	app/views/layouts/_base_footer.html.erb
2014-07-11 11:38:36 +08:00
nwb 48e2d8ecee Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-11 11:36:19 +08:00
nwb 6d698cb5d8 下载添加权限判断 2014-07-11 11:36:00 +08:00
yanxd 2be5041d0d 文件界面的样式修改 2014-07-11 10:42:55 +08:00
sw 4f2298fd22 修复个人动态首页中留言等动态显示有误的问题 2014-07-11 10:31:52 +08:00
nwb bdaf59513b Merge commit '6688ba61dd67ce7bea195d6f5a7a4458b86956d7' into develop
Conflicts:
	app/views/layouts/_base_footer.html.erb
2014-07-11 09:11:37 +08:00
nwb 9b3ffc90ba Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts:
	app/controllers/repositories_controller.rb
	db/schema.rb
2014-07-11 09:08:50 +08:00
nwb 6688ba61dd 1.用户申请加入项目向管理员发送邮件
2.资源文件添加文件密级设置
2014-07-11 09:07:09 +08:00
sw bed662c2e5 修复项目缺陷列表描述显示不正常的BUG 2014-07-10 17:42:40 +08:00
z9hang b4dd8409eb 添加项目托管平台首页定制功能 2014-07-10 17:38:04 +08:00
sw 86adfaecce Merge remote-tracking branch 'origin/szzh' into szzh 2014-07-10 16:59:59 +08:00
sw 51ef3fa5a1 修复主页课程介绍显示有误的BUG 2014-07-10 16:58:57 +08:00
sw 7bcb1cbe2e 修复个人主页中作业、项目介绍不正确的BUG 2014-07-10 16:57:04 +08:00
sw 47ad20421e 修复当课程描述中有特殊标签是,课程列表描述显示有误的BUG 2014-07-10 16:48:13 +08:00
yanxd 056f86caad can't download, html. after exception return; 2014-07-10 16:41:34 +08:00
sw 39434766e3 1.修复超级管理员无法访问课程作业列表的BUG
2.修改作业描述样式
2014-07-10 16:35:53 +08:00
yanxd 803e9cbdb5 globel issue#858, 中国高校--输入无效条件点击搜索,建议给出提示信息 2014-07-10 16:21:55 +08:00
yanxd e573438e43 eager_load 2014-07-10 15:39:40 +08:00
yanxd 249ea19c0c 神坑,users和user_statuses表中,关注信息不同步,按照影响力排序还会有问题。以及users表中在us表没有对应条目,排序中是不会显示的 2014-07-10 15:27:24 +08:00
sw a5518363c3 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-10 11:31:44 +08:00
sw 65c137e617 修复进入课程作业报错的问题 2014-07-10 11:27:06 +08:00
z9hang 720c75478a 修正上传图片可传非图片文件bug 2014-07-10 10:15:20 +08:00
yanxd 2ff24841fd optimization image check. 2014-07-10 10:12:16 +08:00
yanxd 2b57e170ef want that image popup in html when user click on thumbnail. 2014-07-10 10:05:45 +08:00
sw 76db0e61c3 调整页面样式 2014-07-10 09:21:24 +08:00
sw aec6d33db7 添加wiki编辑插件 2014-07-10 09:12:44 +08:00
sw 41823fbddf test 2014-07-10 09:10:44 +08:00
yanxd 91eb7751da issue global 859. 搜索处理空格 2014-07-10 09:02:28 +08:00
Administrator 6082eca117 test 2014-07-10 08:56:52 +08:00
z9hang 4d75fbfcb8 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-09 16:02:36 +08:00
z9hang 9634046d11 权限管理机制优化 2014-07-09 16:02:15 +08:00
yanxd 0998438e67 bootstrap fine tuning. 2014-07-09 15:20:00 +08:00
yanxd 4259f63fbf 预览在issue和new里报错 2014-07-09 14:53:29 +08:00
z9hang fd71435b30 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-09 14:40:11 +08:00
yanxd 38b3e86e62 ip=nil 2014-07-09 14:38:52 +08:00
nwb 4c942bd55f 测试 2014-07-09 13:35:29 +08:00
z9hang b87abf1f68 权限管理优化 2014-07-08 18:02:10 +08:00
yanxd 449b87e38d remove cnzz 2014-07-08 15:38:37 +08:00
z9hang 4c6fb2a266 Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-08 14:29:34 +08:00
xianbo 25ee1d8672 for adjust test domain and give a setting reposwq 2014-07-08 10:59:20 +08:00
z9hang 0fa552c8d3 软件众包中点击我要参与报无权限问题 2014-07-08 09:34:41 +08:00
z9hang b4bf320c2e Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-08 09:12:28 +08:00
z9hang 5e3a763776 添加引用项目权限、修改引用判断 2014-07-08 09:12:16 +08:00
yanxd 4dbe149b42 删掉user里的扩展表信息,防止第一次迁移失败 2014-07-07 17:24:51 +08:00
yanxd ab03962e9a Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh 2014-07-07 16:53:00 +08:00
yanxd aca63146e9 搜索文件归属,课程相关逻辑修改,查询把过滤去掉了。暂时没想有什么过滤的好办法 2014-07-07 16:52:39 +08:00
1728 changed files with 170025 additions and 52994 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@
/db/schema.rb
/Gemfile.lock
/lib/plugins/acts_as_versioned/test/debug.log
/config/configuration.yml

46
Gemfile
View File

@ -1,4 +1,4 @@
source 'https://rubygems.org'
source 'http://ruby.taobao.org'
unless RUBY_PLATFORM =~ /w32/
# unix-like only
@ -19,19 +19,34 @@ gem 'acts-as-taggable-on', '2.4.1'
group :development do
gem 'better_errors', path: 'lib/better_errors'
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
if ENV['PRY']
gem 'pry'
gem 'pry-nav'
end
end
group :test do
# shoulda的版本做了改动
#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'
gem "shoulda", "~> 3.5.0"
gem "mocha", "~> 1.1.0"
gem 'capybara', '~> 2.4.1'
gem 'nokogiri', '~> 1.6.3'
gem 'factory_girl', '~> 4.4.0'
gem 'selenium-webdriver', '~> 2.42.0'
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
end
group :development, :test do
gem "guard-rails", '~> 0.5.3'
gem 'spork-testunit', '~> 0.0.8'
gem 'guard-spork', '~> 1.5.1'
gem 'guard-test', '~> 1.0.0'
gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/
gem 'pry'
gem 'pry-nav'
end
@ -53,15 +68,6 @@ group :ldap do
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"

View File

@ -19,6 +19,7 @@ PATH
rails
GEM
remote: http://ruby.taobao.org/
remote: https://rubygems.org/
specs:
actionmailer (3.2.13)
@ -50,55 +51,113 @@ GEM
multi_json (~> 1.0)
acts-as-taggable-on (2.4.1)
rails (>= 3, < 5)
arel (3.0.2)
arel (3.0.3)
builder (3.0.0)
capybara (2.0.3)
capybara (2.4.1)
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)
xpath (~> 2.0)
celluloid (0.15.2)
timers (~> 1.1.0)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.4)
climate_control (>= 0.0.3, < 1.0)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.7.0)
coffee-script-source (1.7.1)
erubis (2.7.0)
execjs (2.0.2)
fastercsv (1.5.0)
execjs (2.2.1)
factory_girl (4.4.0)
activesupport (>= 3.0.0)
fastercsv (1.5.5)
ffi (1.9.3)
ffi (1.9.3-x86-mingw32)
formatador (0.2.5)
guard (2.6.1)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-rails (0.5.3)
guard (~> 2.0)
guard-spork (1.5.1)
childprocess (>= 0.2.3)
guard (>= 1.1)
spork (>= 0.8.4)
guard-test (1.0.0)
guard (>= 1.8)
test-unit (~> 2.2)
hike (1.2.3)
htmlentities (4.3.2)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.0.3)
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.8.0)
json (1.8.1)
kaminari (0.16.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
libv8 (3.16.14.3)
listen (2.7.9)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.9)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.4)
mime-types (1.23)
mocha (0.13.3)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.0)
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.7.6)
multi_json (1.10.1)
mysql2 (0.3.11)
mysql2 (0.3.11-x86-mingw32)
net-ldap (0.3.1)
nokogiri (1.5.11-x86-mingw32)
polyglot (0.3.3)
nokogiri (1.6.3)
mini_portile (= 0.6.0)
nokogiri (1.6.3-x86-mingw32)
mini_portile (= 0.6.0)
paperclip (3.5.4)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
polyglot (0.3.5)
pry (0.9.12.6)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
pry (0.9.12.6-x86-mingw32)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
win32console (~> 1.3)
pry-nav (0.2.3)
pry (~> 0.9.10)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-openid (1.3.1)
rack-openid (1.4.2)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-ssl (1.3.3)
rack-raw-upload (1.1.1)
multi_json
rack-ssl (1.3.4)
rack
rack-test (0.6.2)
rack (>= 1.0)
@ -118,12 +177,24 @@ GEM
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.3.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdoc (3.12.2)
json (~> 1.4)
ref (1.0.5)
rich (1.4.6)
jquery-rails
kaminari
mime-types
paperclip
rack-raw-upload
rails (>= 3.2.0)
sass-rails
rmagick (2.13.2)
ruby-openid (2.1.8)
rubyzip (1.1.4)
sass (3.2.14)
rubyzip (1.1.6)
sass (3.3.10)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
@ -139,25 +210,36 @@ GEM
shoulda-context (1.2.1)
shoulda-matchers (2.6.1)
activesupport (>= 3.0.0)
slop (3.5.0)
spork (0.9.2)
spork-testunit (0.0.8)
spork (>= 0.6.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.18.1)
test-unit (2.5.5)
therubyracer (0.12.1)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
tilt (1.4.1)
treetop (1.4.14)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
uglifier (2.4.0)
tzinfo (0.3.40)
uglifier (2.5.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
websocket (1.0.7)
xpath (1.0.0)
win32console (1.3.2-x86-mingw32)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
@ -166,23 +248,35 @@ DEPENDENCIES
acts-as-taggable-on (= 2.4.1)
better_errors!
builder (= 3.0.0)
capybara (~> 2.0.0)
capybara (~> 2.4.1)
coderay (~> 1.0.6)
coffee-rails (~> 3.2.1)
factory_girl (~> 4.4.0)
fastercsv (~> 1.5.0)
guard-rails (~> 0.5.3)
guard-spork (~> 1.5.1)
guard-test (~> 1.0.0)
htmlentities
i18n (~> 0.6.0)
jquery-rails (~> 2.0.2)
mocha (~> 0.13.3)
kaminari
mocha (~> 1.1.0)
mysql2 (= 0.3.11)
net-ldap (~> 0.3.1)
nokogiri (< 1.6.0)
nokogiri (~> 1.6.3)
paperclip (~> 3.5.4)
pry
pry-nav
rack-mini-profiler!
rack-openid
rails (= 3.2.13)
rich (= 1.4.6)
rmagick (>= 2.0.0)
ruby-openid (~> 2.1.4)
sass-rails (~> 3.2.3)
seems_rateable!
shoulda (> 3.3.2)
selenium-webdriver (~> 2.42.0)
shoulda (~> 3.5.0)
spork-testunit (~> 0.0.8)
therubyracer
uglifier (>= 1.0.3)

40
Guardfile Normal file
View File

@ -0,0 +1,40 @@
# More info at https://github.com/guard/guard#readme
# guard 'rails' do
# watch('Gemfile.lock')
# watch(%r{^(config|lib)/.*})
# end
#
guard 'spork', :test_unit => true, :test_unit_env => {'RAILS_ENV' => 'test'}, :wait => 60 do
watch(%r{app/models/.+\.rb})
watch('config/application.rb')
watch('config/environment.rb')
watch('config/environments/test.rb')
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
watch('test/test_helper.rb') { :test_unit }
watch(%r{features/support/}) { :cucumber }
end
guard :test, :drb => true, :all_after_pass => false, :all_on_start => false do
watch(%r{^test/.+_test\.rb$})
watch('test/test_helper.rb') { 'test' }
# Non-rails
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
# Rails 4
# watch(%r{^app/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
# watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' }
# watch(%r{^app/controllers/(.+)_controller\.rb}) { |m| "test/integration/#{m[1]}_test.rb" }
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
# watch(%r{^lib/(.+)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
# Rails < 4
watch(%r{^app/models/(.+)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
watch(%r{^app/controllers/(.+)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
watch(%r{^app/views/(.+)/.+\.erb$}) { |m| "test/functional/#{m[1]}_controller_test.rb" }
watch(%r{^app/views/.+$}) { 'test/integration' }
watch('app/controllers/application_controller.rb') { ['test/functional', 'test/integration'] }
end

View File

@ -1,53 +1,90 @@
patch:
用户姓名的部分根据issues#655。
为了修改方便
alias
方法 之前显示 调整之后
name firstname+lastname login
nickname xxx login
realname xxx firstname+lastname
User model经过修改已经完全集成了user_extensions的功能
例如
user.gender=1
user.save
user_extensions字段会自动保存
不必要每次user.user_extensions.xxx以及判断是否为空
================================================================================
app/models/setting.rb :165
# fixed domain url in development. tantantan's bug
if Rails.env.development?
methods.map do |m|
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
end
end
程序部分链接中制定了subdomain参数使链接在二级域名中来回跳转。
为了开发方便使之功能在development模式下失效。
# => nyan
================================================================================
app/controller/projects_controller.rb ===> projects#fake
fake filter: 修改了传到页面中的Count后缀的数量
改为正确的数量删掉fake过滤器即可
================================================================================
#导航栏匹配域名显示和改变
app\helper\application_helper.rb
# rewrite navigation
app\views\layouts\_base_header.html.erb
# reset navigation by domain name and url through regular match
================================================================================
#首页根据域名匹配进入不同的页面
app\controller\welcome_controller.rb
def entry_select_user
if request.original_url.match(/user\.trustie\.net/)
redirect_to(:controller => "users", :action => "index")
return 0
end
end
================================================================================
================================================================================
0606新坑
user_scores表结构有问题需要运行
bundle exec rake db:migrate:down VERSION=20140410021724
bundle exec rake db:migrate:up VERSION=20140410021724
===================================[2014-04-09]=================================
kw: 域名, 二级域名, subdomain, forge, course, contest
域名跳转forge/course/contest这几个设置在settings.yml中
但是跳转在development模式下会导致无法开发
app/models/setting.rb :165
# fixed domain url in development. tantantan's bug
if Rails.env.development?
methods.map do |m|
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
end
end
程序部分链接中制定了subdomain参数使链接在二级域名中来回跳转。
为了开发方便使之功能在development模式下失效。
===================================[2014-04-09]=================================
kw: 菜单, 导航栏, layout
网页上方的导航条没有用Redmine::MenuManager
MenuManager的样式无法定制菜单显示条件if中的proc执行行为没有了解
#导航栏匹配域名显示和改变
app\helper\application_helper.rb
render_dynamic_nav 方法中利用变量可以设置在layout中具体显示哪些条目
app\views\layouts\_base_header.html.erb
需要显示的条目由具体的实例变量设置在各个layout中
===================================[2014-04-09]=================================
kw: home_path, 首页, 跳转, 二级域名, welcome
#首页根据域名匹配进入不同的页面
app\controller\welcome_controller.rb
#entry_select 放射设置二级域名所显示的首页
===================================[2014-06-06]=================================
kw: user_scores
user_scores表结构有问题需要运行
bundle exec rake db:migrate:down VERSION=20140410021724
bundle exec rake db:migrate:up VERSION=20140410021724
===================================[2014-07-08]=================================
kw: CKEditor, 富文本, 编辑器
CKEditor插件加载方法
1.把插件文件夹拷入plugins文件夹确保文件夹名为redmine_ckeditor
2.运行 bundle install --without development test
3.运行 rake redmine:plugins:migrate RAILS_ENV=production
4.启动服务器
5.配置CKEditor插件(Administration > Plugins > Configure)
6.把文本格式 (Administration > Settings > General > Text formatting)改为CKEditor
注意一定要先配置CKEditor插件再见文本格式更改不然数据库不会生成对应记录会报错。。
===================================[2014-07-19]=================================
kw: 首页, 定制, forge, course, contest, 排序
若遇到首页定制报错问题请尝试如下操作
如果运行迁移文件有报错与sort_type相关
先运行 bundle exec rake db:migrate:down version=20140716021202 bundle exec rake db:migrate:up version=20140716021202
在按如下步骤执行,未报与之相关的则直接按如下步骤执行
1.运行 bundle exec rake db:migrate:down version=20140719080032
2.运行 bundle exec rake db:migrate:up version=20140719080032
===================================[2014-07-30]=================================
kw: 首页, 定制, forge, course, contest, 排序image_width
undefined image_width 问题
bundle exec rake db:migrate:down version=20140725062302
bundle exec rake db:migrate:up version=20140725062302
=================================[2014-07-19]=====================================
kw: Mysql2::Error,存储过程,CALL sp_project_status_cursor();
bundle exec rake db:migrate:down version=20130828004955
bundle exec rake db:migrate:up version=20130828004955
=================================[2014-08-13]====================================
kw:配置支持的图片格式
默认支持如下格式:"bmp,jpeg,jpg,png,gif"
可在configuration.yml中修改格式pic_types: "bmp,jpeg,jpg,png,gif"(注意pic_types若前面有#号需去掉)
配置完成后重启服务
=================================[2014-08-16]====================================
kw:数据迁移project_scores表已存在
bundle exec rake db:migrate:down VERSION=20140811022947
bundle exec rake db:migrate:up VERSION=20140811022947
bundle exec rake db:migrate
bundle exec rake project_score:calculate

Binary file not shown.

View File

@ -102,7 +102,14 @@ class AccountController < ApplicationController
# User self-registration
def register
# @root_path="/home/pdl/redmine-2.3.2-0/apache2/"
#
#
@cache_identityy = params[:identity]||"" #身份
@cache_no = params[:no]||"" #学号
@cache_technical_title = params[:technical_title]||"" #教师职称
@cache_province = params[:province]||"" #省份
@cache_city = params[:city]||"" #城市
@cache_enterprise_name = params[:enterprise_name]||"" #企业
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
if request.get?
session[:auth_source_registration] = nil
@ -133,6 +140,15 @@ class AccountController < ApplicationController
@user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation]
end
if(@cache_identityy == "")
flash.now[:error]= l(:label_identity)+l(:'activerecord.errors.messages.empty')
return
end
if(@cache_city == "")
flash.now[:error]= l(:label_location)+l(:'activerecord.errors.messages.empty')
return
end
case Setting.self_registration
when '1'
register_by_email_activation(@user)

View File

@ -20,7 +20,7 @@ class ActivitiesController < ApplicationController
before_filter :find_optional_project, :index
accept_rss_auth :index
helper :Watchers
helper :project_score
def index
@days = Setting.activity_days_default.to_i

View File

@ -24,6 +24,7 @@ class AdminController < ApplicationController
before_filter :require_admin
helper :sort
helper :Users
helper :Settings
include SortHelper
def index
@ -35,15 +36,12 @@ class AdminController < ApplicationController
scope = Project.status(@status).order('lft')
scope = scope.like(params[:name]) if params[:name].present?
@projects = scope.all
@projects = scope.where(project_type: Project::ProjectType_project).all
render :action => "projects", :layout => false if request.xhr?
end
def users
@project_type = params[:project_type]
role = params[:role]
sort_init 'login', 'asc'
sort_update %w(login firstname lastname mail admin created_on last_login_on)
@ -55,95 +53,14 @@ class AdminController < ApplicationController
end
@status = params[:status] || 1
has = {
"show_changesets" => true
}
# @count = Redmine::Activity::Fetcher.new(User.current, :author => @user).scope_select {|t| !has["show_#{t}"].nil?}.events(nil, nil).count
scope = UserStatus.visible
case role
when 'teacher'
scope = UserStatus.teacher
when 'student'
scope = UserStatus.student
else
end
scope = User.logged.status(@status)
scope = User.like(params[:name]) if params[:name].present?
scope = scope.in_group(params[:group_id]) if params[:group_id].present?
# scope.each do |user|
# UserStatus.create(:changesets_count => user.changesets.count, :watchers_count => user.watcher_users.count, :user_id => user.id)
# end
@user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page']
#@offset ||= @user_pages.offset
#@users = scope.order(sort_clause).limit(@limit).offset(@offset).all
@user_base_tag = params[:id] ? 'base_users':'base'
if params[:user_sort_type].present?
case params[:user_sort_type]
when '0'
@offset ||= @user_pages.reverse_offset
unless @offset == 0
@users_statuses = scope.offset(@offset).limit(@limit).all.reverse
else
limit = @user_count % @limit
if limit == 0
limit = @limit
end
@users_statuses = scope.offset(@offset).limit(limit).all.reverse
end
@s_type = 0
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
# @projects = @projects[@offset, @limit]
when '1'
@offset ||= @user_pages.reverse_offset
unless @offset == 0
@users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse
else
limit = @user_count % @limit
if limit == 0
limit = @limit
end
@users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse
end
@s_type = 1
#sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count}
#@users = @users[@offset, @limit]
when '2'
@offset ||= @user_pages.reverse_offset
unless @offset == 0
@users_statuses = scope.reorder('watchers_count').offset(@offset).limit(@limit).all.reverse
else
limit = @user_count % @limit
if limit == 0
limit = @limit
end
@users_statuses = scope.reorder('watchers_count').offset(@offset).limit(limit).all.reverse
end
@s_type = 2
#@users = @users[@offset, @limit]
end
else
@offset ||= @user_pages.reverse_offset
unless @offset == 0
@users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse
else
limit = @user_count % @limit
if limit == 0
limit = @limit
end
@users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse
end
@s_type = 1
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
# @projects = @projects[@offset, @limit]
end
@users = []
@users_statuses.each do |obj|
@users << User.find_by_id("#{obj.user_id}")
end
@offset ||= @user_pages.offset
@users = scope.order(sort_clause).limit(@limit).offset(@offset).all
respond_to do |format|
@ -208,24 +125,13 @@ class AdminController < ApplicationController
end
@status = params[:status] || 1
has = {
"show_changesets" => true
}
scope = User.logged.status(@status)
scope = scope.like(params[:name]) if params[:name].present?
@user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page']
@user_base_tag = params[:id] ? 'base_users':'base'
@offset ||= @user_pages.reverse_offset
unless @offset == 0
@users = scope.offset(@offset).limit(@limit).all.reverse
else
limit = @user_count % @limit
if limit == 0
limit = @limit
end
@users = scope.offset(@offset).limit(limit).all.reverse
end
@users = scope.offset(@user_pages.offset).limit(@user_pages.per_page)
respond_to do |format|
format.html {
@ -234,4 +140,116 @@ class AdminController < ApplicationController
format.api
end
end
#首页定制
def first_page_made
if request.get?
@first_page = FirstPage.where("page_type = 'project'").first
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@first_page.web_title = params[:web_title]
@first_page.description = params[:first_page][:description]
#@first_page.title = params[:title]
@first_page.image_width = params[:image_width]
@first_page.image_height = params[:image_height]
@first_page.sort_type = params[:sort_type]
@first_page.show_course = params[:show_course]
@first_page.show_contest = params[:show_contest]
if @first_page.save
respond_to do |format|
flash[:notice] = l(:notice_successful_update)
format.html {
redirect_to admin_first_page_made_path
}
format.api { render_api_ok }
#format.json { render json: @first_page, status: :created, location: @first_page }
end
else
respond_to do |format|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}"
format.html {
render :action => 'first_page_made'
}
format.api { render_validation_errors(@first_page) }
#format.json { render json: @first_page.errors, status: :unprocessable_entity }
end
end
end
end
def course_page_made
if request.get?
@course_page = FirstPage.where("page_type = 'course'").first
@first_page = FirstPage.where("page_type = 'project'").first
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@course_page = FirstPage.where("page_type = 'course'").first
@first_page.web_title = params[:web_title]
@course_page.web_title = params[:web_title]
@course_page.title = params[:course_title]
@course_page.image_width = params[:image_width]
@course_page.image_height = params[:image_height]
@course_page.description = params[:course_description]
if @first_page.save && @course_page.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_course_page_made_path
}
format.api { render_api_ok }
end
else
respond_to do |format|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@course_page.errors.full_messages[0]}"
#flash.now[:error] = "#{l :label_first_page_create_fail}: #{@course_page.errors.full_messages[0]}"
format.html {
render :action => 'course_page_made'
}
format.api { render_validation_errors(@first_page) }
format.api { render_validation_errors(@course_page) }
end
end
end
end
def contest_page_made
if request.get?
@contest_page = FirstPage.where("page_type = 'contest'").first
@first_page = FirstPage.where("page_type = 'project'").first
@notification = ContestNotification.all.first;
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@contest_page = FirstPage.where("page_type = 'contest'").first
@notification = ContestNotification.all.first;
@first_page.web_title = params[:web_title]
@contest_page.web_title = params[:web_title]
@contest_page.title = params[:contest_title]
@contest_page.image_width = params[:image_width]
@contest_page.image_height = params[:image_height]
@contest_page.description = params[:contest_description]
@notification.title = params[:contest_notification_title]
@notification.content = params[:contest_notification][:content]
if @first_page.save && @contest_page.save && @notification.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_contest_page_made_path
}
format.api { render_api_ok }
end
else
respond_to do |format|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@contest_page.errors.full_messages[0]}\n\t#{@notification.errors.full_messages[0]}"
format.html {
render :action => 'contest_page_made'
}
format.api { render_validation_errors(@first_page) }
format.api { render_validation_errors(@contest_page) }
end
end
end
end
end

View File

@ -41,6 +41,7 @@ class ApplicationController < ActionController::Base
cookies.delete(autologin_cookie_name)
end
before_filter :find_first_page
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
before_filter :user_agent
@ -278,7 +279,7 @@ class ApplicationController < ActionController::Base
# Find project of id params[:id]
def find_project
@project = Project.find(params[:id])
@project = Project.find_by_id(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
@ -482,14 +483,19 @@ class ApplicationController < ActionController::Base
# Renders an error response
def render_error(arg)
arg = {:message => arg} unless arg.is_a?(Hash)
@message = arg[:message]
@lay = arg[:layout]
@message = l(@message) if @message.is_a?(Symbol)
@status = arg[:status] || 500
respond_to do |format|
format.html {
render :template => 'common/error', :layout => use_layout, :status => @status
if @lay
render :template => 'common/error', :layout => @lay,:status => @status
else
render :template => 'common/error', :layout => use_layout, :status => @status
end
}
format.any { head @status }
end
@ -519,7 +525,7 @@ class ApplicationController < ActionController::Base
#
# @return [boolean, string] name of the layout to use or false for no layout
def use_layout
request.xhr? ? false : 'base'
request.xhr? ? false : 'users_base'
end
def invalid_authenticity_token
@ -715,4 +721,17 @@ class ApplicationController < ActionController::Base
raise RuntimeError, 'unknow type, Please input you type into this helper.'
end
end
#查找首页相关信息
def find_first_page
@first_page = FirstPage.where("page_type = 'project'").first
if @first_page.nil?
@first_page = FirstPage.new
@first_page.page_type = 'project'
@first_page.description = ""
@first_page.save()
end
@show_course = @first_page.show_course
@show_contest = @first_page.show_contest
end
end

View File

@ -6,7 +6,8 @@ class AppliedProjectController < ApplicationController
@project = Project.find(params[:project_id])
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
if @applieds.count == 0
AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
Mailer.applied_project(appliedproject).deliver
end
#redirect_to project_path(params[:project_id])

View File

@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class AttachmentsController < ApplicationController
layout "users_base"
before_filter :find_project, :only => [:show, :download, :thumbnail, :destroy, :delete_homework]#, :except => [:upload, :autocomplete]
before_filter :file_readable, :read_authorize, :only => [:show, :thumbnail]#Modified by young
before_filter :delete_authorize, :only => :destroy
@ -23,6 +24,8 @@ class AttachmentsController < ApplicationController
before_filter :login_without_softapplication, only: [:download]
accept_api_auth :show, :download, :upload
require 'iconv'
def show
respond_to do |format|
@ -39,6 +42,13 @@ class AttachmentsController < ApplicationController
render :action => 'diff'
elsif @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte
@content = File.new(@attachment.diskfile, "rb").read
# 编码为非 UTF-8先进行间接转码
# 部分unicode编码不直接支持转为 UTF-8
# modify by nwb
if @content.encoding.name != 'UTF-8'
@content = @content.force_encoding('GBK')
@content = @content.encode('UTF-8')
end
render :action => 'file'
else
download
@ -49,16 +59,40 @@ class AttachmentsController < ApplicationController
end
def download
if true || @attachment.container.is_a?(Version) || @attachment.container.is_a?(Project)
# modify by nwb
# 下载添加权限设置
candown = false
if (@attachment.container.has_attribute?(:project) || @attachment.container.has_attribute?(:project_id)) && @attachment.container.project
project = @attachment.container.project
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
elsif @attachment.container.is_a?(Project)
project = @attachment.container
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
elsif (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course
course = @attachment.container.course
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
elsif @attachment.container.is_a?(Course)
course = @attachment.container
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
elsif @attachment.container.class.to_s=="HomeworkAttach" && @attachment.container.bid.reward_type == 3
candown = true
else
candown = @attachment.is_public == 1
end
if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download
if stale?(:etag => @attachment.digest)
# images are sent inline
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
:disposition => (@attachment.image? ? 'inline' : 'attachment')
end
else
render_403 :message => :notice_not_authorized
end
if stale?(:etag => @attachment.digest)
# images are sent inline
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
: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
@ -75,6 +109,25 @@ class AttachmentsController < ApplicationController
end
end
# 更新文件密级
def updateFileDense
@attachment = Attachment.find(params[:attachmentid])
if @attachment != nil
filedense = params[:newtype].to_s
# d = Iconv.conv("unicodebig","utf-8",filedense)
if filedense == "%E5%85%AC%E5%BC%80" #l(:field_is_public)
@attachment.is_public = 1
else
@attachment.is_public = 0
end
@attachment.save
@newfiledense = filedense
end
respond_to do |format|
format.js
end
end
def thumbnail
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
if stale?(:etag => thumbnail)
@ -89,6 +142,7 @@ class AttachmentsController < ApplicationController
end
end
def upload
# Make sure that API users get used to set this content type
# as it won't trigger Rails' automatic parsing of the request body for parameters
@ -127,8 +181,13 @@ class AttachmentsController < ApplicationController
respond_to do |format|
# modify by nwb
if @attachment.container_type == 'Course'
if @course.nil?
if !@attachment.container.nil? &&
(@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) && @attachment.container.board && @attachment.container.board.course ) )
if @attachment.container.is_a?(News)
format.html { redirect_to_referer_or news_path(@attachment.container) }
elsif @attachment.container.is_a?(Message)
format.html { redirect_to_referer_or new_board_message_path(@attachment.container) }
elsif @course.nil?
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
else
format.html { redirect_to_referer_or course_path(@course) }
@ -160,6 +219,17 @@ class AttachmentsController < ApplicationController
end
end
#删除竞赛作品的附件
def delete_softapplications
@attachment = Attachment.find params[:id]
@softapplication = @attachment.container if @attachment!=nil
@attachment.container.attachments.delete(@attachment) if @attachment!=nil
respond_to do |format|
format.html { redirect_to_referer_or edit_softapplication_path(@softapplication) }
#format.js
end
end
def autocomplete
# modify by nwb
if params[:project_id]
@ -187,6 +257,9 @@ class AttachmentsController < ApplicationController
attach_copied_obj.container = obj
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 1
end
@obj = obj
@save_flag = attach_copied_obj.save
@save_message = attach_copied_obj.errors.full_messages
@ -216,6 +289,9 @@ class AttachmentsController < ApplicationController
attach_copied_obj.container = obj
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 4
end
@obj = obj
@save_flag = attach_copied_obj.save
@save_message = attach_copied_obj.errors.full_messages
@ -240,6 +316,8 @@ private
raise ActiveRecord::RecordNotFound if params[:filename] && params[:filename] != @attachment.filename
if @attachment.container_type == 'Course'
@course = @attachment.course
elsif !@attachment.container.nil? && (@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course)) && @attachment.container.course
@course = @attachment.container.course
else
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication'
@project = @attachment.project

View File

@ -2,7 +2,7 @@ class AvatarController < ApplicationController
#before_filter :set_cache_buster
include AvatarHelper
include AvatarHelper
def upload
# Make sure that API users get used to set this content type
@ -28,6 +28,13 @@ class AvatarController < ApplicationController
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))
# 用户头像上传时进行特别处理
if @source_type == 'User'
diskfile += "temp"
@urlfile += "temp"
end
logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)")
path = File.dirname(diskfile)
unless File.directory?(path)
@ -55,17 +62,20 @@ class AvatarController < ApplicationController
# saved = @avatar.save
begin
f = Magick::ImageList.new(diskfile)
width = 300.0
proportion = (width/f[0].columns)
height = (f[0].rows*proportion)
f.resize_to_fill!(width,height)
# f.scale!(width,height)
f.write(diskfile)
# gif格式不再做大小处理
if f.format != 'GIF'
width = 300.0
proportion = (width/f[0].columns)
height = (f[0].rows*proportion)
f.resize_to_fill!(width,height)
f.write(diskfile)
end
rescue Exception => e
logger.error "[Error] avatar : avatar_controller#upload ===> #{e}"
end
respond_to do |format|
format.js
format.api {
@ -77,6 +87,49 @@ class AvatarController < ApplicationController
}
end
end
#add by zjc
#删除图片
def delete_image
@source_type = params[:source_type]
@source_id = params[:source_id]
@source = nil #eval(@source_type).find(@source_id)
c = Object.const_get(@source_type)
if c.respond_to?(:find)
@source = c.find(@source_id)
end
diskfile=disk_filename(@source_type,@source_id)
unless diskfile.nil? || diskfile == ""
path = File.dirname(diskfile)
if File.directory?(path) && File.exist?(diskfile)
# 用户头像进行特别处理
if @source_type == 'User'
diskfile1 = diskfile + 'temp'
File.open(diskfile1, "wb") do |f|
buffer = "DELETE"
f.write(buffer)
end
else
File.delete(diskfile)
end
end
end
rescue e do
logger.info e.message
end
respond_to do |format|
format.js
format.api {
if saved
render :action => 'upload', :status => :created
else
render_validation_errors(@avatar)
end
}
end
end
private

View File

@ -7,6 +7,9 @@ class BidsController < ApplicationController
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
before_filter :can_show_course,only: []
before_filter :can_show_contest,only: []
#Ended by young
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:delete,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
:show_course, :show_courseEx,:show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
@ -15,7 +18,7 @@ class BidsController < ApplicationController
# end
before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ]
before_filter :memberAccess, only: :show_project
#before_filter :memberAccess, only: :show_project
helper :watchers
helper :attachments
@ -26,6 +29,7 @@ class BidsController < ApplicationController
helper :projects
helper :words
helper :welcome
helper :project_score
def find_project_by_bid_id
@bid = Bid.find(params[:id])
@ -375,11 +379,9 @@ class BidsController < ApplicationController
@option = []
@membership.each do |membership|
unless(membership.project.project_type==1)
membership.member_roles.each{|role|
if(role.role_id == 3)
@option << membership.project
end
}
if membership.user.allowed_to?(:quote_project,membership.project)
@option << membership.project
end
end
end
@ -451,17 +453,9 @@ class BidsController < ApplicationController
# 显示作业课程
# add by nwb
def show_courseEx
if (User.current.logged? && User.current.member_of_course?(@bid.courses.first))
if (User.current.logged? && (User.current.member_of_course?(@bid.courses.first) || User.current.admin?))
# 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
@ -492,8 +486,13 @@ class BidsController < ApplicationController
#ended
end
if @bid.homework_type == 1
if @bid.homework_type
@homework = HomeworkAttach.new
if @bid.proportion
teacher_proportion = @bid.proportion * 1.0 / 100
else
teacher_proportion = 1.0
end
#@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")
@ -501,7 +500,7 @@ class BidsController < ApplicationController
(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")
(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) DESC,created_at ASC")
if params[:student_id].present?
@temp = []
@homework_list.each do |pro|
@ -990,7 +989,23 @@ class BidsController < ApplicationController
return true if current_user.admin?
#return 0 if @bid.courses.first.project_type == Project::ProjectType_project
currentUser = User.current
render_403 unless currentUser.member_of_cousrse?(@bid.courses.first)
render_403 unless currentUser.member_of_course?(@bid.courses.first)
end
#验证是否显示课程
def can_show_course
@first_page = FirstPage.where("page_type = 'project'").first
if @first_page.show_course == 2
render_404
end
end
#验证是否显示竞赛
def can_show_contest
@first_page = FirstPage.where("page_type = 'project'").first
if @first_page.show_contest == 2
render_404
end
end
end

View File

@ -26,6 +26,7 @@ class BoardsController < ApplicationController
helper :sort
include SortHelper
helper :watchers
helper :project_score
def index
#modify by nwb
@ -70,7 +71,7 @@ class BoardsController < ApplicationController
@message = Message.new(:board => @board)
#modify by nwb
if @project
render :action => 'show', :layout => !request.xhr?
render :action => 'show', :layout => 'base_projects'
elsif @course
render :action => 'show', :layout => 'base_courses'
end
@ -140,7 +141,11 @@ private
end
def find_board_if_available
@board = @project.boards.find(params[:id]) if params[:id]
if @project
@board = @project.boards.find(params[:id]) if params[:id]
elsif @course
@board = @course.boards.find(params[:id]) if params[:id]
end
rescue ActiveRecord::RecordNotFound
render_404
end

View File

@ -27,6 +27,7 @@ class CalendarsController < ApplicationController
include QueriesHelper
helper :sort
include SortHelper
helper :project_score
def show
if params[:year] and params[:year].to_i > 1900

View File

@ -0,0 +1,5 @@
class ContestNotificationController
def show
end
end

View File

@ -1,11 +1,14 @@
# fq
# class BidsController < ApplicationController
class ContestsController < ApplicationController
layout "contest_base"
menu_item :respond
menu_item :project, :only => :show_project
menu_item :application, :only => :show_softapplication
menu_item :attendingcontests, :only => :show_attendingcontest
menu_item :contestnotifications, :only => :index
before_filter :can_show_contest,except: []
before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :index, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward,
:show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
@ -26,8 +29,9 @@ class ContestsController < ApplicationController
# @contests = Contest.visible
# @contests ||= []
@offset, @limit = api_offset_and_limit({:limit => 10})
@contests = Contest.visible
@contests = @contests.like(params[:name]) if params[:name].present?
#@contests = Contest.visible
#@contests = @contests.like(params[:name]) if params[:name].present?
@contests = Contest.visible.where("name like '%#{params[:name]}%'")
if params[:contests_search]
(redirect_to contests_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
end
@ -77,6 +81,10 @@ class ContestsController < ApplicationController
end
end
def search
redirect_to action: 'index',name:params[:name]
end
def homework
@offset, @limit = api_offset_and_limit({:limit => 10})
@bids = @course.homeworks.order('deadline DESC')
@ -232,12 +240,7 @@ class ContestsController < ApplicationController
# @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page']
@membership.each do |membership|
unless(membership.project.project_type==1)
#membership.member_roles.each{|role|
# if(role.role_id == 3)
# @option << membership.project
# end
#}
if User.current.allowed_to?({:controller => "projects", :action => "edit"}, membership.project, :global => false)
if User.current.allowed_to?(:quote_project, membership.project)
@option << membership.project
end
end
@ -326,13 +329,8 @@ class ContestsController < ApplicationController
# @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page']
@membership.each do |membership|
unless(membership.project.project_type==1)
#membership.member_roles.each{|role|
#if(role.role_id == 3)
#@option << membership.project
#end
#}
#拥有编辑项目权限的可将该项目参赛
if User.current.allowed_to?({:controller => "projects", :action => "edit"}, membership.project, :global => false)
if User.current.allowed_to?(:quote_project, membership.project)
@option << membership.project
end
end
@ -650,5 +648,13 @@ end
render_404
end
#验证是否显示竞赛
def can_show_contest
@first_page = FirstPage.where("page_type = 'project'").first
if @first_page.show_contest == 2
render_404
end
end
end

View File

@ -13,6 +13,7 @@ class CoursesController < ApplicationController
menu_item l(:label_sort_by_active), :only => :index
menu_item l(:label_sort_by_influence), :only => :index
before_filter :can_show_course, :except => []
before_filter :find_course, :except => [ :index, :search,:list, :new,:join,:unjoin, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches]
before_filter :authorize_course, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course]
before_filter :authorize_course_global, :only => [:view_homework_attaches, :new,:create]
@ -62,6 +63,8 @@ class CoursesController < ApplicationController
#更新课程信息
def update
@course.safe_attributes = params[:course]
@course.time = params[:time]
@course.term = params[:term]
@course.class_period = params[:class_period]
if @course.save
if params[:course][:is_public] == '0'
@ -155,7 +158,7 @@ class CoursesController < ApplicationController
respond_to do |format|
format.html {
render :layout => 'base'
render :layout => 'course_base'
scope = Course
unless params[:closed]
scope = scope.active
@ -172,7 +175,7 @@ class CoursesController < ApplicationController
## 有角色参数的才是课程,没有的就是项目
@render_file = 'member_list'
@teachers= searchTeacherAndAssistant(@course)
@canShowCode = isCourseTeacher(User.current.id)
@canShowCode = isCourseTeacher(User.current.id,@course)
case params[:role]
when '1'
@subPage_title = l :label_teacher_list
@ -217,7 +220,7 @@ class CoursesController < ApplicationController
@issue_category ||= IssueCategory.new
@member ||= @course.members.new
@trackers = Tracker.sorted.all
end
end
def create
if User.current.user_extensions.identity
@ -239,18 +242,18 @@ class CoursesController < ApplicationController
@trackers = Tracker.sorted.all
if User.current.user_extensions.identity == 0
if @course.save
if @course.save
#unless User.current.admin?
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
m = Member.new(:user => User.current, :roles => [r])
m.project_id = -1
course = CourseInfos.new(:user_id => User.current.id, :course_id => @course.id)
#user_grades = UserGrade.create(:user_id => User.current.id, :course_id => @course.id)
if params[:course][:is_public] == '1'
course_status = CourseStatus.create(:course_id => @course.id, :watchers_count => 0, :changesets_count => 0, :grade => 0, :course_type => @course_tag)
end
@course.members << m
@course.course_infos << course
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
m = Member.new(:user => User.current, :roles => [r])
m.project_id = -1
course = CourseInfos.new(:user_id => User.current.id, :course_id => @course.id)
#user_grades = UserGrade.create(:user_id => User.current.id, :course_id => @course.id)
if params[:course][:is_public] == '1'
course_status = CourseStatus.create(:course_id => @course.id, :watchers_count => 0, :changesets_count => 0, :grade => 0, :course_type => @course_tag)
end
@course.members << m
@course.course_infos << course
#end
respond_to do |format|
format.html {
@ -272,7 +275,7 @@ class CoursesController < ApplicationController
format.api { render_validation_errors(@course) }
end
end
end
end
end
@ -494,50 +497,12 @@ class CoursesController < ApplicationController
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
render :layout => 'base_courses'
else
render_404
render_403
end
end
def get_course_activity courses, activities
@course_ids=activities.keys()
days = Setting.activity_days_default.to_i
date_to ||= Date.today + 1
date_from = date_to - days-1.years
#file_count
Attachment.where(container_id: @course_ids, container_type: Course).where("created_on>?", date_from).each do |attachment|
activities[attachment.container_id]+=1
end
#message_count
Board.where(course_id: @course_ids).each do |board|
# activities[board.course_id]+=1
activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count
end
#news
News.where(course_id: @course_ids).where("created_on>?",date_from).each do |news|
activities[news.course_id]+=1
end
#feedbackc_count
JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess|
activities[jourformess.jour_id]+=1
end
#activities!=0
i=0;
courses.each do |course|
id=course.id
if activities[id]==0
activities[id]=1
end
end
return activities
end
def toggleCourse
@course_prefs = Course.find_by_extra(@course.extra)
@ -623,14 +588,31 @@ class CoursesController < ApplicationController
"show_course_journals_for_messages" => true
}
@date_to ||= Date.today + 1
@date_from = @date_to - @days-1.years
#
@date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date
#@date_from = @date_to - @days-1.years
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
# 决定显示所用用户或单个用户活动
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
:with_subprojects => false,
:author => @author)
@activity.scope_select {|t| has["show_#{t}"]}
events = @activity.events(@date_from, @date_to)
# modify by nwb
# 添加私密性判断
if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events(@date_from, @date_to)
else
events = @activity.events(@date_from, @date_to, :is_public => 1)
end
# 无新动态时,显示老动态
if events.count == 0
if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events
else
events = @activity.events(:is_public => 1)
end
end
@offset, @limit = api_offset_and_limit({:limit => 10})
@events_count = events.count
@ -643,7 +625,7 @@ class CoursesController < ApplicationController
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
#
@teachers= searchTeacherAndAssistant(@course)
@canShowRealName = isCourseTeacher(User.current.id)
@canShowRealName = isCourseTeacher(User.current.id,@course)
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
@ -656,9 +638,10 @@ class CoursesController < ApplicationController
end
#判断指定用户是否为课程教师
def isCourseTeacher(id)
def isCourseTeacher(id,course)
result = false
if @teachers && @teachers.find_by_user_id(id) != nil
user = User.find(id)
if user.nil? && user.allowed_to?(:as_teacher,course)#@teachers && @teachers.count != 0 && @teachers.find_by_user_id(id) != nil
result = true
end
result
@ -704,8 +687,14 @@ class CoursesController < ApplicationController
end
end
#验证是否显示课程
def can_show_course
@first_page = FirstPage.where("page_type = 'project'").first
if @first_page.show_course == 2
render_404
end
end
end
end

View File

@ -23,19 +23,28 @@ class DocumentsController < ApplicationController
before_filter :find_model_object, :except => [:index, :new, :create]
before_filter :find_project_from_association, :except => [:index, :new, :create]
before_filter :authorize , :except => [:index]#Added by young
before_filter :authorize_document
helper :attachments
helper :project_score
def index
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
documents = @project.documents.includes(:attachments, :category).all
temp = @project.documents.includes(:attachments, :category).all
documents = []
temp.each do |doc|
if doc.has_right?(@project)
documents << doc
end
end
case @sort_by
when 'date'
@grouped = documents.group_by {|d| d.updated_on.to_date }
when 'title'
@grouped = documents.group_by {|d| d.title.first.upcase}
when 'author'
@grouped = documents.select{|d| d.attachments.any?}.group_by {|d| d.attachments.last.author}
# @grouped = documents.select{|d| d.attachments.any?}.group_by {|d| d.attachments.last.author}
@grouped = documents.group_by {|d| d.user.name }
else
@grouped = documents.group_by(&:category)
end
@ -100,4 +109,12 @@ class DocumentsController < ApplicationController
end
redirect_to document_path(@document)
end
# 权限判断
# add by nwb
def authorize_document
if !(User.current.admin? || User.current.member_of?(@project) || @document == nil || (@document != nil && @document.is_public==1))
render_403 :message => :notice_not_authorized
end
end
end

View File

@ -24,6 +24,19 @@ class FilesController < ApplicationController
helper :sort
include SortHelper
helper :project_score
def show_attachments obj
all_attachments = []
obj.each do |container|
all_attachments += container.attachments
end
@limit = 10
@feedback_count = all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@curse_attachments = all_attachments[@offset, @limit]
end
def index
#sort_init 'filename', 'asc'
@ -32,17 +45,90 @@ class FilesController < ApplicationController
'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
sort = ""
if params[:project_id]
@isproject = true
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
if params[:sort]
params[:sort].split(",").each do |sort_type|
order_by = sort_type.split(":")
case order_by[0]
when "filename"
attribute = "filename"
when "size"
attribute = "filesize"
when "attach_type"
attribute = "attachtype"
when "content_type"
attribute = "created_on"
when "field_file_dense"
attribute = "is_public"
when "downloads"
attribute = "downloads"
when "created_on"
attribute = "created_on"
end
if order_by.count == 1
sort += "#{Attachment.table_name}.#{attribute} desc "
elsif order_by.count == 2
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
end
if sort_type != params[:sort].split(",").last
sort += ","
end
end
end
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
@containers += @project.versions.includes(:attachments).reorder(sort).all.sort
show_attachments @containers
render :layout => !request.xhr?
elsif params[:course_id]
@isproject = false
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
if params[:sort]
params[:sort].split(",").each do |sort_type|
order_by = sort_type.split(":")
case order_by[0]
when "filename"
attribute = "filename"
when "size"
attribute = "filesize"
when "attach_type"
attribute = "attachtype"
when "content_type"
attribute = "created_on"
when "field_file_dense"
attribute = "is_public"
when "downloads"
attribute = "downloads"
when "created_on"
attribute = "created_on"
end
if order_by.count == 1
sort += "#{Attachment.table_name}.#{attribute} desc "
elsif order_by.count == 2
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
end
if sort_type != params[:sort].split(",").last
sort += ","
end
end
end
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers
render :layout => 'base_courses'
end
end
def new
@ -84,6 +170,8 @@ class FilesController < ApplicationController
@containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] #modify by Long Jun
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
show_attachments @containers
@attachtype = 0
@contenttype = 0
@ -110,6 +198,8 @@ class FilesController < ApplicationController
@containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
show_attachments @containers
@attachtype = 0
@contenttype = 0
@ -163,7 +253,7 @@ class FilesController < ApplicationController
end
end
# 返回定资源类型的资源列表
# 返回定资源类型的资源列表
# added by nwb
def getattachtype
sort_init 'created_on', 'desc'
@ -178,6 +268,7 @@ class FilesController < ApplicationController
elsif @course
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
end
show_attachments @containers
@attachtype = params[:type].to_i
@contenttype = params[:contentType].to_s

View File

@ -1,5 +1,7 @@
# added by fq
class ForumsController < ApplicationController
layout "users_base"
# GET /forums
# GET /forums.json
before_filter :find_forum_if_available
@ -50,14 +52,14 @@ class ForumsController < ApplicationController
def index
@offset, @limit = api_offset_and_limit({:limit => 10})
@forums_all = Forum.all
@forums_all = Forum.where('1=1')
@forums_count = @forums_all.count
@forums_pages = Paginator.new @forums_count, @limit, params['page']
@offset ||= @forums_pages.offset
# @forums = @forums_all.offset(@offset).limit(@limit).all
@forums = Forum.all
@forums = @forums_all.offset(@offset).limit(@limit).all
#@forums = Forum.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @forums }
@ -143,9 +145,10 @@ class ForumsController < ApplicationController
respond_to do |format|
if @forum.update_attributes(params[:forum])
format.html { redirect_to @forum, notice: 'Forum was successfully updated.' }
format.html { redirect_to @forum, notice: l(:label_forum_update_succ) }
format.json { head :no_content }
else
flash.now[:error] = "#{l :label_forum_update_fail}: #{@forum.errors.full_messages[0]}"
format.html { render action: "edit" }
format.json { render json: @forum.errors, status: :unprocessable_entity }
end
@ -166,10 +169,10 @@ 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?
q = "%#{params[:name].strip}%"
(redirect_to forums_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
@offset, @limit = api_offset_and_limit({:limit => 10})
@forums_all = Forum.where("name LIKE '%#{params[:name]}%'")
@forums_all = Forum.where("name LIKE ?", q)
@forums_count = @forums_all.count
@forums_pages = Paginator.new @forums_count, @limit, params['page']
@ -185,11 +188,13 @@ class ForumsController < ApplicationController
end
def search_memo
q = "%#{params[:name].strip}%"
limit = PageLimit
@memo = Memo.new
@offset, @limit = api_offset_and_limit({:limit => limit})
@forum = Forum.find(params[:id])
@memos_all = @forum.topics.where("subject LIKE '%#{params[:name]}%'")
@memos_all = @forum.topics.where("subject LIKE ?", q)
@topic_count = @memos_all.count
@topic_pages = Paginator.new @topic_count, @limit, params['page']

View File

@ -29,6 +29,7 @@ class GanttsController < ApplicationController
helper :sort
include SortHelper
include Redmine::Export::PDF
helper :project_score
def show
@gantt = Redmine::Helpers::Gantt.new(params)

View File

@ -1,5 +1,6 @@
#added by baiyu
class GitUsageController < ApplicationController
layout "project_base"
def ch_usage
end

View File

@ -1,6 +1,8 @@
class HomeworkAttachController < ApplicationController
layout "course_base"
include CoursesHelper
###############################
before_filter :can_show_course,except: []
#判断当前角色权限时需先找到当前操作的project
before_filter :find_course_by_bid_id, :only => [:new]
before_filter :find_course_by_hoemwork_id, :only => [:edit,:update,:destroy,:show,:add_homework_users,:destory_homework_users]
@ -169,7 +171,15 @@ class HomeworkAttachController < ApplicationController
#users该作业所有成员
#q:模糊匹配的用户的昵称
def members_for_homework homework,users,q
homework.bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and user_id not in (:users)", {:role_id => [5, 10],:users => users}).joins(:user).where("users.login like '%#{q}%'")
#homework.bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and user_id not in (:users)", {:role_id => [5, 10],:users => users}).joins(:user).where("users.login like '%#{q}%'")
unpartin_users = homework.bid.courses.first.members.where("user_id not in (:users)", {:users => users}).joins(:user).where("users.login like '%#{q}%'")
canpartin_users = []
unpartin_users.each do |m|
if m.user.allowed_to?(:paret_in_homework,homework.bid.courses.first)
canpartin_users << m
end
end
canpartin_users
end
def edit
@ -343,5 +353,13 @@ class HomeworkAttachController < ApplicationController
}
end
end
#验证是否显示课程
def can_show_course
@first_page = FirstPage.where("page_type = 'project'").first
if @first_page.show_course == 2
render_404
end
end
end

View File

@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueCategoriesController < ApplicationController
layout "project_base"
menu_item :settings
model_object IssueCategory
before_filter :find_model_object, :except => [:index, :new, :create]
@ -25,6 +26,8 @@ class IssueCategoriesController < ApplicationController
before_filter :authorize
accept_api_auth :index, :show, :create, :update, :destroy
helper :project_score
def index
respond_to do |format|
format.html { redirect_to_settings_in_projects }

View File

@ -52,6 +52,7 @@ class IssuesController < ApplicationController
include IssuesHelper
helper :timelog
include Redmine::Export::PDF
helper :project_score
def index
retrieve_query
@ -82,6 +83,10 @@ class IssuesController < ApplicationController
:limit => @limit)
@issue_count_by_group = @query.issue_count_by_group
respond_to do |format|
format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young
format.api {
@ -119,6 +124,7 @@ class IssuesController < ApplicationController
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
respond_to do |format|
format.html {
@ -194,6 +200,30 @@ class IssuesController < ApplicationController
end
if saved
#修改界面增加跟踪者
watcherlist = @issue.watcher_users
select_users = []
if params[:issue]
if params[:issue][:watcher_user_ids]
params[:issue][:watcher_user_ids].each do |user_id|
select_users << User.find(user_id)
end
end
end
select_users.each do |user|
if watcherlist.include? user
else
@issue.add_watcher user
end
end
watcherlist.each do |user|
if select_users.include? user
else
@issue.remove_watcher user
end
end
render_attachment_warning_if_needed(@issue)
reply_id = params[:reference_user_id].to_i
if reply_id > 0

View File

@ -1,3 +1,4 @@
# -*coding:utf-8 -*-
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
@ -14,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MembersController < ApplicationController
model_object Member
before_filter :find_model_object, :except => [:index, :create, :autocomplete]
@ -76,8 +78,10 @@ class MembersController < ApplicationController
members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
user_grades << UserGrade.new(:user_id => user_id, :project_id => @project.id)
## added by nie
if (params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3")
project_info << ProjectInfo.new(:user_id => user_id, :project_id => @project.id)
if (params[:membership][:role_ids])
role = Role.find(params[:membership][:role_ids][0])
project_info << ProjectInfo.new(:user_id => user_id, :project_id => @project.id) if role.allowed_to?(:is_manager)
# ProjectInfo.create(:name => "test", :user_id => 123)
end
## end
@ -86,8 +90,9 @@ class MembersController < ApplicationController
members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => params[:membership][:user_id])
user_grades << UserGrade.new(:user_id => params[:membership][:user_id], :project_id => @project.id)
## added by nie
if (params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3")
project_info << ProjectInfo.new(:project_id => @project.id, :user_id => params[:membership][:user_id])
if (params[:membership][:role_ids])
role = Role.find(params[:membership][:role_ids][0])
project_info << ProjectInfo.new(:project_id => @project.id, :user_id => params[:membership][:user_id]) if role.allowed_to?(:is_manager)
end
## end
end
@ -121,16 +126,24 @@ class MembersController < ApplicationController
attrs = params[:membership].dup
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)
member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
role = Role.find_by_id(params[:membership][:role_ids])
# 这里的判断只能通过角色名,可以弄成常量
if role.name == "学生"
StudentsForCourse.create(:student_id => user_id, :course_id =>@course.id)
end
members << member
#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)
if (params[:membership][:role_ids])
role = Role.find(params[:membership][:role_ids][0])
course_info << CourseInfo.new(:user_id => user_id, :course_id => @course.id) if role.allowed_to?(:is_manager)
end
end
else
members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => params[:membership][:user_id])
if (params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3")
course_info << CourseInfo.new(:course_id => @course.id, :user_id => params[:membership][:user_id])
if (params[:membership][:role_ids])
role = Role.find(params[:membership][:role_ids][0])
course_info << CourseInfo.new(:course_id => @course.id, :user_id => params[:membership][:user_id]) if role.allowed_to?(:is_manager)
end
end
@course.members << members
@ -162,14 +175,17 @@ class MembersController < ApplicationController
@member.role_ids = params[:membership][:role_ids]
#added by nie
if (params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3")
@projectInfo = ProjectInfo.new(:user_id => @member.user_id, :project_id => @project.id)
@projectInfo.save
else
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", @member.user_id, @project.id)
if user_admin.size > 0
user_admin.each do |user|
user.destroy
if (params[:membership][:role_ids])
role = Role.find(params[:membership][:role_ids][0])
if role.allowed_to?(:is_manager)
@projectInfo = ProjectInfo.new(:user_id => @member.user_id, :project_id => @project.id)
@projectInfo.save
else
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", @member.user_id, @project.id)
if user_admin.size > 0
user_admin.each do |user|
user.destroy
end
end
end
end
@ -191,14 +207,26 @@ class MembersController < ApplicationController
if params[:membership]
@member.role_ids = params[:membership][:role_ids]
if (params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3")
@courseInfo = CourseInfos.new(:user_id => @member.user_id, :course_id => @course.id)
@courseInfo.save
else
user_admin = CourseInfos.where("user_id = ? and course_id = ?", @member.user_id, @course.id)
if user_admin.size > 0
user_admin.each do |user|
user.destroy
if (params[:membership][:role_ids])
role = Role.find(params[:membership][:role_ids][0])
# 这里的判断只能通过角色名,可以弄成常量
if role.name == "学生"
StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id)
else
joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id)
joined.each do |join|
join.delete
end
end
if role.allowed_to?(:is_manager)
@courseInfo = CourseInfos.new(:user_id => @member.user_id, :course_id => @course.id)
@courseInfo.save
else
user_admin = CourseInfos.where("user_id = ? and course_id = ?", @member.user_id, @course.id)
if user_admin.size > 0
user_admin.each do |user|
user.destroy
end
end
end
end
@ -260,6 +288,11 @@ class MembersController < ApplicationController
user.destroy
end
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id)
joined.each do |join|
join.delete
end
end
respond_to do |format|
format.html { redirect_to_settings_in_courses }

View File

@ -9,6 +9,7 @@ class MemosController < ApplicationController
helper :attachments
include AttachmentsHelper
include ApplicationHelper
layout 'base_memos'
@ -19,6 +20,11 @@ class MemosController < ApplicationController
@content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)} <br/> &nbsp; "
@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
@content = "<blockquote>" << @content
#@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
#@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
#@content_html = textilizable(@content)
@temp = Memo.new
@temp.content = @content
end
def new
@ -34,12 +40,23 @@ class MemosController < ApplicationController
end
def create
if params[:quote].nil?
@quote = ""
else
@quote = params[:quote]
end
#unless params[:quote].nil?
# @quote = params[:quote][:quote]
#end
@memo = Memo.new(params[:memo])
@memo.forum_id = params[:forum_id]
@memo.author_id = User.current.id
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
@memo.content = @quote + @memo.content
respond_to do |format|
if @memo.save
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
@ -67,7 +84,7 @@ class MemosController < ApplicationController
@reply_pages = Paginator.new @reply_count, pre_count, page
@replies = @memo.children.
includes(:author, :attachments).
reorder("#{Memo.table_name}.created_at ASC").
reorder("#{Memo.table_name}.created_at DESC").
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all

View File

@ -16,9 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MessagesController < ApplicationController
include ApplicationHelper
menu_item :boards
default_search_scope :messages
before_filter :find_board, :only => [:new, :preview]
before_filter :find_board, :only => [:new, :preview,:edit]
before_filter :find_attachments, :only => [:preview]
before_filter :find_message, :except => [:new, :preview]
before_filter :authorize, :except => [:preview, :edit, :destroy, :new]
@ -27,11 +28,13 @@ class MessagesController < ApplicationController
helper :watchers
helper :attachments
include AttachmentsHelper
helper :project_score
REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE)
# Show a topic and its replies
def show
@isReply = true
page = params[:page]
# Find the page of the requested reply
if params[:r] && page.nil?
@ -77,12 +80,17 @@ class MessagesController < ApplicationController
# Reply to a topic
def reply
if params[:reply][:content] == ""
(redirect_to board_message_path(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
end
@quote = params[:quote][:quote]
@reply = Message.new
@reply.author = User.current
@reply.board = @board
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@topic.children << @reply
@topic.update_attribute(:updated_on, Time.now)
#@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record?
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments])
@ -96,7 +104,12 @@ class MessagesController < ApplicationController
# Edit a message
def edit
(render_403; return false) unless @message.editable_by?(User.current)
@isReply = false
if @project
(render_403; return false) unless @message.editable_by?(User.current)
else
(render_403; return false) unless @message.course_editable_by?(User.current)
end
@message.safe_attributes = params[:message]
if request.post? && @message.save
attachments = Attachment.attach_files(@message, params[:attachments])
@ -104,18 +117,38 @@ class MessagesController < ApplicationController
flash[:notice] = l(:notice_successful_update)
@message.reload
redirect_to board_message_path(@message.board, @message.root, :r => (@message.parent_id && @message.id))
elsif request.get?
respond_to do |format|
format.html {
layout_file = @project ? 'base_projects' : 'base_courses'
render :layout => layout_file
}
end
end
end
# Delete a messages
def destroy
(render_403; return false) unless @message.destroyable_by?(User.current)
if @project
(render_403; return false) unless @message.destroyable_by?(User.current)
else
(render_403; return false) unless @message.course_destroyable_by?(User.current)
end
r = @message.to_param
@message.destroy
if @message.parent
redirect_to board_message_path(@board, @message.parent, :r => r)
else
redirect_to project_board_path(@project, @board)
# modify by nwb
if @project
if @message.parent
redirect_to board_message_path(@board, @message.parent, :r => r)
else
redirect_to project_board_path(@project, @board)
end
elsif @course
if @message.parent
redirect_to board_message_path(@board, @message.parent, :r => r)
else
redirect_to course_board_path(@course, @board)
end
end
end
@ -123,8 +156,18 @@ class MessagesController < ApplicationController
@subject = @message.subject
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
#@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
#@temp = Message.new
##@temp.content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}> "
#@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
#@content_html = textilizable(@content)
#@temp.content = @content_html
@content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)} <br/> &nbsp; "
@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
@content = "<blockquote>" << @content
@temp = Message.new
@temp.content = @content
end
def preview

View File

@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MyController < ApplicationController
layout "users_base"
before_filter :require_login
helper :issues
@ -36,20 +37,47 @@ class MyController < ApplicationController
}.freeze
def index
page
render :action => 'page'
end
end
# Show user's page
def page
@user = User.current
@Issues= Issue.visible.open.
where(:assigned_to_id => ([User.current.id] + User.current.group_ids))
@limit = 10
@feedback_count = @Issues.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@curse_attachments = @Issues[@offset, @limit]
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
end
def page2
@limit = 10
@user = User.current
@Issues= Issue.visible.open.
where(:assigned_to_id => ([User.current.id] + User.current.group_ids))
@feedback_count = @Issues.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@curse_attachments = @Issues[@offset, @limit]
@state = false
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
respond_to do |format|
format.js
end
end
# Edit user's account
def account
@user = User.current
@pref = @user.pref
diskfile = disk_filename('User', @user.id)
diskfile1 = diskfile + 'temp'
if request.post?
@user.safe_attributes = params[:user]
@user.pref.attributes = params[:pref]
@ -71,6 +99,33 @@ class MyController < ApplicationController
@se.student_id = params[:no] if params[:no]
if @user.save && @se.save
# 头像保存
if File.exist?(diskfile1)
if File.exist?(diskfile)
File.delete(diskfile)
end
File.open(diskfile1, "rb") do |f|
buffer = f.read(10)
if buffer != "DELETE"
File.open(diskfile1, "rb") do |f1|
File.open(diskfile, "wb") do |f|
buffer = ""
while (buffer = f1.read(8192))
f.write(buffer)
end
end
end
# File.rename(diskfile + 'temp',diskfile);
end
end
end
# 确保文件被删除
if File.exist?(diskfile1)
File.delete(diskfile1)
end
@user.pref.save
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
set_language_if_valid @user.language
@ -78,8 +133,17 @@ class MyController < ApplicationController
redirect_to user_path(@user)
return
else
# 确保文件被删除
if File.exist?(diskfile1)
File.delete(diskfile1)
end
@user
end
else
# 确保文件被删除
if File.exist?(diskfile1)
File.delete(diskfile1)
end
end
end
@ -114,11 +178,11 @@ class MyController < ApplicationController
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
if @user.save
flash[:notice] = l(:notice_account_password_updated)
flash.now[:notice] = l(:notice_account_password_updated)
redirect_to my_account_path
end
else
flash[:error] = l(:notice_account_wrong_password)
flash.now[:error] = l(:notice_account_wrong_password)
end
end
end

View File

@ -29,6 +29,7 @@ class NewsController < ApplicationController
helper :watchers
helper :attachments
helper :project_score
def index
case params[:format]
@ -98,10 +99,12 @@ class NewsController < ApplicationController
end
def new
@news = News.new(:project => @project, :author => User.current)
@course_tag = @project.project_type
if @course_tag
render :layout => 'base_courses'
#modify by nwb
if @project
@news = News.new(:project => @project, :author => User.current)
elsif @course
@news = News.new(:course => @course, :author => User.current)
render :layout => 'base_courses'
end
end
@ -145,7 +148,8 @@ class NewsController < ApplicationController
flash[:notice] = l(:notice_successful_update)
redirect_to news_path(@news)
else
render :action => 'edit'
#flash[:error] = l(:notice_successful_update)
redirect_to news_path(@news)
end
end

View File

@ -1,4 +1,7 @@
class NotificationcommentsController < ApplicationController
def show
end
# default_search_scope :contestnotifications
# model_object Contestnotifications
# before_filter :authorize
@ -20,8 +23,14 @@ class NotificationcommentsController < ApplicationController
end
def destroy
@contestnotifications.notificaioncomments.find(params[:notificaioncomment_id]).destroy
redirect_to contest_contestnotification_path(@contestnotifications)
@contest = Contest.find(params[:contest_id])
@contestnotification = Contestnotification.find(params[:contestnotification_id])
notificaioncomments = Notificationcomment.find(params[:id])
notificaioncomments.destroy if notificaioncomments
#@contestnotifications = notificaioncomments.Contestnotification
#@contest = @contestnotifications.contest
#@contestnotifications.notificaioncomments.find(params[:notificaioncomment_id]).destroy
redirect_to contest_contestnotification_path(@contest,@contestnotification)
end
end

View File

@ -16,11 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class PreviewsController < ApplicationController
before_filter :find_project, :find_attachments, :find_contest, except: [:contestnotification]
before_filter :find_project, :find_attachments, except: :contestnotification
def issue
@issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank?
@issue = @contest.issues.find_by_id(params[:id]) unless params[:id].blank?
if @issue
@description = params[:issue] && params[:issue][:description]
if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @issue.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n")
@ -65,12 +64,4 @@ class PreviewsController < ApplicationController
render :partial => 'common/preview'
end
private
def find_contest
contest_id = (params[:issue] && params[:issue][:contest_id]) || params[:contest_id]
@contest = Contest.find(contest_id)
rescue ActiveRecord::RecordNotFound
render_404
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]
#before_filter :find_project_repository, :only => [:show]
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
before_filter :memberAccess, only: :member
@ -75,6 +75,8 @@ class ProjectsController < ApplicationController
helper :watchers
# helper :watcherlist
helper :words
helper :project_score
helper :user_score
### added by william
include ActsAsTaggableOn::TagsHelper
@ -103,12 +105,14 @@ class ProjectsController < ApplicationController
end
def index
#调用存储过程更新提交次数
#ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();")
#Modified by nie
@project_type = params[:project_type].to_i
per_page_option = 10
@projects_all = Project.active.visible.
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").joins("LEFT JOIN #{ProjectScore.table_name} ON #{Project.table_name}.id = #{ProjectScore.table_name}.project_id").
where("#{Project.table_name}.project_type = ? ", Project::ProjectType_project)
@project_count = @projects_all.count
@ -131,7 +135,7 @@ class ProjectsController < ApplicationController
@projects = @projects_all.order("created_on desc")
@s_type = 0
when '1'
@projects = @projects_all.order("grade desc")
@projects = @projects_all.order("score desc")
@s_type = 1
when '2'
@projects = @projects_all.order("watchers_count desc")
@ -145,11 +149,12 @@ class ProjectsController < ApplicationController
@projects = @projects[@project_pages.offset, @project_pages.per_page]
else
@projects = @projects = @projects_all.order("grade desc")
@projects = @projects = @projects_all.order("score desc")
@s_type = 1
end
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
respond_to do |format|
format.html {
render :layout => 'base'
@ -398,21 +403,35 @@ class ProjectsController < ApplicationController
#Ended by young
def feedback
page = params[:page]
@page = params[:page]
@page = @page.to_i
# Find the page of the requested reply
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@limit = 10
if params[:r] && page.nil?
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit
if params[:r] && @page.nil?
@page = page
end
puts @page
if @page < 0
@page = 1
end
if @page > page
@page = page
end
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, page
@feedback_pages = Paginator.new @feedback_count, @limit, @page
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
@state = false
@base_courses_tag = @project.project_type
respond_to do |format|
format.html{render :layout => 'base_courses' if @base_courses_tag==1}
format.api
@ -448,24 +467,10 @@ class ProjectsController < ApplicationController
end
def new
@project_type = params[:project_type] ||= params[:course]
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
case @project_type
when '0' # Project
@project = Project.new
@project.safe_attributes = params[:project]
when '1' # Course
@project = Project.new
@project.safe_attributes = params[:project]
@course_tag = params[:course]
@course = Course.new
@course.safe_attributes = params[:course]
else # default Project
@project = Project.new
@project.safe_attributes = params[:project]
end
@project = Project.new
@project.safe_attributes = params[:project]
render :layout => 'base'
end
@ -478,127 +483,44 @@ class ProjectsController < ApplicationController
end
end
def create
@course_tag = params[:project][:project_type]
if(@course_tag=="1")
if User.current.user_extensions.identity#.include?(UserExtensions::TEACHER,UserExtensions::DEVELOPER)
@course = Course.new
@course.extra='course' + DateTime.parse(Time.now.to_s).strftime('%Y-%m-%d_%H-%M-%S').to_s
@course.safe_attributes = params[:project][:course]
@course.tea_id = User.current.id
# added by bai
@course.term = params[:term]
@course.time = params[:time]
#@course.school_id = params[:occupation]
@course.school_id = User.current.user_extensions.school_id
@course.setup_time = params[:setup_time]
@course.endup_time = params[:endup_time]
@course.class_period = params[:class_period]
end
end
def create
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@project = Project.new
@project.user_id = User.current.id
@project.safe_attributes = params[:project]
if @course_tag == '1'
@project.identifier = @course.extra
end
if @course_tag == '1'
if User.current.user_extensions.identity == 0
if@course.save
if validate_parent_id && @project.save
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
# Add current user as a project member if he is not admin
unless User.current.admin?
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
m = Member.new(:user => User.current, :roles => [r])
project = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
if params[:project][:is_public] == '1'
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :grade => 0, :project_type => @course_tag)
end
@project.members << m
@project.project_infos << project
end
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)
if params[:continue]
attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
redirect_to new_project_path(attrs, :course => '0')
#Added by young
elsif params[:course_continue]
redirect_to new_project_path(:course => '1')
#Ended by young
else
redirect_to settings_project_path(@project,:project_type => 1)
end
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
end
if validate_parent_id && @project.save
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
# Add current user as a project member if he is not admin
#unless User.current.admin?
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
m = Member.new(:user => User.current, :roles => [r])
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
#if params[:project][:is_public] == '1'
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type,:grade => 0)
Rails.logger.debug "ProjectStatus created: #{project_status.to_json}"
#end
@project.members << m
@project.project_infos << project_info
#end
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)
if params[:continue]
attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
redirect_to new_project_path(attrs, :course => '0')
else
@course.destroy
respond_to do |format|
format.html { render :action => 'new', :layout => 'base'}#Added by young
format.api { render_validation_errors(@project) }
end
redirect_to settings_project_path(@project)
end
else
if validate_parent_id && @project.save
@project.delete
respond_to do |format|
format.html { render :action => 'new', :layout => 'base'}#Added by young
format.api { render_validation_errors(@project) }
end
else
respond_to do |format|
format.html { render :action => 'new', :layout => 'base'}#Added by young
format.api { render_validation_errors(@project) }
end
end
end
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
end
else
if validate_parent_id && @project.save
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
# Add current user as a project member if he is not admin
unless User.current.admin?
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
m = Member.new(:user => User.current, :roles => [r])
project = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
if params[:project][:is_public] == '1' || @course_tag=="1"
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type)
end
@project.members << m
@project.project_infos << project
end
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)
if params[:continue]
attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
redirect_to new_project_path(attrs, :course => '0')
#Added by young
elsif params[:course_continue]
redirect_to new_project_path(:course => '1')
#Ended by young
else
redirect_to settings_project_path(@project)
end
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
end
else
respond_to do |format|
format.html { render :action => 'new', :layout => 'base'}#Added by young
format.api { render_validation_errors(@project) }
end
end
respond_to do |format|
format.html { render :action => 'new', :layout => 'base'}#Added by young
format.api { render_validation_errors(@project) }
end
end
end
@ -672,6 +594,7 @@ class ProjectsController < ApplicationController
"show_news" => true,
"show_bids" => true,
"show_contests" => true,
"show_wiki_edits"=>true,
"show_journals_for_messages" => true
}
@date_to ||= Date.today + 1
@ -685,8 +608,14 @@ class ProjectsController < ApplicationController
@activity.scope_select {|t| !has["show_#{t}"].nil?}
# logger.debug "=========================================#{@activity.scope}"
# @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
#Added by young
events = @activity.events(@date_from, @date_to)
# modify by nwb
# 添加私密性判断
if User.current.member_of?(@project)|| User.current.admin?
events = @activity.events(@date_from, @date_to)
else
events = @activity.events(@date_from, @date_to, :is_public => 1)
end
@offset, @limit = api_offset_and_limit({:limit => 10})
@events_count = events.count
@ -717,8 +646,8 @@ class ProjectsController < ApplicationController
@canShowRealName = isCourseTeacher(User.current.id)
end
#勿删 real_name action为虚拟的该方法并不存在用来辅助判断真名权限
#勿删 @canShowRealName = User.current.allowed_to?({:controller => "projects", :action => "real_name"}, @project || @projects, :global => false)
# real_name action为虚拟的该方法并不存在用来辅助判断真名权限
# @canShowRealName = User.current.allowed_to?({:controller => "projects", :action => "real_name"}, @project || @projects, :global => false)
respond_to do |format|
format.html{render :layout => 'base_courses' if @base_courses_tag==1}
format.api
@ -734,7 +663,7 @@ class ProjectsController < ApplicationController
#Added by young
# @course_tag = params[:course]
# if @course_tag == '1'
@course = Course.find_by_extra(@project.identifier)
#@course = Course.find_by_extra(@project.identifier)
# if @project.project_type == 1
# render :layout => 'base_courses'
# else
@ -769,8 +698,8 @@ class ProjectsController < ApplicationController
else # @project.project_type == Project::ProjectType_project
roles = Role.find_all_givable
@subPage_title = l :label_member_list
@members = @project.member_principals.includes(:roles, :principal).all
@members = sort_project_members(@project, @members)
@members = @project.member_principals.includes(:roles, :principal).joins("LEFT JOIN #{OptionNumber.table_name} ON #{OptionNumber.table_name}.user_id = #{Member.table_name}.user_id and #{OptionNumber.table_name}.score_type = 2 AND #{Member.table_name}.project_id = #{OptionNumber.table_name}.project_id").order("#{OptionNumber.table_name}.total_score DESC").all
#@members = sort_project_members(@project, @members)
@applied_members = appied_project_members(@project, @members)
end
@members = paginateHelper @members
@ -826,6 +755,7 @@ class ProjectsController < ApplicationController
def update
@project.safe_attributes = params[:project]
#@project.dts_test = params[:project][:dts_test]
if validate_parent_id && @project.save
@course = Course.find_by_extra(@project.identifier)
unless @course.nil?
@ -966,6 +896,18 @@ class ProjectsController < ApplicationController
end
end
def exit_project
@project = Project.find params[:id]
if User.current.login?
members = Member.where(:user_id => User.current.id, :project_id=>params[:id]).first
if members != nil
members.destroy
end
respond_to do |format|
format.js
end
end
end
private
def memberAccess
@ -1112,4 +1054,5 @@ class ProjectsController < ApplicationController
end
#gcmend
end

View File

@ -39,6 +39,7 @@ class RepositoriesController < ApplicationController
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
helper :repositories
include RepositoriesHelper
helper :project_score
#@root_path = RepositoriesHelper::ROOT_PATH
@ -92,57 +93,74 @@ class RepositoriesController < ApplicationController
end
def create
##xianbo
@root_path=RepositoriesHelper::ROOT_PATH
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
@project_path=@root_path+"htdocs/"+@repository_name
@repository_tag=params[:repository][:upassword]
@repo_name=User.current.login.to_s+"_"+params[:repository][:identifier]
logger.info "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+": "+@repository_tag
logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name
attrs = pickup_extra_info
if((@repository_tag!="")&&params[:repository_scm]=="Git")
if params[:repository_scm].to_s == 'Gitlab'
# add by nwb
# 增加对gitlab版本库的支持
attrs = pickup_extra_info
@repository = Repository.factory('Git')
@repository.safe_attributes = params[:repository]
if attrs[:attrs_extra].keys.any?
@repository.merge_extra_info(attrs[:attrs_extra])
end
@repository.project = @project
if request.post? && @repository.save
redirect_to settings_project_path(@project, :tab => 'repositories')
else
render :action => 'new'
end
else # 原逻辑
##xianbo
@root_path=RepositoriesHelper::ROOT_PATH
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
@project_path=@root_path+"htdocs/"+@repository_name
@repository_tag=params[:repository][:upassword]
@repo_name=User.current.login.to_s+"_"+params[:repository][:identifier]
logger.info "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+": "+@repository_tag
logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name
attrs = pickup_extra_info
if((@repository_tag!="")&&params[:repository_scm]=="Git")
params[:repository][:url]=@project_path
end
###xianbo
@repository = Repository.factory(params[:repository_scm])
@repository.safe_attributes = params[:repository]
if attrs[:attrs_extra].keys.any?
@repository.merge_extra_info(attrs[:attrs_extra])
end
#by xianbo
@repository.project = @project
if request.post? && @repository.save
if(params[:repository_scm]=="Git")
system "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+" "+@repository_tag
system "echo -e '"+@repo_name+"-write:"+
" "+@repo_name+"' >> "+@root_path+"group.passwd"
system "mkdir "+@root_path+"htdocs/"+User.current.login.to_s
system "git init --bare "+@project_path
system "mv "+@project_path+"/hooks/post-update{.sample,}"
system "chmod a+x "+@project_path+"/hooks/post-update"
system "echo -e 'Allow from all \n Order Deny,Allow \n "+
"<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
"Require group "+@repo_name+"-write \n "+
"</Limit> \n ' >> "+
@root_path+"htdocs/"+ @repository_name+"/.htaccess"
system "cd "+@project_path+" ;git update-server-info"
# if(create_repo_file&&create_passwd&&create_group&&init_repository&&add_privilege&&init_server_info)
# else
# logger.info "An error occured when authenticating "+"create passwd"+@creat_passwd+"create_group"+
# crate_group+"create repository file "+create_repo_file+"init repository"+init_repostory+
# "aad privilege to rpository"+add_privilege+"init server infos"+init_server_info
# end
end
###xianbo
@repository = Repository.factory(params[:repository_scm])
@repository.safe_attributes = params[:repository]
if attrs[:attrs_extra].keys.any?
@repository.merge_extra_info(attrs[:attrs_extra])
end
#by xianbo
@repository.project = @project
if request.post? && @repository.save
if(params[:repository_scm]=="Git")
system "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+" "+@repository_tag
system "echo -e '"+@repo_name+"-write:"+
" "+@repo_name+"' >> "+@root_path+"group.passwd"
system "mkdir "+@root_path+"htdocs/"+User.current.login.to_s
system "git init --bare "+@project_path
system "mv "+@project_path+"/hooks/post-update{.sample,}"
system "chmod a+x "+@project_path+"/hooks/post-update"
system "echo -e 'Allow from all \n Order Deny,Allow \n "+
"<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
"Require group "+@repo_name+"-write \n "+
"</Limit> \n ' >> "+
@root_path+"htdocs/"+ @repository_name+"/.htaccess"
system "cd "+@project_path+" ;git update-server-info"
# if(create_repo_file&&create_passwd&&create_group&&init_repository&&add_privilege&&init_server_info)
# else
# logger.info "An error occured when authenticating "+"create passwd"+@creat_passwd+"create_group"+
# crate_group+"create repository file "+create_repo_file+"init repository"+init_repostory+
# "aad privilege to rpository"+add_privilege+"init server infos"+init_server_info
# end
@repository.update_attributes(:login => User.current.login.to_s)
end
redirect_to settings_project_path(@project, :tab => 'repositories')
else if(@repository_tag)
render :action => 'newrepo', :layout =>'base_projects'
else
render :action => 'new', :layout =>'base_projects'
end
redirect_to settings_project_path(@project, :tab => 'repositories')
else if(@repository_tag)
render :action => 'newrepo', :layout =>'base_projects'
else
render :action => 'new', :layout =>'base_projects'
end
end
end
end
end
def edit
@ -188,6 +206,14 @@ class RepositoriesController < ApplicationController
@repository.committer_ids = params[:committers].values.inject({}) {|h, c| h[c.first] = c.last; h}
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'repositories')
elsif request.get?
respond_to do |format|
format.html{
render :layout => "project_base"
}
end
end
end
@ -240,7 +266,7 @@ class RepositoriesController < ApplicationController
@course_tag = params[:course]
project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
ip = RepositoriesHelper::REPO_IP_ADDRESS
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip+
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s+
@repository.url.slice(project_path_cut, @repository.url.length).to_s
if @course_tag == 1
render :action => 'show', :layout => 'base_courses'
@ -395,7 +421,10 @@ class RepositoriesController < ApplicationController
Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}-#{current_language}")
unless read_fragment(@cache_key)
@diff = @repository.diff(@path, @rev, @rev_to)
show_error_not_found unless @diff
unless @diff
show_error_not_found
return
end
end
@changeset = @repository.find_changeset_by_name(@rev)

View File

@ -1,5 +1,5 @@
class SchoolController < ApplicationController
layout 'course_base'
before_filter :require_admin, :only => :upload_logo
def upload
@ -98,16 +98,18 @@ class SchoolController < ApplicationController
end
def search_school
if params[:province].nil? or params[:province] == "0"
@school = School.where("name LIKE '%"+params[:key_word]+"%'");
else
@school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]);
end
q = "%#{params[:key_word].strip}%"
@school = School.where("name LIKE ?", q)
@school = @school.where("province = ?", params[:province]) if (params[:province] != '0' )
options = ""
@school.each do |s|
options << "<li style = 'width: 33%; float: left'> <a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
end
render :text => options
options = "<div class='flash error' id='flash_error'>#{l(:label_school_not_fount)}</div>" if options.blank?
render :text => options
end
end

View File

@ -1,4 +1,5 @@
class SoftapplicationsController < ApplicationController
layout "contest_base"
before_filter :find_softapplication, only: [:edit, :update, :destroy]
before_filter :editable, only: [:edit, :update]
before_filter :destroyable, only: :destroy
@ -18,20 +19,20 @@ class SoftapplicationsController < ApplicationController
#new added sort
if params[:softapplication_sort_type].present?
case params[:softapplication_sort_type]
case params[:softapplication_sort_type]
when '0'
@softapplications = @softapplications[@offset, @limit]
@softapplications = @softapplications[@offset, @limit]
@s_state = 0
when '1'
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
end
else
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
else
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
end
#new added end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @softapplications }
@ -108,14 +109,8 @@ class SoftapplicationsController < ApplicationController
# @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page']
@membership.each do |membership|
unless(membership.project.project_type==1)
#membership.member_roles.each{|role|
# if(role.role_id == 3)
# @option << membership.project
# end
#}
#拥有编辑项目权限的可操作该项目
if User.current.allowed_to?({:controller => "projects", :action => "edit"}, membership.project, :global => false)
if User.current.allowed_to?(:quote_project,membership.project)
@option << membership.project
end
end
@ -145,13 +140,14 @@ class SoftapplicationsController < ApplicationController
#new changed created function
def create
#options = params[:softapplication]
#options[:app_type_name] = params[:other_input] if options[:app_type_name] == "其他" && params[:other_input]
@softapplication = Softapplication.new(params[:softapplication])
@softapplication.user = User.current
#@softapplication.deposit_project = params[:project]
@softapplication.project = Project.find_by_id(params[:project])
@softapplication.app_type_name = params[:other_input] if params[:other_input] != ""
@softapplication.save_attachments(params[:attachments])
respond_to do |format|
if @softapplication.save
ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id)
@ -160,8 +156,8 @@ class SoftapplicationsController < ApplicationController
format.html { redirect_to show_attendingcontest_contest_path(:id => params[:contest_id]), notice: l(:notice_attendingcontest_work_successfully_created) }
# format.json { render json: @softapplication, status: :created, location: @softapplication }
else
format.js { render status: 406 }
format.html { render action: "new" }
#format.js { render status: 406 }
format.html { render action: "contests/show_attendingcontest" }
# format.json { render json: @softapplication.errors, status: :unprocessable_entity }
end
end
@ -176,12 +172,20 @@ class SoftapplicationsController < ApplicationController
# PUT /softapplications/1.json
def update
# @softapplication = Softapplication.find(params[:id])
@softapplication.attachments.map{|attach| attach.destroy }
@softapplication.save_attachments(params[:attachments])
#@softapplication.attachments.map{|attach| attach.destroy }
@softapplication.save_attachments(params[:attachments]) if params[:attachments]
#@softapplication.deposit_project = params[:project]
@softapplication.project = Project.find_by_id(params[:project])
@softapplication.name = params[:softapplication][:name]
@softapplication.android_min_version_available = params[:softapplication][:android_min_version_available]
@softapplication.app_type_name = params[:other_input] == "" ? params[:softapplication][:app_type_name] : params[:other_input]
@softapplication.description = params[:softapplication][:description]
@softapplication.application_developers = params[:softapplication][:application_developers]
#@softapplication.app_type_name = params[:other_input] if params[:other_input] != ""
respond_to do |format|
if @softapplication.update_attributes(params[:softapplication])
#if @softapplication.update_attributes(params[:softapplication])
if @softapplication.save
format.html { redirect_to @softapplication, notice: l(:notice_softapplication_was_successfully_updated) }
format.json { head :no_content }
else
@ -212,19 +216,19 @@ class SoftapplicationsController < ApplicationController
def new_message
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
if @jour
user = @jour.user
text = @jour.notes
user = @jour.user
text = @jour.notes
else
user = @softapplication.user
text = @softapplication.description
user = @softapplication.user
text = @softapplication.description
end
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
@id = user.id
rescue ActiveRecord::RecordNotFound
rescue ActiveRecord::RecordNotFound
render_404
end
end
#新建评价
def create_message
@ -300,6 +304,36 @@ class SoftapplicationsController < ApplicationController
end
end
def search
@softapplications = Softapplication.where("name like '%#{params[:name]}%'")
#new added fenyefunction
@limit = 5
@softapplication_count = @softapplications.count
@softapplication_pages = Paginator.new @softapplication_count, @limit, params['page']
@offset ||= @softapplication_pages.offset
#new added sort
if params[:softapplication_sort_type].present?
case params[:softapplication_sort_type]
when '0'
@softapplications = @softapplications[@offset, @limit]
@s_state = 0
when '1'
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
end
else
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
end
#new added end
respond_to do |format|
format.html
end
end
private
def find_softapplication
@softapplication = Softapplication.find_by_id(params[:id])

View File

@ -5,12 +5,18 @@ class StoresController < ApplicationController
layout 'base_stores'
def search
name = params[:name] ||= ''
(redirect_to stores_path, :notice => l(:label_sumbit_empty);return) if name.blank?
begin
q = "%#{params[:name].strip}%"
(redirect_to stores_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
result = find_public_attache name
result = find_public_attache q
@searched_attach = paginateHelper result
@result_all_count = result.count;
rescue Exception => e
#render 'stores'
redirect_to stores_path
end
end
def find_public_attache keywords
@ -20,25 +26,27 @@ class StoresController < ApplicationController
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{keywords}%").
reorder("created_on DESC")
result = resultSet.to_a.dup
# result = resultSet.to_a.dup
resultSet.to_a.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.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
false
)
result.delete(res)
end
}
result
# resultSet.to_a.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.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
# false
# )
# result.delete(res)
# end
# }
# result
end
LIMIT = 12 unless const_defined?(:LIMIT)
def index
@projects_attach = project_classification(0).take(LIMIT)
@courses_attach = project_classification(1).take(LIMIT)
@courses_attach = Attachment.includes(:course).where("courses.is_public = 1").
where(container_type: 'Course').
limit(LIMIT)
# @projects_attach = Attachment.includes(:project).where("projects.project_type=? AND projects.is_public = ?", 0, 1).
# reorder("#{Attachment.table_name}.downloads DESC").
# limit(LIMIT)

View File

@ -71,8 +71,8 @@ class TagsController < ApplicationController
@projects_results,
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@forums_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@obj_flag,@selected_tags)
@ -107,8 +107,8 @@ class TagsController < ApplicationController
@projects_results,
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@forums_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
@ -130,8 +130,8 @@ class TagsController < ApplicationController
@projects_results,
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@forums_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
@ -199,7 +199,7 @@ class TagsController < ApplicationController
@bids_results = nil
@contests_results = nil
@forums_results = nil
attachments_results = nil
@attachments_results = nil
@open_source_projects_results = nil
@obj_pages = nil
@obj = nil
@ -228,8 +228,9 @@ class TagsController < ApplicationController
# modifed by Long Jun
# this is used to find the attachments that came from the same project and tagged with the same tag.
@result = get_attachments_by_project_tag(selected_tags, @obj)
@obj_pages, attachments_results, @results_count = for_pagination(@result)
#@result = get_attachments_by_project_tag(selected_tags, @obj)
@result = get_attachments_by_tag(selected_tags)
@obj_pages, @attachments_results, @results_count = for_pagination(@result)
when '7'
@obj = Contest.find_by_id(obj_id)
@obj_pages,@contests_results,@results_count = for_pagination(get_contests_by_tag(selected_tags))
@ -249,8 +250,8 @@ class TagsController < ApplicationController
@projects_results,
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@forums_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results]

View File

@ -26,7 +26,7 @@ class TestController < ApplicationController
end
def courselist
@courses = Project.course_entities
@courses = paginateHelper Course.includes(:homeworks).all, 10
end
def ziping files_path

View File

@ -17,11 +17,11 @@
class TrackersController < ApplicationController
layout 'admin'
helper "project_score"
before_filter :require_admin, :except => :index
before_filter :require_admin_or_api_request, :only => :index
accept_api_auth :index
include CoursesHelper
def index
respond_to do |format|
format.html {
@ -37,7 +37,13 @@ class TrackersController < ApplicationController
def new
@tracker ||= Tracker.new(params[:tracker])
@trackers = Tracker.sorted.all
@projects = Project.all
@projects = Project.where("project_type = #{Project::ProjectType_project}").all
@courses = Course.all
@course_activity_count=Hash.new
@courses.each do |course|
@course_activity_count[course.id]=0
end
@course_activity_count=get_course_activity @courses,@course_activity_count
end
def create
@ -57,7 +63,8 @@ class TrackersController < ApplicationController
def edit
@tracker ||= Tracker.find(params[:id])
@projects = Project.all
@projects = Project.where("project_type = #{Project::ProjectType_project}").all
@courses = Course.all
end
def update

View File

@ -29,11 +29,11 @@ class UsersController < ApplicationController
#Ended by young
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
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,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score]
:activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities]
#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,
@ -41,10 +41,12 @@ class UsersController < ApplicationController
: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
before_filter :rest_user_score, only: :show
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
#william
before_filter :require_login, :only => [:tag_save,:tag_saveEx]
#before_filter :refresh_changests, :only =>[:user_activities,:user_courses,:user_projects,:user_newfeedback]
helper :sort
@ -53,6 +55,9 @@ class UsersController < ApplicationController
include CustomFieldsHelper
include AvatarHelper
include WordsHelper
include GitlabHelper
include UserScoreHelper
helper :user_score
# added by liuping 关注
@ -64,6 +69,17 @@ class UsersController < ApplicationController
# fq
helper :words
def refresh_changests
if !(@user.nil?) && !(@user.memberships.nil?)
@user.memberships.each do |member|
unless member.project.nil?
member.project.repository.fetch_changesets if Setting.autofetch_changesets?
end
end
end
end
#added by young
def user_projects
@ -150,6 +166,9 @@ class UsersController < ApplicationController
# added by fq
def user_activities
redirect_to user_path(@user, type: params[:type], page: params[:page])
return
# useless abort.
@watcher = User.watched_by_id(@user)
events = []
for user in @watcher
@ -255,10 +274,7 @@ class UsersController < ApplicationController
#end
def index
@project_type = params[:project_type]
role = params[:role]
@status = params[:status] || 1
sort_init 'login', 'asc'
sort_update %w(login firstname lastname mail admin created_on last_login_on)
@ -266,101 +282,52 @@ class UsersController < ApplicationController
when 'xml', 'json'
@offset, @limit = api_offset_and_limit({:limit => 15})
else
@limit = 15#per_page_option
@limit = 15
end
@status = params[:status] || 1
has = {
"show_changesets" => true
}
# @count = Redmine::Activity::Fetcher.new(User.current, :author => @user).scope_select {|t| !has["show_#{t}"].nil?}.events(nil, nil).count
scope = UserStatus.visible
case role
when 'teacher'
scope = UserStatus.teacher
when 'student'
scope = UserStatus.student
else
end
# retrieve all users
# 先内连一下statuses 保证排序之后数量一致
scope = User.visible.
joins("INNER JOIN user_statuses ON users.id = user_statuses.user_id")
# unknow
scope = scope.in_group(params[:group_id]) if params[:group_id].present?
# scope.each do |user|
# UserStatus.create(:changesets_count => user.changesets.count, :watchers_count => user.watcher_users.count, :user_id => user.id)
# end
# pagination
@user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page']
#@offset ||= @user_pages.offset
#@users = scope.order(sort_clause).limit(@limit).offset(@offset).all
@user_base_tag = params[:id] ? 'base_users':'base'
if params[:user_sort_type].present?
case params[:user_sort_type]
when '0'
@offset ||= @user_pages.reverse_offset
unless @offset == 0
@users_statuses = scope.offset(@offset).limit(@limit).all.reverse
else
limit = @user_count % @limit
if limit == 0
limit = @limit
end
@users_statuses = scope.offset(@offset).limit(limit).all.reverse
end
@s_type = 0
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
# @projects = @projects[@offset, @limit]
when '1'
@offset ||= @user_pages.reverse_offset
unless @offset == 0
@users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse
else
limit = @user_count % @limit
if limit == 0
limit = @limit
end
@users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse
end
@s_type = 1
#sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count}
#@users = @users[@offset, @limit]
when '2'
@offset ||= @user_pages.reverse_offset
unless @offset == 0
@users_statuses = scope.reorder('watchers_count').offset(@offset).limit(@limit).all.reverse
else
limit = @user_count % @limit
if limit == 0
limit = @limit
end
@users_statuses = scope.reorder('watchers_count').offset(@offset).limit(limit).all.reverse
end
@s_type = 2
#@users = @users[@offset, @limit]
end
# users classify
case params[:user_sort_type]
when '0'
# 创建时间排序
@s_type = 0
@users = scope.reorder('users.created_on DESC')
when '1'
# 活跃度排序, 就是所谓的得分情况
@s_type = 1
@users = scope.
joins("LEFT JOIN option_numbers ON users.id = option_numbers.user_id and option_numbers.score_type = 1").
reorder('option_numbers.total_score DESC')
when '2'
# 粉丝数排序
@s_type = 2
@users = scope.
#joins("INNER JOIN user_statuses ON users.id = user_statuses.user_id").
reorder('user_statuses.watchers_count DESC')
else
@offset ||= @user_pages.reverse_offset
unless @offset == 0
@users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse
else
limit = @user_count % @limit
if limit == 0
limit = @limit
end
@users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse
end
@s_type = 1
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
# @projects = @projects[@offset, @limit]
# 默认活跃度排序
@s_type = 1
@users = scope.
joins("LEFT JOIN option_numbers ON users.id = option_numbers.user_id and option_numbers.score_type = 1").
reorder('option_numbers.total_score DESC')
end
@users = []
@users_statuses.each do |obj|
@users << User.find_by_id("#{obj.user_id}")
end
# limit and offset
@users = @users.limit(@user_pages.per_page).offset(@user_pages.offset)
@user_base_tag = params[:id] ? 'base_users':'users_base'
respond_to do |format|
format.html {
@groups = Group.all.sort
@ -378,7 +345,7 @@ class UsersController < ApplicationController
when 'xml', 'json'
@offset, @limit = api_offset_and_limit({:limit => 15})
else
@limit = 15#per_page_option
@limit = 15#per_page_option
end
@status = params[:status] || 1
@ -389,7 +356,7 @@ class UsersController < ApplicationController
scope = scope.like(params[:name]) if params[:name].present?
@user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page']
@user_base_tag = params[:id] ? 'base_users':'base'
@user_base_tag = params[:id] ? 'base_users':'users_base'
@offset ||= @user_pages.reverse_offset
unless @offset == 0
@users = scope.offset(@offset).limit(@limit).all.reverse
@ -520,7 +487,7 @@ class UsersController < ApplicationController
def new
@user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option)
@auth_sources = AuthSource.all
render :layout => "base"
render :layout => "users_base"
end
def create
@ -555,7 +522,7 @@ class UsersController < ApplicationController
@user.password = @user.password_confirmation = nil
respond_to do |format|
format.html { render :action => 'new' }
format.html { render :action => 'new',:layout => "users_base" }
format.api { render_validation_errors(@user) }
end
end
@ -631,7 +598,7 @@ class UsersController < ApplicationController
def destroy
@user.destroy
respond_to do |format|
format.html { redirect_back_or_default(users_path) }
format.html { redirect_back_or_default(admin_users_path) }
format.api { render_api_ok }
end
end
@ -690,9 +657,9 @@ class UsersController < ApplicationController
return
end
if @obj.save
## 执行成功的操作。
logger.debug "#{__FILE__}:#{__LINE__} ===> #{@obj.to_json}"
else
#捕获异常
logger.error "#{__FILE__}:#{__LINE__} ===> #{@obj.errors.try(:full_messages)}"
end
respond_to do |format|
format.js
@ -829,4 +796,27 @@ class UsersController < ApplicationController
redirect_to my_account_path
end
end
#重置用户得分
def rest_user_score
memo_num(@user)
messges_for_issue_num(@user)
issues_status_num(@user)
replay_for_memo_num(@user)
tread_num(@user)
praise_num(@user)
changeset_num(@user)
document_num(@user)
attachment_num(@user)
issue_done_ratio_num(@user)
post_issue_num(@user)
end
#验证是否显示课程
def can_show_course
@first_page = FirstPage.where("page_type = 'project'").first
if @first_page.show_course == 2
render_404
end
end
end

View File

@ -29,6 +29,7 @@ class VersionsController < ApplicationController
helper :custom_fields
helper :projects
helper :project_score
def index
respond_to do |format|

View File

@ -16,11 +16,42 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WelcomeController < ApplicationController
include ApplicationHelper
include WelcomeHelper
helper :project_score
caches_action :robots
before_filter :find_first_page, :only => [:index]
# before_filter :fake, :only => [:index, :course]
before_filter :entry_select, :only => [:index]
def index
#@first_page = FirstPage.where("page_type = 'project'").first
#@show_course = @first_page.show_course
if @first_page.nil? || @first_page.sort_type.nil?
@projects = find_miracle_project(10, 3,"score desc")
else
case @first_page.sort_type
when 0
@projects = find_miracle_project(10, 3,"created_on desc")
#@projects = @projects_all.order("created_on desc")
when 1
@projects = find_miracle_project(10, 3,"score desc")
#@projects = @projects_all.order("grade desc")
when 2
@projects = find_miracle_project(10, 3,"watchers_count desc")
#@projects = @projects_all.order("watchers_count desc")
#gcm
#when '3'
#@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array)
# @projects=handle_project @projects_all,@project_activity_count
# @s_type = 3
# @projects = @projects[@project_pages.offset, @project_pages.per_page]
else
@projects = @projects_all.order("score desc")
end
end
end
@ -30,6 +61,7 @@ class WelcomeController < ApplicationController
end
def course
@course_page = FirstPage.where("page_type = 'course'").first
if params[:school_id]
@school_id = params[:school_id]
elsif User.current.logged? && User.current.user_extensions.school
@ -41,13 +73,24 @@ class WelcomeController < ApplicationController
def logolink()
@course_page = FirstPage.where("page_type = 'course'").first
logo = get_avatar?(@course_page)
id = params[:school_id]
logo_link = ""
if id.nil? and User.current.user_extensions.school.nil?
logo_link = '/images/transparent.png'
if id.nil? && (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?)
if logo
logo_link = url_to_avatar(@course_page)
else
logo_link = '/images/transparent.png'
end
else
if id == "0"
logo_link = '/images/transparent.png'
if logo
logo_link = url_to_avatar(@course_page)
else
logo_link = '/images/transparent.png'
end
else
if id.nil?
if School.find(User.current.user_extensions.school.id).logo_link.nil?
@ -66,13 +109,19 @@ class WelcomeController < ApplicationController
def contest
@contest_page = FirstPage.where("page_type = 'contest'").first
@contestNotification = ContestNotification.all.first
end
def search
search_condition = params[:q]
search_type = params[:search_type].to_sym unless search_condition.blank?
if search_type.nil? && params[:contests_search] && params[:name] != ""
search_type = :contests
search_condition = params[:name]
end
respond_to do |format|
format.html{
case search_type
@ -81,6 +130,8 @@ class WelcomeController < ApplicationController
:project_type => Project::ProjectType_project)
when :courses
redirect_to courses_search_path(:name => search_condition)
when :contests
redirect_to contests_path(:name => search_condition)
when :users
redirect_to users_search_path(:name => search_condition)
when :users_teacher
@ -96,46 +147,35 @@ class WelcomeController < ApplicationController
end
private
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
def entry_select
url = request.original_url
if url.include?("course.trustie.net")
course
render :course
#@first_page = FirstPage.where("page_type = 'project'").first
url = request.original_url.gsub('/','')
if url.include?(Setting.host_course.gsub('/',''))
if @first_page.show_course == 1
course
render :course
else
render_404
end
return 0
elsif url.include?("contest.trustie.net")
contest
render :contest
elsif url.include?(Setting.host_contest.gsub('/',''))
if @first_page.show_contest == 1
contest
render :contest
else
render_404
end
return 0
elsif url.include?("user.trustie.net")
elsif url.include?(Setting.host_user.gsub('/',''))
redirect_to(:controller => "users", :action => "index")
end
end
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
def entry_select_course
if request.original_url.match(/course\.trustie\.net/)
(course() and render :course and return 0)
end
end
def entry_select_contest
if request.original_url.match(/contest\.trustie\.net/)
contest
render :contest
return 0
end
end
def entry_select_user
if request.original_url.match(/user\.trustie\.net$/)
redirect_to(:controller => "users", :action => "index")
return 0
end
end
# def render(*args)
# _fake if @fake_filter
# super

View File

@ -44,6 +44,7 @@ class WikiController < ApplicationController
include AttachmentsHelper
helper :watchers
include Redmine::Export::PDF
helper :project_score
# List of pages, sorted alphabetically and by parent (hierarchy)
def index

View File

@ -88,7 +88,43 @@ class WordsController < ApplicationController
#format.api { render_api_ok }
end
end
def destroyJournal
@journalP=JournalsForMessage.find(params[:object_id])
@journalP.destroy
@page = params[:page]
@page = @page.to_i
@project = Project.find params[:project_id]
# Find the page of the requested reply
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@limit = 10
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit
if params[:r] && @page.nil?
@page = page
end
if @page < 0
@page = 1
end
if @page > page
@page = page
end
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, @page
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
@state = false
@base_courses_tag = @project.project_type
respond_to do |format|
format.js
end
end
def new
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
if @jour
@ -216,7 +252,7 @@ class WordsController < ApplicationController
elsif ( referer.match(/homework_attach/) || referer.match(/homework_attach/) ) #new added
obj = HomeworkAttach.find_by_id(obj_id)
else
raise 'create reply obj unknow type.'
raise "create reply obj unknow type.#{referer}"
end
obj
end
@ -240,8 +276,8 @@ class WordsController < ApplicationController
elsif obj.kind_of? HomeworkAttach
obj.add_jour(nil, nil, obj.id, options) #new added
else
raise 'create reply obj unknow type.'
raise "create reply obj unknow type.#{obj.class}"
end
end
#######end of message
end
end

View File

@ -1,4 +1,5 @@
class ZipdownController < ApplicationController
#查找项目(课程)
before_filter :find_project_by_bid_id, :only => [:assort]
#检查权限
@ -37,12 +38,23 @@ class ZipdownController < ApplicationController
#下载某一学生的作业的所有文件
def download_user_homework
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+".zip", :type => detect_content_type(zipfile) if zipfile
if User.current.admin? || User.current.member_of_course?(homework.bid.courses.first)
if homework != nil
if homework.attachments.count > 0
zipfile = zip_homework_by_user homework
send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile)
else
render_403 :message => :no_file_dowmload ,:layout => "course_base"
end
else
render_403 :message =>:notice_file_not_found ,:layout => "course_base"
end
else
render_403 :message => :notice_not_authorized
render_403 :message => :notice_not_authorized ,:layout => "course_base"
end
rescue => e
render file: 'public/file_not_found.html' , :layout => 'course_base'
end
private
@ -67,7 +79,9 @@ class ZipdownController < ApplicationController
# 得到每一个人所有文件打包的zip文件
# 并将每一个人的zip打包为一个并返回路径
user_zip_paths = homeattaches.map do |homeattach|
zip_homework_by_user homeattach
if homeattach.attachments.count > 0
zip_homework_by_user homeattach
end
end
zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER
@ -81,15 +95,17 @@ class ZipdownController < ApplicationController
end
def zip_homework_by_user(homeattach)
homeworks_attach_path = []
# 需要将所有homework.attachments遍历加入zip
# 并且返回zip路径
user_attaches_paths = homeattach.attachments.each do |attach|
#length = attach.storage_path.length
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
end
zipping "#{homeattach.user.name.to_s}_#{Time.now.to_i}.zip", homeworks_attach_path, OUTPUT_FOLDER, true
#user_attaches_paths
#if homeattach.attachments.count > 0
homeworks_attach_path = []
# 需要将所有homework.attachments遍历加入zip
# 并且返回zip路径
user_attaches_paths = homeattach.attachments.each do |attach|
#length = attach.storage_path.length
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
end
zipping("#{homeattach.user.name.to_s}_#{Time.now.to_i}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
#user_attaches_paths
#end
end

View File

@ -32,7 +32,7 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
#Added by young
#Define the course menu's link class
# 不是数组的转化成数组然后判断当前menu_item是否在给定的列表
@ -53,10 +53,10 @@ module ApplicationHelper
def authorize_for_course(controller, action)
User.current.allowed_to?({:controller => controller, :action => action}, @course)
end
def authorize_for_contest(controller, action)
User.current.allowed_to?({:controller => controller, :action => action}, @contest)
end
end
# Display a link if user is authorized
#
@ -68,6 +68,10 @@ module ApplicationHelper
link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action])
end
def link_to_if_authorized_course(name, options = {}, html_options = nil, *parameters_for_method_reference)
link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for_course(options[:controller] || params[:controller], options[:action])
end
def link_to_if_authorized_contest(name, options = {}, html_options = nil, *parameters_for_method_reference)
link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for_contest(options[:controller] || params[:controller], options[:action])
end
@ -80,11 +84,12 @@ module ApplicationHelper
name = h(user.name(options[:format]))
end
if user.active? || (User.current.admin? && user.logged?)
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes
else
name
end
#if user.active? || (User.current.admin? && user.logged?)
# link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes
#else
# name
#end
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes
else
h(user.to_s)
end
@ -256,8 +261,8 @@ module ApplicationHelper
end
def format_activity_description(text)
h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')
).gsub(/[\r\n]+/, "<br />").html_safe
h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, "<br />").html_safe
#h(truncate(text.to_s, :length => 120).gsub(/<\/?.*?>/,"")).html_safe
end
def format_version_name(version)
@ -304,7 +309,7 @@ module ApplicationHelper
s << h(block_given? ? yield(project) : project.name)
else
end
if project.try(:project_type) == Project::ProjectType_project
unless User.current.member_of?(@project)
s << "<span style = 'float: right;'>"
@ -334,7 +339,7 @@ module ApplicationHelper
# set the project environment to please macros.
@course = course
if (ancestors.empty? )#|| course.is_descendant_of?(ancestors.last))
s << "<ul class=courses'>\n"
s << "<ul class=courses>\n"
else
ancestors.pop
s << "</li>"
@ -377,7 +382,7 @@ module ApplicationHelper
s << "</ul></li>\n"
end
end
classes = (ancestors.empty? ? 'root' : 'child')
classes = (ancestors.empty? ? 'root' : 'child')
s << h(block_given? ? yield(project) : project.name)
ancestors << project
end
@ -473,11 +478,16 @@ module ApplicationHelper
def principals_check_box_tags_ex(name, principals)
s = ''
principals.each do |principal|
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
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
end
s.html_safe
end
#扩展的checkbox生成
def principals_radio_box_tags_ex(name, principals)
s = ''
principals.each do |principal|
s << "<label>#{ radio_button_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
end
s.html_safe
end
@ -535,11 +545,11 @@ module ApplicationHelper
def authoring(created, author, options={})
l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)).html_safe
end
def added_time(created)
l(:label_added_time, :age => time_tag(created)).html_safe
end
def user_url_and_time(user_name, user_url, created)
unless user_name.nil? || user_name == ''
l(:label_added_time_by, :author => link_to(user_name, user_url), :age => time_tag(created)).html_safe
@ -625,10 +635,15 @@ module ApplicationHelper
end
def html_title(*args)
first_page = FirstPage.where("page_type = 'project'").first
if args.empty?
title = @html_title || []
title << @project.name if @project
title << Setting.app_title unless Setting.app_title == title.last
if first_page.nil? || first_page.web_title.nil?
title << Setting.app_title unless Setting.app_title == title.last
else
title << first_page.web_title unless first_page.web_title == title.last
end
title.select {|t| !t.blank? }.join(' - ')
else
@html_title ||= []
@ -664,15 +679,15 @@ module ApplicationHelper
def textilizable(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
case args.size
when 1
obj = options[:object]
text = args.shift
when 2
obj = args.shift
attr = args.shift
text = obj.send(attr).to_s
else
raise ArgumentError, 'invalid arguments to textilizable'
when 1
obj = options[:object]
text = args.shift
when 2
obj = args.shift
attr = args.shift
text = obj.send(attr).to_s
else
raise ArgumentError, 'invalid arguments to textilizable'
end
return '' if text.blank?
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
@ -701,6 +716,48 @@ module ApplicationHelper
text.html_safe
end
#
#格式化字符串不转义html代码
def textAreailizable(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
case args.size
when 1
obj = options[:object]
text = args.shift
when 2
obj = args.shift
attr = args.shift
text = obj.send(attr).to_s
else
raise ArgumentError, 'invalid arguments to textilizable'
end
return '' if text.blank?
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
only_path = options.delete(:only_path) == false ? false : true
text = text.dup
macros = catch_macros(text)
#text = Redmine::WikiFormatting.to_html("CKEditor", text, :object => obj, :attribute => attr)
@parsed_headings = []
@heading_anchors = {}
@current_section = 0 if options[:edit_section_links]
parse_sections(text, project, obj, attr, only_path, options)
text = parse_non_pre_blocks(text, obj, macros) do |text|
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|
send method_name, text, project, obj, attr, only_path, options
end
end
parse_headings(text, project, obj, attr, only_path, options)
if @parsed_headings.any?
replace_toc(text, @parsed_headings)
end
text.html_safe
end
def parse_non_pre_blocks(text, obj, macros)
s = StringScanner.new(text)
tags = []
@ -794,7 +851,7 @@ module ApplicationHelper
else
wiki_page_id = page.present? ? Wiki.titleize(page) : nil
parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
:id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent)
end
end
@ -808,12 +865,15 @@ module ApplicationHelper
end
end
end
def select_option_helper option
tmp = Hash.new
tmp={"" => ""}
option.each do |project|
tmp[project.name] = project.id
if option.nil?
else
option.each do |project|
tmp[project.name] = project.id
end
end
tmp
end
@ -1117,7 +1177,7 @@ module ApplicationHelper
end
def lang_options_for_select(blank=true)
{ 'Chinese简体中文 '=> 'zh', :English => :en}
{ 'Chinese简体中文 '=> 'zh', :English => :en}
end
def label_tag_for(name, option_tags = nil, options = {})
@ -1157,28 +1217,30 @@ module ApplicationHelper
objects = objects.first
end
# end
objects = objects.map {|o| o.is_a?(String) ? instance_variable_get("@#{o}") : o}.compact
errors = objects.map {|o| o.errors.full_messages}.flatten
if errors.any?
html << "<div id='errorExplanation'><ul>\n"
errors.each do |error|
if objects != nil
objects = objects.map {|o| o.is_a?(String) ? instance_variable_get("@#{o}") : o}.compact
errors = objects.map {|o| o.errors.full_messages}.flatten
if errors.any?
html << "<div id='errorExplanation'><ul>\n"
errors.each do |error|
###by xianbo
if(error!=l(:label_repository_path_not_null))
html << "<li>#{h error}</li>\n"
end
###xianbo
end
###by xianbo
if(error!=l(:label_repository_path_not_null))
html << "<li>#{h error}</li>\n"
unless params[:repository].nil?
if params[:repository][:upassword]==""
html << "<li>"+ l(:label_password_not_null) +"</li>\n"
end
end
###xianbo
html << "</ul></div>\n"
end
###by xianbo
unless params[:repository].nil?
if params[:repository][:upassword]==""
html << "<li>"+ l(:label_password_not_null) +"</li>\n"
end
end
###xianbo
html << "</ul></div>\n"
end
html.html_safe
end
end
def delete_link(url, options={})
options = {
@ -1192,8 +1254,8 @@ module ApplicationHelper
def preview_link(url, form, target='preview', options={})
content_tag 'a', l(:label_preview), {
:href => "#",
:onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); return false;|,
:href => "#",
:onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); return false;|,
:accesskey => accesskey(:preview)
}.merge(options)
end
@ -1264,33 +1326,58 @@ module ApplicationHelper
javascript_tag "contextMenuInit('#{ url_for(url) }')"
end
def calendar_for(field_id)
include_calendar_headers_tags
def calendar_for(field_id,start_day=nil)
include_calendar_headers_tags(start_day)
javascript_tag("$(function() { $('##{field_id}').datepicker(datepickerOptions); });")
end
def include_calendar_headers_tags
unless @calendar_headers_tags_included
@calendar_headers_tags_included = true
content_for :header_tags do
start_of_week = Setting.start_of_week
start_of_week = l(:general_first_day_of_week, :default => '1') if start_of_week.blank?
# Redmine uses 1..7 (monday..sunday) in settings and locales
# JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0
start_of_week = start_of_week.to_i % 7
def include_calendar_headers_tags(start_day=nil)
if start_day.nil?
unless @calendar_headers_tags_included
@calendar_headers_tags_included = true
content_for :header_tags do
start_of_week = Setting.start_of_week
start_of_week = l(:general_first_day_of_week, :default => '1') if start_of_week.blank?
# Redmine uses 1..7 (monday..sunday) in settings and locales
# JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0
start_of_week = start_of_week.to_i % 7
tags = javascript_tag(
"var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: #{start_of_week}, " +
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
path_to_image('/images/calendar.png') +
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};")
jquery_locale = l('jquery.locale', :default => current_language.to_s)
unless jquery_locale == 'en'
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
tags = javascript_tag(
"var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: #{start_of_week}, " +
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
path_to_image('/images/calendar.png') +
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};")
jquery_locale = l('jquery.locale', :default => current_language.to_s)
unless jquery_locale == 'en'
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
end
tags
end
end
else
unless @calendar_headers_tags_included
@calendar_headers_tags_included = true
content_for :header_tags do
start_of_week = Setting.start_of_week
start_of_week = l(:general_first_day_of_week, :default => '1') if start_of_week.blank?
# Redmine uses 1..7 (monday..sunday) in settings and locales
# JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0
start_of_week = start_of_week.to_i % 7
tags = javascript_tag(
"var datepickerOptions={dateFormat: 'yy-mm-dd',minDate: new Date(), firstDay: #{start_of_week}, " +
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
path_to_image('/images/calendar.png') +
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true, onClose: function(dateText, inst) {TimeClose(dateText,inst);}, beforeShow : function(input){TimeBeforeShow(input);} };")
jquery_locale = l('jquery.locale', :default => current_language.to_s)
unless jquery_locale == 'en'
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
end
tags
end
tags
end
end
end
# Overrides Rails' stylesheet_link_tag with themes and plugins support.
@ -1380,6 +1467,8 @@ module ApplicationHelper
email = $1
end
return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil
#options ={"class" => ["avatar2"],"width" =>["80px"],"height" =>["80px"]}
#return image_tag url_to_avatar(user), options
else
''
end
@ -1396,7 +1485,7 @@ module ApplicationHelper
# Returns the javascript tags that are included in the html layout head
def javascript_heads
tags = javascript_include_tag('jquery-1.8.3-ui-1.9.2-ujs-2.0.3', 'application')
tags = javascript_include_tag('jquery-1.8.3-ui-1.9.2-ujs-2.0.3', 'application', 'jquery.colorbox-min')
unless User.current.pref.warn_on_leaving_unsaved == '0'
tags << "\n".html_safe + javascript_tag("$(window).load(function(){ warnLeavingUnsaved('#{escape_javascript l(:text_warn_on_leaving_unsaved)}'); });")
end
@ -1454,18 +1543,37 @@ module ApplicationHelper
options
end
end
# Add by Tao
def url_to_avatar(source)
source = nil if source.kind_of?(String)
get_avatar(source)
end
# Endof Tao's code
def date_format_local(time)
date = time.strftime("%Y年%m月%d日")
end
#当TAG数量过多时更多链接
#1代表是user类型 2代表是project类型 3代表是issue类型 4代表需求 9代表课程
def more_tags id,object_flag
a= 1
case object_flag
when "1"
s = link_to l(:label_more_tags),:controller => "users", :action => "show", :id => id
when "2"
s = link_to l(:label_more_tags),:controller => "projects", :action => "show", :id => id
when "3"
s = link_to l(:label_more_tags),:controller => "issues", :action => "show", :id => id
when "4"
s = link_to l(:label_more_tags),:controller => "bids", :action => "show", :id => id
when "9"
s = link_to l(:label_more_tags),:controller => "courses", :action => "show", :id => id
end
s
end
private
def wiki_helper
@ -1477,7 +1585,7 @@ module ApplicationHelper
def link_to_content_update(text, url_params = {}, html_options = {})
link_to(text, url_params, html_options)
end
#added by nie
# Display watcher picture
def show_more_watchers?(obj)
@ -1487,7 +1595,7 @@ module ApplicationHelper
return false
end
end
def show_watcher_profile(obj)
count = 0
html = ''
@ -1512,7 +1620,7 @@ module ApplicationHelper
return false
end
end
def show_bid_project(bid)
html = ''
if bid.projects.where('is_public = 1').count == 0
@ -1524,15 +1632,15 @@ module ApplicationHelper
end
html.html_safe
end
def show_bid_fans_picture(obj)
html = ''
if obj.watcher_users.count == 0
html << (content_tag "span", l(:label_project_no_follow))
else
obj.watcher_users.take(12).each do |user|
obj.watcher_users.take(12).each do |user|
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
end
end
end
html.html_safe
end
@ -1553,7 +1661,7 @@ module ApplicationHelper
return false
end
end
def show_contest_project(bid)
html = ''
if contest.projects.where('is_public = 1').count == 0
@ -1565,7 +1673,7 @@ module ApplicationHelper
end
html.html_safe
end
def show_contest_project(contest)
html = ''
if contest.projects.where('is_public = 1').count == 0
@ -1577,7 +1685,7 @@ module ApplicationHelper
end
html.html_safe
end
def show_contest_softapplication(contest)
html = ''
if contest.softapplications.where('is_public = 1').count == 0
@ -1589,19 +1697,19 @@ module ApplicationHelper
end
html.html_safe
end
def show_contest_fans_picture(obj)
html = ''
if obj.watcher_users.count == 0
html << (content_tag "span", l(:label_project_no_follow))
else
obj.watcher_users.take(12).each do |user|
obj.watcher_users.take(12).each do |user|
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
end
end
end
html.html_safe
end
end
#display fans picture
def show_more_fans?(obj)
if obj.watcher_users.count > 12
@ -1610,20 +1718,20 @@ module ApplicationHelper
return false
end
end
def show_fans_picture(obj)
html = ''
if obj.watcher_users.count == 0
html << (content_tag "span", l(:label_no_current_fans))
else
obj.watcher_users.take(12).each do |user|
obj.watcher_users.take(12).each do |user|
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
end
end
end
html.html_safe
end
# added by bai
# added by bai
def show_more_participate?(obj)
if obj.join_in_contests.count > 12
return true
@ -1631,7 +1739,7 @@ module ApplicationHelper
return false
end
end
def show_participate_picture(obj)
html = ''
count = 0
@ -1644,10 +1752,10 @@ module ApplicationHelper
if count >= 12
break
end
end
end
html.html_safe
end
end
#end
# add by huang
@ -1662,7 +1770,7 @@ module ApplicationHelper
end
end
html.html_safe
end
end
# end
#added by william
@ -1671,7 +1779,7 @@ module ApplicationHelper
end
#end
def hadcommittedhomework(cur,curb)
bid = Bid.find_by_id(curb)
return true if bid.nil?
@ -1686,21 +1794,21 @@ module ApplicationHelper
else
true
end
end
def render_dynamic_nav
home_link = link_to l(:field_homepage), {:controller => 'welcome', :action => 'index'}
home_link = "<li>" << home_link << "</li>"
bootstrap_render_dynamic_nav
# bootstrap_render_dynamic_nav
content_tag :ul, (home_link.html_safe+bootstrap_render_dynamic_nav)
end
def bootstrap_render_dynamic_nav
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain}
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain}
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain}
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain}
course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'}
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain}
@ -1712,30 +1820,30 @@ module ApplicationHelper
forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index"}
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'}
#@nav_dispaly_project_label
nav_list = Array.new
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label
nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1
nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label && @show_course == 1
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1
nav_list.push(main_project_link) if @nav_dispaly_main_project_label
nav_list.push(main_course_link) if @nav_dispaly_main_course_label
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label
nav_list.push(courses_link) if @nav_dispaly_course_label
nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1
nav_list.push(projects_link) if @nav_dispaly_project_label
nav_list.push(users_link) if @nav_dispaly_user_label
nav_list.push(contest_link) if @nav_dispaly_contest_label
nav_list.push(contest_link) if @nav_dispaly_contest_label && @show_contest == 1
nav_list.push(bids_link) if @nav_dispaly_bid_label
nav_list.push(forum_link) if @nav_dispaly_forum_label
nav_list.push(stores_link) if @nav_dispaly_store_all_label
content_li = ''
nav_list.collect do |nav_item|
nav_list.collect do |nav_item|
content_li << content_tag(:li, nav_item)
end
content_li.html_safe
@ -1744,12 +1852,12 @@ module ApplicationHelper
def current_user
User.current
end
# def hadcommittedforcontest(curu)
# message = JournalsForMessage.find_by_sql("select * from journals_for_messages where jour_type = 'Softapplication' ")
# message.each do |createmessage|
# if createmessage.user_id == curu
# return true
# if createmessage.user_id == curu
# return true
# end
# end
# end
@ -1762,11 +1870,12 @@ module ApplicationHelper
logos.push(link_to image_tag('/images/footer_logo/iscas.png', :alt=>"iscas"), "http://www.iscas.ac.cn" )
logos.push(link_to image_tag('/images/footer_logo/inforbus.png', :alt=>"inforbus"), "http://www.inforbus.com" )
logos.collect! { |logo|
logos.collect! { |logo|
content_tag(:li, logo.html_safe, :class => li_class.to_s)
}
content_tag(:ul, logos.join("").html_safe, :class => ul_class.to_s).html_safe
end
end

View File

@ -87,8 +87,9 @@ module AttachmentsHelper
@project_id = obj.container_id
end
Attachment.tagged_with(tag_name).order('created_on desc').where("(container_id = :project_id and container_type = 'Project') or
attachments = Attachment.tagged_with(tag_name).order('created_on desc').where("(container_id = :project_id and container_type = 'Project') or
(container_id in (select id from versions where project_id =:project_id) and container_type = 'Version')", {:project_id => @project_id})
return attachments
end
@ -109,8 +110,8 @@ module AttachmentsHelper
domain = project.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 = domain.where("is_public=1 and filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
#searched_attach = private_filter searched_attach
searched_attach = paginateHelper(searched_attach, 10)
s = content_tag('div', attachments_check_box_tags('attachment[attach][]', searched_attach), :id => 'attachments')
@ -148,8 +149,8 @@ module AttachmentsHelper
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 = domain.where("is_public=1 and 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

View File

@ -38,7 +38,7 @@ module AvatarHelper
avatar_image(source)
else
File.join(relative_path,avatar_directory(source.class),'0')
end
end
end
def get_avatar?(source)

View File

@ -173,6 +173,18 @@ module ContestsHelper
end
tmp
end
#作品分类下拉框
def work_type_opttion
type = []
#work_types = WorksCategory.all
WorksCategory.all.each do |work_type|
option = []
option << work_type.category
option << work_type.category
type << option
end
type
end
end

View File

@ -7,29 +7,30 @@ module CoursesHelper
3. define search by roles
4. define search member function
=end
TeacherRoles = [3, 4, 7, 9]
StudentRoles = [5, 10]
AllPeople = StudentRoles+TeacherRoles
#TeacherRoles = [3, 4, 7, 9]
#StudentRoles = [5, 10]
#AllPeople = StudentRoles+TeacherRoles
## return people count
# 返回x项目成员数量即roles表中定义的所有成员
def projectCount project
searchCountByRoles project, AllPeople
#searchCountByRoles project, AllPeople
project.members.count
end
# 返回教师数量即roles表中定义的Manager
def teacherCount project
searchCountByRoles project, TeacherRoles
searchTeacherAndAssistant(project).count
# or
# searchTeacherAndAssistant(project).count
end
# 返回学生数量即roles表中定义的Reporter
def studentCount project
searchCountByRoles project,StudentRoles
#def studentCount project
# searchStudent(project).count
# or
# searchStudent(project).count
end
# end
# 判断用户是否是课程的管理员
# add by nwb
@ -97,16 +98,44 @@ module CoursesHelper
end
alias teacherCountOrigin teacherCount
def teacherCount project
count = teacherCountOrigin project
garble count
#alias teacherCountOrigin teacherCount
#def teacherCount project
# count = teacherCountOrigin project
# garble count
#end
# 注意:此方法有问题,速度慢且结果不准
# alias studentCountOrigin studentCount
#def studentCount course
# count = studentCountOrigin course
#garble count
# end
# 学生人数计算
# add by nwb
def studentCount course
count = searchStudent(course).count#course.student.count
if count <= 5
result = count.to_s
elsif count < 10 && count > 5
result = "5+"
else
result = (count-count % 10).to_s + "+"
end
result
end
alias studentCountOrigin studentCount
def studentCount course
count = studentCountOrigin course
garble count
#课程成员数计算
def memberCount course
count = searchStudent(course).count + searchTeacherAndAssistant(course).count
if count <= 5
result = count.to_s
elsif count < 10 && count > 5
result = "5+"
else
result = (count-count % 10).to_s + "+"
end
result
end
def eventToLanguageCourse event_type, course
@ -133,29 +162,39 @@ module CoursesHelper
# =====================================================================================
# return people list
def searchTeacherAndAssistant project
searchPeopleByRoles(project, TeacherRoles)
end
def searchStudent project
searchPeopleByRoles(project, StudentRoles)
end
# =====================================================================================
def searchCountByRoles project, roles_id
members = searchPeopleByRoles project, roles_id
members.count
end
def searchPeopleByRoles project, roles_id
#searchPeopleByRoles(project, TeacherRoles)
members = []
begin
members = project.members.joins(:member_roles).where("member_roles.role_id IN (:role_id)", {:role_id => roles_id})
rescue Exception => e
logger.error "[CoursesHelper] ===> #{e}"
project.members.each do |m|
members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
end
members
end
def searchStudent project
#searchPeopleByRoles(project, StudentRoles)
members = []
project.members.each do |m|
members << m if m && m.user && m.user.allowed_to?(:as_student,project)
end
members
end
# =====================================================================================
#def searchCountByRoles project, roles_id
# members = searchPeopleByRoles project, roles_id
# members.count
#end
#def searchPeopleByRoles project, roles_id
# members = []
# begin
# members = project.members.joins(:member_roles).where("member_roles.role_id IN (:role_id)", {:role_id => roles_id})
# rescue Exception => e
# logger.error "[CoursesHelper] ===> #{e}"
# end
# members
#end
def sort_courses(state)
content = ''.html_safe
case state
@ -186,15 +225,15 @@ module CoursesHelper
end
#useless
def searchMembersByRole project, role_id
members = []
begin
members = project.members.joins(:member_roles).where("member_roles.role_id = :role_id", {:role_id => role_id })
rescue Exception => e
logger.error "[CoursesHelper] ===> #{e}"
end
members
end
#def searchMembersByRole project, role_id
# members = []
# begin
# members = project.members.joins(:member_roles).where("member_roles.role_id = :role_id", {:role_id => role_id })
# rescue Exception => e
# logger.error "[CoursesHelper] ===> #{e}"
# end
# members
#end
def sort_course(state, school_id)
content = ''.html_safe
@ -270,9 +309,10 @@ module CoursesHelper
def find_by_extra_from_project extra
Course.find_by_extra(try(extra))
end
#判断定用户是不是当前课程的老师
#判断定用户是不是当前课程的老师
def is_course_teacher (user,course)
course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and members.user_id = #{user.id}", {:role_id => TeacherRoles}).count != 0
#course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and members.user_id = #{user.id}", {:role_id => TeacherRoles}).count != 0
user.allowed_to?(:as_teacher,course)
#修改为根据用户是否有发布任务的权限来判断用户是否是课程的老师
#is_teacher = false
#@membership = user.memberships.all(:conditions => Project.visible_condition(User.current))
@ -287,7 +327,8 @@ module CoursesHelper
end
#当前用户是不是指定课程的学生
def is_cur_course_student course
course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and members.user_id = #{User.current.id}", {:role_id => StudentRoles}).count != 0
#course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and members.user_id = #{User.current.id}", {:role_id => StudentRoles}).count != 0
!(User.current.allowed_to?(:as_teacher,course))
#修改:能新建占位且不能新建任务的角色判定为学生
#is_student = false
#@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
@ -329,20 +370,44 @@ module CoursesHelper
#获取作业的互评得分
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")
#member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
#if member.nil?
# return "0.00"
#end
#student_stars = homework.rates(:quality).where("rater_id <> #{member.user_id}").select("stars")
members = searchStudent(homework.bid.courses.first)
user_ids = []
members.each do |user|
user_ids << user.user_id
end
student_stars = homework.rates(:quality).where("rater_id in (:user_ids)",{:user_ids => user_ids}).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)
members = searchTeacherAndAssistant(homework.bid.courses.first)#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
#if member.nil?
# return "0.00"
#end
teacher_ids = []
members.each do |user|
teacher_ids << user.user_id
end
teacher_stars = homework.rates(:quality).where("rater_id in (:teacher_ids)",{:teacher_ids => teacher_ids}).select("stars")
teacher_stars_count = 0
teacher_stars.each do |star|
teacher_stars_count = teacher_stars_count + star.stars
end
return format("%.2f",teacher_stars_count)
end
#获取指定项目的得分
@ -376,7 +441,7 @@ module CoursesHelper
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)
homework_users = homework_users + (is_teacher ? (user.lastname + user.firstname) : user.login)
if user != homework.users.last
homework_users = homework_users + ""
end
@ -388,4 +453,72 @@ module CoursesHelper
Course.tagged_with(tag_name).order('updated_at desc')
end
#课程实践年份下拉框
def course_time_option
type = []
#work_types = WorksCategory.all
for i in (2008..2020)
option = []
option << i
option << i
type << option
end
type
end
#课程课时下拉框
def course_term_option
type = []
option1 = []
option1 << l(:label_spring)
option1 << l(:label_spring)
option2 = []
option2 << l(:label_autumn)
option2 << l(:label_autumn)
type << option1
type << option2
type
end
#获取课程动态
def get_course_activity courses, activities
@course_ids=activities.keys()
days = Setting.activity_days_default.to_i
date_to ||= Date.today + 1
date_from = date_to - days-1.years
#file_count
Attachment.where(container_id: @course_ids, container_type: Course).where("created_on>?", date_from).each do |attachment|
activities[attachment.container_id]+=1
end
#message_count
Board.where(course_id: @course_ids).each do |board|
# activities[board.course_id]+=1
activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count
end
#news
News.where(course_id: @course_ids).where("created_on>?",date_from).each do |news|
activities[news.course_id]+=1
end
#feedbackc_count
JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess|
activities[jourformess.jour_id]+=1
end
#activities!=0
i=0;
courses.each do |course|
id=course.id
if activities[id]==0
activities[id]=1
end
end
return activities
end
end

View File

@ -0,0 +1,247 @@
# Gitlab5.3 API操作接口
# Add by nwb
# 暂时没支持SSH
# 接口通过HTTP协议与服务器交互理论上只要能安装gitlab的操作系统本接口都能支持
# 本机的测试环境是Ubuntu 12.04
module GitlabHelper
# gitlab版本库数据本地保存的根目录
ROOT_PATH="/home/git/repositories/"
PROJECT_PATH_CUT = 40
# gitlab版本库所在服务器
# 注意REPO_IP_ADDRESS必须以http://开头暂时只支持HTTP协议未支持SSH
#REPO_IP_ADDRESS = "http://" + Setting.repository_domain
REPO_IP_ADDRESS = "http://192.168.137.100"
GITLAB_API = "/api/v3"
# 用户在项目中的权限级别
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MASTER = 40
# gitlab的登录验证信息
# add by nwb
def self.gitlab_token=(token)
Thread.current[:gitlab_token] = token
end
# gitlab的登录验证信息
# add by nwb
def self.gitlab_token
Thread.current[:gitlab_token] ||= nil
end
# 登录gitlab
# add by nwb
def login_gitlab(email,password)
url = REPO_IP_ADDRESS + GITLAB_API + "/session"
uri = URI.parse(url)
data = {email:email, password:password}
begin
res = Net::HTTP.post_form(uri, data)
if res.code == '201'
temp = ActiveSupport::JSON.decode(res.body)
GitlabHelper.gitlab_token= temp['private_token']
return true
else
return false
end
rescue =>err
return false
end
end
# 创建项目
# add by nwb
def create_project(project_name)
url = REPO_IP_ADDRESS + GITLAB_API + "/projects"
uri = URI.parse(url)
data = {name:project_name, private_token:GitlabHelper.gitlab_token}
begin
res = Net::HTTP.post_form(uri, data)
if res.code == '201'
temp = ActiveSupport::JSON.decode(res.body)
#新创建项目的版本库地址
respo = temp['http_url_to_repo']
respo['http://localhost'] = REPO_IP_ADDRESS
# 新创建项目的web地址
webaddress = temp['web_url']
webaddress['http://localhost'] = REPO_IP_ADDRESS
return true
else
return false
end
rescue =>err
return false
end
end
# 为指定用户创建版本库
# project_name版本库名称 user_id:Gitlab版本库中的用户编号
# add by nwb
def create_project_for_user(project_name,user_id)
url = REPO_IP_ADDRESS + GITLAB_API + "/projects/user/" + user_id
uri = URI.parse(url)
data = {user_id:user_id, name:project_name,private_token:GitlabHelper.gitlab_token}
begin
res = Net::HTTP.post_form(uri, data)
if res.code == '201'
temp = ActiveSupport::JSON.decode(res.body)
#新创建项目的版本库地址
respo = temp['http_url_to_repo']
respo['http://localhost'] = REPO_IP_ADDRESS
# 新创建项目的web地址
webaddress = temp['web_url']
webaddress['http://localhost'] = REPO_IP_ADDRESS
return true
else
return false
end
rescue =>err
return false
end
end
# 创建用户
# loginname登录名称(版本库路径包含) name用户姓名
# add by nwb
def create_user (loginname,name,password,email)
url = REPO_IP_ADDRESS + GITLAB_API + "/users"
uri = URI.parse(url)
data = {email:email,password:password,username:loginname, name:name, private_token:GitlabHelper.gitlab_token}
begin
res = Net::HTTP.post_form(uri, data)
if res.code == '201'
temp = ActiveSupport::JSON.decode(res.body)
#新创建的gitlab用户编号(需保存)
user_id = temp['id']
return true
else
return false
end
rescue =>err
return false
end
end
# 删除用户
# user_id:用户在gitlab中的id
# add by nwb
def delete_user(user_id)
url = REPO_IP_ADDRESS + GITLAB_API + "/users/" + user_id
uri = URI.parse(url)
data = {id:user_id,private_token:GitlabHelper.gitlab_token}
http = Net::HTTP.new uri.host, uri.port
begin
req = Net::HTTP::Delete.new(uri.request_uri)
req.form_data = data
res= http.start { |http| http.request req }
if res.code == '200'
temp = ActiveSupport::JSON.decode(res.body)
# 删除成功对应更新trustie用户的gitlab用户编号
return true
else
return false
end
rescue =>err
return false
end
end
# 给用户添加一个可操作的项目
# 若用户已在该项目中,权限级别取新权限与现有权限的最大值
# project_id:项目在gitlab中的id user_id:用户在gitlab中的id
# access_level为用户在项目中的权限级别对应如下
#GUEST = 10
#REPORTER = 20
#DEVELOPER = 30
#MASTER = 40
# add by nwb
def add_user_to_project(project_id,user_id,access_level)
url = REPO_IP_ADDRESS + GITLAB_API + "/projects/" + project_id +"/members"
uri = URI.parse(url)
data = {id:project_id,user_id:user_id,access_level:access_level, private_token:GitlabHelper.gitlab_token}
begin
res = Net::HTTP.post_form(uri, data)
if res.code == '201'
temp = ActiveSupport::JSON.decode(res.body)
return true
else
return false
end
rescue =>err
return false
end
end
# 从项目中删除用户
# project_id:项目在gitlab中的ids user_id:用户在gitlab中的id
# add by nwb
def delete_user_from_project(project_id,user_id)
url = REPO_IP_ADDRESS + GITLAB_API + "/projects/" + project_id +"/members/" + user_id
uri = URI.parse(url)
data = {id:project_id,user_id:user_id,private_token:GitlabHelper.gitlab_token}
http = Net::HTTP.new uri.host, uri.port
begin
req = Net::HTTP::Delete.new(uri.request_uri)
req.form_data = data
res= http.start { |http| http.request req }
if res.code == '200'
temp = ActiveSupport::JSON.decode(res.body)
return true
else
return false
end
rescue =>err
return false
end
end
# 发送post消息
# add by nwb
def post(url, params)
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
if uri.scheme == 'https'
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.use_ssl = true
end
begin
request = Net::HTTP::Post.new(uri.request_uri)
request['Content-Type'] = 'application/json;charset=utf-8'
request['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1; rv:29.0) Gecko/20100101 Firefox/29.0'
request['X-ACL-TOKEN'] = 'xxx_token'
#request.set_form_data(params)
request.body = params.to_json
response = http.start { |http| http.request(request) }
return JSON.parse response.body
rescue =>err
return nil
end
end
# 发送get消息
# add by nwb
def get(url, params)
uri = URI.parse(url)
uri.query = URI.encode_www_form(params)
http = Net::HTTP.new uri.host, uri.port
if uri.scheme == 'https'
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.use_ssl = true
end
begin
request = Net::HTTP::Get.new uri.request_uri
request['Content-Type'] = 'application/json;charset=utf-8'
request['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1; rv:29.0) Gecko/20100101 Firefox/29.0'
request['X-ACL-TOKEN'] = 'xxx_token'
response = http.start { |http| http.request request }
return JSON.parse response.body
rescue =>err
return nil
end
end
end

View File

@ -73,7 +73,7 @@ module IssuesHelper
ancestors.each do |ancestor|
s << '<div>' + content_tag('p', link_to_issue(ancestor, :project => (issue.project_id != ancestor.project_id)))
end
s << '<div>'
s << '<div style="word-wrap: break-word; word-break: normal;">'
subject = h(issue.subject)
if issue.is_private?
subject = content_tag('span', l(:field_is_private), :class => 'private') + ' ' + subject
@ -326,7 +326,7 @@ module IssuesHelper
if detail.property == 'attr' && detail.prop_key == 'description'
s = l(:text_journal_changed_no_detail, :label => label)
unless no_html
diff_link = link_to 'diff',
diff_link = link_to l(:label_diff),
{:controller => 'journals', :action => 'diff', :id => detail.journal_id,
:detail_id => detail.id, :only_path => options[:only_path]},
:title => l(:label_view_diff)

View File

@ -31,6 +31,7 @@ module MembersHelper
}
s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
end
# add by nwb
@ -53,10 +54,13 @@ module MembersHelper
# 当前申请加入的成员名单
def render_principals_for_applied_members(project)
scope = Principal.active.sorted.applied_members(project).like(params[:q])
scope = project.applied_projects.map(&:user)
principal_count = scope.count
principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page']
principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all
offset ||= principal_pages.offset
principals = scope[offset, 10]
#principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all
#principals = ApplicationController.new.paginateHelper scope,10
s = content_tag('div', principals_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals')

View File

@ -0,0 +1,122 @@
# encoding: utf-8
module ProjectScoreHelper
#缺陷数量
def issue_num project
project.issues.count
end
#缺陷留言数量
def issue_journal_num project
project.issue_changes.count
end
#新闻数量
def news_num project
project.news.count
end
#文档数量
def documents_num project
project.documents.count
end
#代码提交数量
def changesets_num project
project.changesets.count
end
#讨论区帖子数量
def board_message_num project
board_message_count = 0
project.boards.each do |board|
board_message_count += board.messages_count
end
board_message_count
end
#缺陷得分
def issue_score project
i_num = issue_num project
i_j_num = issue_journal_num project
i_num * 4 + i_j_num
end
# 新闻得分
def news_score project
n_num = news_num project
n_num
end
#文档得分
def documents_score project
d_num = documents_num(project)
d_num * 4
end
#代码提交得分
def changesets_score project
c_num = changesets_num project
c_num * 4
end
#讨论区帖子得分
def board_message_score project
b_m_num = board_message_num project
b_m_num * 2
end
#计算项目得分
def project_scores project
result = (issue_score project) + (news_score project) + (documents_score project) + (changesets_score project) + (board_message_score project)
pss = ProjectScore.where("project_id = '#{project.id}'")
if pss.nil? || pss.count == 0
ps = ProjectScore.new
ps.issue_num = issue_num(project)
ps.board_message_num = board_message_num(project)
ps.changeset_num = changesets_num(project)
ps.documents_num = documents_num(project)
ps.issue_journal_num = issue_journal_num(project)
ps.news_num = news_num(project)
ps.score = result
ps.project = project
ps.save
else
ps = pss.first
ps.issue_num = issue_num(project)
ps.board_message_num = board_message_num(project)
ps.changeset_num = changesets_num(project)
ps.documents_num = documents_num(project)
ps.issue_journal_num = issue_journal_num(project)
ps.news_num = news_num(project)
ps.score = result
ps.save
end
result
end
#读取项目得分
def red_project_scores project
grade = 0
pss = ProjectScore.where("project_id = '#{project.id}'")
if pss.nil? || pss.count == 0
grade
else
ps = pss.first
grade = ps.score
grade
end
end
def get_project_score project
pss = ProjectScore.where("project_id = '#{project.id}'")
ps = nil
if pss.nil? || pss.count == 0
ps = nil
else
ps = pss.first
end
ps
end
end

View File

@ -175,9 +175,19 @@ module ProjectsHelper
render_project_nested_lists(projects) do |project|
#Modified by young
if (project.try(:project_type) == Project::ProjectType_course )
s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}").html_safe
unless project.is_public == 1
s = "<span class='private_project'>#{l(:lable_private)}</span>".html_safe
else
s = "".html_safe
end
s += link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}").html_safe
else
s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
unless project.is_public
s = "<span class='private_project'>#{l(:label_private)}</span>".html_safe
else
s = "".html_safe
end
s += link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
end
#Ended by young
if project.description.present?
@ -339,4 +349,12 @@ module ProjectsHelper
return true
end
end
def find_project_repository project
unless project.repositories.nil?
project.repositories.each do |repository|
repository.fetch_changesets if Setting.autofetch_changesets?
end
end
end
end

View File

@ -20,7 +20,7 @@
module RepositoriesHelper
ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/"
PROJECT_PATH_CUT = 40
REPO_IP_ADDRESS = "repository.trustie.net"
REPO_IP_ADDRESS = Setting.repository_domain
def format_revision(revision)
if revision.respond_to? :format_identifier

View File

@ -4,13 +4,8 @@ def options_from_select_project(user)
@option = []
@membership.each do |membership|
unless(membership.project.project_type==1)
#membership.member_roles.each{|role|
# if(role.role_id == 3)
# @option << membership.project
# end
#}
#拥有编辑项目权限的可操作该项目
if user.allowed_to?({:controller => "projects", :action => "edit"}, membership.project, :global => false)
#可被用户引用的项目
if user.allowed_to?(:quote_project, membership.project)
@option << membership.project
end
end

View File

@ -13,6 +13,19 @@ module SoftapplicationsHelper
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
end
#作品分类下拉框
def work_type_opttion
type = []
#work_types = WorksCategory.all
WorksCategory.all.each do |work_type|
option = []
option << work_type.category
option << work_type.category
type << option
end
type
end
# def select_option_helper option
# tmp = Hash.new

View File

@ -16,6 +16,8 @@ module StoresHelper
news_path(container)
when 'Project'
project_files_path(container)
when 'Course'
course_files_path(container)
when 'Version'
# version_path(container)
project_files_path(container.project)
@ -37,15 +39,23 @@ module StoresHelper
WORD_LIMIT = 100
def come_from_local attachment
container = attachment.container
case container.class.to_s
when 'Message'
# '项目 > zzz > 论坛 > 帖子xxx'
# topic_str = container.project.project_type == 0 ? l(:label_board) : l(:label_new_course)
topic_list = link_to l(:label_board), project_boards_path(container.project)
topic_item = link_to container.subject.truncate(WORD_LIMIT, omission: '...'), board_message_path(container.board, container), title: container.subject
project_link(container.project).push(topic_list, topic_item)
course = container.course
project = container.project
if course.nil? # container is belongs to Project
topic_list = link_to l(:label_board), project_boards_path(container.project)
topic_item = link_to container.subject.truncate(WORD_LIMIT, omission: '...'), board_message_path(container.board, container), title: container.subject
project_link(container.project).push(topic_list, topic_item)
else # container is belongs to Course
topic_list = link_to l(:label_course_news), course_boards_path(course)
topic_item = link_to container.try(:subject).to_s.truncate(WORD_LIMIT, omission: '...'), board_message_path(container.board, container), title: container.subject
project_link(course).push(topic_list, topic_item)
end
when 'Issue'
# '项目 > zzz > 缺陷 > 问题xxx'
issue_list = link_to l(:label_project_issues), project_issues_path(container.project)
@ -58,15 +68,26 @@ module StoresHelper
project_link(container.project).push(doc_list, doc_item)
when 'News'
# '课程 > zzz > 新闻 > 新闻xxx'
news_str = container.project.project_type == 0 ? l(:label_news) : l(:label_course_news)
news_list = link_to news_str, project_news_index_path(container.project)
news_item = link_to container.title.truncate(WORD_LIMIT, omission: '...'), news_path(container), title: container.title
project_link(container.project).push(news_list, news_item)
course = container.course
project = container.project
if course.nil? # container is belongs to Project
news_list = link_to l(:label_news), project_news_index_path(container.project)
news_item = link_to container.title.truncate(WORD_LIMIT, omission: '...'), news_path(container), title: container.title
project_link(container.project).push(news_list, news_item)
else # container is belongs to Course
news_list = link_to l(:label_course_news), course_news_index_path(course)
news_item = link_to container.title.truncate(WORD_LIMIT, omission: '...'), news_path(container), title: container.title
project_link(course).push(news_list, news_item)
end
when 'Project'
# '项目 > zzz '
file_str = container.project.project_type == 0 ? l(:project_module_files) : l(:label_course_file)
files_list = link_to file_str, project_files_path(container.project)
project_link(container).push(files_list)
when 'Course'
files_list = link_to l(:label_course_file), course_files_path(container)
project_link(container).push(files_list)
when 'Version'
# '项目 > zzz > 里程碑 > xxx'
ver_list = link_to l(:label_roadmap), project_roadmap_path(container.project)
@ -91,7 +112,8 @@ module StoresHelper
# '竞赛 > xxx '
bid_link(container)
else
Rails.logger.error "ERROR: attachment type unkown"
Rails.logger.error "ERROR: attachment type unkown. file:#{__FILE__}, line:#{__LINE__}"
Rails.logger.error "#{container.class.to_s}"
[link_to('unkown', '')]
end
rescue ActionController::RoutingError => e
@ -99,20 +121,6 @@ module StoresHelper
[link_to('unkown', '')]
end
def project_link project
if project.nil?
Rails.logger.error "ERROR: attachment type unkown #project_link project.nil?"
return [link_to('unkown', '')]
end
project_list = nil
if project.project_type == 0
project_list = link_to l(:label_project_plural), projects_path
else
project_list = link_to l(:label_new_course), course_path
end
project_item = link_to project.to_s, project_path(project)
[project_list, project_item]
end
def bid_link bid
bid_list = nil
@ -129,7 +137,7 @@ module StoresHelper
Rails.logger.error "ERROR: attachment type unkown #bid_link/when 3"
return [link_to('unkown', '#')]
end
bid_list = link_to l(:label_homework), project_homework_path(bid.courses.first)
bid_list = link_to l(:label_homework), homework_course_path(bid.courses.first)
bid_item = link_to bid.name, respond_path(bid)
return project_link(bid.courses.first).push(bid_list, bid_item)
else
@ -137,4 +145,28 @@ module StoresHelper
end
[bid_list, bid_item]
end
def project_link project
if project.nil?
Rails.logger.error "ERROR: attachment type unkown #project_link project.nil? file: #{__FILE__}, line: #{__LINE__}"
return [link_to('unkown', '')]
end
project_list = nil
klass = project.class.to_s
case klass
when "Project"
project_list = link_to l(:label_project_plural), projects_path
project_item = link_to project.to_s, project_path(project)
[project_list, project_item]
when "Course"
course_list = link_to l(:label_new_course), courses_path
course_item = link_to project.name, course_path(project)
[course_list, course_item]
else
Rails.logger.error "[StoresHelper]: #{klass} ======================================="
[]
end
end
end

View File

@ -12,6 +12,8 @@ module TagsHelper
@obj = Issue.find_by_id(obj_id)
when '4'
@obj = Bid.find_by_id(obj_id)
when '5'
@obj = Forum.find_by_id(obj_id)
when '6'
@obj = Attachment.find_by_id(obj_id)
when '7'
@ -44,6 +46,8 @@ module TagsHelper
if user.id == obj_id
@result = true
end
when '5'
@result = is_forum_manager?(user.id,obj_id)
when '7'
if user.id == obj_id
@result = true
@ -56,6 +60,17 @@ module TagsHelper
end
# 判断用户是否是贴吧的管理员
# add by chenmin
def is_forum_manager?(user_id,forum_id)
@result = false
@user_id = Forum.find(forum_id).creator_id;
if @user_id == user.id
@result = true
end
return @result
end
def tagname_val
("#tag_name_name").value
end

View File

@ -228,16 +228,10 @@ module UserScoreHelper
isManager = 0
members = Member.where('user_id = ?', user.id)
members.each do |m|
#roles = m.member_roles
#roles.each do |r|
# if r.role_id == 3
# isManager = 1
# end
#end
@membership = m.memberships.all(:conditions => Project.visible_condition(User.current))
@membership.each do |membership|
#拥有编辑项目权限的可操作该项目
if m.allowed_to?({:controller => "projects", :action => "edit"}, membership.project, :global => false)
if m.allowed_to?(:is_manager, membership.project, :global => false)
isManager = 1
end
end
@ -342,8 +336,619 @@ module UserScoreHelper
user.user_score.update_attributes(:collaboration => collaboration, :influence => influence, :skill => skill,
:activity => activity, :file => file, :issue => issue, :level => level)
end
#========================================================================================================
#个人得分统计
#========================================================================================================
#type 1个人得分、2个人在项目project中的得分
def get_option_number(user,type,project=nil)
if project.nil?
option_number = OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}'");
else
option_number = OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}' and project_id = '#{project.id}'");
end
result = nil
if option_number.nil? || option_number.count == 0
result = OptionNumber.new
result.user_id = user.id
result.memo = 0
result.messages_for_issues = 0
result.issues_status = 0
result.replay_for_message = 0
result.replay_for_memo = 0
result.follow = 0
result.tread = 0
result.praise_by_one = 0
result.praise_by_two = 0
result.praise_by_three = 0
result.tread_by_one = 0
result.tread_by_two = 0
result.tread_by_three = 0
result.changeset = 0
result.document = 0
result.attachment = 0
result.issue_done_ratio = 0
result.post_issue = 0
result.total_score = 0
result.score_type =type
unless project.nil?
result.project_id = project.id
end
else
result = option_number.first
end
result
end
def get_option_num_by_id(user_id,type,project_id=nil)
if project_id.nil?
option_number = OptionNumber.where("user_id = '#{user_id}' and score_type = '#{type}'");
else
option_number = OptionNumber.where("user_id = '#{user_id}' and score_type = '#{type}' and project_id = '#{project_id}'");
end
result = nil
if option_number.nil? || option_number.count == 0
result = OptionNumber.new
result.user_id = user_id
result.memo = 0
result.messages_for_issues = 0
result.issues_status = 0
result.replay_for_message = 0
result.replay_for_memo = 0
result.follow = 0
result.tread = 0
result.praise_by_one = 0
result.praise_by_two = 0
result.praise_by_three = 0
result.tread_by_one = 0
result.tread_by_two = 0
result.tread_by_three = 0
result.changeset = 0
result.document = 0
result.attachment = 0
result.issue_done_ratio = 0
result.post_issue = 0
result.total_score = 0
result.score_type =type
unless project_id.nil?
result.project_id = project_id
end
else
result = option_number.first
end
result
end
#更新分数
def update_score(option_number)
option_number.total_score = collaboration(option_number) + influence(option_number) + skill(option_number) + active(option_number)
if option_number.total_score < 0
option_number.total_score = 0
end
option_number.save
option_number.total_score
end
#协同得分
def collaboration(option_number)
option_number.memo * 2 + option_number.messages_for_issues + option_number.issues_status + option_number.replay_for_message + option_number.replay_for_memo
end
#影响力得分
def influence(option_number)
option_number.follow * 2
end
#技术得分
def skill(option_number)
option_number.praise_by_one * 4 + option_number.praise_by_two * 6 + option_number.praise_by_three * 8 - option_number.tread * 2 - option_number.tread_by_one * 2 - option_number.tread_by_two * 4 - option_number.tread_by_three * 6
end
#项目贡献得分
def active(option_number)
option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4
end
#更新发帖数
def update_memo_number(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.memo = memo_num(user,project)#Message.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count + Memo.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count
update_score(option_number)
end
#发帖数
def memo_num(user,project=nil)
if project.nil?
#Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id != -1").all.count #+ Memo.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count
users = Message.find_by_sql("SELECT COUNT(*) as m_count FROM `messages` JOIN `boards` ON boards.project_id != -1 AND messages.board_id = boards.id
WHERE messages.parent_id IS NULL AND messages.author_id = #{user.id}")
result = 0
users.each do |user|
result = user.m_count
end
result
#user.messages.where("parent_id IS NULL").count
else
#Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id = #{project.id}").all.count
users = Message.find_by_sql("SELECT COUNT(*) as m_count FROM `messages` JOIN `boards` ON boards.project_id = '#{project.id}' AND messages.board_id = boards.id
WHERE messages.parent_id IS NULL AND messages.author_id = #{user.id}")
result = 0
users.each do |user|
result = user.m_count
end
result
end
end
def memo_score(user,project=nil)
if project.nil?
User.find_by_sql("SELECT `users`.id,(SELECT COUNT(*) * 2 FROM `messages` JOIN `boards` ON boards.project_id != -1 AND messages.board_id = boards.id
WHERE messages.parent_id IS NULL AND messages.author_id = `users`.id) AS m_count
FROM `users` where id = #{user.id}")
else
User.find_by_sql("SELECT `users`.id,(SELECT COUNT(*) * 2 FROM `messages` JOIN `boards` ON boards.project_id = '#{project.id}' AND messages.board_id = boards.id
WHERE messages.parent_id IS NULL AND messages.author_id = `users`.id) AS m_count
FROM `users` where id = #{user.id}")
end
end
#更新对缺陷留言数
def update_messges_for_issue(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.messages_for_issues = messges_for_issue_num(user,project)#Journal.includes(:user).where("user_id = '#{user.id}' and notes != '' and notes is not null").all.count
update_score(option_number)
end
def messges_for_issue_num(user,project=nil)
if project.nil?
#Journal.includes(:user).where("user_id = '#{user.id}' and notes is not null and notes != ''").all.count
users = Journal.find_by_sql("SELECT COUNT(*) as m_count FROM journals WHERE journals.user_id = #{user.id} AND journals.notes IS NOT NULL AND journals.notes != ''")
result = 0
if users.count > 0
result = users.first.m_count
end
result
else
#Journal.includes(:user).joins(:issue).where("#{Journal.table_name}.user_id = '#{user.id}' and #{Issue.table_name}.project_id = '#{project.id}' and #{Journal.table_name}.notes != '' and #{Journal.table_name}.notes is not null").all.count
users = Journal.find_by_sql("SELECT COUNT(*) as m_count FROM journals join issues on #{Journal.table_name}.journalized_type = 'Issue' and #{Journal.table_name}.journalized_id = #{Issue.table_name}.id WHERE journals.user_id = #{user.id} AND journals.notes IS NOT NULL AND journals.notes != ''and #{Issue.table_name}.project_id = '#{project.id}'")
result = 0
if users.count > 0
result = users.first.m_count
end
result
end
end
def messges_for_issue_score(user,project=nil)
if project.nil?
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals WHERE journals.user_id = users.id AND journals.notes IS NOT NULL AND journals.notes != '') AS m_score FROM users where id = #{user.id}")
else
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals join issues on #{Journal.table_name}.journalized_type = 'Issue' and #{Journal.table_name}.journalized_id = #{Issue.table_name}.id WHERE journals.user_id = users.id AND journals.notes IS NOT NULL AND journals.notes != ''and #{Issue.table_name}.project_id = '#{project.id}') AS m_score FROM users where id = #{user.id}")
end
end
#更新更改缺陷状态状态次数
def update_issues_status(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.issues_status = issues_status_num(user,project)#Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
update_score(option_number)
end
def issues_status_num(user,project=nil)
if project.nil?
#Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
users = Journal.find_by_sql("SELECT COUNT(*) as m_count FROM journals JOIN journal_details on journals.id = journal_details.journal_id WHERE journal_details.prop_key = 'status_id' and journals.user_id = #{user.id}")
result = 0
if users.count > 0
result = users.first.m_count
end
result
else
#Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
users = Journal.find_by_sql("SELECT COUNT(*) as m_count FROM journals JOIN journal_details on journals.id = journal_details.journal_id JOIN issues ON issues.id = journals.journalized_id and journalized_type = 'Issue' WHERE journal_details.prop_key = 'status_id' and journals.user_id = #{user.id} and issues.project_id = '#{project.id}'")
result = 0
if users.count > 0
result = users.first.m_count
end
result
end
end
def issues_status_score(user,project=nil)
if project.nil?
#Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id) AS m_count FROM users WHERE users.id = '#{user.id}'")
else
#Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id JOIN issues ON issues.id = journals.journalized_id and journalized_type = 'Issue' WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id and issues.project_id = '#{project.id}') AS m_count FROM users WHERE users.id = '#{user.id}'")
end
end
#更新对留言的回复数量
def update_replay_for_message(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.replay_for_message = replay_for_message_num(user,project)#JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
update_score(option_number)
end
def replay_for_message_num(user,project=nil)
if project.nil?
#JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id} and jour_type = 'Project'").count
users = JournalsForMessage.find_by_sql("SELECT COUNT(*) as m_count From #{JournalsForMessage.table_name} WHERE m_parent_id IS NOT NULL and user_id = #{user.id} and jour_type = 'Project'")
result = 0
if users.count > 0
result = users.first.m_count
end
result
else
#JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id} and jour_type = 'Project' and jour_id = '#{project.id}'").count
users = JournalsForMessage.find_by_sql("SELECT COUNT(*) as m_count From #{JournalsForMessage.table_name} WHERE m_parent_id IS NOT NULL and user_id = #{user.id} and jour_type = 'Project' and jour_id = '#{project.id}'")
result = 0
if users.count > 0
result = users.first.m_count
end
result
end
end
def replay_for_message_score(user,project=nil)
if project.nil?
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project') as m_score FROM users WHERE users.id = '#{user.id}'")
else
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project' and jour_id = '#{project.id}') as m_score FROM users WHERE users.id = '#{user.id}'")
end
end
#更新对帖子的回复数量
def update_replay_for_memo(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.replay_for_memo = replay_for_memo_num(user,project)#Message.includes(:author).where("parent_id IS NOT NULL and author_id = #{user.id}").all.count #+ Memo.includes(:author).where("parent_id IS NOT NULL and author_id = #{user.id}").all.count
update_score(option_number)
end
def replay_for_memo_num(user,project=nil)
if project.nil?
#Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NOT NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id != -1").all.count
users = Message.find_by_sql("SELECT COUNT(*) as m_count FROM messages JOIN boards on messages.board_id = boards.id WHERE messages.parent_id IS NOT NULL AND messages.author_id = #{user.id} AND boards.project_id != -1")
result = 0
if users.count > 0
result = users.first.m_count
end
result
else
#Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NOT NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id = #{project.id}").all.count
users = Message.find_by_sql("SELECT COUNT(*) as m_count FROM messages JOIN boards on messages.board_id = boards.id WHERE messages.parent_id IS NOT NULL AND messages.author_id = #{user.id} AND boards.project_id = #{project.id}")
result = 0
if users.count > 0
result = users.first.m_count
end
result
end
end
def replay_for_memo_score(user,project=nil)
if project.nil?
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM messages JOIN boards on messages.board_id = boards.id WHERE messages.parent_id IS NOT NULL AND messages.author_id = users.id AND boards.project_id != -1) FROM users WHERE users.id = #{user.id}")
else
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM messages JOIN boards on messages.board_id = boards.id WHERE messages.parent_id IS NOT NULL AND messages.author_id = users.id AND boards.project_id = #{project.id}) FROM users WHERE users.id = #{user.id}")
end
end
#更新被关注的人数
def update_follow(user,type)
option_number = get_option_number(user,type)
option_number.follow = follow_num(user)#Watcher.includes(:watchable).where("watchable_type = 'Principal' and watchable_id = '#{user.id}'").count
update_score(option_number)
end
def follow_num(user)
#Watcher.includes(:watchable).where("watchable_type = 'Principal' and watchable_id = '#{user.id}'").count
users = Watcher.find_by_sql("SELECT COUNT(*) as m_count FROM #{Watcher.table_name} WHERE watchable_type = 'Principal' and watchable_id = #{user.id}")
result = 0
if users.count > 0
result = users.first.m_count
end
result
end
def follow_score(user)
User.find_by_sql("SELECT users.id, (SELECT COUNT(*) * 2 FROM #{Watcher.table_name} WHERE watchable_type = 'Principal' and watchable_id = users.id) FROM users WHERE users.id = '#{user.id}'")
end
#更新帖子踩各项数量
def update_tread(user,type,project=nil)
option_number = get_option_number(user,type,project)
tread_nums = tread_num(user,project)
option_number.tread = tread_nums[:tread]
option_number.tread_by_one = tread_nums[:tead_by_one]
option_number.tread_by_two = tread_nums[:tread_by_two]
option_number.tread_by_three = tread_nums[:tread_by_three]
update_score(option_number)
end
def tread_num(user,project=nil)
if project.nil?
result0 = PraiseTread.where("praise_tread_object_type IN ( 'Issue','Message') and praise_or_tread = 0 and user_id = '#{user.id}'").all.count
pts = PraiseTread.where("praise_tread_object_type IN ( 'Issue','Message') and praise_or_tread = 0").all
result = []
result1 = []
result2 = []
pts.each do |pt|
obj = PraiseTread.find_object_by_type_and_id(pt.praise_tread_object_type, pt.praise_tread_object_id)
if obj.nil?
next
end
target_user = obj.author
level = UserLevels.get_level(pt.user)#pt.user.get_level
#project = pt.project
if level == 1 && target_user.id == user.id
result << pt
elsif level == 2 && target_user.id == user.id
result1 << pt
elsif level == 3 && target_user.id == user.id
result2 << pt
end
end
{:tread=>result0,:tead_by_one => result.count,:tread_by_two => result1.count,:tread_by_three =>result2.count}
else
result0 = PraiseTread.where("praise_tread_object_type IN ( 'Issue','Message') and praise_or_tread = 0 and user_id = '#{user.id}'").all.count
pts = PraiseTread.where("praise_tread_object_type IN ( 'Issue','Message') and praise_or_tread = 0").all
result = []
result1 = []
result2 = []
pts.each do |pt|
obj = PraiseTread.find_object_by_type_and_id(pt.praise_tread_object_type, pt.praise_tread_object_id)
if obj.nil? || (pt.praise_tread_object_type == "Issue" && obj.project.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.project.nil?)
next
end
if !(pt.praise_tread_object_type == "Issue" && obj.project.id == project.id) && !(pt.praise_tread_object_type == "Message" && obj.board.project.id == project.id)
next
end
target_user = obj.author
level = UserLevels.get_level(pt.user)#pt.user.get_level
#project = pt.project
if level == 1 && target_user.id == user.id
result << pt
elsif level == 2 && target_user.id == user.id
result1 << pt
elsif level == 3 && target_user.id == user.id
result2 << pt
end
end
{:tread=>result0,:tead_by_one => result.count,:tread_by_two => result1.count,:tread_by_three =>result2.count}
end
end
#更新帖子顶数量
def update_praise(user,type,project=nil)
option_number = get_option_number(user,type,project)
praise_nums = praise_num(user,project)
option_number.praise_by_one = praise_nums[:praise_by_one]
option_number.praise_by_two = praise_nums[:praise_by_two]
option_number.praise_by_three = praise_nums[:praise_by_three]
update_score(option_number)
end
def praise_num(user,project=nil)
if !project.nil?
pts = PraiseTread.where("praise_tread_object_type IN ( 'Issue','Message') and praise_or_tread = 1").all
result = []
result1 = []
result2 = []
pts.each do |pt|
obj = PraiseTread.find_object_by_type_and_id(pt.praise_tread_object_type, pt.praise_tread_object_id)
if obj.nil? || (pt.praise_tread_object_type == "Issue" && obj.project.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.project.nil?)
next
end
if !(pt.praise_tread_object_type == "Issue" && obj.project.id == project.id) && !(pt.praise_tread_object_type == "Message" && obj.board.project.id == project.id)
next
end
target_user = obj.author
level = UserLevels.get_level(pt.user)#pt.user.get_level
#project = pt.project
if level == 1 && target_user.id == user.id
result << pt
elsif level == 2 && target_user.id == user.id
result1 << pt
elsif level == 3 && target_user.id == user.id
result2 << pt
end
end
{:praise_by_one => result.count,:praise_by_two => result1.count,:praise_by_three => result2.count}
else
pts = PraiseTread.where("praise_tread_object_type IN ( 'Issue','Message') and praise_or_tread = 1").all
result = []
result1 = []
result2 = []
pts.each do |pt|
obj = PraiseTread.find_object_by_type_and_id(pt.praise_tread_object_type, pt.praise_tread_object_id)
if obj.nil?
next
end
#if obj.project.id == -1
# next
#end
target_user = obj.author
level = UserLevels.get_level(pt.user)#pt.user.get_level
project = pt.project
if level == 1 && target_user.id == user.id
result << pt
elsif level == 2 && target_user.id == user.id
result1 << pt
elsif level == 3 && target_user.id == user.id
result2 << pt
end
end
{:praise_by_one => result.count,:praise_by_two => result1.count,:praise_by_three => result2.count}
end
end
#更新提交代码次数
def update_changeset(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.changeset = changeset_num(user,project)#Changeset.includes(:user).where("user_id = '#{user.id}'").all.count
update_score(option_number)
end
def changeset_num(user,project=nil)
if project.nil?
#Changeset.includes(:user).where("user_id = '#{user.id}'").all.count
users = Changeset.find_by_sql("SELECT COUNT(*) as m_count FROM #{Changeset.table_name} WHERE user_id = #{user.id}")
result = 0
if users.count > 0
result = users.first.m_count
end
result
else
#Changeset.includes(:user).joins(:repository).where("#{Changeset.table_name}.user_id = '#{user.id}' and #{Repository.table_name}.project_id = #{project.id}").all.count
users = Changeset.find_by_sql("SELECT COUNT(*) as m_count FROM #{Changeset.table_name} JOIN #{Repository.table_name} ON #{Changeset.table_name}.repository_id = #{Repository.table_name}.id WHERE #{Changeset.table_name}.user_id = #{user.id} and #{Repository.table_name}.project_id = #{project.id}")
result = 0
if users.count > 0
result = users.first.m_count
end
result
end
end
#更新文档提交次数
def update_document(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.document = document_num(user,project)#Document.includes(:user).where("user_id = '#{user.id}'").all.count
update_score(option_number)
end
def document_num(user,project=nil)
if project.nil?
#Document.includes(:user).where("user_id = '#{user.id}'").all.count
users = Document.find_by_sql("SELECT COUNT(*) as m_count FROM #{Document.table_name} WHERE #{Document.table_name}.user_id = #{user.id}")
result = 0
if users.count > 0
result = users.first.m_count
end
result
else
#Document.includes(:user,:project).where("user_id = '#{user.id}' and project_id = '#{project.id}'").all.count
users = Document.find_by_sql("SELECT COUNT(*) as m_count FROM #{Document.table_name} WHERE #{Document.table_name}.user_id = #{user.id} and #{Document.table_name}.project_id = '#{project.id}'")
result = 0
if users.count > 0
result = users.first.m_count
end
result
end
end
#更新附件提交数量
def update_attachment(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.attachment = attachment_num(user,project)#Attachment.includes(:author).where("author_id = '#{user.id}'").all.count
update_score(option_number)
end
def attachment_num(user,project=nil)
if project.nil?
#Attachment.includes(:author,:container).where("author_id = '#{user.id}' and container_type = 'Project'").all.count
users = Attachment.find_by_sql("SELECT COUNT(*) as m_count FROM #{Attachment.table_name} WHERE author_id = '#{user.id}' and container_type = 'Project'")
result = 0
if users.count > 0
result = users.first.m_count
end
result
else
#Attachment.includes(:author,:container).where("author_id = '#{user.id}' and container_type = 'Project' and container_id = #{project.id}").all.count
users = Attachment.find_by_sql("SELECT COUNT(*) as m_count FROM #{Attachment.table_name} WHERE author_id = '#{user.id}' and container_type = 'Project' and container_id = #{project.id}")
result = 0
if users.count > 0
result = users.first.m_count
end
result
end
end
#更新缺陷完成度次数
def update_issue_done_ratio(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.issue_done_ratio = issue_done_ratio_num(user,project) #Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
update_score(option_number)
end
def issue_done_ratio_num(user,project=nil)
if project.nil?
#Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
users = Journal.find_by_sql("SELECT COUNT(*) as m_count FROM #{Journal.table_name} JOIN #{JournalDetail.table_name} ON #{JournalDetail.table_name}.journal_id = #{Journal.table_name}.id WHERE #{JournalDetail.table_name}.prop_key = 'done_ratio' and #{Journal.table_name}.user_id = #{user.id}")
result = 0
if users.count > 0
result = users.first.m_count
end
result
else
#Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
users = Journal.find_by_sql("SELECT COUNT(*) as m_count FROM #{Journal.table_name} JOIN #{JournalDetail.table_name} ON #{JournalDetail.table_name}.journal_id = #{Journal.table_name}.id JOIN issues ON issues.id = journals.journalized_id and journalized_type = 'Issue' WHERE #{JournalDetail.table_name}.prop_key = 'done_ratio' and #{Journal.table_name}.user_id = #{user.id} and #{Issue.table_name}.project_id = '#{project.id}'")
result = 0
if users.count > 0
result = users.first.m_count
end
result
end
end
#更新发布缺陷次数
def update_post_issue(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.post_issue = post_issue_num(user,project) #Issue.includes(:author).where("author_id = '#{user.id}'").all.count
update_score(option_number)
end
def post_issue_num(user,project=nil)
if project.nil?
#Issue.includes(:author).where("author_id = '#{user.id}'").all.count
users = Issue.find_by_sql("SELECT COUNT(*) as m_count FROM #{Issue.table_name} WHERE author_id = #{user.id}")
result = 0
if users.count > 0
result = users.first.m_count
end
result
else
#Issue.includes(:author).where("author_id = '#{user.id}' and project_id = '#{project.id}'").all.count
users = Issue.find_by_sql("SELECT COUNT(*) as m_count FROM #{Issue.table_name} WHERE author_id = #{user.id} and project_id = '#{project.id}'")
result = 0
if users.count > 0
result = users.first.m_count
end
result
end
end
#读取项目成员得分
def read_user_project_scores(user,project)
option_num = get_option_number(user,2,project)
option_num.total_score
end
def user_scores(user,type,project=nil)
ooption_num = get_option_number(user,type,project)
update_memo_number(user,type,project)
update_messges_for_issue(user,type,project)
update_issues_status(user,type,project)
update_replay_for_message(user,type,project)
update_replay_for_memo(user,type,project)
update_tread(user,type,project)
update_praise(user,type,project)
update_changeset(user,type,project)
update_document(user,type,project)
update_attachment(user,type,project)
update_issue_done_ratio(user,type,project)
update_post_issue(user,type,project)
if project.nil?
update_follow(user,type)
end
update_score(ooption_num)
ooption_num
end
end

View File

@ -258,4 +258,24 @@ module UsersHelper
end
return result
end
#获取用户参与的公开的课程列表
def user_public_course_list user
membership = user.coursememberships.all#@user.coursememberships.all(:conditions => Course.visible_condition(User.current))
membership.sort! {|older, newer| newer.created_on <=> older.created_on }
memberships = []
membership.collect { |e|
memberships.push(e)
}
## 判断课程是否过期 [需封装]
memberships_doing = []
memberships_done = []
memberships.map { |e|
if course_endTime_timeout?(e.course)
memberships_done.push e
else
memberships_doing.push e
end
}
end
end

View File

@ -211,13 +211,17 @@ module WatchersHelper
end
def watchers_checkboxes(object, users, checked=nil)
users.map do |user|
c = checked.nil? ? object.watched_by?(user) : checked
tag = check_box_tag 'issue[watcher_user_ids][]', user.id, c, :id => nil
content_tag 'label', "#{tag} #{h(user)}".html_safe,
:id => "issue_watcher_user_ids_#{user.id}",
:class => "floating"
end.join.html_safe
if users.nil?
else
users.map do |user|
c = checked.nil? ? object.watched_by?(user) : checked
tag = check_box_tag 'issue[watcher_user_ids][]', user.id, c, :id => nil
content_tag 'label', "#{tag} #{h(user)}".html_safe,
:id => "issue_watcher_user_ids_#{user.id}",
:class => "floating"
end.join.html_safe
end
end
def applied_css(project)
@ -246,4 +250,7 @@ module WatchersHelper
link_to text, url, :remote => true, :method => method ,:class=>css
end
end
def exit_project_link(project)
link_to("退出项目",exit_cur_project_path(project.id),:remote => true )
end
end

View File

@ -203,12 +203,12 @@ module WelcomeHelper
#end
end
def find_miracle_project(sum, max_rate)
def find_miracle_project(sum, max_rate,order)
#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
find_all_hot_project(sum,order).to_a.dup
end
def find_new_course limit=15
@ -220,8 +220,8 @@ module WelcomeHelper
end
def find_all_hot_project limit=15
sort_project_by_hot limit
def find_all_hot_project limit=15,order
sort_project_by_hot limit,order
end
def find_all_hot_course limit=15
@ -231,12 +231,12 @@ module WelcomeHelper
# 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");
time_now = Time.new.strftime("%Y")
if school_id
courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <>
courses = Course.includes(:school, :members).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
courses = Course.includes(:school, :members).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
@ -366,8 +366,9 @@ module WelcomeHelper
private
def sort_project_by_hot limit=15
sort_project_by_hot_rails 0, 'grade DESC', limit
def sort_project_by_hot limit=15,order
#'grade DESC'
sort_project_by_hot_rails 0,order , limit
end
def sort_course_by_hot limit=15
@ -427,13 +428,13 @@ module WelcomeHelper
resultSet.take(limit)
end
def sort_project_by_hot_rails project_type=0, order_by='grade DESC', limit=15
def sort_project_by_hot_rails project_type=0, order_by='score DESC', limit=15
# Project.find_by_sql("
# SELECT p.id, p.name, p.description, p.identifier, t.project_id
# FROM projects AS p LEFT OUTER JOIN (
# SELECT project_id,grade FROM project_statuses
# WHERE project_type = #{project_type} ORDER BY #{order_by} LIMIT #{limit} ) AS t ON p.id = t.project_id ")
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ?", project_type).order(order_by).limit(limit).all
Project.visible.joins(:project_status).joins("LEFT JOIN #{ProjectScore.table_name} ON #{Project.table_name}.id = #{ProjectScore.table_name}.project_id").where("#{Project.table_name}.project_type = ?", project_type).order(order_by).limit(limit).all
end
def sort_bid_by_hot_rails reward_type, limit = 10

View File

@ -40,4 +40,14 @@ module WikiHelper
link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project, :version => nil})
})
end
def wiki_content_format wiki
text = wiki.text.html_safe
text = parse_non_pre_blocks(text, wiki, text) do |text|
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|
send method_name, text, project, wiki, attr, only_path, options
end
end
text
end
end

View File

@ -26,10 +26,12 @@ class Attachment < ActiveRecord::Base
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
include UserScoreHelper
validates_presence_of :filename, :author
validates_length_of :filename, :maximum => 255
validates_length_of :disk_filename, :maximum => 255
validates_length_of :description, :maximum => 255
validates_length_of :filename, :maximum => 254
validates_length_of :disk_filename, :maximum => 254
validates_length_of :description, :maximum => 254
validate :validate_max_file_size
@ -39,19 +41,22 @@ class Attachment < ActiveRecord::Base
#课程资源文件
acts_as_activity_provider :type => 'course_files',
:is_public => 'attachments.is_public',
:permission => :view_files,
:author_key => :author_id,
:find_options => {:select => "#{Attachment.table_name}.*",
:joins => "LEFT JOIN #{Course.table_name} ON ( #{Attachment.table_name}.container_type='Course' AND #{Attachment.table_name}.container_id = #{Course.table_name}.id )"}
acts_as_activity_provider :type => 'files',
:is_public => 'attachments.is_public',
:permission => :view_files,
:author_key => :author_id,
:find_options => {:select => "#{Attachment.table_name}.*",
:find_options => { :select => "#{Attachment.table_name}.*",
:joins => "LEFT JOIN #{Version.table_name} ON #{Attachment.table_name}.container_type='Version' AND #{Version.table_name}.id = #{Attachment.table_name}.container_id " +
"LEFT JOIN #{Project.table_name} ON #{Version.table_name}.project_id = #{Project.table_name}.id OR ( #{Attachment.table_name}.container_type='Project' AND #{Attachment.table_name}.container_id = #{Project.table_name}.id )"}
acts_as_activity_provider :type => 'documents',
:is_public => 'documents.is_public',
:permission => :view_documents,
:author_key => :author_id,
:find_options => {:select => "#{Attachment.table_name}.*",
@ -65,8 +70,9 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location
before_save :be_user_score # user_score
after_destroy :delete_from_disk
after_create :be_user_score # user_score
after_update :be_user_score
after_destroy :delete_from_disk,:down_user_score
# add by nwb
# 获取所有可公开的资源文件列表
@ -190,12 +196,27 @@ class Attachment < ActiveRecord::Base
def show_suffix_type
suffix = 'other'
temp = self.suffix_type.downcase
if self.attachmentstype.suffixArr.include?(temp)
if self.attachmentstype && self.attachmentstype.suffixArr.include?(temp)
suffix = temp
end
suffix
end
# 文件密级的字符描述
def file_dense_str
if self.is_public == 1
dense = l(:field_is_public)
else
dense = l(:field_is_private)
end
dense
end
# 文件可设置的密级列表
def file_dense_list
denselist = [l(:field_is_public),l(:field_is_private)]
end
def suffixArr
@@SuffixArr
end
@ -209,7 +230,8 @@ class Attachment < ActiveRecord::Base
def file=(incoming_file)
unless incoming_file.nil?
@temp_file = incoming_file
if @temp_file.size > 0
# 允许上传文件大小为0的文件
#if @temp_file.size > 0
if @temp_file.respond_to?(:original_filename)
self.filename = @temp_file.original_filename
self.filename.force_encoding("UTF-8") if filename.respond_to?(:force_encoding)
@ -221,7 +243,7 @@ class Attachment < ActiveRecord::Base
self.content_type = Redmine::MimeType.of(filename)
end
self.filesize = @temp_file.size
end
#end
end
end
@ -237,7 +259,8 @@ class Attachment < ActiveRecord::Base
# Copies the temporary file to its final location
# and computes its MD5 hash
def files_to_final_location
if @temp_file && (@temp_file.size > 0)
# # 允许上传文件大小为0的文件
if @temp_file# && (@temp_file.size > 0)
self.disk_directory = target_directory
self.disk_filename = Attachment.disk_filename(filename, disk_directory)
logger.info("Saving attachment '#{self.diskfile}' (#{@temp_file.size} bytes)")
@ -484,9 +507,23 @@ 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,self, { attachment_id: self.id })
#UserScore.project(:push_file, self.author,self, { attachment_id: self.id })
end
end
update_attachment(self.author,1)
if self.container_type == 'Project'
update_attachment(self.author,2,self.container)
end
end
#删除附件时重新统计用户的附件数量得分
def down_user_score
update_attachment(self.author,1)
if self.container_type == 'Project'
update_attachment(self.author,2,self.container)
end
end
end

View File

@ -18,7 +18,7 @@
class Changeset < ActiveRecord::Base
belongs_to :repository
belongs_to :user
include UserScoreHelper
#after_save :be_user_score # user_score
has_many :filechanges, :class_name => 'Change', :dependent => :delete_all
@ -63,7 +63,9 @@ class Changeset < ActiveRecord::Base
includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args))
}
after_create :scan_for_issues,:be_user_score # user_score
after_create :scan_for_issues,:refresh_changests#:be_user_score # user_score
after_update :be_user_score
after_destroy :down_user_score
before_create :before_create_cs
# fq
@ -303,8 +305,27 @@ class Changeset < ActiveRecord::Base
# update user score
def be_user_score
UserScore.project(:push_code, self.user,self, { changeset_id: self.id })
#更新用户等级
UserLevels.update_user_level(self.user)
unless self.user.nil?
#更新用户等级
UserLevels.update_user_level(self.user)
update_changeset(self.user,1)
update_changeset(self.user,2,self.repository.project)
end
end
#积分刷新
def down_user_score
UserLevels.update_user_level(self.user)
update_changeset(self.user,1)
update_changeset(self.user,2,self.repository.project)
end
#刷新本次提交补全相关信息如user_id等
def refresh_changests
unless self.repository.nil?
self.repository.fetch_changesets if Setting.autofetch_changesets?
end
end
end

View File

@ -6,7 +6,7 @@ class Contest < ActiveRecord::Base
has_many :contesting_projects, :dependent => :destroy
has_many :projects, :through => :contesting_projects
has_many :contesting_softapplications, :dependent => :destroy
has_many :softapplications, :through => :contesting_softapplications
has_many :softapplications, :through => :contesting_softapplications, :dependent => :destroy
has_many :projects_member, :class_name => 'User', :through => :projects
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy

View File

@ -0,0 +1,4 @@
class ContestNotification < ActiveRecord::Base
attr_accessible :content, :title
validates_length_of :title, maximum: 30
end

View File

@ -3,7 +3,7 @@ class ContestingSoftapplication < ActiveRecord::Base
attr_accessible :contest_id, :description, :softapplication_id, :user_id
belongs_to :contest
belongs_to :softapplication
belongs_to :softapplication, :dependent => :destroy
belongs_to :user

View File

@ -21,7 +21,7 @@ class Course < ActiveRecord::Base
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :homework_for_courses, :dependent => :destroy
has_many :student, :through => :students_for_courses, :source => :user
has_many :student, :class_name => 'StudentsForCourse', :source => :user
has_many :course_infos, :class_name => 'CourseInfos',:dependent => :destroy
has_many :enabled_modules, :dependent => :delete_all
has_many :boards, :dependent => :destroy, :order => "position ASC"
@ -34,12 +34,12 @@ class Course < ActiveRecord::Base
acts_as_attachable :view_permission => :view_files,
:delete_permission => :manage_files
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]+$/
validates_presence_of :password, :term,:name ,:class_period
validates_format_of :class_period, :with =>/^\d*$/
#validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
before_save :self_validate
after_save :create_board_sync
after_create :create_board_sync
before_destroy :delete_all_members
safe_attributes 'extra',
@ -90,9 +90,38 @@ class Course < ActiveRecord::Base
false
end
# Returns the mail adresses of users that should be always notified on project events
def recipients
notified_users.collect {|user| user.mail}
end
# Returns the users that should be notified on project events
def notified_users
# TODO: User part should be extracted to User#notify_about?
members.select {|m| m.principal.present? && (m.mail_notification? || m.principal.mail_notification == 'all')}.collect {|m| m.principal}
end
# 课程的短描述信息
def short_description(length = 255)
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
description.gsub(/<\/?.*?>/,"").html_safe if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
end
# 课程的短名称信息
def short_name(length = 8)
name.gsub(/<\/?.*?>/,"").html_safe if name
end
def strip_html(html)
return html if html.empty? || !html.include?('<')
output = ""
tokenizer = HTML::Tokenizer.new(html)
while token = tokenizer.next
node = HTML::Node.parse(nil, 0, 0, token, false)
output += token unless (node.kind_of? HTML::Tag) or (token =~ /^<!/)
end
return output
end
def extra_frozen?
@ -112,6 +141,7 @@ class Course < ActiveRecord::Base
@attachmenttypes = Attachmentstype.find(:all, :conditions => ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ])
end
# 获取资源后缀名列表
def contenttypes
attachmenttypes
@ -275,7 +305,7 @@ class Course < ActiveRecord::Base
end
#项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题
def name
read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)
end
#def name
# read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)
#end
end

View File

@ -0,0 +1,3 @@
class CourseAttachment < ActiveRecord::Base
attr_accessible :attachtype, :author_id, :content_type, :description, :digest, :disk_directory, :disk_filename, :downloads, :filename, :filesize, :integer, :is_public
end

View File

@ -20,9 +20,9 @@ class Document < ActiveRecord::Base
belongs_to :project
belongs_to :user
belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id"
after_create :be_user_score # user_score
include UserScoreHelper
after_save :be_user_score # user_score
after_destroy :down_user_score
acts_as_attachable :delete_permission => :delete_documents
@ -30,7 +30,8 @@ class Document < ActiveRecord::Base
acts_as_event :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"},
:author => Proc.new {|o| o.attachments.reorder("#{Attachment.table_name}.created_on ASC").first.try(:author) },
:url => Proc.new {|o| {:controller => 'documents', :action => 'show', :id => o.id}}
acts_as_activity_provider :find_options => {:include => :project}
acts_as_activity_provider :find_options => {:include => :project},
:is_public => 'documents.is_public'
validates_presence_of :project, :title, :category
validates_length_of :title, :maximum => 60
@ -39,12 +40,16 @@ class Document < ActiveRecord::Base
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_documents, *args))
}
safe_attributes 'category_id', 'title', 'description'
safe_attributes 'category_id', 'title', 'description','is_public'
def visible?(user=User.current)
!user.nil? && user.allowed_to?(:view_documents, project)
end
def has_right?(project,user=User.current)
user.admin? || user.member_of?(project) || self.is_public==1
end
def initialize(attributes=nil, *args)
super
if new_record?
@ -63,5 +68,12 @@ class Document < ActiveRecord::Base
# update user score
def be_user_score
UserScore.project(:push_document, self.user,self,{ document_id: self.id })
update_document(self.user,1)
update_document(self.user,2,self.project)
end
def down_user_score
update_document(self.user,1)
update_document(self.user,2,self.project)
end
end

8
app/models/first_page.rb Normal file
View File

@ -0,0 +1,8 @@
class FirstPage < ActiveRecord::Base
attr_accessible :description, :title, :web_title,:page_type,:sort_type
validates_presence_of :web_title, :title, :description,:page_type
validates_length_of :web_title,:title, maximum: 30
validates_inclusion_of :image_width,:in => 50..120, :message => l(:image_width_error_message)
validates_inclusion_of :image_height,:in => 50..80, :message => l(:image_height_error_message)
#validates_length_of :description, maximum: 100
end

View File

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

View File

@ -18,6 +18,7 @@
class Issue < ActiveRecord::Base
include Redmine::SafeAttributes
include Redmine::Utils::DateCalculation
include UserScoreHelper
belongs_to :project
belongs_to :tracker
@ -78,6 +79,7 @@ class Issue < ActiveRecord::Base
# fq
after_create :act_as_activity,:be_user_score_new_issue
after_update :be_user_score
after_destroy :down_user_score
# after_create :be_user_score
# end
@ -136,10 +138,10 @@ class Issue < ActiveRecord::Base
nil
when 'default'
user_ids = [user.id] + user.groups.map(&:id)
"(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
"(#{table_name}.is_private = #{connection.quoted_false}) OR (#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
when 'own'
user_ids = [user.id] + user.groups.map(&:id)
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
else
'1=0'
end
@ -158,8 +160,8 @@ class Issue < ActiveRecord::Base
true
when 'default'
!self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to))
when 'own'
self.author == user || user.is_or_belongs_to?(assigned_to)
when 'own'
self.author == user || user.is_or_belongs_to?(assigned_to)
else
false
end
@ -238,11 +240,14 @@ class Issue < ActiveRecord::Base
self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
self.status = issue.status
self.author = User.current
unless options[:attachments] == false
self.attachments = issue.attachments.map do |attachement|
attachement.copy(:container => self)
end
end
#赞不提供附件复制功能
#unless options[:attachments] == false
#self.attachments = issue.attachments.map do |attachement|
# a = attachement.copy(:container => self)
# #a.save
# a
#end
#end
@copied_from = issue
@copy_options = options
self
@ -562,6 +567,12 @@ class Issue < ActiveRecord::Base
@workflow_rule_by_attribute = result if user.nil?
result
end
# 缺陷的短描述信息
def short_description(length = 255)
description.gsub(/<\/?.*?>/,"").html_safe if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
end
private :workflow_rule_by_attribute
def done_ratio
@ -1001,9 +1012,10 @@ class Issue < ActiveRecord::Base
s << ' overdue' if overdue?
s << ' child' if child?
s << ' parent' unless leaf?
s << ' private' if is_private?
#s << ' private' if is_private?
s << ' created-by-me' if User.current.logged? && author_id == User.current.id
s << ' assigned-to-me' if User.current.logged? && assigned_to_id == User.current.id
s << ' tracker-id' if User.current.logged? && tracker_id == User.current.id
s
end
@ -1500,17 +1512,45 @@ class Issue < ActiveRecord::Base
def be_user_score
#缺陷完成度更新
if self.done_ratio_changed?
UserScore.project(:update_issue_ratio, User.current,self,{ issue_id: self.id })
UserScore.project(:update_issue_ratio, self.author,self,{ issue_id: self.id })
#update_issue_done_ratio(self.author,1)
end
#缺陷状态更改
if self.status_id_changed?
#协同得分
UserScore.joint(:change_issue_status, User.current,nil,self, {issue_id: self.id})
#协同得分
UserScore.joint(:change_issue_status, self.author,nil,self, {issue_id: self.id})
#update_issues_status(self.author , 1)
end
end
#发布缺陷
def be_user_score_new_issue
UserScore.project(:post_issue, User.current,self, { issue_id: self.id })
UserScore.project(:post_issue, self.author,self, { issue_id: self.id })
update_post_issue(self.author,1)
update_post_issue(self.author,2,self.project)
end
def down_user_score
#缺陷完成度更新
#if self.done_ratio_changed?
# UserScore.project(:update_issue_ratio, User.current,self,{ issue_id: self.id })
# update_issue_done_ratio(User.current,1)
#end
#缺陷状态更改
#if self.status_id_changed?
# #协同得分
# UserScore.joint(:change_issue_status, User.current,nil,self, {issue_id: self.id})
# update_issues_status(self.author , 1)
#end
update_post_issue(self.author,1)
#update_issue_done_ratio(self.author,1)
#update_issues_status(self.author , 1)
update_post_issue(self.author,2,self.project)
#update_issue_done_ratio(self.author,2,self.project)
#update_issues_status(self.author , 2)
end
end

View File

@ -0,0 +1,33 @@
class IssueOverdue < ActiveRecord::Base
#缺陷到期后发送邮件提示
#只监听已经提交的未到期的缺陷,已过期的缺陷默认已经发过邮件通知,不再提醒。
def self.mail_issue
threads = []
issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null")
puts issues
issues.each do |issue|
thread = Thread.new do
while true
cur_issue = Issue.find issue.id
if cur_issue.done_ratio == 100 || cur_issue.closed_on != nil
break
end
if Time.now < Time.parse(cur_issue.due_date.to_s)
#休眠一个小时。。。
puts cur_issue.id.to_s
sleep 5
else
#发邮件
#puts "11" + issue.id.to_s
#Mailer.issue_expire(issue).deliver
Mailer.issue_add(issue).deliver
break
end
end
end
threads << thread
end
puts threads
return threads
end
end

View File

@ -132,7 +132,7 @@ class IssueQuery < Query
:type => :list_optional, :values => group_values
) unless group_values.empty?
role_values = Role.givable.collect {|r| [r.name, r.id.to_s] }
role_values = Role.project_role.collect {|r| [r.name, r.id.to_s] }
add_available_filter("assigned_to_role",
:type => :list_optional, :values => role_values
) unless role_values.empty?

View File

@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Journal < ActiveRecord::Base
include UserScoreHelper
belongs_to :journalized, :polymorphic => true
# added as a quick fix to allow eager loading of the polymorphic association
# since always associated to an issue, for now
@ -45,11 +46,11 @@ class Journal < ActiveRecord::Base
before_create :split_private_notes
# fq
after_create :act_as_activity,:be_user_score
after_save :act_as_activity,:be_user_score
# end
#after_destroy :down_user_score
#before_save :be_user_score
#before_destroy :down_user_score
after_destroy :down_user_score
scope :visible, lambda {|*args|
user = args.shift || User.current
@ -157,18 +158,24 @@ class Journal < ActiveRecord::Base
# 更新用户分数 -by zjc
def be_user_score
#新建了缺陷留言且留言不为空,不为空白
#新建了缺陷留言且留言不为空,不为空白
if !self.notes.nil? && self.notes.gsub(' ','') != ''
#协同得分加分
UserScore.joint(:post_issue_message, User.current,self.issue.author,self, { message_id: self.id })
UserScore.joint(:post_issue_message, self.user,self.issue.author,self, { message_id: self.id })
update_messges_for_issue(self.user,1)
update_messges_for_issue(self.user,2,self.issue.project)
end
end
# 减少用户分数 -by zjc
def down_user_score
#删除有效缺陷留言
if !self.notes.nil? && self.notes.gsub(' ','') != ''
#协同得分减分
UserScore.joint(:delete_issue_message, User.current,self.issue.author, { message_id: self.id })
UserScore.joint(:delete_issue_message, self.user,self.issue.author,self, { message_id: self.id })
update_messges_for_issue(self.user,1)
update_messges_for_issue(self.user,2,self.issue.project)
end
end
end

View File

@ -16,9 +16,12 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class JournalDetail < ActiveRecord::Base
include UserScoreHelper
belongs_to :journal
before_save :normalize_values
after_save :be_user_score
after_destroy :down_user_score
#before_destroy :down_user_score
private
def normalize_values
@ -38,4 +41,39 @@ class JournalDetail < ActiveRecord::Base
v
end
end
def be_user_score
#更新缺陷完成度
if self.prop_key == 'done_ratio'
update_issue_done_ratio(self.journal.user,1)
unless self.journal.project.nil?
update_issue_done_ratio(self.journal.user,2,self.journal.project)
end
#更新缺陷状态
elsif self.prop_key == 'status_id'
update_issues_status(self.journal.user , 1)
unless self.journal.project.nil?
update_issues_status(self.journal.user,2,self.journal.project)
end
end
end
#更新用户分数
def down_user_score
if self.prop_key == 'done_ratio'
update_issue_done_ratio(self.journal.user,1)
unless self.journal.project.nil?
update_issue_done_ratio(self.journal.user,2,self.journal.project)
end
#更新缺陷状态
elsif self.prop_key == 'status_id'
update_issues_status(self.journal.user, 1)
unless self.journal.project.nil?
update_issues_status(self.journal.user,2,self.journal.project)
end
end
end
end

View File

@ -3,6 +3,7 @@
# 注意reply_id 是提到人的id不是留言id, Base中叫做 at_user
class JournalsForMessage < ActiveRecord::Base
include Redmine::SafeAttributes
include UserScoreHelper
safe_attributes "jour_type", # 留言所属类型
"jour_id", # 留言所属类型的id
"notes", # 留言内容
@ -53,10 +54,10 @@ class JournalsForMessage < ActiveRecord::Base
validates :notes, presence: true
after_create :act_as_activity #huang
after_create :reset_counters!,:be_user_score
after_create :reset_counters!
after_destroy :reset_counters!
#before_save :be_user_score
#before_destroy :down_user_score
after_save :be_user_score
after_destroy :down_user_score
# default_scope { where('m_parent_id IS NULL') }
@ -67,6 +68,7 @@ class JournalsForMessage < ActiveRecord::Base
return true
end
end
def self.remove_by_user? user
if( self.user == user ||
@ -86,6 +88,15 @@ class JournalsForMessage < ActiveRecord::Base
def reference_user
User.find(reply_id)
end
def delete_by_user?user
# 用户可删除自己的留言
if self.user.id == user.id || user.admin?
return true
else
return false
end
end
def self.reference_message(user_id)
@user = User.find(user_id)
@ -131,7 +142,11 @@ class JournalsForMessage < ActiveRecord::Base
#新建了留言回复
if self.reply_id != 0
#协同得分加分
UserScore.joint(:reply_message, User.current,User.find(self.reply_id),self, { journals_for_messages_id: self.id })
UserScore.joint(:reply_message, self.user,User.find(self.reply_id),self, { journals_for_messages_id: self.id })
update_replay_for_message(self.user,1)
if self.jour_type == "Project"
update_replay_for_message(self.user,2,self.jour)
end
end
end
# 更新用户分数 -by zjc
@ -139,7 +154,11 @@ class JournalsForMessage < ActiveRecord::Base
#删除了留言回复
if self.reply_id != 0
#协同得分减分
UserScore.joint(:reply_message_delete, User.current,User.find(self.reply_id), { journals_for_messages_id: self.id })
UserScore.joint(:reply_message_delete, self.user,User.find(self.reply_id), { journals_for_messages_id: self.id })
update_replay_for_message(self.user,1)
if self.jour_type == "Project"
update_replay_for_message(self.user,2,self.jour)
end
end
end
end

View File

@ -104,7 +104,7 @@ class Mailer < ActionMailer::Base
message_id issue
@author = issue.author
@issue = issue
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
recipients = issue.recipients
cc = issue.watcher_recipients - recipients
mail :to => recipients,
@ -141,6 +141,19 @@ class Mailer < ActionMailer::Base
:subject => s
end
# 用户申请加入项目邮件通知
def applied_project(applied)
@project =applied.project
redmine_headers 'Project' => @project,
'User' => applied.user
@user = applied.user
recipients = @project.manager_recipients
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
mail :to => recipients,
:subject => s
end
def reminder(user, issues, days)
set_language_if_valid user.language
@issues = issues
@ -152,6 +165,47 @@ class Mailer < ActionMailer::Base
:subject => l(:mail_subject_reminder, :count => issues.size, :days => days)
end
#缺陷到期邮件通知
def issue_expire issue
issue_id = issue.project_index
redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue_id,
'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id issue
@author = issue.author
@issue = issue
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
recipients = issue.recipients
s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
mail :to => recipients,
:subject => s
#########################################################################################################
#@issues = issues
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
#puts s + "////" + issue.assigned_to.mail
#@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id)
#mail :to => issue.assigned_to.mail,
# :subject => s
#########################################################################################################
#issue_id = issue.project_index
#redmine_headers 'Project' => issue.project.identifier,
# 'Issue-Id' => issue_id,
# 'Issue-Author' => issue.author.login
#redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
#message_id issue
#@author = issue.author
#@issue = issue
#@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
#recipients = issue.recipients
#cc = issue.watcher_recipients - recipients
#mail :to => recipients,
# :cc => cc,
# :subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
######################################################################################################
end
# Builds a Mail::Message object used to email users belonging to the added document's project.
#
# Example:
@ -177,25 +231,45 @@ class Mailer < ActionMailer::Base
added_to_url = ''
@author = attachments.first.author
case container.class.name
when 'Project'
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
added_to = "#{l(:label_project)}: #{container}"
recipients = container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail}
when 'Version'
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
added_to = "#{l(:label_version)}: #{container.name}"
recipients = container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail}
when 'Document'
added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
added_to = "#{l(:label_document)}: #{container.title}"
recipients = container.recipients
when 'Project'
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
added_to = "#{l(:label_project)}: #{container}"
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
when 'Course'
added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container)
added_to = "#{l(:label_course)}: #{container}"
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
when 'Version'
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
added_to = "#{l(:label_version)}: #{container.name}"
recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail }
when 'Document'
added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
added_to = "#{l(:label_document)}: #{container.title}"
recipients = container.recipients
end
if container.class.name == 'Course'
redmine_headers 'Course' => container.id
@attachments = attachments
@added_to = added_to
@added_to_url = added_to_url
mail :to => recipients,
:subject => "[#{container.name}] #{l(:label_attachment_new)}"
elsif container.class.name == 'Project'
redmine_headers 'Project' => container.id
@attachments = attachments
@added_to = added_to
@added_to_url = added_to_url
mail :to => recipients,
:subject => "[#{container.name}] #{l(:label_attachment_new)}"
else
redmine_headers 'Project' => container.project.identifier
@attachments = attachments
@added_to = added_to
@added_to_url = added_to_url
mail :to => recipients,
:subject => "[#{container.project.name}] #{l(:label_attachment_new)}"
end
redmine_headers 'Project' => container.project.identifier
@attachments = attachments
@added_to = added_to
@added_to_url = added_to_url
mail :to => recipients,
:subject => "[#{container.project.name}] #{l(:label_attachment_new)}"
end
# Builds a Mail::Message object used to email recipients of a news' project when a news item is added.
@ -508,6 +582,8 @@ class Mailer < ActionMailer::Base
end
end
private
# Appends a Redmine header field (name is prepended with 'X-Redmine-')
@ -538,4 +614,6 @@ class Mailer < ActionMailer::Base
def mylogger
Rails.logger
end
end

View File

@ -1,5 +1,6 @@
class Memo < ActiveRecord::Base
include Redmine::SafeAttributes
include UserScoreHelper
belongs_to :forum
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
@ -7,12 +8,13 @@ class Memo < ActiveRecord::Base
# 若是主题帖,则内容可以是空
#validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
validates_length_of :subject, maximum: 50
validates_length_of :content, maximum: 3072
#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
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
belongs_to :last_reply, :class_name => 'Memo', :foreign_key => 'last_reply_id'
# acts_as_searchable :column => ['subject', 'content'],
# #:include => { :forum => :p}
@ -41,9 +43,9 @@ class Memo < ActiveRecord::Base
"parent_id",
"replies_count"
after_create :add_author_as_watcher, :reset_counters!,:be_user_score
after_create :add_author_as_watcher, :reset_counters!#,:be_user_score -- 公共区发帖暂不计入得分
# after_update :update_memos_forum
after_destroy :reset_counters!
after_destroy :reset_counters!#,:down_user_score -- 公共区发帖暂不计入得分
# after_create :send_notification
# after_save :plusParentAndForum
# after_destroy :minusParentAndForum
@ -144,14 +146,23 @@ class Memo < ActiveRecord::Base
end
#更新用户分数 -by zjc
def be_user_score
def be_user_score
#新建memo且无parent的为发帖
if self.parent_id.nil?
UserScore.joint(:post_message, User.current,nil,self ,{ memo_id: self.id })
update_memo_number(User.current,1)
#新建memo且有parent的为回帖
elsif !self.parent_id.nil?
UserScore.joint(:reply_posting, User.current,self.parent.author,self, { memo_id: self.id })
update_replay_for_memo(User.current,1)
end
end
#被删除时更新用户分数
def down_user_score
update_memo_number(User.current,1)
update_replay_for_memo(User.current,1)
end
end

View File

@ -17,8 +17,12 @@
class Message < ActiveRecord::Base
include Redmine::SafeAttributes
include UserScoreHelper
belongs_to :board
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC"
acts_as_attachable
belongs_to :last_reply, :class_name => 'Message', :foreign_key => 'last_reply_id'
@ -57,12 +61,11 @@ class Message < ActiveRecord::Base
after_create :add_author_as_watcher, :reset_counters!
after_update :update_messages_board
after_destroy :reset_counters!
after_destroy :reset_counters!,:down_user_score
# fq
after_create :act_as_activity,:be_user_score
#before_save :be_user_score
#before_destroy :down_user_score
# end
scope :visible, lambda {|*args|
@ -124,6 +127,14 @@ class Message < ActiveRecord::Base
board.course
end
def course_editable_by?(usr)
usr && usr.logged? && (usr.allowed_to?(:edit_messages, course) || (self.author == usr && usr.allowed_to?(:edit_own_messages, course)))
end
def course_destroyable_by?(usr)
usr && usr.logged? && (usr.allowed_to?(:delete_messages, course) || (self.author == usr && usr.allowed_to?(:delete_own_messages, course)))
end
def editable_by?(usr)
usr && usr.logged? && (usr.allowed_to?(:edit_messages, project) || (self.author == usr && usr.allowed_to?(:edit_own_messages, project)))
end
@ -147,21 +158,36 @@ class Message < ActiveRecord::Base
#更新用户分数 -by zjc
def be_user_score
#新建message且无parent的为发帖
if self.parent_id.nil?
UserScore.joint(:post_message, User.current,nil,self, { message_id: self.id })
if self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:post_message, self.author,nil,self, { message_id: self.id })
update_memo_number(self.author,1)
if self.board.project_id != -1
update_memo_number(self.author,2,self.board.project)
end
#新建message且有parent的为回帖
elsif !self.parent_id.nil?
UserScore.joint(:reply_posting, User.current,self.parent.author,self, { message_id: self.id })
elsif !self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:reply_posting, self.author,self.parent.author,self, { message_id: self.id })
update_replay_for_memo(self.author,1)
if self.board.project_id != -1
update_replay_for_memo(self.author,2,self.board.project)
end
end
end
#减少用户分数
def down_user_score
#删除发帖
if self.parent_id.nil?
UserScore.joint(:delete_message, User.current,nil, { message_id: self.id })
#删除留言
else
UserScore.joint(:reply_deleting, User.current,self.parent.author, { message_id: self.id })
if self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id })
update_memo_number(User.current,1)
if self.board.project_id != -1
update_memo_number(self.author,2,self.board.project)
end
elsif !self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:reply_deleting, self.author,self.parent.author,self, { message_id: self.id })
update_replay_for_memo(User.current,1)
if self.board.project_id != -1
update_replay_for_memo(self.author,2,self.board.project)
end
end
end
end

View File

@ -74,6 +74,13 @@ class News < ActiveRecord::Base
visible(user).includes([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).all
end
# 新闻的短描述信息
def short_description(length = 255)
description.gsub(/<\/?.*?>/,"").html_safe if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
#description
end
private
def add_author_as_watcher

View File

@ -4,6 +4,7 @@ class Notificationcomment < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :notificationcommented, :polymorphic => true#, :counter_cache => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
belongs_to :Contestnotification
validates_presence_of :notificationcommented, :author, :notificationcomments

View File

@ -85,6 +85,9 @@ class OpenSourceProject < ActiveRecord::Base
def short_description(length = 255)
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
#description.gsub(/<\/?.*?>/,"").html_safe if description
# 不再使用短描述
# description
end
def applied_by?(user)

View File

@ -0,0 +1,14 @@
class OptionNumber < ActiveRecord::Base
attr_accessible :attachment, :changeset, :document, :follow, :issue_done_ratio, :issues_status, :memo, :messages_for_issues, :post_issue, :praise_by_one, :praise_by_three, :praise_by_two, :replay_for_memo, :replay_for_message, :score_type, :total_score, :tread, :tread_by_one, :tread_by_three, :tread_by_two, :user_id
def self.get_user_option_number user_id
result = nil
unless user_id.nil?
ons = OptionNumber.find_all_by_user_id(user_id);
unless (ons .nil? && ons.count > 0)
result = ons.first
end
end
result
end
end

View File

@ -3,7 +3,8 @@ class PraiseTread < ActiveRecord::Base
belongs_to :user
belongs_to :praise_tread_object, polymorphic: true
after_create :be_user_score
after_destroy :down_user_score
include UserScoreHelper
def self.find_object_by_type_and_id(type,id)
@obj = nil
case type
@ -28,7 +29,7 @@ class PraiseTread < ActiveRecord::Base
# 获取裁定对象为Message时Message所属的项目或课程
def project
project = nil
if self.praise_tread_object_type == 'Message'
if self.praise_tread_object_type == 'Message' || self.praise_tread_object_type == 'Issues'
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
project = obj.project
end
@ -38,15 +39,51 @@ class PraiseTread < ActiveRecord::Base
#更新用户分数 - by zjc
def be_user_score
#踩贴吧或讨论区帖子
if 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 == 'Issue' || 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,self, { praise_tread_id: self.id })
update_tread(self.user,1)
update_tread(target_user,1)
unless self.project.nil?
update_tread(self.user,2,self.project)
update_tread(target_user,2,self.project)
end
#顶贴吧或讨论区帖子
elsif 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 == 'Issue' || 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,self,{ praise_tread_id: self.id })
update_praise(target_user,1)
unless self.project.nil?
update_praise(target_user,2,self.project)
end
#更新用户等级
UserLevels.update_user_level(target_user)
end
end
def down_user_score
#踩贴吧或讨论区帖子
if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Issue' || 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,self, { praise_tread_id: self.id })
update_tread(self.user,1)
update_tread(target_user,1)
unless self.project.nil?
update_tread(self.user,2,self.project)
update_tread(target_user,2,self.project)
end
#顶贴吧或讨论区帖子
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || 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,self,{ praise_tread_id: self.id })
update_praise(target_user,1)
unless self.project.nil?
update_praise(target_user,2,self.project)
end
#更新用户等级
UserLevels.update_user_level(target_user)
end

View File

@ -41,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] , :order => "id ASC"
has_many :issues, :dependent => :destroy, :include => [:status, :tracker]
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
@ -56,13 +56,12 @@ class Project < ActiveRecord::Base
#added by xianbo for delete biding_project
has_many :biding_projects, :dependent => :destroy
has_many :contesting_projects, :dependent => :destroy
has_many :projecting_softapplications, :dependent => :destroy
has_many :softapplications, :through => :projecting_softapplications
#ended by xianbo
# added by fq
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :homework_for_courses, :dependent => :destroy
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
#has_many :homework_for_courses, :dependent => :destroy
#has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
has_many :shares, :dependent => :destroy
# has_many :students_for_courses, :dependent => :destroy
has_many :student, :through => :students_for_courses, :source => :user
@ -127,7 +126,7 @@ class Project < ActiveRecord::Base
after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?}
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
# 创建project之后默认创建一个board之后的board去掉了board的概念
after_save :create_board_sync
after_create :create_board_sync
before_destroy :delete_all_members
def remove_references_before_destroy
return if self.id.nil?
@ -156,7 +155,7 @@ class Project < ActiveRecord::Base
where(nil)
else
pattern = "%#{arg.to_s.strip.downcase}%"
where("LOWER(identifier) LIKE :p OR LOWER(name) LIKE :p ", :p => pattern)
where("LOWER(name) LIKE :p ", :p => pattern)
end
}
scope :project_entities, -> { where(project_type: ProjectType_project) }
@ -207,6 +206,12 @@ class Project < ActiveRecord::Base
end
# end
# 管理员的邮件列表
def manager_recipients
notified = project.project_infos.collect(&:user)
notified.collect(&:mail)
end
def initialize(attributes=nil, *args)
super
@ -623,7 +628,8 @@ class Project < ActiveRecord::Base
# Returns a short description of the projects (first lines)
def short_description(length = 255)
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
description.gsub(/<\/?.*?>/,"").html_safe if description
end
def css_classes
@ -752,6 +758,7 @@ class Project < ActiveRecord::Base
'tracker_ids',
'issue_custom_field_ids',
'project_type',
'dts_test',
'attachmenttype'
@ -1131,13 +1138,13 @@ class Project < ActiveRecord::Base
# 创建项目后在项目下同步创建一个讨论区
def create_board_sync
@board = self.boards.build
self.name=" #{l(:label_borad_course) }"
self.name=" #{l(:label_borad_project) }"
@board.name = self.name
@board.description = self.name.to_s
if @board.save
logger.debug "[Course Model] ===> #{@board.to_json}"
logger.debug "[Project Model] ===> #{@board.to_json}"
else
logger.error "[Course Model] ===> Auto create board when Course saved, because #{@board.full_messages}"
logger.error "[Project Model] ===> Auto create board when Project saved, because #{@board.full_messages}"
end
end

View File

@ -0,0 +1,4 @@
class ProjectScore < ActiveRecord::Base
attr_accessible :project_id, :score
belongs_to :project, foreign_key: :project_id
end

View File

@ -1,5 +1,5 @@
class ProjectStatus < ActiveRecord::Base
attr_accessible :changesets_count, :watchers_count, :project_id, :project_type
attr_accessible :changesets_count, :watchers_count, :project_id, :project_type,:grade
belongs_to :project
belongs_to :watchers
belongs_to :changesets

View File

@ -21,8 +21,8 @@ class Repository < ActiveRecord::Base
include Redmine::Ciphering
include Redmine::SafeAttributes
# Maximum length for repository identifiers
IDENTIFIER_MAX_LENGTH = 255
# Maximum length for repository ideflashntifiers
IDENTIFIER_MAX_LENGTH = 254
belongs_to :project
has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
@ -39,10 +39,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_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
#validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_uniqueness_of :identifier, :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-zA-Z0-9_\-]+$/, :allow_blank => true
validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true
# Checks if the SCM is enabled when creating a repository
validate :repo_create_validation, :on => :create

View File

@ -67,6 +67,16 @@ class Role < ActiveRecord::Base
:in => ISSUES_VISIBILITY_OPTIONS.collect(&:first),
:if => lambda {|role| role.respond_to?(:issues_visibility)}
#获取项目相关角色
def self.project_role
self.givable[0..2]
end
#获取课程相关角色
def self.course_role
self.givable[3..5]
end
# Copies attributes from another role, arg can be an id or a Role
def copy_from(arg, options={})
return unless arg.present?

View File

@ -163,7 +163,7 @@ class Setting < ActiveRecord::Base
end
# fixed domain url in development. tantantan's bug
if Rails.env.development?
if Rails.env.development? || Rails.env.test?
methods.map do |m|
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
end

View File

@ -10,7 +10,10 @@ class Softapplication < ActiveRecord::Base
belongs_to :user
belongs_to :project
has_many :contests, :through => :contesting_softapplications
belongs_to :project
validates_length_of :name, :maximum => 25
validates_length_of :application_developers, :maximum => 125
validates_length_of :android_min_version_available, :maximum => 125
def add_jour(user, notes, reference_user_id = 0, options = {})
if options.count == 0

View File

@ -32,6 +32,7 @@ class Tracker < ActiveRecord::Base
end
has_and_belongs_to_many :projects
has_and_belongs_to_many :courses
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
acts_as_list

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